Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/drivers/acpi/amlresrc.h need to be fixed.

0001 
0002 /******************************************************************************
0003  *
0004  * Module Name: amlresrc.h - AML resource descriptors
0005  *
0006  *****************************************************************************/
0007 
0008 /******************************************************************************
0009  *
0010  * 1. Copyright Notice
0011  *
0012  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
0013  * All rights reserved.
0014  *
0015  * 2. License
0016  *
0017  * 2.1. This is your license from Intel Corp. under its intellectual property
0018  * rights.  You may have additional license terms from the party that provided
0019  * you this software, covering your right to use that party's intellectual
0020  * property rights.
0021  *
0022  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0023  * copy of the source code appearing in this file ("Covered Code") an
0024  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0025  * base code distributed originally by Intel ("Original Intel Code") to copy,
0026  * make derivatives, distribute, use and display any portion of the Covered
0027  * Code in any form, with the right to sublicense such rights; and
0028  *
0029  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0030  * license (with the right to sublicense), under only those claims of Intel
0031  * patents that are infringed by the Original Intel Code, to make, use, sell,
0032  * offer to sell, and import the Covered Code and derivative works thereof
0033  * solely to the minimum extent necessary to exercise the above copyright
0034  * license, and in no event shall the patent license extend to any additions
0035  * to or modifications of the Original Intel Code.  No other license or right
0036  * is granted directly or by implication, estoppel or otherwise;
0037  *
0038  * The above copyright and patent license is granted only if the following
0039  * conditions are met:
0040  *
0041  * 3. Conditions
0042  *
0043  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0044  * Redistribution of source code of any substantial portion of the Covered
0045  * Code or modification with rights to further distribute source must include
0046  * the above Copyright Notice, the above License, this list of Conditions,
0047  * and the following Disclaimer and Export Compliance provision.  In addition,
0048  * Licensee must cause all Covered Code to which Licensee contributes to
0049  * contain a file documenting the changes Licensee made to create that Covered
0050  * Code and the date of any change.  Licensee must include in that file the
0051  * documentation of any changes made by any predecessor Licensee.  Licensee
0052  * must include a prominent statement that the modification is derived,
0053  * directly or indirectly, from Original Intel Code.
0054  *
0055  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0056  * Redistribution of source code of any substantial portion of the Covered
0057  * Code or modification without rights to further distribute source must
0058  * include the following Disclaimer and Export Compliance provision in the
0059  * documentation and/or other materials provided with distribution.  In
0060  * addition, Licensee may not authorize further sublicense of source of any
0061  * portion of the Covered Code, and must include terms to the effect that the
0062  * license from Licensee to its licensee is limited to the intellectual
0063  * property embodied in the software Licensee provides to its licensee, and
0064  * not to intellectual property embodied in modifications its licensee may
0065  * make.
0066  *
0067  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0068  * substantial portion of the Covered Code or modification must reproduce the
0069  * above Copyright Notice, and the following Disclaimer and Export Compliance
0070  * provision in the documentation and/or other materials provided with the
0071  * distribution.
0072  *
0073  * 3.4. Intel retains all right, title, and interest in and to the Original
0074  * Intel Code.
0075  *
0076  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0077  * Intel shall be used in advertising or otherwise to promote the sale, use or
0078  * other dealings in products derived from or relating to the Covered Code
0079  * without prior written authorization from Intel.
0080  *
0081  * 4. Disclaimer and Export Compliance
0082  *
0083  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0084  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0085  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
0086  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
0087  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
0088  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0089  * PARTICULAR PURPOSE.
0090  *
0091  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0092  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0093  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0094  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0095  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0096  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
0097  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0098  * LIMITED REMEDY.
0099  *
0100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0101  * software or system incorporating such software without first obtaining any
0102  * required license or other approval from the U. S. Department of Commerce or
0103  * any other agency or department of the United States Government.  In the
0104  * event Licensee exports any such software from the United States or
0105  * re-exports any such software from a foreign destination, Licensee shall
0106  * ensure that the distribution and export/re-export of the software is in
0107  * compliance with all laws, regulations, orders, or other restrictions of the
0108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0109  * any of its subsidiaries will export/re-export any technical data, process,
0110  * software, or service, directly or indirectly, to any country for which the
0111  * United States government or any agency thereof requires an export license,
0112  * other governmental approval, or letter of assurance, without first obtaining
0113  * such license, approval or letter.
0114  *
0115  *****************************************************************************/
0116 
0117 /* acpisrc:StructDefs -- for acpisrc conversion */
0118 
0119 #ifndef __AMLRESRC_H
0120 #define __AMLRESRC_H
0121 
0122 
0123 /*
0124  * Resource descriptor tags, as defined in the ACPI specification.
0125  * Used to symbolically reference fields within a descriptor.
0126  */
0127 #define ACPI_RESTAG_ADDRESS                     "_ADR"
0128 #define ACPI_RESTAG_ALIGNMENT                   "_ALN"
0129 #define ACPI_RESTAG_ADDRESSSPACE                "_ASI"
0130 #define ACPI_RESTAG_ACCESSSIZE                  "_ASZ"
0131 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES      "_ATT"
0132 #define ACPI_RESTAG_BASEADDRESS                 "_BAS"
0133 #define ACPI_RESTAG_BUSMASTER                   "_BM_"  /* Master(1), Slave(0) */
0134 #define ACPI_RESTAG_DECODE                      "_DEC"
0135 #define ACPI_RESTAG_DMA                         "_DMA"
0136 #define ACPI_RESTAG_DMATYPE                     "_TYP"  /* Compatible(0), A(1), B(2), F(3) */
0137 #define ACPI_RESTAG_GRANULARITY                 "_GRA"
0138 #define ACPI_RESTAG_INTERRUPT                   "_INT"
0139 #define ACPI_RESTAG_INTERRUPTLEVEL              "_LL_"  /* ActiveLo(1), ActiveHi(0) */
0140 #define ACPI_RESTAG_INTERRUPTSHARE              "_SHR"  /* Shareable(1), NoShare(0) */
0141 #define ACPI_RESTAG_INTERRUPTTYPE               "_HE_"  /* Edge(1), Level(0) */
0142 #define ACPI_RESTAG_LENGTH                      "_LEN"
0143 #define ACPI_RESTAG_MEMATTRIBUTES               "_MTP"  /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
0144 #define ACPI_RESTAG_MEMTYPE                     "_MEM"  /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
0145 #define ACPI_RESTAG_MAXADDR                     "_MAX"
0146 #define ACPI_RESTAG_MINADDR                     "_MIN"
0147 #define ACPI_RESTAG_MAXTYPE                     "_MAF"
0148 #define ACPI_RESTAG_MINTYPE                     "_MIF"
0149 #define ACPI_RESTAG_REGISTERBITOFFSET           "_RBO"
0150 #define ACPI_RESTAG_REGISTERBITWIDTH            "_RBW"
0151 #define ACPI_RESTAG_RANGETYPE                   "_RNG"
0152 #define ACPI_RESTAG_READWRITETYPE               "_RW_"  /* ReadOnly(0), Writeable (1) */
0153 #define ACPI_RESTAG_TRANSLATION                 "_TRA"
0154 #define ACPI_RESTAG_TRANSTYPE                   "_TRS"  /* Sparse(1), Dense(0) */
0155 #define ACPI_RESTAG_TYPE                        "_TTP"  /* Translation(1), Static (0) */
0156 #define ACPI_RESTAG_XFERTYPE                    "_SIZ"  /* 8(0), 8And16(1), 16(2) */
0157 
0158 
0159 /* Default sizes for "small" resource descriptors */
0160 
0161 #define ASL_RDESC_IRQ_SIZE                      0x02
0162 #define ASL_RDESC_DMA_SIZE                      0x02
0163 #define ASL_RDESC_ST_DEPEND_SIZE                0x00
0164 #define ASL_RDESC_END_DEPEND_SIZE               0x00
0165 #define ASL_RDESC_IO_SIZE                       0x07
0166 #define ASL_RDESC_FIXED_IO_SIZE                 0x03
0167 #define ASL_RDESC_END_TAG_SIZE                  0x01
0168 
0169 
0170 typedef struct asl_resource_node
0171 {
0172     UINT32                          BufferLength;
0173     void                            *Buffer;
0174     struct asl_resource_node        *Next;
0175 
0176 } ASL_RESOURCE_NODE;
0177 
0178 
0179 /* Macros used to generate AML resource length fields */
0180 
0181 #define ACPI_AML_SIZE_LARGE(r)      (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
0182 #define ACPI_AML_SIZE_SMALL(r)      (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
0183 
0184 /*
0185  * Resource descriptors defined in the ACPI specification.
0186  *
0187  * Packing/alignment must be BYTE because these descriptors
0188  * are used to overlay the raw AML byte stream.
0189  */
0190 #pragma pack(1)
0191 
0192 /*
0193  * SMALL descriptors
0194  */
0195 #define AML_RESOURCE_SMALL_HEADER_COMMON \
0196     UINT8                           DescriptorType;
0197 
0198 typedef struct aml_resource_small_header
0199 {
0200     AML_RESOURCE_SMALL_HEADER_COMMON
0201 
0202 } AML_RESOURCE_SMALL_HEADER;
0203 
0204 
0205 typedef struct aml_resource_irq
0206 {
0207     AML_RESOURCE_SMALL_HEADER_COMMON
0208     UINT16                          IrqMask;
0209     UINT8                           Flags;
0210 
0211 } AML_RESOURCE_IRQ;
0212 
0213 
0214 typedef struct aml_resource_irq_noflags
0215 {
0216     AML_RESOURCE_SMALL_HEADER_COMMON
0217     UINT16                          IrqMask;
0218 
0219 } AML_RESOURCE_IRQ_NOFLAGS;
0220 
0221 
0222 typedef struct aml_resource_dma
0223 {
0224     AML_RESOURCE_SMALL_HEADER_COMMON
0225     UINT8                           DmaChannelMask;
0226     UINT8                           Flags;
0227 
0228 } AML_RESOURCE_DMA;
0229 
0230 
0231 typedef struct aml_resource_start_dependent
0232 {
0233     AML_RESOURCE_SMALL_HEADER_COMMON
0234     UINT8                           Flags;
0235 
0236 } AML_RESOURCE_START_DEPENDENT;
0237 
0238 
0239 typedef struct aml_resource_start_dependent_noprio
0240 {
0241     AML_RESOURCE_SMALL_HEADER_COMMON
0242 
0243 } AML_RESOURCE_START_DEPENDENT_NOPRIO;
0244 
0245 
0246 typedef struct aml_resource_end_dependent
0247 {
0248     AML_RESOURCE_SMALL_HEADER_COMMON
0249 
0250 } AML_RESOURCE_END_DEPENDENT;
0251 
0252 
0253 typedef struct aml_resource_io
0254 {
0255     AML_RESOURCE_SMALL_HEADER_COMMON
0256     UINT8                           Flags;
0257     UINT16                          Minimum;
0258     UINT16                          Maximum;
0259     UINT8                           Alignment;
0260     UINT8                           AddressLength;
0261 
0262 } AML_RESOURCE_IO;
0263 
0264 
0265 typedef struct aml_resource_fixed_io
0266 {
0267     AML_RESOURCE_SMALL_HEADER_COMMON
0268     UINT16                          Address;
0269     UINT8                           AddressLength;
0270 
0271 } AML_RESOURCE_FIXED_IO;
0272 
0273 
0274 typedef struct aml_resource_vendor_small
0275 {
0276     AML_RESOURCE_SMALL_HEADER_COMMON
0277 
0278 } AML_RESOURCE_VENDOR_SMALL;
0279 
0280 
0281 typedef struct aml_resource_end_tag
0282 {
0283     AML_RESOURCE_SMALL_HEADER_COMMON
0284     UINT8                           Checksum;
0285 
0286 } AML_RESOURCE_END_TAG;
0287 
0288 
0289 /*
0290  * LARGE descriptors
0291  */
0292 #define AML_RESOURCE_LARGE_HEADER_COMMON \
0293     UINT8                           DescriptorType;\
0294     UINT16                          ResourceLength;
0295 
0296 typedef struct aml_resource_large_header
0297 {
0298     AML_RESOURCE_LARGE_HEADER_COMMON
0299 
0300 } AML_RESOURCE_LARGE_HEADER;
0301 
0302 
0303 typedef struct aml_resource_memory24
0304 {
0305     AML_RESOURCE_LARGE_HEADER_COMMON
0306     UINT8                           Flags;
0307     UINT16                          Minimum;
0308     UINT16                          Maximum;
0309     UINT16                          Alignment;
0310     UINT16                          AddressLength;
0311 
0312 } AML_RESOURCE_MEMORY24;
0313 
0314 
0315 typedef struct aml_resource_vendor_large
0316 {
0317     AML_RESOURCE_LARGE_HEADER_COMMON
0318 
0319 } AML_RESOURCE_VENDOR_LARGE;
0320 
0321 
0322 typedef struct aml_resource_memory32
0323 {
0324     AML_RESOURCE_LARGE_HEADER_COMMON
0325     UINT8                           Flags;
0326     UINT32                          Minimum;
0327     UINT32                          Maximum;
0328     UINT32                          Alignment;
0329     UINT32                          AddressLength;
0330 
0331 } AML_RESOURCE_MEMORY32;
0332 
0333 
0334 typedef struct aml_resource_fixed_memory32
0335 {
0336     AML_RESOURCE_LARGE_HEADER_COMMON
0337     UINT8                           Flags;
0338     UINT32                          Address;
0339     UINT32                          AddressLength;
0340 
0341 } AML_RESOURCE_FIXED_MEMORY32;
0342 
0343 
0344 #define AML_RESOURCE_ADDRESS_COMMON \
0345     UINT8                           ResourceType; \
0346     UINT8                           Flags; \
0347     UINT8                           SpecificFlags;
0348 
0349 
0350 typedef struct aml_resource_address
0351 {
0352     AML_RESOURCE_LARGE_HEADER_COMMON
0353     AML_RESOURCE_ADDRESS_COMMON
0354 
0355 } AML_RESOURCE_ADDRESS;
0356 
0357 
0358 typedef struct aml_resource_extended_address64
0359 {
0360     AML_RESOURCE_LARGE_HEADER_COMMON
0361     AML_RESOURCE_ADDRESS_COMMON
0362     UINT8                           RevisionID;
0363     UINT8                           Reserved;
0364     UINT64                          Granularity;
0365     UINT64                          Minimum;
0366     UINT64                          Maximum;
0367     UINT64                          TranslationOffset;
0368     UINT64                          AddressLength;
0369     UINT64                          TypeSpecific;
0370 
0371 } AML_RESOURCE_EXTENDED_ADDRESS64;
0372 
0373 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION          1       /* ACPI 3.0 */
0374 
0375 
0376 typedef struct aml_resource_address64
0377 {
0378     AML_RESOURCE_LARGE_HEADER_COMMON
0379     AML_RESOURCE_ADDRESS_COMMON
0380     UINT64                          Granularity;
0381     UINT64                          Minimum;
0382     UINT64                          Maximum;
0383     UINT64                          TranslationOffset;
0384     UINT64                          AddressLength;
0385 
0386 } AML_RESOURCE_ADDRESS64;
0387 
0388 
0389 typedef struct aml_resource_address32
0390 {
0391     AML_RESOURCE_LARGE_HEADER_COMMON
0392     AML_RESOURCE_ADDRESS_COMMON
0393     UINT32                          Granularity;
0394     UINT32                          Minimum;
0395     UINT32                          Maximum;
0396     UINT32                          TranslationOffset;
0397     UINT32                          AddressLength;
0398 
0399 } AML_RESOURCE_ADDRESS32;
0400 
0401 
0402 typedef struct aml_resource_address16
0403 {
0404     AML_RESOURCE_LARGE_HEADER_COMMON
0405     AML_RESOURCE_ADDRESS_COMMON
0406     UINT16                          Granularity;
0407     UINT16                          Minimum;
0408     UINT16                          Maximum;
0409     UINT16                          TranslationOffset;
0410     UINT16                          AddressLength;
0411 
0412 } AML_RESOURCE_ADDRESS16;
0413 
0414 
0415 typedef struct aml_resource_extended_irq
0416 {
0417     AML_RESOURCE_LARGE_HEADER_COMMON
0418     UINT8                           Flags;
0419     UINT8                           InterruptCount;
0420     UINT32                          Interrupts[1];
0421     /* ResSourceIndex, ResSource optional fields follow */
0422 
0423 } AML_RESOURCE_EXTENDED_IRQ;
0424 
0425 
0426 typedef struct aml_resource_generic_register
0427 {
0428     AML_RESOURCE_LARGE_HEADER_COMMON
0429     UINT8                           AddressSpaceId;
0430     UINT8                           BitWidth;
0431     UINT8                           BitOffset;
0432     UINT8                           AccessSize; /* ACPI 3.0, was previously Reserved */
0433     UINT64                          Address;
0434 
0435 } AML_RESOURCE_GENERIC_REGISTER;
0436 
0437 /* restore default alignment */
0438 
0439 #pragma pack()
0440 
0441 /* Union of all resource descriptors, so we can allocate the worst case */
0442 
0443 typedef union aml_resource
0444 {
0445     /* Descriptor headers */
0446 
0447     UINT8                                   DescriptorType;
0448     AML_RESOURCE_SMALL_HEADER               SmallHeader;
0449     AML_RESOURCE_LARGE_HEADER               LargeHeader;
0450 
0451     /* Small resource descriptors */
0452 
0453     AML_RESOURCE_IRQ                        Irq;
0454     AML_RESOURCE_DMA                        Dma;
0455     AML_RESOURCE_START_DEPENDENT            StartDpf;
0456     AML_RESOURCE_END_DEPENDENT              EndDpf;
0457     AML_RESOURCE_IO                         Io;
0458     AML_RESOURCE_FIXED_IO                   FixedIo;
0459     AML_RESOURCE_VENDOR_SMALL               VendorSmall;
0460     AML_RESOURCE_END_TAG                    EndTag;
0461 
0462     /* Large resource descriptors */
0463 
0464     AML_RESOURCE_MEMORY24                   Memory24;
0465     AML_RESOURCE_GENERIC_REGISTER           GenericReg;
0466     AML_RESOURCE_VENDOR_LARGE               VendorLarge;
0467     AML_RESOURCE_MEMORY32                   Memory32;
0468     AML_RESOURCE_FIXED_MEMORY32             FixedMemory32;
0469     AML_RESOURCE_ADDRESS16                  Address16;
0470     AML_RESOURCE_ADDRESS32                  Address32;
0471     AML_RESOURCE_ADDRESS64                  Address64;
0472     AML_RESOURCE_EXTENDED_ADDRESS64         ExtAddress64;
0473     AML_RESOURCE_EXTENDED_IRQ               ExtendedIrq;
0474 
0475     /* Utility overlays */
0476 
0477     AML_RESOURCE_ADDRESS                    Address;
0478     UINT32                                  DwordItem;
0479     UINT16                                  WordItem;
0480     UINT8                                   ByteItem;
0481 
0482 } AML_RESOURCE;
0483 
0484 #endif
0485