Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:42

0001 /******************************************************************************
0002  *
0003  * Module Name: amlresrc.h - AML resource descriptors
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights. You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code. No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision. In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change. Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee. Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution. In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government. In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************
0115  *
0116  * Alternatively, you may choose to be licensed under the terms of the
0117  * following license:
0118  *
0119  * Redistribution and use in source and binary forms, with or without
0120  * modification, are permitted provided that the following conditions
0121  * are met:
0122  * 1. Redistributions of source code must retain the above copyright
0123  *    notice, this list of conditions, and the following disclaimer,
0124  *    without modification.
0125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0126  *    substantially similar to the "NO WARRANTY" disclaimer below
0127  *    ("Disclaimer") and any redistribution must be conditioned upon
0128  *    including a substantially similar Disclaimer requirement for further
0129  *    binary redistribution.
0130  * 3. Neither the names of the above-listed copyright holders nor the names
0131  *    of any contributors may be used to endorse or promote products derived
0132  *    from this software without specific prior written permission.
0133  *
0134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0145  *
0146  * Alternatively, you may choose to be licensed under the terms of the
0147  * GNU General Public License ("GPL") version 2 as published by the Free
0148  * Software Foundation.
0149  *
0150  *****************************************************************************/
0151 
0152 /* acpisrc:StructDefs -- for acpisrc conversion */
0153 
0154 #ifndef __AMLRESRC_H
0155 #define __AMLRESRC_H
0156 
0157 
0158 /*
0159  * Resource descriptor tags, as defined in the ACPI specification.
0160  * Used to symbolically reference fields within a descriptor.
0161  */
0162 #define ACPI_RESTAG_ADDRESS                     "_ADR"
0163 #define ACPI_RESTAG_ALIGNMENT                   "_ALN"
0164 #define ACPI_RESTAG_ADDRESSSPACE                "_ASI"
0165 #define ACPI_RESTAG_ACCESSSIZE                  "_ASZ"
0166 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES      "_ATT"
0167 #define ACPI_RESTAG_BASEADDRESS                 "_BAS"
0168 #define ACPI_RESTAG_BUSMASTER                   "_BM_"  /* Master(1), Slave(0) */
0169 #define ACPI_RESTAG_DEBOUNCETIME                "_DBT"
0170 #define ACPI_RESTAG_DECODE                      "_DEC"
0171 #define ACPI_RESTAG_DEVICEPOLARITY              "_DPL"
0172 #define ACPI_RESTAG_DMA                         "_DMA"
0173 #define ACPI_RESTAG_DMATYPE                     "_TYP"  /* Compatible(0), A(1), B(2), F(3) */
0174 #define ACPI_RESTAG_DRIVESTRENGTH               "_DRS"
0175 #define ACPI_RESTAG_ENDIANNESS                  "_END"
0176 #define ACPI_RESTAG_FLOWCONTROL                 "_FLC"
0177 #define ACPI_RESTAG_FUNCTION                    "_FUN"
0178 #define ACPI_RESTAG_GRANULARITY                 "_GRA"
0179 #define ACPI_RESTAG_INTERRUPT                   "_INT"
0180 #define ACPI_RESTAG_INTERRUPTLEVEL              "_LL_"  /* ActiveLo(1), ActiveHi(0) */
0181 #define ACPI_RESTAG_INTERRUPTSHARE              "_SHR"  /* Shareable(1), NoShare(0) */
0182 #define ACPI_RESTAG_INTERRUPTTYPE               "_HE_"  /* Edge(1), Level(0) */
0183 #define ACPI_RESTAG_IORESTRICTION               "_IOR"
0184 #define ACPI_RESTAG_LENGTH                      "_LEN"
0185 #define ACPI_RESTAG_LINE                        "_LIN"
0186 #define ACPI_RESTAG_LOCALPORT                   "_PRT"
0187 #define ACPI_RESTAG_MEMATTRIBUTES               "_MTP"  /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
0188 #define ACPI_RESTAG_MEMTYPE                     "_MEM"  /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
0189 #define ACPI_RESTAG_MAXADDR                     "_MAX"
0190 #define ACPI_RESTAG_MINADDR                     "_MIN"
0191 #define ACPI_RESTAG_MAXTYPE                     "_MAF"
0192 #define ACPI_RESTAG_MINTYPE                     "_MIF"
0193 #define ACPI_RESTAG_MODE                        "_MOD"
0194 #define ACPI_RESTAG_PARITY                      "_PAR"
0195 #define ACPI_RESTAG_PHASE                       "_PHA"
0196 #define ACPI_RESTAG_PHYTYPE                     "_PHY"
0197 #define ACPI_RESTAG_PIN                         "_PIN"
0198 #define ACPI_RESTAG_PINCONFIG                   "_PPI"
0199 #define ACPI_RESTAG_PINCONFIG_TYPE              "_TYP"
0200 #define ACPI_RESTAG_PINCONFIG_VALUE             "_VAL"
0201 #define ACPI_RESTAG_POLARITY                    "_POL"
0202 #define ACPI_RESTAG_REGISTERBITOFFSET           "_RBO"
0203 #define ACPI_RESTAG_REGISTERBITWIDTH            "_RBW"
0204 #define ACPI_RESTAG_RANGETYPE                   "_RNG"
0205 #define ACPI_RESTAG_READWRITETYPE               "_RW_"  /* ReadOnly(0), Writeable (1) */
0206 #define ACPI_RESTAG_LENGTH_RX                   "_RXL"
0207 #define ACPI_RESTAG_LENGTH_TX                   "_TXL"
0208 #define ACPI_RESTAG_SLAVEMODE                   "_SLV"
0209 #define ACPI_RESTAG_SPEED                       "_SPE"
0210 #define ACPI_RESTAG_STOPBITS                    "_STB"
0211 #define ACPI_RESTAG_TRANSLATION                 "_TRA"
0212 #define ACPI_RESTAG_TRANSTYPE                   "_TRS"  /* Sparse(1), Dense(0) */
0213 #define ACPI_RESTAG_TYPE                        "_TTP"  /* Translation(1), Static (0) */
0214 #define ACPI_RESTAG_XFERTYPE                    "_SIZ"  /* 8(0), 8And16(1), 16(2) */
0215 #define ACPI_RESTAG_VENDORDATA                  "_VEN"
0216 #define ACPI_RESTAG_FQN                         "_FQN"
0217 #define ACPI_RESTAG_FQD                         "_FQD"
0218 
0219 
0220 /* Default sizes for "small" resource descriptors */
0221 
0222 #define ASL_RDESC_IRQ_SIZE                      0x02
0223 #define ASL_RDESC_DMA_SIZE                      0x02
0224 #define ASL_RDESC_ST_DEPEND_SIZE                0x00
0225 #define ASL_RDESC_END_DEPEND_SIZE               0x00
0226 #define ASL_RDESC_IO_SIZE                       0x07
0227 #define ASL_RDESC_FIXED_IO_SIZE                 0x03
0228 #define ASL_RDESC_FIXED_DMA_SIZE                0x05
0229 #define ASL_RDESC_END_TAG_SIZE                  0x01
0230 
0231 
0232 typedef struct asl_resource_node
0233 {
0234     UINT32                          BufferLength;
0235     void                            *Buffer;
0236     struct asl_resource_node        *Next;
0237 
0238 } ASL_RESOURCE_NODE;
0239 
0240 typedef struct asl_resource_info
0241 {
0242     ACPI_PARSE_OBJECT               *DescriptorTypeOp;  /* Resource descriptor parse node */
0243     ACPI_PARSE_OBJECT               *MappingOp;         /* Used for mapfile support */
0244     UINT32                          CurrentByteOffset;  /* Offset in resource template */
0245 
0246 } ASL_RESOURCE_INFO;
0247 
0248 
0249 /* Macros used to generate AML resource length fields */
0250 
0251 #define ACPI_AML_SIZE_LARGE(r)      (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
0252 #define ACPI_AML_SIZE_SMALL(r)      (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
0253 
0254 /*
0255  * Resource descriptors defined in the ACPI specification.
0256  *
0257  * Packing/alignment must be BYTE because these descriptors
0258  * are used to overlay the raw AML byte stream.
0259  */
0260 #pragma pack(1)
0261 
0262 /*
0263  * SMALL descriptors
0264  */
0265 #define AML_RESOURCE_SMALL_HEADER_COMMON \
0266     UINT8                           DescriptorType;
0267 
0268 typedef struct aml_resource_small_header
0269 {
0270     AML_RESOURCE_SMALL_HEADER_COMMON
0271 
0272 } AML_RESOURCE_SMALL_HEADER;
0273 
0274 
0275 typedef struct aml_resource_irq
0276 {
0277     AML_RESOURCE_SMALL_HEADER_COMMON
0278     UINT16                          IrqMask;
0279     UINT8                           Flags;
0280 
0281 } AML_RESOURCE_IRQ;
0282 
0283 
0284 typedef struct aml_resource_irq_noflags
0285 {
0286     AML_RESOURCE_SMALL_HEADER_COMMON
0287     UINT16                          IrqMask;
0288 
0289 } AML_RESOURCE_IRQ_NOFLAGS;
0290 
0291 
0292 typedef struct aml_resource_dma
0293 {
0294     AML_RESOURCE_SMALL_HEADER_COMMON
0295     UINT8                           DmaChannelMask;
0296     UINT8                           Flags;
0297 
0298 } AML_RESOURCE_DMA;
0299 
0300 
0301 typedef struct aml_resource_start_dependent
0302 {
0303     AML_RESOURCE_SMALL_HEADER_COMMON
0304     UINT8                           Flags;
0305 
0306 } AML_RESOURCE_START_DEPENDENT;
0307 
0308 
0309 typedef struct aml_resource_start_dependent_noprio
0310 {
0311     AML_RESOURCE_SMALL_HEADER_COMMON
0312 
0313 } AML_RESOURCE_START_DEPENDENT_NOPRIO;
0314 
0315 
0316 typedef struct aml_resource_end_dependent
0317 {
0318     AML_RESOURCE_SMALL_HEADER_COMMON
0319 
0320 } AML_RESOURCE_END_DEPENDENT;
0321 
0322 
0323 typedef struct aml_resource_io
0324 {
0325     AML_RESOURCE_SMALL_HEADER_COMMON
0326     UINT8                           Flags;
0327     UINT16                          Minimum;
0328     UINT16                          Maximum;
0329     UINT8                           Alignment;
0330     UINT8                           AddressLength;
0331 
0332 } AML_RESOURCE_IO;
0333 
0334 
0335 typedef struct aml_resource_fixed_io
0336 {
0337     AML_RESOURCE_SMALL_HEADER_COMMON
0338     UINT16                          Address;
0339     UINT8                           AddressLength;
0340 
0341 } AML_RESOURCE_FIXED_IO;
0342 
0343 
0344 typedef struct aml_resource_vendor_small
0345 {
0346     AML_RESOURCE_SMALL_HEADER_COMMON
0347 
0348 } AML_RESOURCE_VENDOR_SMALL;
0349 
0350 
0351 typedef struct aml_resource_end_tag
0352 {
0353     AML_RESOURCE_SMALL_HEADER_COMMON
0354     UINT8                           Checksum;
0355 
0356 } AML_RESOURCE_END_TAG;
0357 
0358 
0359 typedef struct aml_resource_fixed_dma
0360 {
0361     AML_RESOURCE_SMALL_HEADER_COMMON
0362     UINT16                          RequestLines;
0363     UINT16                          Channels;
0364     UINT8                           Width;
0365 
0366 } AML_RESOURCE_FIXED_DMA;
0367 
0368 
0369 /*
0370  * LARGE descriptors
0371  */
0372 #define AML_RESOURCE_LARGE_HEADER_COMMON \
0373     UINT8                           DescriptorType;\
0374     UINT16                          ResourceLength;
0375 
0376 typedef struct aml_resource_large_header
0377 {
0378     AML_RESOURCE_LARGE_HEADER_COMMON
0379 
0380 } AML_RESOURCE_LARGE_HEADER;
0381 
0382 
0383 /* General Flags for address space resource descriptors */
0384 
0385 #define ACPI_RESOURCE_FLAG_DEC      2
0386 #define ACPI_RESOURCE_FLAG_MIF      4
0387 #define ACPI_RESOURCE_FLAG_MAF      8
0388 
0389 typedef struct aml_resource_memory24
0390 {
0391     AML_RESOURCE_LARGE_HEADER_COMMON
0392     UINT8                           Flags;
0393     UINT16                          Minimum;
0394     UINT16                          Maximum;
0395     UINT16                          Alignment;
0396     UINT16                          AddressLength;
0397 
0398 } AML_RESOURCE_MEMORY24;
0399 
0400 
0401 typedef struct aml_resource_vendor_large
0402 {
0403     AML_RESOURCE_LARGE_HEADER_COMMON
0404 
0405 } AML_RESOURCE_VENDOR_LARGE;
0406 
0407 
0408 typedef struct aml_resource_memory32
0409 {
0410     AML_RESOURCE_LARGE_HEADER_COMMON
0411     UINT8                           Flags;
0412     UINT32                          Minimum;
0413     UINT32                          Maximum;
0414     UINT32                          Alignment;
0415     UINT32                          AddressLength;
0416 
0417 } AML_RESOURCE_MEMORY32;
0418 
0419 
0420 typedef struct aml_resource_fixed_memory32
0421 {
0422     AML_RESOURCE_LARGE_HEADER_COMMON
0423     UINT8                           Flags;
0424     UINT32                          Address;
0425     UINT32                          AddressLength;
0426 
0427 } AML_RESOURCE_FIXED_MEMORY32;
0428 
0429 
0430 #define AML_RESOURCE_ADDRESS_COMMON \
0431     UINT8                           ResourceType; \
0432     UINT8                           Flags; \
0433     UINT8                           SpecificFlags;
0434 
0435 
0436 typedef struct aml_resource_address
0437 {
0438     AML_RESOURCE_LARGE_HEADER_COMMON
0439     AML_RESOURCE_ADDRESS_COMMON
0440 
0441 } AML_RESOURCE_ADDRESS;
0442 
0443 
0444 typedef struct aml_resource_extended_address64
0445 {
0446     AML_RESOURCE_LARGE_HEADER_COMMON
0447     AML_RESOURCE_ADDRESS_COMMON
0448     UINT8                           RevisionID;
0449     UINT8                           Reserved;
0450     UINT64                          Granularity;
0451     UINT64                          Minimum;
0452     UINT64                          Maximum;
0453     UINT64                          TranslationOffset;
0454     UINT64                          AddressLength;
0455     UINT64                          TypeSpecific;
0456 
0457 } AML_RESOURCE_EXTENDED_ADDRESS64;
0458 
0459 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION          1       /* ACPI 3.0 */
0460 
0461 
0462 typedef struct aml_resource_address64
0463 {
0464     AML_RESOURCE_LARGE_HEADER_COMMON
0465     AML_RESOURCE_ADDRESS_COMMON
0466     UINT64                          Granularity;
0467     UINT64                          Minimum;
0468     UINT64                          Maximum;
0469     UINT64                          TranslationOffset;
0470     UINT64                          AddressLength;
0471 
0472 } AML_RESOURCE_ADDRESS64;
0473 
0474 
0475 typedef struct aml_resource_address32
0476 {
0477     AML_RESOURCE_LARGE_HEADER_COMMON
0478     AML_RESOURCE_ADDRESS_COMMON
0479     UINT32                          Granularity;
0480     UINT32                          Minimum;
0481     UINT32                          Maximum;
0482     UINT32                          TranslationOffset;
0483     UINT32                          AddressLength;
0484 
0485 } AML_RESOURCE_ADDRESS32;
0486 
0487 
0488 typedef struct aml_resource_address16
0489 {
0490     AML_RESOURCE_LARGE_HEADER_COMMON
0491     AML_RESOURCE_ADDRESS_COMMON
0492     UINT16                          Granularity;
0493     UINT16                          Minimum;
0494     UINT16                          Maximum;
0495     UINT16                          TranslationOffset;
0496     UINT16                          AddressLength;
0497 
0498 } AML_RESOURCE_ADDRESS16;
0499 
0500 
0501 typedef struct aml_resource_extended_irq
0502 {
0503     AML_RESOURCE_LARGE_HEADER_COMMON
0504     UINT8                           Flags;
0505     UINT8                           InterruptCount;
0506     union {
0507         UINT32                      Interrupt;
0508         ACPI_FLEX_ARRAY(UINT32,     Interrupts);
0509     };
0510     /* ResSourceIndex, ResSource optional fields follow */
0511 
0512 } AML_RESOURCE_EXTENDED_IRQ;
0513 
0514 
0515 typedef struct aml_resource_generic_register
0516 {
0517     AML_RESOURCE_LARGE_HEADER_COMMON
0518     UINT8                           AddressSpaceId;
0519     UINT8                           BitWidth;
0520     UINT8                           BitOffset;
0521     UINT8                           AccessSize; /* ACPI 3.0, was previously Reserved */
0522     UINT64                          Address;
0523 
0524 } AML_RESOURCE_GENERIC_REGISTER;
0525 
0526 
0527 /* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
0528 
0529 typedef struct aml_resource_gpio
0530 {
0531     AML_RESOURCE_LARGE_HEADER_COMMON
0532     UINT8                           RevisionId;
0533     UINT8                           ConnectionType;
0534     UINT16                          Flags;
0535     UINT16                          IntFlags;
0536     UINT8                           PinConfig;
0537     UINT16                          DriveStrength;
0538     UINT16                          DebounceTimeout;
0539     UINT16                          PinTableOffset;
0540     UINT8                           ResSourceIndex;
0541     UINT16                          ResSourceOffset;
0542     UINT16                          VendorOffset;
0543     UINT16                          VendorLength;
0544     /*
0545      * Optional fields follow immediately:
0546      * 1) PIN list (Words)
0547      * 2) Resource Source String
0548      * 3) Vendor Data bytes
0549      */
0550 
0551 } AML_RESOURCE_GPIO;
0552 
0553 #define AML_RESOURCE_GPIO_REVISION              1       /* ACPI 5.0 */
0554 
0555 /* Values for ConnectionType above */
0556 
0557 #define AML_RESOURCE_GPIO_TYPE_INT              0
0558 #define AML_RESOURCE_GPIO_TYPE_IO               1
0559 #define AML_RESOURCE_MAX_GPIOTYPE               1
0560 
0561 
0562 /* Common preamble for all serial descriptors (ACPI 5.0) */
0563 
0564 #define AML_RESOURCE_SERIAL_COMMON \
0565     UINT8                           RevisionId; \
0566     UINT8                           ResSourceIndex; \
0567     UINT8                           Type; \
0568     UINT8                           Flags; \
0569     UINT16                          TypeSpecificFlags; \
0570     UINT8                           TypeRevisionId; \
0571     UINT16                          TypeDataLength; \
0572 
0573 /* Values for the type field above */
0574 
0575 #define AML_RESOURCE_I2C_SERIALBUSTYPE          1
0576 #define AML_RESOURCE_SPI_SERIALBUSTYPE          2
0577 #define AML_RESOURCE_UART_SERIALBUSTYPE         3
0578 #define AML_RESOURCE_CSI2_SERIALBUSTYPE         4
0579 #define AML_RESOURCE_MAX_SERIALBUSTYPE          4
0580 #define AML_RESOURCE_VENDOR_SERIALBUSTYPE       192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
0581 
0582 typedef struct aml_resource_common_serialbus
0583 {
0584     AML_RESOURCE_LARGE_HEADER_COMMON
0585     AML_RESOURCE_SERIAL_COMMON
0586 
0587 } AML_RESOURCE_COMMON_SERIALBUS;
0588 
0589 
0590 typedef struct aml_resource_csi2_serialbus
0591 {
0592     AML_RESOURCE_LARGE_HEADER_COMMON
0593     AML_RESOURCE_SERIAL_COMMON
0594 
0595     /*
0596      * Optional fields follow immediately:
0597      * 1) Vendor Data bytes
0598      * 2) Resource Source String
0599      */
0600 
0601 } AML_RESOURCE_CSI2_SERIALBUS;
0602 
0603 #define AML_RESOURCE_CSI2_REVISION              1       /* ACPI 6.4 */
0604 #define AML_RESOURCE_CSI2_TYPE_REVISION         1       /* ACPI 6.4 */
0605 #define AML_RESOURCE_CSI2_MIN_DATA_LEN          0       /* ACPI 6.4 */
0606 
0607 typedef struct aml_resource_i2c_serialbus
0608 {
0609     AML_RESOURCE_LARGE_HEADER_COMMON
0610     AML_RESOURCE_SERIAL_COMMON
0611     UINT32                          ConnectionSpeed;
0612     UINT16                          SlaveAddress;
0613     /*
0614      * Optional fields follow immediately:
0615      * 1) Vendor Data bytes
0616      * 2) Resource Source String
0617      */
0618 
0619 } AML_RESOURCE_I2C_SERIALBUS;
0620 
0621 #define AML_RESOURCE_I2C_REVISION               1       /* ACPI 5.0 */
0622 #define AML_RESOURCE_I2C_TYPE_REVISION          1       /* ACPI 5.0 */
0623 #define AML_RESOURCE_I2C_MIN_DATA_LEN           6
0624 
0625 typedef struct aml_resource_spi_serialbus
0626 {
0627     AML_RESOURCE_LARGE_HEADER_COMMON
0628     AML_RESOURCE_SERIAL_COMMON
0629     UINT32                          ConnectionSpeed;
0630     UINT8                           DataBitLength;
0631     UINT8                           ClockPhase;
0632     UINT8                           ClockPolarity;
0633     UINT16                          DeviceSelection;
0634     /*
0635      * Optional fields follow immediately:
0636      * 1) Vendor Data bytes
0637      * 2) Resource Source String
0638      */
0639 
0640 } AML_RESOURCE_SPI_SERIALBUS;
0641 
0642 #define AML_RESOURCE_SPI_REVISION               1       /* ACPI 5.0 */
0643 #define AML_RESOURCE_SPI_TYPE_REVISION          1       /* ACPI 5.0 */
0644 #define AML_RESOURCE_SPI_MIN_DATA_LEN           9
0645 
0646 typedef struct aml_resource_uart_serialbus
0647 {
0648     AML_RESOURCE_LARGE_HEADER_COMMON
0649     AML_RESOURCE_SERIAL_COMMON
0650     UINT32                          DefaultBaudRate;
0651     UINT16                          RxFifoSize;
0652     UINT16                          TxFifoSize;
0653     UINT8                           Parity;
0654     UINT8                           LinesEnabled;
0655     /*
0656      * Optional fields follow immediately:
0657      * 1) Vendor Data bytes
0658      * 2) Resource Source String
0659      */
0660 
0661 } AML_RESOURCE_UART_SERIALBUS;
0662 
0663 #define AML_RESOURCE_UART_REVISION              1       /* ACPI 5.0 */
0664 #define AML_RESOURCE_UART_TYPE_REVISION         1       /* ACPI 5.0 */
0665 #define AML_RESOURCE_UART_MIN_DATA_LEN          10
0666 
0667 typedef struct aml_resource_pin_function
0668 {
0669     AML_RESOURCE_LARGE_HEADER_COMMON
0670     UINT8                           RevisionId;
0671     UINT16                          Flags;
0672     UINT8                           PinConfig;
0673     UINT16                          FunctionNumber;
0674     UINT16                          PinTableOffset;
0675     UINT8                           ResSourceIndex;
0676     UINT16                          ResSourceOffset;
0677     UINT16                          VendorOffset;
0678     UINT16                          VendorLength;
0679     /*
0680      * Optional fields follow immediately:
0681      * 1) PIN list (Words)
0682      * 2) Resource Source String
0683      * 3) Vendor Data bytes
0684      */
0685 
0686 } AML_RESOURCE_PIN_FUNCTION;
0687 
0688 #define AML_RESOURCE_PIN_FUNCTION_REVISION      1       /* ACPI 6.2 */
0689 
0690 typedef struct aml_resource_pin_config
0691 {
0692     AML_RESOURCE_LARGE_HEADER_COMMON
0693     UINT8                           RevisionId;
0694     UINT16                          Flags;
0695     UINT8                           PinConfigType;
0696     UINT32                          PinConfigValue;
0697     UINT16                          PinTableOffset;
0698     UINT8                           ResSourceIndex;
0699     UINT16                          ResSourceOffset;
0700     UINT16                          VendorOffset;
0701     UINT16                          VendorLength;
0702     /*
0703      * Optional fields follow immediately:
0704      * 1) PIN list (Words)
0705      * 2) Resource Source String
0706      * 3) Vendor Data bytes
0707      */
0708 
0709 } AML_RESOURCE_PIN_CONFIG;
0710 
0711 #define AML_RESOURCE_CLOCK_INPUT_REVISION      1       /* ACPI 6.5 */
0712 
0713 typedef struct aml_resource_clock_input
0714 {
0715     AML_RESOURCE_LARGE_HEADER_COMMON
0716     UINT8                           RevisionId;
0717     UINT16                          Flags;
0718     UINT16                          FrequencyDivisor;
0719     UINT32                          FrequencyNumerator;
0720     /*
0721      * Optional fields follow immediately:
0722      * 1) Resource Source index
0723      * 2) Resource Source String
0724      */
0725 } AML_RESOURCE_CLOCK_INPUT;
0726 
0727 
0728 #define AML_RESOURCE_PIN_CONFIG_REVISION      1       /* ACPI 6.2 */
0729 
0730 typedef struct aml_resource_pin_group
0731 {
0732     AML_RESOURCE_LARGE_HEADER_COMMON
0733     UINT8                           RevisionId;
0734     UINT16                          Flags;
0735     UINT16                          PinTableOffset;
0736     UINT16                          LabelOffset;
0737     UINT16                          VendorOffset;
0738     UINT16                          VendorLength;
0739     /*
0740      * Optional fields follow immediately:
0741      * 1) PIN list (Words)
0742      * 2) Resource Label String
0743      * 3) Vendor Data bytes
0744      */
0745 
0746 } AML_RESOURCE_PIN_GROUP;
0747 
0748 #define AML_RESOURCE_PIN_GROUP_REVISION      1       /* ACPI 6.2 */
0749 
0750 typedef struct aml_resource_pin_group_function
0751 {
0752     AML_RESOURCE_LARGE_HEADER_COMMON
0753     UINT8                           RevisionId;
0754     UINT16                          Flags;
0755     UINT16                          FunctionNumber;
0756     UINT8                           ResSourceIndex;
0757     UINT16                          ResSourceOffset;
0758     UINT16                          ResSourceLabelOffset;
0759     UINT16                          VendorOffset;
0760     UINT16                          VendorLength;
0761     /*
0762      * Optional fields follow immediately:
0763      * 1) Resource Source String
0764      * 2) Resource Source Label String
0765      * 3) Vendor Data bytes
0766      */
0767 
0768 } AML_RESOURCE_PIN_GROUP_FUNCTION;
0769 
0770 #define AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION    1       /* ACPI 6.2 */
0771 
0772 typedef struct aml_resource_pin_group_config
0773 {
0774     AML_RESOURCE_LARGE_HEADER_COMMON
0775     UINT8                           RevisionId;
0776     UINT16                          Flags;
0777     UINT8                           PinConfigType;
0778     UINT32                          PinConfigValue;
0779     UINT8                           ResSourceIndex;
0780     UINT16                          ResSourceOffset;
0781     UINT16                          ResSourceLabelOffset;
0782     UINT16                          VendorOffset;
0783     UINT16                          VendorLength;
0784     /*
0785      * Optional fields follow immediately:
0786      * 1) Resource Source String
0787      * 2) Resource Source Label String
0788      * 3) Vendor Data bytes
0789      */
0790 
0791 } AML_RESOURCE_PIN_GROUP_CONFIG;
0792 
0793 #define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION    1       /* ACPI 6.2 */
0794 
0795 /* restore default alignment */
0796 
0797 #pragma pack()
0798 
0799 /* Union of all resource descriptors, so we can allocate the worst case */
0800 
0801 typedef union aml_resource
0802 {
0803     /* Descriptor headers */
0804 
0805     UINT8                                   DescriptorType;
0806     AML_RESOURCE_SMALL_HEADER               SmallHeader;
0807     AML_RESOURCE_LARGE_HEADER               LargeHeader;
0808 
0809     /* Small resource descriptors */
0810 
0811     AML_RESOURCE_IRQ                        Irq;
0812     AML_RESOURCE_DMA                        Dma;
0813     AML_RESOURCE_START_DEPENDENT            StartDpf;
0814     AML_RESOURCE_END_DEPENDENT              EndDpf;
0815     AML_RESOURCE_IO                         Io;
0816     AML_RESOURCE_FIXED_IO                   FixedIo;
0817     AML_RESOURCE_FIXED_DMA                  FixedDma;
0818     AML_RESOURCE_VENDOR_SMALL               VendorSmall;
0819     AML_RESOURCE_END_TAG                    EndTag;
0820 
0821     /* Large resource descriptors */
0822 
0823     AML_RESOURCE_MEMORY24                   Memory24;
0824     AML_RESOURCE_GENERIC_REGISTER           GenericReg;
0825     AML_RESOURCE_VENDOR_LARGE               VendorLarge;
0826     AML_RESOURCE_MEMORY32                   Memory32;
0827     AML_RESOURCE_FIXED_MEMORY32             FixedMemory32;
0828     AML_RESOURCE_ADDRESS16                  Address16;
0829     AML_RESOURCE_ADDRESS32                  Address32;
0830     AML_RESOURCE_ADDRESS64                  Address64;
0831     AML_RESOURCE_EXTENDED_ADDRESS64         ExtAddress64;
0832     AML_RESOURCE_EXTENDED_IRQ               ExtendedIrq;
0833     AML_RESOURCE_GPIO                       Gpio;
0834     AML_RESOURCE_I2C_SERIALBUS              I2cSerialBus;
0835     AML_RESOURCE_SPI_SERIALBUS              SpiSerialBus;
0836     AML_RESOURCE_UART_SERIALBUS             UartSerialBus;
0837     AML_RESOURCE_CSI2_SERIALBUS             Csi2SerialBus;
0838     AML_RESOURCE_COMMON_SERIALBUS           CommonSerialBus;
0839     AML_RESOURCE_PIN_FUNCTION               PinFunction;
0840     AML_RESOURCE_PIN_CONFIG                 PinConfig;
0841     AML_RESOURCE_PIN_GROUP                  PinGroup;
0842     AML_RESOURCE_PIN_GROUP_FUNCTION         PinGroupFunction;
0843     AML_RESOURCE_PIN_GROUP_CONFIG           PinGroupConfig;
0844     AML_RESOURCE_CLOCK_INPUT                ClockInput;
0845 
0846     /* Utility overlays */
0847 
0848     AML_RESOURCE_ADDRESS                    Address;
0849     UINT32                                  DwordItem;
0850     UINT16                                  WordItem;
0851     UINT8                                   ByteItem;
0852 
0853 } AML_RESOURCE;
0854 
0855 
0856 /* Interfaces used by both the disassembler and compiler */
0857 
0858 void
0859 MpSaveGpioInfo (
0860     ACPI_PARSE_OBJECT       *Op,
0861     AML_RESOURCE            *Resource,
0862     UINT32                  PinCount,
0863     UINT16                  *PinList,
0864     char                    *DeviceName);
0865 
0866 void
0867 MpSaveSerialInfo (
0868     ACPI_PARSE_OBJECT       *Op,
0869     AML_RESOURCE            *Resource,
0870     char                    *DeviceName);
0871 
0872 char *
0873 MpGetHidFromParseTree (
0874     ACPI_NAMESPACE_NODE     *HidNode);
0875 
0876 char *
0877 MpGetHidViaNamestring (
0878     char                    *DeviceName);
0879 
0880 char *
0881 MpGetConnectionInfo (
0882     ACPI_PARSE_OBJECT       *Op,
0883     UINT32                  PinIndex,
0884     ACPI_NAMESPACE_NODE     **TargetNode,
0885     char                    **TargetName);
0886 
0887 char *
0888 MpGetParentDeviceHid (
0889     ACPI_PARSE_OBJECT       *Op,
0890     ACPI_NAMESPACE_NODE     **TargetNode,
0891     char                    **ParentDeviceName);
0892 
0893 char *
0894 MpGetDdnValue (
0895     char                    *DeviceName);
0896 
0897 char *
0898 MpGetHidValue (
0899     ACPI_NAMESPACE_NODE     *DeviceNode);
0900 
0901 #endif