Path: blob/main/sys/contrib/dev/acpica/include/amlresrc.h
48286 views
/******************************************************************************1*2* Module Name: amlresrc.h - AML resource descriptors3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151/* acpisrc:StructDefs -- for acpisrc conversion */152153#ifndef __AMLRESRC_H154#define __AMLRESRC_H155156157/*158* Resource descriptor tags, as defined in the ACPI specification.159* Used to symbolically reference fields within a descriptor.160*/161#define ACPI_RESTAG_ADDRESS "_ADR"162#define ACPI_RESTAG_ALIGNMENT "_ALN"163#define ACPI_RESTAG_ADDRESSSPACE "_ASI"164#define ACPI_RESTAG_ACCESSSIZE "_ASZ"165#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"166#define ACPI_RESTAG_BASEADDRESS "_BAS"167#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */168#define ACPI_RESTAG_DEBOUNCETIME "_DBT"169#define ACPI_RESTAG_DECODE "_DEC"170#define ACPI_RESTAG_DEVICEPOLARITY "_DPL"171#define ACPI_RESTAG_DMA "_DMA"172#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */173#define ACPI_RESTAG_DRIVESTRENGTH "_DRS"174#define ACPI_RESTAG_ENDIANNESS "_END"175#define ACPI_RESTAG_FLOWCONTROL "_FLC"176#define ACPI_RESTAG_FUNCTION "_FUN"177#define ACPI_RESTAG_GRANULARITY "_GRA"178#define ACPI_RESTAG_INTERRUPT "_INT"179#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */180#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */181#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */182#define ACPI_RESTAG_IORESTRICTION "_IOR"183#define ACPI_RESTAG_LENGTH "_LEN"184#define ACPI_RESTAG_LINE "_LIN"185#define ACPI_RESTAG_LOCALPORT "_PRT"186#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */187#define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */188#define ACPI_RESTAG_MAXADDR "_MAX"189#define ACPI_RESTAG_MINADDR "_MIN"190#define ACPI_RESTAG_MAXTYPE "_MAF"191#define ACPI_RESTAG_MINTYPE "_MIF"192#define ACPI_RESTAG_MODE "_MOD"193#define ACPI_RESTAG_PARITY "_PAR"194#define ACPI_RESTAG_PHASE "_PHA"195#define ACPI_RESTAG_PHYTYPE "_PHY"196#define ACPI_RESTAG_PIN "_PIN"197#define ACPI_RESTAG_PINCONFIG "_PPI"198#define ACPI_RESTAG_PINCONFIG_TYPE "_TYP"199#define ACPI_RESTAG_PINCONFIG_VALUE "_VAL"200#define ACPI_RESTAG_POLARITY "_POL"201#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"202#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"203#define ACPI_RESTAG_RANGETYPE "_RNG"204#define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */205#define ACPI_RESTAG_LENGTH_RX "_RXL"206#define ACPI_RESTAG_LENGTH_TX "_TXL"207#define ACPI_RESTAG_SLAVEMODE "_SLV"208#define ACPI_RESTAG_SPEED "_SPE"209#define ACPI_RESTAG_STOPBITS "_STB"210#define ACPI_RESTAG_TRANSLATION "_TRA"211#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */212#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */213#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */214#define ACPI_RESTAG_VENDORDATA "_VEN"215#define ACPI_RESTAG_FQN "_FQN"216#define ACPI_RESTAG_FQD "_FQD"217218219/* Default sizes for "small" resource descriptors */220221#define ASL_RDESC_IRQ_SIZE 0x02222#define ASL_RDESC_DMA_SIZE 0x02223#define ASL_RDESC_ST_DEPEND_SIZE 0x00224#define ASL_RDESC_END_DEPEND_SIZE 0x00225#define ASL_RDESC_IO_SIZE 0x07226#define ASL_RDESC_FIXED_IO_SIZE 0x03227#define ASL_RDESC_FIXED_DMA_SIZE 0x05228#define ASL_RDESC_END_TAG_SIZE 0x01229230231typedef struct asl_resource_node232{233UINT32 BufferLength;234void *Buffer;235struct asl_resource_node *Next;236237} ASL_RESOURCE_NODE;238239typedef struct asl_resource_info240{241ACPI_PARSE_OBJECT *DescriptorTypeOp; /* Resource descriptor parse node */242ACPI_PARSE_OBJECT *MappingOp; /* Used for mapfile support */243UINT32 CurrentByteOffset; /* Offset in resource template */244245} ASL_RESOURCE_INFO;246247248/* Macros used to generate AML resource length fields */249250#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))251#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))252253/*254* Resource descriptors defined in the ACPI specification.255*256* Packing/alignment must be BYTE because these descriptors257* are used to overlay the raw AML byte stream.258*/259#pragma pack(1)260261/*262* SMALL descriptors263*/264#define AML_RESOURCE_SMALL_HEADER_COMMON \265UINT8 DescriptorType;266267typedef struct aml_resource_small_header268{269AML_RESOURCE_SMALL_HEADER_COMMON270271} AML_RESOURCE_SMALL_HEADER;272273274typedef struct aml_resource_irq275{276AML_RESOURCE_SMALL_HEADER_COMMON277UINT16 IrqMask;278UINT8 Flags;279280} AML_RESOURCE_IRQ;281282283typedef struct aml_resource_irq_noflags284{285AML_RESOURCE_SMALL_HEADER_COMMON286UINT16 IrqMask;287288} AML_RESOURCE_IRQ_NOFLAGS;289290291typedef struct aml_resource_dma292{293AML_RESOURCE_SMALL_HEADER_COMMON294UINT8 DmaChannelMask;295UINT8 Flags;296297} AML_RESOURCE_DMA;298299300typedef struct aml_resource_start_dependent301{302AML_RESOURCE_SMALL_HEADER_COMMON303UINT8 Flags;304305} AML_RESOURCE_START_DEPENDENT;306307308typedef struct aml_resource_start_dependent_noprio309{310AML_RESOURCE_SMALL_HEADER_COMMON311312} AML_RESOURCE_START_DEPENDENT_NOPRIO;313314315typedef struct aml_resource_end_dependent316{317AML_RESOURCE_SMALL_HEADER_COMMON318319} AML_RESOURCE_END_DEPENDENT;320321322typedef struct aml_resource_io323{324AML_RESOURCE_SMALL_HEADER_COMMON325UINT8 Flags;326UINT16 Minimum;327UINT16 Maximum;328UINT8 Alignment;329UINT8 AddressLength;330331} AML_RESOURCE_IO;332333334typedef struct aml_resource_fixed_io335{336AML_RESOURCE_SMALL_HEADER_COMMON337UINT16 Address;338UINT8 AddressLength;339340} AML_RESOURCE_FIXED_IO;341342343typedef struct aml_resource_vendor_small344{345AML_RESOURCE_SMALL_HEADER_COMMON346347} AML_RESOURCE_VENDOR_SMALL;348349350typedef struct aml_resource_end_tag351{352AML_RESOURCE_SMALL_HEADER_COMMON353UINT8 Checksum;354355} AML_RESOURCE_END_TAG;356357358typedef struct aml_resource_fixed_dma359{360AML_RESOURCE_SMALL_HEADER_COMMON361UINT16 RequestLines;362UINT16 Channels;363UINT8 Width;364365} AML_RESOURCE_FIXED_DMA;366367368/*369* LARGE descriptors370*/371#define AML_RESOURCE_LARGE_HEADER_COMMON \372UINT8 DescriptorType;\373UINT16 ResourceLength;374375typedef struct aml_resource_large_header376{377AML_RESOURCE_LARGE_HEADER_COMMON378379} AML_RESOURCE_LARGE_HEADER;380381382/* General Flags for address space resource descriptors */383384#define ACPI_RESOURCE_FLAG_DEC 2385#define ACPI_RESOURCE_FLAG_MIF 4386#define ACPI_RESOURCE_FLAG_MAF 8387388typedef struct aml_resource_memory24389{390AML_RESOURCE_LARGE_HEADER_COMMON391UINT8 Flags;392UINT16 Minimum;393UINT16 Maximum;394UINT16 Alignment;395UINT16 AddressLength;396397} AML_RESOURCE_MEMORY24;398399400typedef struct aml_resource_vendor_large401{402AML_RESOURCE_LARGE_HEADER_COMMON403404} AML_RESOURCE_VENDOR_LARGE;405406407typedef struct aml_resource_memory32408{409AML_RESOURCE_LARGE_HEADER_COMMON410UINT8 Flags;411UINT32 Minimum;412UINT32 Maximum;413UINT32 Alignment;414UINT32 AddressLength;415416} AML_RESOURCE_MEMORY32;417418419typedef struct aml_resource_fixed_memory32420{421AML_RESOURCE_LARGE_HEADER_COMMON422UINT8 Flags;423UINT32 Address;424UINT32 AddressLength;425426} AML_RESOURCE_FIXED_MEMORY32;427428429#define AML_RESOURCE_ADDRESS_COMMON \430UINT8 ResourceType; \431UINT8 Flags; \432UINT8 SpecificFlags;433434435typedef struct aml_resource_address436{437AML_RESOURCE_LARGE_HEADER_COMMON438AML_RESOURCE_ADDRESS_COMMON439440} AML_RESOURCE_ADDRESS;441442443typedef struct aml_resource_extended_address64444{445AML_RESOURCE_LARGE_HEADER_COMMON446AML_RESOURCE_ADDRESS_COMMON447UINT8 RevisionID;448UINT8 Reserved;449UINT64 Granularity;450UINT64 Minimum;451UINT64 Maximum;452UINT64 TranslationOffset;453UINT64 AddressLength;454UINT64 TypeSpecific;455456} AML_RESOURCE_EXTENDED_ADDRESS64;457458#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */459460461typedef struct aml_resource_address64462{463AML_RESOURCE_LARGE_HEADER_COMMON464AML_RESOURCE_ADDRESS_COMMON465UINT64 Granularity;466UINT64 Minimum;467UINT64 Maximum;468UINT64 TranslationOffset;469UINT64 AddressLength;470471} AML_RESOURCE_ADDRESS64;472473474typedef struct aml_resource_address32475{476AML_RESOURCE_LARGE_HEADER_COMMON477AML_RESOURCE_ADDRESS_COMMON478UINT32 Granularity;479UINT32 Minimum;480UINT32 Maximum;481UINT32 TranslationOffset;482UINT32 AddressLength;483484} AML_RESOURCE_ADDRESS32;485486487typedef struct aml_resource_address16488{489AML_RESOURCE_LARGE_HEADER_COMMON490AML_RESOURCE_ADDRESS_COMMON491UINT16 Granularity;492UINT16 Minimum;493UINT16 Maximum;494UINT16 TranslationOffset;495UINT16 AddressLength;496497} AML_RESOURCE_ADDRESS16;498499500typedef struct aml_resource_extended_irq501{502AML_RESOURCE_LARGE_HEADER_COMMON503UINT8 Flags;504UINT8 InterruptCount;505union {506UINT32 Interrupt;507ACPI_FLEX_ARRAY(UINT32, Interrupts);508};509/* ResSourceIndex, ResSource optional fields follow */510511} AML_RESOURCE_EXTENDED_IRQ;512513514typedef struct aml_resource_generic_register515{516AML_RESOURCE_LARGE_HEADER_COMMON517UINT8 AddressSpaceId;518UINT8 BitWidth;519UINT8 BitOffset;520UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */521UINT64 Address;522523} AML_RESOURCE_GENERIC_REGISTER;524525526/* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */527528typedef struct aml_resource_gpio529{530AML_RESOURCE_LARGE_HEADER_COMMON531UINT8 RevisionId;532UINT8 ConnectionType;533UINT16 Flags;534UINT16 IntFlags;535UINT8 PinConfig;536UINT16 DriveStrength;537UINT16 DebounceTimeout;538UINT16 PinTableOffset;539UINT8 ResSourceIndex;540UINT16 ResSourceOffset;541UINT16 VendorOffset;542UINT16 VendorLength;543/*544* Optional fields follow immediately:545* 1) PIN list (Words)546* 2) Resource Source String547* 3) Vendor Data bytes548*/549550} AML_RESOURCE_GPIO;551552#define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */553554/* Values for ConnectionType above */555556#define AML_RESOURCE_GPIO_TYPE_INT 0557#define AML_RESOURCE_GPIO_TYPE_IO 1558#define AML_RESOURCE_MAX_GPIOTYPE 1559560561/* Common preamble for all serial descriptors (ACPI 5.0) */562563#define AML_RESOURCE_SERIAL_COMMON \564UINT8 RevisionId; \565UINT8 ResSourceIndex; \566UINT8 Type; \567UINT8 Flags; \568UINT16 TypeSpecificFlags; \569UINT8 TypeRevisionId; \570UINT16 TypeDataLength; \571572/* Values for the type field above */573574#define AML_RESOURCE_I2C_SERIALBUSTYPE 1575#define AML_RESOURCE_SPI_SERIALBUSTYPE 2576#define AML_RESOURCE_UART_SERIALBUSTYPE 3577#define AML_RESOURCE_CSI2_SERIALBUSTYPE 4578#define AML_RESOURCE_MAX_SERIALBUSTYPE 4579#define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */580581typedef struct aml_resource_common_serialbus582{583AML_RESOURCE_LARGE_HEADER_COMMON584AML_RESOURCE_SERIAL_COMMON585586} AML_RESOURCE_COMMON_SERIALBUS;587588589typedef struct aml_resource_csi2_serialbus590{591AML_RESOURCE_LARGE_HEADER_COMMON592AML_RESOURCE_SERIAL_COMMON593594/*595* Optional fields follow immediately:596* 1) Vendor Data bytes597* 2) Resource Source String598*/599600} AML_RESOURCE_CSI2_SERIALBUS;601602#define AML_RESOURCE_CSI2_REVISION 1 /* ACPI 6.4 */603#define AML_RESOURCE_CSI2_TYPE_REVISION 1 /* ACPI 6.4 */604#define AML_RESOURCE_CSI2_MIN_DATA_LEN 0 /* ACPI 6.4 */605606typedef struct aml_resource_i2c_serialbus607{608AML_RESOURCE_LARGE_HEADER_COMMON609AML_RESOURCE_SERIAL_COMMON610UINT32 ConnectionSpeed;611UINT16 SlaveAddress;612/*613* Optional fields follow immediately:614* 1) Vendor Data bytes615* 2) Resource Source String616*/617618} AML_RESOURCE_I2C_SERIALBUS;619620#define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */621#define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */622#define AML_RESOURCE_I2C_MIN_DATA_LEN 6623624typedef struct aml_resource_spi_serialbus625{626AML_RESOURCE_LARGE_HEADER_COMMON627AML_RESOURCE_SERIAL_COMMON628UINT32 ConnectionSpeed;629UINT8 DataBitLength;630UINT8 ClockPhase;631UINT8 ClockPolarity;632UINT16 DeviceSelection;633/*634* Optional fields follow immediately:635* 1) Vendor Data bytes636* 2) Resource Source String637*/638639} AML_RESOURCE_SPI_SERIALBUS;640641#define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */642#define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */643#define AML_RESOURCE_SPI_MIN_DATA_LEN 9644645typedef struct aml_resource_uart_serialbus646{647AML_RESOURCE_LARGE_HEADER_COMMON648AML_RESOURCE_SERIAL_COMMON649UINT32 DefaultBaudRate;650UINT16 RxFifoSize;651UINT16 TxFifoSize;652UINT8 Parity;653UINT8 LinesEnabled;654/*655* Optional fields follow immediately:656* 1) Vendor Data bytes657* 2) Resource Source String658*/659660} AML_RESOURCE_UART_SERIALBUS;661662#define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */663#define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */664#define AML_RESOURCE_UART_MIN_DATA_LEN 10665666typedef struct aml_resource_pin_function667{668AML_RESOURCE_LARGE_HEADER_COMMON669UINT8 RevisionId;670UINT16 Flags;671UINT8 PinConfig;672UINT16 FunctionNumber;673UINT16 PinTableOffset;674UINT8 ResSourceIndex;675UINT16 ResSourceOffset;676UINT16 VendorOffset;677UINT16 VendorLength;678/*679* Optional fields follow immediately:680* 1) PIN list (Words)681* 2) Resource Source String682* 3) Vendor Data bytes683*/684685} AML_RESOURCE_PIN_FUNCTION;686687#define AML_RESOURCE_PIN_FUNCTION_REVISION 1 /* ACPI 6.2 */688689typedef struct aml_resource_pin_config690{691AML_RESOURCE_LARGE_HEADER_COMMON692UINT8 RevisionId;693UINT16 Flags;694UINT8 PinConfigType;695UINT32 PinConfigValue;696UINT16 PinTableOffset;697UINT8 ResSourceIndex;698UINT16 ResSourceOffset;699UINT16 VendorOffset;700UINT16 VendorLength;701/*702* Optional fields follow immediately:703* 1) PIN list (Words)704* 2) Resource Source String705* 3) Vendor Data bytes706*/707708} AML_RESOURCE_PIN_CONFIG;709710#define AML_RESOURCE_CLOCK_INPUT_REVISION 1 /* ACPI 6.5 */711712typedef struct aml_resource_clock_input713{714AML_RESOURCE_LARGE_HEADER_COMMON715UINT8 RevisionId;716UINT16 Flags;717UINT16 FrequencyDivisor;718UINT32 FrequencyNumerator;719/*720* Optional fields follow immediately:721* 1) Resource Source index722* 2) Resource Source String723*/724} AML_RESOURCE_CLOCK_INPUT;725726727#define AML_RESOURCE_PIN_CONFIG_REVISION 1 /* ACPI 6.2 */728729typedef struct aml_resource_pin_group730{731AML_RESOURCE_LARGE_HEADER_COMMON732UINT8 RevisionId;733UINT16 Flags;734UINT16 PinTableOffset;735UINT16 LabelOffset;736UINT16 VendorOffset;737UINT16 VendorLength;738/*739* Optional fields follow immediately:740* 1) PIN list (Words)741* 2) Resource Label String742* 3) Vendor Data bytes743*/744745} AML_RESOURCE_PIN_GROUP;746747#define AML_RESOURCE_PIN_GROUP_REVISION 1 /* ACPI 6.2 */748749typedef struct aml_resource_pin_group_function750{751AML_RESOURCE_LARGE_HEADER_COMMON752UINT8 RevisionId;753UINT16 Flags;754UINT16 FunctionNumber;755UINT8 ResSourceIndex;756UINT16 ResSourceOffset;757UINT16 ResSourceLabelOffset;758UINT16 VendorOffset;759UINT16 VendorLength;760/*761* Optional fields follow immediately:762* 1) Resource Source String763* 2) Resource Source Label String764* 3) Vendor Data bytes765*/766767} AML_RESOURCE_PIN_GROUP_FUNCTION;768769#define AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION 1 /* ACPI 6.2 */770771typedef struct aml_resource_pin_group_config772{773AML_RESOURCE_LARGE_HEADER_COMMON774UINT8 RevisionId;775UINT16 Flags;776UINT8 PinConfigType;777UINT32 PinConfigValue;778UINT8 ResSourceIndex;779UINT16 ResSourceOffset;780UINT16 ResSourceLabelOffset;781UINT16 VendorOffset;782UINT16 VendorLength;783/*784* Optional fields follow immediately:785* 1) Resource Source String786* 2) Resource Source Label String787* 3) Vendor Data bytes788*/789790} AML_RESOURCE_PIN_GROUP_CONFIG;791792#define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION 1 /* ACPI 6.2 */793794/* Union of all resource descriptors, so we can allocate the worst case */795796typedef union aml_resource797{798/* Descriptor headers */799800UINT8 DescriptorType;801AML_RESOURCE_SMALL_HEADER SmallHeader;802AML_RESOURCE_LARGE_HEADER LargeHeader;803804/* Small resource descriptors */805806AML_RESOURCE_IRQ Irq;807AML_RESOURCE_DMA Dma;808AML_RESOURCE_START_DEPENDENT StartDpf;809AML_RESOURCE_END_DEPENDENT EndDpf;810AML_RESOURCE_IO Io;811AML_RESOURCE_FIXED_IO FixedIo;812AML_RESOURCE_FIXED_DMA FixedDma;813AML_RESOURCE_VENDOR_SMALL VendorSmall;814AML_RESOURCE_END_TAG EndTag;815816/* Large resource descriptors */817818AML_RESOURCE_MEMORY24 Memory24;819AML_RESOURCE_GENERIC_REGISTER GenericReg;820AML_RESOURCE_VENDOR_LARGE VendorLarge;821AML_RESOURCE_MEMORY32 Memory32;822AML_RESOURCE_FIXED_MEMORY32 FixedMemory32;823AML_RESOURCE_ADDRESS16 Address16;824AML_RESOURCE_ADDRESS32 Address32;825AML_RESOURCE_ADDRESS64 Address64;826AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;827AML_RESOURCE_EXTENDED_IRQ ExtendedIrq;828AML_RESOURCE_GPIO Gpio;829AML_RESOURCE_I2C_SERIALBUS I2cSerialBus;830AML_RESOURCE_SPI_SERIALBUS SpiSerialBus;831AML_RESOURCE_UART_SERIALBUS UartSerialBus;832AML_RESOURCE_CSI2_SERIALBUS Csi2SerialBus;833AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus;834AML_RESOURCE_PIN_FUNCTION PinFunction;835AML_RESOURCE_PIN_CONFIG PinConfig;836AML_RESOURCE_PIN_GROUP PinGroup;837AML_RESOURCE_PIN_GROUP_FUNCTION PinGroupFunction;838AML_RESOURCE_PIN_GROUP_CONFIG PinGroupConfig;839AML_RESOURCE_CLOCK_INPUT ClockInput;840841/* Utility overlays */842843AML_RESOURCE_ADDRESS Address;844UINT32 DwordItem;845UINT16 WordItem;846UINT8 ByteItem;847848} AML_RESOURCE;849850/* restore default alignment */851852#pragma pack()853854/* Interfaces used by both the disassembler and compiler */855856void857MpSaveGpioInfo (858ACPI_PARSE_OBJECT *Op,859AML_RESOURCE *Resource,860UINT32 PinCount,861UINT16 *PinList,862char *DeviceName);863864void865MpSaveSerialInfo (866ACPI_PARSE_OBJECT *Op,867AML_RESOURCE *Resource,868char *DeviceName);869870char *871MpGetHidFromParseTree (872ACPI_NAMESPACE_NODE *HidNode);873874char *875MpGetHidViaNamestring (876char *DeviceName);877878char *879MpGetConnectionInfo (880ACPI_PARSE_OBJECT *Op,881UINT32 PinIndex,882ACPI_NAMESPACE_NODE **TargetNode,883char **TargetName);884885char *886MpGetParentDeviceHid (887ACPI_PARSE_OBJECT *Op,888ACPI_NAMESPACE_NODE **TargetNode,889char **ParentDeviceName);890891char *892MpGetDdnValue (893char *DeviceName);894895char *896MpGetHidValue (897ACPI_NAMESPACE_NODE *DeviceNode);898899#endif900901902