diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2011-11-23 18:05:37 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2011-11-23 18:05:37 +0000 |
commit | 50796274dc74454ca64a6e120552adb2620c3e65 (patch) | |
tree | 91526f3e19920a98573c3d04bbef39cd71a7c0ce | |
parent | 33c583d0c71a12a703f849679505114e27bba011 (diff) |
Import ACPICA 20111123.vendor/acpica/20111123
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=227896
svn path=/vendor-sys/acpica/20111123/; revision=227897; tag=vendor/acpica/20111123
131 files changed, 10951 insertions, 1470 deletions
diff --git a/changes.txt b/changes.txt index 82ab813229dc..2e64a9062859 100644 --- a/changes.txt +++ b/changes.txt @@ -1,7 +1,214 @@ ---------------------------------------- -22 September 2011. Summary of changes for version 20110922: +23 November 2011. Summary of changes for version 20111123: This release is available at www.acpica.org/downloads +The ACPI 5.0 specification is available at www.acpi.info + +0) ACPI 5.0 Support: + +This release contains full support for the ACPI 5.0 specification, as +summarized below. + +Reduced Hardware Support: +------------------------- + +This support allows for ACPI systems without the usual ACPI hardware. This +support is enabled by a flag in the revision 5 FADT. If it is set, ACPICA will +not attempt to initialize or use any of the usual ACPI hardware. Note, when +this flag is set, all of the following ACPI hardware is assumed to be not +present and is not initialized or accessed: + + General Purpose Events (GPEs) + Fixed Events (PM1a/PM1b and PM Control) + Power Management Timer and Console Buttons (power/sleep) + Real-time Clock Alarm + Global Lock + System Control Interrupt (SCI) + The FACS is assumed to be non-existent + +ACPI Tables: +------------ + +All new tables and updates to existing tables are fully supported in the +ACPICA headers (for use by device drivers), the disassembler, and the iASL +Data Table Compiler. ACPI 5.0 defines these new tables: + + BGRT /* Boot Graphics Resource Table */ + DRTM /* Dynamic Root of Trust for Measurement table */ + FPDT /* Firmware Performance Data Table */ + GTDT /* Generic Timer Description Table */ + MPST /* Memory Power State Table */ + PCCT /* Platform Communications Channel Table */ + PMTT /* Platform Memory Topology Table */ + RASF /* RAS Feature table */ + +Operation Regions/SpaceIDs: +--------------------------- + +All new operation regions are fully supported by the iASL compiler, the +disassembler, and the ACPICA runtime code (for dispatch to region handlers.) +The new operation region Space IDs are: + + GeneralPurposeIo + GenericSerialBus + +Resource Descriptors: +--------------------- + +All new ASL resource descriptors are fully supported by the iASL compiler, the +ASL/AML disassembler, and the ACPICA runtime Resource Manager code (including +all new predefined resource tags). New descriptors are: + + FixedDma + GpioIo + GpioInt + I2cSerialBus + SpiSerialBus + UartSerialBus + +ASL/AML Operators, New and Modified: +------------------------------------ + +One new operator is added, the Connection operator, which is used to associate +a GeneralPurposeIo or GenericSerialBus resource descriptor with individual +field objects within an operation region. Several new protocols are associated +with the AccessAs operator. All are fully supported by the iASL compiler, +disassembler, and runtime ACPICA AML interpreter: + + Connection // Declare Field Connection attributes + AccessAs: AttribBytes (n) // Read/Write N-Bytes Protocol + AccessAs: AttribRawBytes (n) // Raw Read/Write N-Bytes Protocol + AccessAs: AttribRawProcessBytes (n) // Raw Process Call Protocol + RawDataBuffer // Data type for Vendor Data fields + +Predefined ASL/AML Objects: +--------------------------- + +All new predefined objects/control-methods are supported by the iASL compiler +and the ACPICA runtime validation/repair (arguments and return values.) New +predefined names include the following: + +Standard Predefined Names (Objects or Control Methods): + _AEI, _CLS, _CPC, _CWS, _DEP, + _DLM, _EVT, _GCP, _CRT, _GWS, + _HRV, _PRE, _PSE, _SRT, _SUB. + +Resource Tags (Names used to access individual fields within resource +descriptors): + _DBT, _DPL, _DRS, _END, _FLC, + _IOR, _LIN, _MOD, _PAR, _PHA, + _PIN, _PPI, _POL, _RXL, _SLV, + _SPE, _STB, _TXL, _VEN. + +ACPICA External Interfaces: +--------------------------- + +Several new interfaces have been defined for use by ACPI-related device +drivers and other host OS services: + +AcpiAcquireMutex and AcpiReleaseMutex: These interfaces allow the host OS to +acquire and release AML mutexes that are defined in the DSDT/SSDT tables +provided by the BIOS. They are intended to be used in conjunction with the +ACPI 5.0 _DLM (Device Lock Method) in order to provide transaction-level +mutual exclusion with the AML code/interpreter. + +AcpiGetEventResources: Returns the (formatted) resource descriptors as defined +by the ACPI 5.0 _AEI object (ACPI Event Information). This object provides +resource descriptors associated with hardware-reduced platform events, similar +to the AcpiGetCurrentResources interface. + +Operation Region Handlers: For General Purpose IO and Generic Serial Bus +operation regions, information about the Connection() object and any optional +length information is passed to the region handler within the Context +parameter. + +AcpiBufferToResource: This interface converts a raw AML buffer containing a +resource template or resource descriptor to the ACPI_RESOURCE internal format +suitable for use by device drivers. Can be used by an operation region handler +to convert the Connection() buffer object into a ACPI_RESOURCE. + +Miscellaneous/Tools/TestSuites: +------------------------------- + +Support for extended _HID names (Four alpha characters instead of three). +Support for ACPI 5.0 features in the AcpiExec and AcpiHelp utilities. +Support for ACPI 5.0 features in the ASLTS test suite. +Fully updated documentation (ACPICA and iASL reference documents.) + +ACPI Table Definition Language: +------------------------------- + +Support for this language was implemented and released as a subsystem of the +iASL compiler in 2010. (See the iASL compiler User Guide.) + + +Non-ACPI 5.0 changes for this release: +-------------------------------------- + +1) ACPICA Core Subsystem: + +Fix a problem with operation region declarations where a failure can occur if +the region name and an argument that evaluates to an object (such as the +region address) are in different namespace scopes. Lin Ming, ACPICA BZ 937. + +Do not abort an ACPI table load if an invalid space ID is found within. This +will be caught later if the offending method is executed. ACPICA BZ 925. + +Fixed an issue with the FFixedHW space ID where the ID was not always +recognized properly (Both ACPICA and iASL). ACPICA BZ 926. + +Fixed a problem with the 32-bit generation of the unix-specific OSL +(osunixxf.c). Lin Ming, ACPICA BZ 936. + +Several changes made to enable generation with the GCC 4.6 compiler. ACPICA BZ +935. + +New error messages: Unsupported I/O requests (not 8/16/32 bit), and Index/Bank +field registers out-of-range. + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented the __PATH__ operator, which returns the full pathname of +the current source file. + +AcpiHelp: Automatically display expanded keyword information for all ASL +operators. + +Debugger: Add "Template" command to disassemble/dump resource template +buffers. + +Added a new master script to generate and execute the ASLTS test suite. +Automatically handles 32- and 64-bit generation. See tests/aslts.sh + +iASL: Fix problem with listing generation during processing of the Switch() +operator where AML listing was disabled until the entire Switch block was +completed. + +iASL: Improve support for semicolon statement terminators. Fix "invalid +character" message for some cases when the semicolon is used. Semicolons are +now allowed after every <Term> grammar element. ACPICA BZ 927. + +iASL: Fixed some possible aliasing warnings during generation. ACPICA BZ 923. + +Disassembler: Fix problem with disassembly of the DataTableRegion operator +where an inadvertent "Unhandled deferred opcode" message could be generated. + +3) Example Code and Data Size + +These are the sizes for the OS-independent acpica.lib produced by the +Microsoft Visual C++ 9.0 32-bit compiler. The debug version of the code +includes the debug output trace mechanism and has a much larger code and data +size. + + Previous Release: + Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + Current Release: + Non-Debug Version: 92.3K Code, 24.9K Data, 117.2K Total + Debug Version: 170.8K Code, 72.6K Data, 243.4K Total + +---------------------------------------- +22 September 2011. Summary of changes for version 20110922: 0) ACPI 5.0 News: diff --git a/common/adisasm.c b/common/adisasm.c index bafcea486f47..618371dbfa13 100644 --- a/common/adisasm.c +++ b/common/adisasm.c @@ -868,6 +868,7 @@ AdParseDeferredOps ( break; case AML_REGION_OP: + case AML_DATA_REGION_OP: case AML_CREATE_QWORD_FIELD_OP: case AML_CREATE_DWORD_FIELD_OP: case AML_CREATE_WORD_FIELD_OP: diff --git a/common/adwalk.c b/common/adwalk.c index df6944cb3f58..47ba46629c2f 100644 --- a/common/adwalk.c +++ b/common/adwalk.c @@ -378,6 +378,10 @@ AcpiDmDumpDescending ( AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer); break; + case AML_QWORD_OP: + AcpiOsPrintf ("%8.8X%8.8X", ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); + break; + case AML_INT_NAMEPATH_OP: if (Op->Common.Value.String) { diff --git a/common/dmrestag.c b/common/dmrestag.c index 9cda27fadf32..da0e61daebe0 100644 --- a/common/dmrestag.c +++ b/common/dmrestag.c @@ -63,7 +63,7 @@ AcpiDmUpdateResourceName ( static char * AcpiDmSearchTagList ( UINT32 BitIndex, - ACPI_RESOURCE_TAG *TagList); + const ACPI_RESOURCE_TAG *TagList); static char * AcpiDmGetResourceTag ( @@ -108,7 +108,7 @@ AcpiDmAddResourcesToNamespace ( * ******************************************************************************/ -static ACPI_RESOURCE_TAG AcpiDmIrqTags[] = +static const ACPI_RESOURCE_TAG AcpiDmIrqTags[] = { {( 1 * 8), ACPI_RESTAG_INTERRUPT}, {( 3 * 8) + 0, ACPI_RESTAG_INTERRUPTTYPE}, @@ -117,7 +117,7 @@ static ACPI_RESOURCE_TAG AcpiDmIrqTags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmDmaTags[] = +static const ACPI_RESOURCE_TAG AcpiDmDmaTags[] = { {( 1 * 8), ACPI_RESTAG_DMA}, {( 2 * 8) + 0, ACPI_RESTAG_XFERTYPE}, @@ -126,7 +126,7 @@ static ACPI_RESOURCE_TAG AcpiDmDmaTags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmIoTags[] = +static const ACPI_RESOURCE_TAG AcpiDmIoTags[] = { {( 1 * 8) + 0, ACPI_RESTAG_DECODE}, {( 2 * 8), ACPI_RESTAG_MINADDR}, @@ -136,14 +136,22 @@ static ACPI_RESOURCE_TAG AcpiDmIoTags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmFixedIoTags[] = +static const ACPI_RESOURCE_TAG AcpiDmFixedIoTags[] = { {( 1 * 8), ACPI_RESTAG_BASEADDRESS}, {( 3 * 8), ACPI_RESTAG_LENGTH}, {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] = +static const ACPI_RESOURCE_TAG AcpiDmFixedDmaTags[] = +{ + {( 1 * 8), ACPI_RESTAG_DMA}, + {( 3 * 8), ACPI_RESTAG_DMATYPE}, + {( 5 * 8), ACPI_RESTAG_XFERTYPE}, + {0, NULL} +}; + +static const ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] = { {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, {( 4 * 8), ACPI_RESTAG_MINADDR}, @@ -153,7 +161,7 @@ static ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmRegisterTags[] = +static const ACPI_RESOURCE_TAG AcpiDmRegisterTags[] = { {( 3 * 8), ACPI_RESTAG_ADDRESSSPACE}, {( 4 * 8), ACPI_RESTAG_REGISTERBITWIDTH}, @@ -163,7 +171,7 @@ static ACPI_RESOURCE_TAG AcpiDmRegisterTags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] = +static const ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] = { {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, {( 4 * 8), ACPI_RESTAG_MINADDR}, @@ -173,7 +181,7 @@ static ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] = +static const ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] = { {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, {( 4 * 8), ACPI_RESTAG_BASEADDRESS}, @@ -181,7 +189,7 @@ static ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmInterruptTags[] = +static const ACPI_RESOURCE_TAG AcpiDmInterruptTags[] = { {( 3 * 8) + 1, ACPI_RESTAG_INTERRUPTTYPE}, {( 3 * 8) + 2, ACPI_RESTAG_INTERRUPTLEVEL}, @@ -190,7 +198,7 @@ static ACPI_RESOURCE_TAG AcpiDmInterruptTags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] = +static const ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] = { {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, @@ -203,7 +211,7 @@ static ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] = +static const ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] = { {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, @@ -216,7 +224,7 @@ static ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] = +static const ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] = { {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, @@ -229,7 +237,7 @@ static ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] = +static const ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] = { {( 4 * 8) + 1, ACPI_RESTAG_DECODE}, {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE}, @@ -243,9 +251,71 @@ static ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] = {0, NULL} }; -/* Special-case tables for the type-specific flags */ +/* Subtype tables for GPIO descriptors */ + +static const ACPI_RESOURCE_TAG AcpiDmGpioIntTags[] = +{ + {( 7 * 8) + 0, ACPI_RESTAG_MODE}, + {( 7 * 8) + 1, ACPI_RESTAG_POLARITY}, + {( 7 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE}, + {( 9 * 8), ACPI_RESTAG_PINCONFIG}, + {(10 * 8), ACPI_RESTAG_DRIVESTRENGTH}, + {(12 * 8), ACPI_RESTAG_DEBOUNCETIME}, + {0, NULL} +}; + +static const ACPI_RESOURCE_TAG AcpiDmGpioIoTags[] = +{ + {( 7 * 8) + 0, ACPI_RESTAG_IORESTRICTION}, + {( 7 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE}, + {( 9 * 8), ACPI_RESTAG_PINCONFIG}, + {(10 * 8), ACPI_RESTAG_DRIVESTRENGTH}, + {(12 * 8), ACPI_RESTAG_DEBOUNCETIME}, + {0, NULL} +}; + +/* Subtype tables for SerialBus descriptors */ + +static const ACPI_RESOURCE_TAG AcpiDmI2cSerialBusTags[] = +{ + {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, + {( 7 * 8) + 0, ACPI_RESTAG_MODE}, + {(12 * 8), ACPI_RESTAG_SPEED}, + {(16 * 8), ACPI_RESTAG_ADDRESS}, + {0, NULL} +}; + +static const ACPI_RESOURCE_TAG AcpiDmSpiSerialBusTags[] = +{ + {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, + {( 7 * 8) + 0, ACPI_RESTAG_MODE}, + {( 7 * 8) + 1, ACPI_RESTAG_DEVICEPOLARITY}, + {(12 * 8), ACPI_RESTAG_SPEED}, + {(16 * 8), ACPI_RESTAG_LENGTH}, + {(17 * 8), ACPI_RESTAG_PHASE}, + {(18 * 8), ACPI_RESTAG_POLARITY}, + {(19 * 8), ACPI_RESTAG_ADDRESS}, + {0, NULL} +}; + +static const ACPI_RESOURCE_TAG AcpiDmUartSerialBusTags[] = +{ + {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, /* Note: not part of original macro */ + {( 7 * 8) + 0, ACPI_RESTAG_FLOWCONTROL}, + {( 7 * 8) + 2, ACPI_RESTAG_STOPBITS}, + {( 7 * 8) + 4, ACPI_RESTAG_LENGTH}, + {( 7 * 8) + 7, ACPI_RESTAG_ENDIANNESS}, + {(12 * 8), ACPI_RESTAG_SPEED}, + {(16 * 8), ACPI_RESTAG_LENGTH_RX}, + {(18 * 8), ACPI_RESTAG_LENGTH_TX}, + {(20 * 8), ACPI_RESTAG_PARITY}, + {(21 * 8), ACPI_RESTAG_LINE}, + {0, NULL} +}; + +/* Subtype tables for Address descriptor type-specific flags */ -static ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] = +static const ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] = { {( 5 * 8) + 0, ACPI_RESTAG_READWRITETYPE}, {( 5 * 8) + 1, ACPI_RESTAG_MEMTYPE}, @@ -254,7 +324,7 @@ static ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] = {0, NULL} }; -static ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] = +static const ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] = { {( 5 * 8) + 0, ACPI_RESTAG_RANGETYPE}, {( 5 * 8) + 4, ACPI_RESTAG_TYPE}, @@ -263,9 +333,15 @@ static ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] = }; -/* Dispatch table used to obtain the correct tag table for a descriptor */ - -static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] = +/* + * Dispatch table used to obtain the correct tag table for a descriptor. + * + * A NULL in this table means one of three things: + * 1) The descriptor ID is reserved and invalid + * 2) The descriptor has no tags associated with it + * 3) The descriptor has subtypes and a separate table will be used. + */ +static const ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags[] = { /* Small descriptors */ @@ -279,7 +355,7 @@ static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] = NULL, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ AcpiDmIoTags, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */ AcpiDmFixedIoTags, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */ - NULL, /* 0x0A, Reserved */ + AcpiDmFixedDmaTags, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */ NULL, /* 0x0B, Reserved */ NULL, /* 0x0C, Reserved */ NULL, /* 0x0D, Reserved */ @@ -299,9 +375,29 @@ static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] = AcpiDmAddress16Tags, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */ AcpiDmInterruptTags, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */ AcpiDmAddress64Tags, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */ - AcpiDmExtendedAddressTags /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ + AcpiDmExtendedAddressTags, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ + NULL, /* 0x0C, ACPI_RESOURCE_NAME_GPIO - Use Subtype table below */ + NULL, /* 0x0D, Reserved */ + NULL /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use Subtype table below */ +}; + +/* GPIO Subtypes */ + +static const ACPI_RESOURCE_TAG *AcpiGbl_GpioResourceTags[] = +{ + AcpiDmGpioIntTags, /* 0x00 Interrupt Connection */ + AcpiDmGpioIoTags /* 0x01 I/O Connection */ }; +/* Serial Bus Subtypes */ + +static const ACPI_RESOURCE_TAG *AcpiGbl_SerialResourceTags[] = +{ + NULL, /* 0x00 Reserved */ + AcpiDmI2cSerialBusTags, /* 0x01 I2C SerialBus */ + AcpiDmSpiSerialBusTags, /* 0x02 SPI SerialBus */ + AcpiDmUartSerialBusTags /* 0x03 UART SerialBus */ +}; /* * Globals used to generate unique resource descriptor names. We use names that @@ -666,6 +762,9 @@ AcpiDmUpdateResourceName ( * * DESCRIPTION: Convert a BitIndex into a symbolic resource tag. * + * Note: ResourceIndex should be previously validated and guaranteed to ve + * valid. + * ******************************************************************************/ static char * @@ -674,23 +773,16 @@ AcpiDmGetResourceTag ( AML_RESOURCE *Resource, UINT8 ResourceIndex) { - ACPI_RESOURCE_TAG *TagList; + const ACPI_RESOURCE_TAG *TagList; char *Tag = NULL; /* Get the tag list for this resource descriptor type */ TagList = AcpiGbl_ResourceTags[ResourceIndex]; - if (!TagList) - { - /* There are no tags for this resource type */ - - return (NULL); - } /* - * Handle the type-specific flags field for the address descriptors. - * Kindof brute force, but just blindly search for an index match. + * Handle descriptors that have multiple subtypes */ switch (Resource->DescriptorType) { @@ -699,6 +791,10 @@ AcpiDmGetResourceTag ( case ACPI_RESOURCE_NAME_ADDRESS64: case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64: + /* + * Subtype differentiation is the flags. + * Kindof brute force, but just blindly search for an index match + */ if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE) { Tag = AcpiDmSearchTagList (BitIndex, AcpiDmMemoryFlagTags); @@ -716,13 +812,42 @@ AcpiDmGetResourceTag ( } break; + case ACPI_RESOURCE_NAME_GPIO: + + /* GPIO connection has 2 subtypes: Interrupt and I/O */ + + if (Resource->Gpio.ConnectionType > AML_RESOURCE_MAX_GPIOTYPE) + { + return (NULL); + } + + TagList = AcpiGbl_GpioResourceTags[Resource->Gpio.ConnectionType]; + break; + + case ACPI_RESOURCE_NAME_SERIAL_BUS: + + /* SerialBus has 3 subtypes: I2C, SPI, and UART */ + + if ((Resource->CommonSerialBus.Type == 0) || + (Resource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)) + { + return (NULL); + } + + TagList = AcpiGbl_SerialResourceTags[Resource->CommonSerialBus.Type]; + break; + default: break; } - /* Search the tag list for this descriptor type */ + /* Search for a match against the BitIndex */ + + if (TagList) + { + Tag = AcpiDmSearchTagList (BitIndex, TagList); + } - Tag = AcpiDmSearchTagList (BitIndex, TagList); return (Tag); } @@ -744,7 +869,7 @@ AcpiDmGetResourceTag ( static char * AcpiDmSearchTagList ( UINT32 BitIndex, - ACPI_RESOURCE_TAG *TagList) + const ACPI_RESOURCE_TAG *TagList) { /* diff --git a/common/dmtable.c b/common/dmtable.c index 92a956b9c15d..833dcd1da08d 100644 --- a/common/dmtable.c +++ b/common/dmtable.c @@ -196,6 +196,16 @@ static const char *AcpiDmMadtSubnames[] = "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */ "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */ "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */ + "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */ + "Generic Interrupt Distributor",/* ACPI_MADT_GENERIC_DISTRIBUTOR */ + "Unknown SubTable Type" /* Reserved */ +}; + +static const char *AcpiDmPmttSubnames[] = +{ + "Socket", /* ACPI_PMTT_TYPE_SOCKET */ + "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ + "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ "Unknown SubTable Type" /* Reserved */ }; @@ -268,6 +278,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"}, + {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"}, {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"}, @@ -275,14 +286,20 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"}, {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"}, {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table"}, + {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"}, + {ACPI_SIG_GTDT, AcpiDmTableInfoGtdt, NULL, NULL, TemplateGtdt, "Generic Timer Description Table"}, {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"}, {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"}, {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"}, {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"}, {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, + {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"}, {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, + {ACPI_SIG_PCCT, NULL, AcpiDmDumpPcct, NULL, NULL, "Platform Communications Channel Table"}, + {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, + {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, @@ -400,7 +417,7 @@ AcpiDmDumpDataTable ( /* * Handle tables that don't use the common ACPI table header structure. - * Currently, these are the FACS and RSDP. + * Currently, these are the FACS, RSDP, and S3PT. */ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) { @@ -411,6 +428,10 @@ AcpiDmDumpDataTable ( { Length = AcpiDmDumpRsdp (Table); } + else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT)) + { + Length = AcpiDmDumpS3pt (Table); + } else { /* @@ -646,6 +667,7 @@ AcpiDmDumpTable ( case ACPI_DMT_ACCWIDTH: case ACPI_DMT_IVRS: case ACPI_DMT_MADT: + case ACPI_DMT_PMTT: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -670,6 +692,10 @@ AcpiDmDumpTable ( case ACPI_DMT_SLIC: ByteLength = 4; break; + case ACPI_DMT_UINT40: + ByteLength = 5; + break; + case ACPI_DMT_UINT48: case ACPI_DMT_NAME6: ByteLength = 6; break; @@ -718,6 +744,12 @@ AcpiDmDumpTable ( return (AE_BAD_DATA); } + if (Info->Opcode == ACPI_DMT_EXTRA_TEXT) + { + AcpiOsPrintf ("%s", Info->Name); + continue; + } + /* Start a new line and decode the opcode */ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); @@ -745,17 +777,29 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%1.1X\n", *Target & 0x03); break; + case ACPI_DMT_FLAGS1: + + AcpiOsPrintf ("%1.1X\n", (*Target >> 1) & 0x03); + break; + case ACPI_DMT_FLAGS2: AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03); break; + case ACPI_DMT_FLAGS4: + + AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03); + break; + /* Integer Data Types */ case ACPI_DMT_UINT8: case ACPI_DMT_UINT16: case ACPI_DMT_UINT24: case ACPI_DMT_UINT32: + case ACPI_DMT_UINT40: + case ACPI_DMT_UINT48: case ACPI_DMT_UINT56: case ACPI_DMT_UINT64: /* @@ -1021,6 +1065,19 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]); break; + case ACPI_DMT_PMTT: + + /* PMTT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_PMTT_TYPE_RESERVED) + { + Temp8 = ACPI_PMTT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]); + break; + case ACPI_DMT_SLIC: /* SLIC subtable types */ diff --git a/common/dmtbdump.c b/common/dmtbdump.c index 087d52d19422..5df1f87076ef 100644 --- a/common/dmtbdump.c +++ b/common/dmtbdump.c @@ -230,11 +230,18 @@ AcpiDmDumpFadt ( AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); } - /* Check for FADT revision 3 fields and up (ACPI 2.0+ extended data) */ + /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */ else if (Table->Length > ACPI_FADT_V2_SIZE) { AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); + + /* Check for FADT revision 5 fields and up (ACPI 5.0+) */ + + if (Table->Length > ACPI_FADT_V3_SIZE) + { + AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); + } } /* Validate various fields in the FADT, including length */ @@ -290,6 +297,10 @@ AcpiDmValidateFadtLength ( ExpectedLength = ACPI_FADT_V3_SIZE; break; + case 5: + ExpectedLength = ACPI_FADT_V5_SIZE; + break; + default: return; } @@ -751,6 +762,84 @@ AcpiDmDumpErst ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpFpdt + * + * PARAMETERS: Table - A FPDT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a FPDT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpFpdt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_FPDT_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_FPDT); + ACPI_DMTABLE_INFO *InfoTable; + + + /* There is no main table (other than the standard ACPI header) */ + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoFpdtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (SubTable->Type) + { + case ACPI_FPDT_TYPE_BOOT: + InfoTable = AcpiDmTableInfoFpdt0; + break; + case ACPI_FPDT_TYPE_S3PERF: + InfoTable = AcpiDmTableInfoFpdt1; + break; + default: + AcpiOsPrintf ("\n**** Unknown FPDT sub-table type 0x%X\n\n", SubTable->Type); + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubTable; + } + + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + +NextSubTable: + /* Point to next sub-table */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpHest * * PARAMETERS: Table - A HEST table @@ -1134,6 +1223,12 @@ AcpiDmDumpMadt ( case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: InfoTable = AcpiDmTableInfoMadt10; break; + case ACPI_MADT_TYPE_GENERIC_INTERRUPT: + InfoTable = AcpiDmTableInfoMadt11; + break; + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + InfoTable = AcpiDmTableInfoMadt12; + break; default: AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type); @@ -1223,6 +1318,150 @@ AcpiDmDumpMcfg ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpMpst + * + * PARAMETERS: Table - A MPST Table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a MPST table + * + ******************************************************************************/ + +void +AcpiDmDumpMpst ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_MPST); + ACPI_MPST_POWER_NODE *SubTable0; + ACPI_MPST_POWER_STATE *SubTable0A; + ACPI_MPST_COMPONENT *SubTable0B; + ACPI_MPST_DATA_HDR *SubTable1; + ACPI_MPST_POWER_DATA *SubTable2; + UINT16 SubtableCount; + UINT8 PowerStateCount; + UINT8 ComponentCount; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Subtable: Memory Power Node(s) */ + + SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount; + SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset); + + while ((Offset < Table->Length) && SubtableCount) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0, + sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Extract the sub-subtable counts */ + + PowerStateCount = SubTable0->NumPowerStates; + ComponentCount = SubTable0->NumPhysicalComponents; + Offset += sizeof (ACPI_MPST_POWER_NODE); + + /* Sub-subtables - Memory Power State Structure(s) */ + + SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0, + sizeof (ACPI_MPST_POWER_NODE)); + + while (PowerStateCount) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A, + sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); + if (ACPI_FAILURE (Status)) + { + return; + } + + SubTable0A++; + PowerStateCount--; + Offset += sizeof (ACPI_MPST_POWER_STATE); + } + + /* Sub-subtables - Physical Component ID Structure(s) */ + + SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A); + + if (ComponentCount) + { + AcpiOsPrintf ("\n"); + } + + while (ComponentCount) + { + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B, + sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); + if (ACPI_FAILURE (Status)) + { + return; + } + + SubTable0B++; + ComponentCount--; + Offset += sizeof (ACPI_MPST_COMPONENT); + } + + /* Point to next Memory Power Node subtable */ + + SubtableCount--; + SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0, + sizeof (ACPI_MPST_POWER_NODE) + + (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) + + (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents)); + } + + /* Subtable: Count of Memory Power State Characteristic structures */ + + AcpiOsPrintf ("\n"); + SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1, + sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1); + if (ACPI_FAILURE (Status)) + { + return; + } + + SubtableCount = SubTable1->CharacteristicsCount; + Offset += sizeof (ACPI_MPST_DATA_HDR); + + /* Subtable: Memory Power State Characteristics structure(s) */ + + SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR)); + + while ((Offset < Table->Length) && SubtableCount) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2, + sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); + if (ACPI_FAILURE (Status)) + { + return; + } + + SubTable2++; + SubtableCount--; + Offset += sizeof (ACPI_MPST_POWER_DATA); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpMsct * * PARAMETERS: Table - A MSCT table @@ -1275,6 +1514,349 @@ AcpiDmDumpMsct ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpPcct + * + * PARAMETERS: Table - A PCCT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a PCCT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpPcct ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_PCCT_SUBSPACE *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_PCCT); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Header.Length, AcpiDmTableInfoPcct0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table */ + + Offset += SubTable->Header.Length; + SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable, + SubTable->Header.Length); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpPmtt + * + * PARAMETERS: Table - A PMTT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a PMTT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpPmtt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_PMTT_HEADER *SubTable; + ACPI_PMTT_HEADER *MemSubTable; + ACPI_PMTT_HEADER *DimmSubTable; + ACPI_PMTT_DOMAIN *DomainArray; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_PMTT); + UINT32 MemOffset; + UINT32 DimmOffset; + UINT32 DomainOffset; + UINT32 DomainCount; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Subtables */ + + SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoPmttHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Only Socket subtables are expected at this level */ + + if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET) + { + AcpiOsPrintf ( + "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", + SubTable->Type); + return; + } + + /* Dump the fixed-length portion of the subtable */ + + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoPmtt0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Walk the memory controller subtables */ + + MemOffset = sizeof (ACPI_PMTT_SOCKET); + MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable, + sizeof (ACPI_PMTT_SOCKET)); + + while (((Offset + MemOffset) < Table->Length) && + (MemOffset < SubTable->Length)) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, + Offset + MemOffset, MemSubTable, + MemSubTable->Length, AcpiDmTableInfoPmttHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Only memory controller subtables are expected at this level */ + + if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER) + { + AcpiOsPrintf ( + "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", + MemSubTable->Type); + return; + } + + /* Dump the fixed-length portion of the controller subtable */ + + Status = AcpiDmDumpTable (Length, + Offset + MemOffset, MemSubTable, + MemSubTable->Length, AcpiDmTableInfoPmtt1); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Walk the variable count of proximity domains */ + + DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount; + DomainOffset = sizeof (ACPI_PMTT_CONTROLLER); + DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable, + sizeof (ACPI_PMTT_CONTROLLER)); + + while (((Offset + MemOffset + DomainOffset) < Table->Length) && + ((MemOffset + DomainOffset) < SubTable->Length) && + DomainCount) + { + Status = AcpiDmDumpTable (Length, + Offset + MemOffset + DomainOffset, DomainArray, + sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a); + if (ACPI_FAILURE (Status)) + { + return; + } + + DomainOffset += sizeof (ACPI_PMTT_DOMAIN); + DomainArray++; + DomainCount--; + } + + if (DomainCount) + { + AcpiOsPrintf ( + "\n**** DomainCount exceeds subtable length\n\n", + MemSubTable->Type); + } + + /* Walk the physical component (DIMM) subtables */ + + DimmOffset = DomainOffset; + DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable, + DomainOffset); + + while (((Offset + MemOffset + DimmOffset) < Table->Length) && + (DimmOffset < MemSubTable->Length)) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, + Offset + MemOffset + DimmOffset, DimmSubTable, + DimmSubTable->Length, AcpiDmTableInfoPmttHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Only DIMM subtables are expected at this level */ + + if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM) + { + AcpiOsPrintf ( + "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", + DimmSubTable->Type); + return; + } + + /* Dump the fixed-length DIMM subtable */ + + Status = AcpiDmDumpTable (Length, + Offset + MemOffset + DimmOffset, DimmSubTable, + DimmSubTable->Length, AcpiDmTableInfoPmtt2); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next DIMM subtable */ + + DimmOffset += DimmSubTable->Length; + DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, + DimmSubTable, DimmSubTable->Length); + } + + /* Point to next Controller subtable */ + + MemOffset += MemSubTable->Length; + MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, + MemSubTable, MemSubTable->Length); + } + + /* Point to next Socket subtable */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, + SubTable, SubTable->Length); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpS3pt + * + * PARAMETERS: Table - A S3PT table + * + * RETURN: Length of the table + * + * DESCRIPTION: Format the contents of a S3PT + * + ******************************************************************************/ + +UINT32 +AcpiDmDumpS3pt ( + ACPI_TABLE_HEADER *Tables) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_S3PT); + ACPI_S3PT_HEADER *SubTable; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables); + + + /* Main table */ + + Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt); + if (ACPI_FAILURE (Status)) + { + return 0; + } + + SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset); + while (Offset < S3ptTable->Length) + { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoS3ptHdr); + if (ACPI_FAILURE (Status)) + { + return 0; + } + + switch (SubTable->Type) + { + case ACPI_S3PT_TYPE_RESUME: + InfoTable = AcpiDmTableInfoS3pt0; + break; + case ACPI_S3PT_TYPE_SUSPEND: + InfoTable = AcpiDmTableInfoS3pt1; + break; + default: + AcpiOsPrintf ("\n**** Unknown S3PT sub-table type 0x%X\n", SubTable->Type); + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return 0; + } + goto NextSubTable; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return 0; + } + +NextSubTable: + /* Point to next sub-table */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length); + } + + return (S3ptTable->Length); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpSlic * * PARAMETERS: Table - A SLIC table diff --git a/common/dmtbinfo.c b/common/dmtbinfo.c index d776b34a2a93..555374353a35 100644 --- a/common/dmtbinfo.c +++ b/common/dmtbinfo.c @@ -82,21 +82,28 @@ #define ACPI_GAS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f) #define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f) #define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f) -#define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f) #define ACPI_BERT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BERT,f) +#define ACPI_BGRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BGRT,f) +#define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f) #define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f) #define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f) #define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f) +#define ACPI_DRTM_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DRTM,f) #define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f) #define ACPI_EINJ_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_EINJ,f) #define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f) +#define ACPI_GTDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_GTDT,f) #define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f) #define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f) #define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f) #define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) #define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) #define ACPI_MCHI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCHI,f) +#define ACPI_MPST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MPST,f) #define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f) +#define ACPI_PCCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_PCCT,f) +#define ACPI_PMTT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_PMTT,f) +#define ACPI_S3PT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_S3PT,f) #define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f) #define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f) #define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f) @@ -126,6 +133,9 @@ #define ACPI_DMAR3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RHSA,f) #define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_ERST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) +#define ACPI_FPDTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_FPDT_HEADER,f) +#define ACPI_FPDT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_FPDT_BOOT,f) +#define ACPI_FPDT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_FPDT_S3PT_PTR,f) #define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) #define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) #define ACPI_HEST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) @@ -153,9 +163,25 @@ #define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f) #define ACPI_MADT9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f) #define ACPI_MADT10_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) +#define ACPI_MADT11_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f) +#define ACPI_MADT12_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_GENERIC_DISTRIBUTOR,f) #define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) +#define ACPI_MPST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_POWER_NODE,f) +#define ACPI_MPST0A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_POWER_STATE,f) +#define ACPI_MPST0B_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_COMPONENT,f) +#define ACPI_MPST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_DATA_HDR,f) +#define ACPI_MPST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f) #define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) +#define ACPI_PCCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) +#define ACPI_PMTT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) +#define ACPI_PMTT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f) +#define ACPI_PMTT1A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_DOMAIN,f) +#define ACPI_PMTT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_PHYSICAL_COMPONENT,f) +#define ACPI_PMTTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PMTT_HEADER,f) +#define ACPI_S3PTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_S3PT_HEADER,f) +#define ACPI_S3PT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_S3PT_RESUME,f) +#define ACPI_S3PT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f) #define ACPI_SLICH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_HEADER,f) #define ACPI_SLIC0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_KEY,f) #define ACPI_SLIC1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_MARKER,f) @@ -178,6 +204,7 @@ #define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o) #define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o) #define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o) +#define ACPI_GTDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_GTDT,f,o) #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) #define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o) @@ -187,6 +214,11 @@ #define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o) #define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o) #define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o) +#define ACPI_MADT11_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f,o) +#define ACPI_MPST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_NODE,f,o) +#define ACPI_MPST2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_DATA,f,o) +#define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o) +#define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o) #define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o) #define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) #define ACPI_ERST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) @@ -198,6 +230,7 @@ * Required terminator for all tables below */ #define ACPI_DMT_TERMINATOR {ACPI_DMT_EXIT, 0, NULL, 0} +#define ACPI_DMT_NEW_LINE {ACPI_DMT_EXTRA_TEXT, 0, "\n", 0} /* @@ -383,6 +416,9 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)", 0}, {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)", 0}, {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)", 0}, + {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,2), "Hardware Reduced (V5)", 0}, + {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,2), "Prefer S0 Idle (V5)", 0}, + {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use Sleep Register (V5)", 0}, ACPI_DMT_TERMINATOR }; @@ -396,7 +432,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = ACPI_DMT_TERMINATOR }; -/* ACPI 2.0+ Extensions (FADT version 3+) */ +/* ACPI 2.0+ Extensions (FADT version 3 and 4) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = { @@ -416,6 +452,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = ACPI_DMT_TERMINATOR }; +/* ACPI 5.0 Extensions (FADT version 5) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[] = +{ + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (SleepRegister), "Sleep Register", 0}, + ACPI_DMT_TERMINATOR +}; + /* * Remaining tables are not consumed directly by the ACPICA subsystem @@ -541,6 +585,24 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] = /******************************************************************************* * + * BGRT - Boot Graphics Resource Table (ACPI 5.0) + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[] = +{ + {ACPI_DMT_UINT16, ACPI_BGRT_OFFSET (Version), "Version", 0}, + {ACPI_DMT_UINT8, ACPI_BGRT_OFFSET (Status), "Status", 0}, + {ACPI_DMT_UINT8, ACPI_BGRT_OFFSET (ImageType), "Image Type", 0}, + {ACPI_DMT_UINT64, ACPI_BGRT_OFFSET (ImageAddress), "Image Address", 0}, + {ACPI_DMT_UINT32, ACPI_BGRT_OFFSET (ImageOffsetX), "Image OffsetX", 0}, + {ACPI_DMT_UINT32, ACPI_BGRT_OFFSET (ImageOffsetY), "Image OffsetY", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * BOOT - Simple Boot Flag Table * ******************************************************************************/ @@ -672,6 +734,19 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] = /******************************************************************************* * + * DRTM - Dynamic Root of Trust for Measurement table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[] = +{ + + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * ECDT - Embedded Controller Boot Resources Table * ******************************************************************************/ @@ -748,6 +823,82 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoErst0[] = /******************************************************************************* * + * FPDT - Firmware Performance Data Table (ACPI 5.0) + * + ******************************************************************************/ + +/* Main table consists of only the standard ACPI header - subtables follow */ + +/* FPDT subtable header */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoFpdtHdr[] = +{ + {ACPI_DMT_UINT16, ACPI_FPDTH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_FPDTH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_FPDTH_OFFSET (Revision), "Revision", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0: Firmware Basic Boot Performance Record */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[] = +{ + {ACPI_DMT_UINT32, ACPI_FPDT0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ResetEnd), "Reset End", 0}, + {ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (LoadStart), "Load Image Start", 0}, + {ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (StartupStart), "Start Image Start", 0}, + {ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesEntry), "Exit Services Entry", 0}, + {ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesExit), "Exit Services Exit", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: S3 Performance Table Pointer Record */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[] = +{ + {ACPI_DMT_UINT32, ACPI_FPDT1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_FPDT1_OFFSET (Address), "S3PT Address", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * + * GTDT - Generic Timer Description Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[] = +{ + {ACPI_DMT_UINT64, ACPI_GTDT_OFFSET (Address), "Timer Address", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (Flags,0), "Memory Present", 0}, + ACPI_DMT_NEW_LINE, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (SecurePl1Interrupt), "Secure PL1 Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (SecurePl1Flags), "SPL1 Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (SecurePl1Flags,0), "Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (SecurePl1Flags,0), "Polarity", 0}, + ACPI_DMT_NEW_LINE, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl1Interrupt), "Non-Secure PL1 Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl1Flags), "NSPL1 Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (NonSecurePl1Flags,0),"Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (NonSecurePl1Flags,0),"Polarity", 0}, + ACPI_DMT_NEW_LINE, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (VirtualTimerInterrupt), "Virtual Timer Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (VirtualTimerFlags), "VT Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (VirtualTimerFlags,0),"Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (VirtualTimerFlags,0),"Polarity", 0}, + ACPI_DMT_NEW_LINE, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl2Interrupt), "Non-Secure PL2 Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl2Flags), "NSPL2 Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (NonSecurePl2Flags,0),"Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (NonSecurePl2Flags,0),"Polarity", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * HEST - Hardware Error Source table * ******************************************************************************/ @@ -1190,6 +1341,34 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = ACPI_DMT_TERMINATOR }; +/* 11: Generic Interrupt Controller (ACPI 5.0) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[] = +{ + {ACPI_DMT_UINT16, ACPI_MADT11_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (GicId), "Local GIC Hardware ID", 0}, + {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (Uid), "Processor UID", 0}, + {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MADT11_FLAG_OFFSET (Flags,0), "Processor Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (ParkingVersion), "Parking Protocol Version", 0}, + {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (PerformanceInterrupt), "Performance Interrupt", 0}, + {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (ParkedAddress), "Parked Address", 0}, + {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (BaseAddress), "Base Address", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 12: Generic Interrupt Distributor (ACPI 5.0) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[] = +{ + {ACPI_DMT_UINT16, ACPI_MADT12_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (GicId), "Local GIC Hardware ID", 0}, + {ACPI_DMT_UINT64, ACPI_MADT12_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (GlobalIrqBase), "Interrupt Base", 0}, + {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * @@ -1240,6 +1419,87 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[] = /******************************************************************************* * + * MPST - Memory Power State Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMpst[] = +{ + {ACPI_DMT_UINT16, ACPI_MPST_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_MPST_OFFSET (ChannelId), "Channel ID", 0}, + {ACPI_DMT_UINT8, ACPI_MPST_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_MPST_OFFSET (PowerNodeCount), "Power Node Count", 0}, + ACPI_DMT_TERMINATOR +}; + +/* MPST subtables */ + +/* 0: Memory Power Node Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0[] = +{ + {ACPI_DMT_UINT8, ACPI_MPST0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MPST0_FLAG_OFFSET (Flags,0), "Node Enabled", 0}, + {ACPI_DMT_FLAG1, ACPI_MPST0_FLAG_OFFSET (Flags,0), "Power Managed", 0}, + {ACPI_DMT_FLAG2, ACPI_MPST0_FLAG_OFFSET (Flags,0), "Hot Plug Capable", 0}, + + {ACPI_DMT_UINT8, ACPI_MPST0_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_MPST0_OFFSET (NodeId), "Node ID", 0}, + {ACPI_DMT_UINT32, ACPI_MPST0_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT64, ACPI_MPST0_OFFSET (RangeAddress), "Range Address", 0}, + {ACPI_DMT_UINT64, ACPI_MPST0_OFFSET (RangeLength), "Range Length", 0}, + {ACPI_DMT_UINT8, ACPI_MPST0_OFFSET (NumPowerStates), "Num Power States", 0}, + {ACPI_DMT_UINT8, ACPI_MPST0_OFFSET (NumPhysicalComponents), "Num Physical Components", 0}, + {ACPI_DMT_UINT16, ACPI_MPST0_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0A: Sub-subtable - Memory Power State Structure (follows Memory Power Node above) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0A[] = +{ + {ACPI_DMT_UINT8, ACPI_MPST0A_OFFSET (PowerState), "Power State", 0}, + {ACPI_DMT_UINT8, ACPI_MPST0A_OFFSET (InfoIndex), "InfoIndex", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0B: Sub-subtable - Physical Component ID Structure (follows Memory Power State(s) above) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0B[] = +{ + {ACPI_DMT_UINT16, ACPI_MPST0B_OFFSET (ComponentId), "Component Id", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 01: Power Characteristics Count (follows all Power Node(s) above) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMpst1[] = +{ + {ACPI_DMT_UINT16, ACPI_MPST1_OFFSET (CharacteristicsCount), "Characteristics Count", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 02: Memory Power State Characteristics Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMpst2[] = +{ + {ACPI_DMT_UINT8, ACPI_MPST2_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_UINT8, ACPI_MPST2_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MPST2_FLAG_OFFSET (Flags,0), "Memory Preserved", 0}, + {ACPI_DMT_FLAG1, ACPI_MPST2_FLAG_OFFSET (Flags,0), "Auto Entry", 0}, + {ACPI_DMT_FLAG2, ACPI_MPST2_FLAG_OFFSET (Flags,0), "Auto Exit", 0}, + + {ACPI_DMT_UINT16, ACPI_MPST2_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MPST2_OFFSET (AveragePower), "Average Power", 0}, + {ACPI_DMT_UINT32, ACPI_MPST2_OFFSET (PowerSaving), "Power Saving", 0}, + {ACPI_DMT_UINT64, ACPI_MPST2_OFFSET (ExitLatency), "Exit Latency", 0}, + {ACPI_DMT_UINT64, ACPI_MPST2_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * MSCT - Maximum System Characteristics Table (ACPI 4.0) * ******************************************************************************/ @@ -1269,6 +1529,155 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] = /******************************************************************************* * + * PCCT - Platform Communications Channel Table (ACPI 5.0) + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[] = +{ + {ACPI_DMT_UINT32, ACPI_PCCT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_PCCT_FLAG_OFFSET (Flags,0), "Doorbell", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT_OFFSET (Latency), "Command Latency", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* PCCT subtables */ + +/* 0: Generic Communications Subspace */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[] = +{ + {ACPI_DMT_UINT8, ACPI_PCCT0_OFFSET (Header.Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT0_OFFSET (Header.Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT48, ACPI_PCCT0_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (Length), "Address Length", 0}, + {ACPI_DMT_GAS, ACPI_PCCT0_OFFSET (DoorbellRegister), "Doorbell Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (PreserveMask), "Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (WriteMask), "Write Mask", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * + * PMTT - Platform Memory Topology Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[] = +{ + {ACPI_DMT_UINT32, ACPI_PMTT_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPmttHdr[] = +{ + {ACPI_DMT_PMTT, ACPI_PMTTH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_PMTTH_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_PMTTH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_PMTTH_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_PMTTH_FLAG_OFFSET (Flags,0), "Top-level Device", 0}, + {ACPI_DMT_FLAG1, ACPI_PMTTH_FLAG_OFFSET (Flags,0), "Physical Element", 0}, + {ACPI_DMT_FLAGS2, ACPI_PMTTH_FLAG_OFFSET (Flags,0), "Memory Type", 0}, + {ACPI_DMT_UINT16, ACPI_PMTTH_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* PMTT Subtables */ + +/* 0: Socket */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[] = +{ + {ACPI_DMT_UINT16, ACPI_PMTT0_OFFSET (SocketId), "Socket ID", 0}, + {ACPI_DMT_UINT16, ACPI_PMTT0_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: Memory Controller */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[] = +{ + {ACPI_DMT_UINT32, ACPI_PMTT1_OFFSET (ReadLatency), "Read Latency", 0}, + {ACPI_DMT_UINT32, ACPI_PMTT1_OFFSET (WriteLatency), "Write Latency", 0}, + {ACPI_DMT_UINT32, ACPI_PMTT1_OFFSET (ReadBandwidth), "Read Bandwidth", 0}, + {ACPI_DMT_UINT32, ACPI_PMTT1_OFFSET (WriteBandwidth), "Write Bandwidth", 0}, + {ACPI_DMT_UINT16, ACPI_PMTT1_OFFSET (AccessWidth), "Access Width", 0}, + {ACPI_DMT_UINT16, ACPI_PMTT1_OFFSET (Alignment), "Alignment", 0}, + {ACPI_DMT_UINT16, ACPI_PMTT1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_PMTT1_OFFSET (DomainCount), "Domain Count", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1a: Proximity Domain */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1a[] = +{ + {ACPI_DMT_UINT32, ACPI_PMTT1A_OFFSET (ProximityDomain), "Proximity Domain", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 2: Physical Component */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[] = +{ + {ACPI_DMT_UINT16, ACPI_PMTT2_OFFSET (ComponentId), "Component ID", 0}, + {ACPI_DMT_UINT16, ACPI_PMTT2_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_PMTT2_OFFSET (MemorySize), "Memory Size", 0}, + {ACPI_DMT_UINT32, ACPI_PMTT2_OFFSET (BiosHandle), "Bios Handle", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * + * S3PT - S3 Performance Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[] = +{ + {ACPI_DMT_SIG, ACPI_S3PT_OFFSET (Signature[0]), "Signature", 0}, + {ACPI_DMT_UINT32, ACPI_S3PT_OFFSET (Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + +/* S3PT subtable header */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoS3ptHdr[] = +{ + {ACPI_DMT_UINT16, ACPI_S3PTH_OFFSET (Type), "Type", 0}, + {ACPI_DMT_UINT8, ACPI_S3PTH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_S3PTH_OFFSET (Revision), "Revision", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0: Basic S3 Resume Performance Record */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt0[] = +{ + {ACPI_DMT_UINT32, ACPI_S3PT0_OFFSET (ResumeCount), "Resume Count", 0}, + {ACPI_DMT_UINT64, ACPI_S3PT0_OFFSET (FullResume), "Full Resume", 0}, + {ACPI_DMT_UINT64, ACPI_S3PT0_OFFSET (AverageResume), "Average Resume", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: Basic S3 Suspend Performance Record */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt1[] = +{ + {ACPI_DMT_UINT64, ACPI_S3PT1_OFFSET (SuspendStart), "Suspend Start", 0}, + {ACPI_DMT_UINT64, ACPI_S3PT1_OFFSET (SuspendEnd), "Suspend End", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * SBST - Smart Battery Specification Table * ******************************************************************************/ @@ -1609,8 +2018,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = ACPI_DMT_TERMINATOR }; +/*! [Begin] no source code translation */ + /* - * Generic types (used in UEFI) + * Generic types (used in UEFI and custom tables) * * Examples: * @@ -1629,7 +2040,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = * DevicePath : "\PciRoot(0)\Pci(0x1f,1)\Usb(0,0)" */ -#define ACPI_DM_GENERIC_ENTRY(FieldType, FieldName)\ +#define ACPI_DM_GENERIC_ENTRY(FieldType, FieldName) \ {{FieldType, 0, FieldName, 0}, ACPI_DMT_TERMINATOR} ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] = @@ -1638,6 +2049,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] = ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT16, "UINT16"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT24, "UINT24"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT32, "UINT32"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT40, "UINT40"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT48, "UINT48"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT56, "UINT56"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT64, "UINT64"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "String"), @@ -1648,3 +2061,4 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] = ACPI_DM_GENERIC_ENTRY (ACPI_DMT_LABEL, "Label"), {ACPI_DMT_TERMINATOR} }; +/*! [End] no source code translation !*/ diff --git a/compiler/Makefile b/compiler/Makefile index e08941a19aed..fe29abbd42b7 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -96,6 +96,7 @@ OBJECTS = \ aslrestype2.o \ aslrestype2d.o \ aslrestype2e.o \ + aslrestype2s.o \ aslrestype2q.o \ aslrestype2w.o \ aslstartup.o \ @@ -121,6 +122,7 @@ OBJECTS = \ dmopcode.o \ dmresrc.o \ dmresrcl.o \ + dmresrcl2.o \ dmresrcs.o \ dmrestag.o \ dmtable.o \ diff --git a/compiler/aslanalyze.c b/compiler/aslanalyze.c index 414f8d3682fb..8d02f61f36a9 100644 --- a/compiler/aslanalyze.c +++ b/compiler/aslanalyze.c @@ -126,7 +126,6 @@ AnCheckId ( { UINT32 i; ACPI_SIZE Length; - UINT32 AlphaPrefixLength; /* Only care about string versions of _HID/_CID (integers are legal) */ @@ -174,12 +173,18 @@ AnCheckId ( { AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, Op, Op->Asl.Value.String); - break; + return; } } - /* _HID String must be of the form "XXX####" or "ACPI####" */ - + /* + * _HID String must be one of these forms: + * + * "AAA####" A is an uppercase letter and # is a hex digit + * "ACPI####" # is a hex digit + * "NNNN####" N is an uppercase letter or decimal digit (0-9) + * # is a hex digit (ACPI 5.0) + */ if ((Length < 7) || (Length > 8)) { AslError (ASL_ERROR, ASL_MSG_HID_LENGTH, @@ -187,22 +192,48 @@ AnCheckId ( return; } - /* _HID Length is valid, now check for uppercase (first 3 or 4 chars) */ + /* _HID Length is valid (7 or 8), now check the prefix (first 3 or 4 chars) */ - AlphaPrefixLength = 3; - if (Length >= 8) + if (Length == 7) { - AlphaPrefixLength = 4; + /* AAA####: Ensure the alphabetic prefix is all uppercase */ + + for (i = 0; i < 3; i++) + { + if (!isupper ((int) Op->Asl.Value.String[i])) + { + AslError (ASL_ERROR, ASL_MSG_UPPER_CASE, + Op, &Op->Asl.Value.String[i]); + return; + } + } + } + else /* Length == 8 */ + { + /* + * ACPI#### or NNNN####: + * Ensure the prefix contains only uppercase alpha or decimal digits + */ + for (i = 0; i < 4; i++) + { + if (!isupper ((int) Op->Asl.Value.String[i]) && + !isdigit ((int) Op->Asl.Value.String[i])) + { + AslError (ASL_ERROR, ASL_MSG_HID_PREFIX, + Op, &Op->Asl.Value.String[i]); + return; + } + } } - /* Ensure the alphabetic prefix is all uppercase */ + /* Remaining characters (suffix) must be hex digits */ - for (i = 0; (i < AlphaPrefixLength) && Op->Asl.Value.String[i]; i++) + for (; i < Length; i++) { - if (!isupper ((int) Op->Asl.Value.String[i])) + if (!isxdigit ((int) Op->Asl.Value.String[i])) { - AslError (ASL_ERROR, ASL_MSG_UPPER_CASE, - Op, &Op->Asl.Value.String[i]); + AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX, + Op, &Op->Asl.Value.String[i]); break; } } diff --git a/compiler/aslcodegen.c b/compiler/aslcodegen.c index 49d9cbbd730e..a4cfd1293f36 100644 --- a/compiler/aslcodegen.c +++ b/compiler/aslcodegen.c @@ -271,12 +271,17 @@ CgWriteAmlOpcode ( /* Special opcodes for within a field definition */ - Aml.Opcode = 0x00; + Aml.Opcode = AML_FIELD_OFFSET_OP; break; case AML_INT_ACCESSFIELD_OP: - Aml.Opcode = 0x01; + Aml.Opcode = AML_FIELD_ACCESS_OP; + break; + + case AML_INT_CONNECTION_OP: + + Aml.Opcode = AML_FIELD_CONNECTION_OP; break; default: diff --git a/compiler/aslcompiler.h b/compiler/aslcompiler.h index 3f2dd4a64cd1..d102688d5431 100644 --- a/compiler/aslcompiler.h +++ b/compiler/aslcompiler.h @@ -843,6 +843,13 @@ RsSetFlagBits ( UINT8 Position, UINT8 DefaultBit); +void +RsSetFlagBits16 ( + UINT16 *Flags, + ACPI_PARSE_OBJECT *Op, + UINT8 Position, + UINT8 DefaultBit); + ACPI_PARSE_OBJECT * RsCompleteNodeAndGetNext ( ACPI_PARSE_OBJECT *Op); @@ -926,6 +933,11 @@ RsDoDmaDescriptor ( UINT32 CurrentByteOffset); ASL_RESOURCE_NODE * +RsDoFixedDmaDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * RsDoFixedIoDescriptor ( ACPI_PARSE_OBJECT *Op, UINT32 CurrentByteOffset); @@ -964,6 +976,30 @@ RsDoGeneralRegisterDescriptor ( ACPI_PARSE_OBJECT *Op, UINT32 CurrentByteOffset); +ASL_RESOURCE_NODE * +RsDoGpioIntDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoGpioIoDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoI2cSerialBusDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoSpiSerialBusDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); + +ASL_RESOURCE_NODE * +RsDoUartSerialBusDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset); /* * aslrestype2d - DWord address descriptors diff --git a/compiler/aslcompiler.l b/compiler/aslcompiler.l index c5458bd8625e..fc6f6fb6576b 100644 --- a/compiler/aslcompiler.l +++ b/compiler/aslcompiler.l @@ -1,8 +1,7 @@ - %{ /****************************************************************************** * - * Module Name: aslcompiler.l - Flex input file + * Module Name: aslcompiler.l - Flex/lex input file * *****************************************************************************/ @@ -60,6 +59,9 @@ YYSTYPE AslCompilerlval; #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslscan") + +/* Local prototypes */ + char comment (void); char @@ -74,7 +76,7 @@ copy (void); /*! [Begin] no source code translation */ %} - + /* Definitions */ LeadNameChar [A-Za-z_] DigitChar [0-9] @@ -94,6 +96,7 @@ NonEmptyNamePath {NameSeg}{NamePathTail}* NamePathTail [.]{NameSeg} %% + /* Rules */ [ ] { count (0); } [\n] { count (0); } /* Handle files with both LF and CR/LF */ @@ -105,6 +108,7 @@ NamePathTail [.]{NameSeg} "//" { if (!comment2 ()) yyterminate (); } "\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); } +";" { count (0); return(';'); } 0[xX]{HexDigitChar}+ | @@ -116,73 +120,56 @@ NamePathTail [.]{NameSeg} "#line" { count (1); return (PARSEOP_LINE_CSTYLE); } "External" { count (1); return (PARSEOP_EXTERNAL); } + /**************************************************************************** + * + * Main ASL operators + * + ****************************************************************************/ -"Ones" { count (1); return (PARSEOP_ONES); } -"One" { count (1); return (PARSEOP_ONE); } -"Zero" { count (1); return (PARSEOP_ZERO); } -"Revision" { count (1); return (PARSEOP_REVISION); } - -"Offset" { count (1); return (PARSEOP_OFFSET); } "AccessAs" { count (1); return (PARSEOP_ACCESSAS); } -"BankField" { count (2); return (PARSEOP_BANKFIELD); } -"CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); } -"CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); } -"CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); } -"CreateField" { count (2); return (PARSEOP_CREATEFIELD); } -"CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); } -"CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); } -"DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); } -"Device" { count (2); return (PARSEOP_DEVICE); } -"Event" { count (2); return (PARSEOP_EVENT); } -"Field" { count (2); return (PARSEOP_FIELD); } -"Function" { count (2); return (PARSEOP_FUNCTION); } -"IndexField" { count (2); return (PARSEOP_INDEXFIELD); } -"Method" { count (2); return (PARSEOP_METHOD); } -"Mutex" { count (2); return (PARSEOP_MUTEX); } -"OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); } -"PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); } -"Processor" { count (2); return (PARSEOP_PROCESSOR); } -"ThermalZone" { count (2); return (PARSEOP_THERMALZONE); } +"Acquire" { count (3); return (PARSEOP_ACQUIRE); } +"Add" { count (3); return (PARSEOP_ADD); } "Alias" { count (2); return (PARSEOP_ALIAS); } -"Name" { count (2); return (PARSEOP_NAME); } -"Scope" { count (2); return (PARSEOP_SCOPE); } +"And" { count (3); return (PARSEOP_AND); } +"BankField" { count (2); return (PARSEOP_BANKFIELD); } "Break" { count (3); return (PARSEOP_BREAK); } "BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); } -"Continue" { count (3); return (PARSEOP_CONTINUE); } -"Fatal" { count (3); return (PARSEOP_FATAL); } -"If" { count (3); return (PARSEOP_IF); } -"Else" { count (3); return (PARSEOP_ELSE); } -"ElseIf" { count (3); return (PARSEOP_ELSEIF); } -"Load" { count (3); return (PARSEOP_LOAD); } -"Noop" { count (3); return (PARSEOP_NOOP); } -"Notify" { count (3); return (PARSEOP_NOTIFY); } -"Release" { count (3); return (PARSEOP_RELEASE); } -"Reset" { count (3); return (PARSEOP_RESET); } -"Return" { count (3); return (PARSEOP_RETURN); } -"Signal" { count (3); return (PARSEOP_SIGNAL); } -"Sleep" { count (3); return (PARSEOP_SLEEP); } -"Stall" { count (3); return (PARSEOP_STALL); } -"Switch" { count (3); return (PARSEOP_SWITCH); } +"Buffer" { count (1); return (PARSEOP_BUFFER); } "Case" { count (3); return (PARSEOP_CASE); } -"Default" { count (3); return (PARSEOP_DEFAULT); } -"Unload" { count (3); return (PARSEOP_UNLOAD); } -"While" { count (3); return (PARSEOP_WHILE); } - -"Acquire" { count (3); return (PARSEOP_ACQUIRE); } -"Add" { count (3); return (PARSEOP_ADD); } -"And" { count (3); return (PARSEOP_AND); } "Concatenate" { count (3); return (PARSEOP_CONCATENATE); } "ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); } "CondRefOf" { count (3); return (PARSEOP_CONDREFOF); } +"Connection" { count (2); return (PARSEOP_CONNECTION); } +"Continue" { count (3); return (PARSEOP_CONTINUE); } "CopyObject" { count (3); return (PARSEOP_COPYOBJECT); } +"CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); } +"CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); } +"CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); } +"CreateField" { count (2); return (PARSEOP_CREATEFIELD); } +"CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); } +"CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); } +"DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); } +"Debug" { count (1); return (PARSEOP_DEBUG); } "Decrement" { count (3); return (PARSEOP_DECREMENT); } +"Default" { count (3); return (PARSEOP_DEFAULT); } +"DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); } "DeRefOf" { count (3); return (PARSEOP_DEREFOF); } +"Device" { count (2); return (PARSEOP_DEVICE); } "Divide" { count (3); return (PARSEOP_DIVIDE); } +"Eisaid" { count (1); return (PARSEOP_EISAID); } +"Else" { count (3); return (PARSEOP_ELSE); } +"ElseIf" { count (3); return (PARSEOP_ELSEIF); } +"Event" { count (2); return (PARSEOP_EVENT); } +"Fatal" { count (3); return (PARSEOP_FATAL); } +"Field" { count (2); return (PARSEOP_FIELD); } "FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); } "FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); } -"FromBCD" { count (3); return (PARSEOP_FROMBCD); } +"FromBcd" { count (3); return (PARSEOP_FROMBCD); } +"Function" { count (2); return (PARSEOP_FUNCTION); } +"If" { count (3); return (PARSEOP_IF); } "Increment" { count (3); return (PARSEOP_INCREMENT); } "Index" { count (3); return (PARSEOP_INDEX); } +"IndexField" { count (2); return (PARSEOP_INDEXFIELD); } "LAnd" { count (3); return (PARSEOP_LAND); } "LEqual" { count (3); return (PARSEOP_LEQUAL); } "LGreater" { count (3); return (PARSEOP_LGREATER); } @@ -191,32 +178,62 @@ NamePathTail [.]{NameSeg} "LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); } "LNot" { count (3); return (PARSEOP_LNOT); } "LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); } +"Load" { count (3); return (PARSEOP_LOAD); } "LoadTable" { count (3); return (PARSEOP_LOADTABLE); } "LOr" { count (3); return (PARSEOP_LOR); } "Match" { count (3); return (PARSEOP_MATCH); } +"Method" { count (2); return (PARSEOP_METHOD); } "Mid" { count (3); return (PARSEOP_MID); } "Mod" { count (3); return (PARSEOP_MOD); } "Multiply" { count (3); return (PARSEOP_MULTIPLY); } +"Mutex" { count (2); return (PARSEOP_MUTEX); } +"Name" { count (2); return (PARSEOP_NAME); } "NAnd" { count (3); return (PARSEOP_NAND); } +"Noop" { count (3); return (PARSEOP_NOOP); } "NOr" { count (3); return (PARSEOP_NOR); } "Not" { count (3); return (PARSEOP_NOT); } +"Notify" { count (3); return (PARSEOP_NOTIFY); } "ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); } +"Offset" { count (1); return (PARSEOP_OFFSET); } +"One" { count (1); return (PARSEOP_ONE); } +"Ones" { count (1); return (PARSEOP_ONES); } +"OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); } "Or" { count (3); return (PARSEOP_OR); } +"Package" { count (1); return (PARSEOP_PACKAGE); } +"PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); } +"Processor" { count (2); return (PARSEOP_PROCESSOR); } "RefOf" { count (3); return (PARSEOP_REFOF); } +"Release" { count (3); return (PARSEOP_RELEASE); } +"Reset" { count (3); return (PARSEOP_RESET); } +"Return" { count (3); return (PARSEOP_RETURN); } +"Revision" { count (1); return (PARSEOP_REVISION); } +"Scope" { count (2); return (PARSEOP_SCOPE); } "ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); } "ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); } +"Signal" { count (3); return (PARSEOP_SIGNAL); } "SizeOf" { count (3); return (PARSEOP_SIZEOF); } +"Sleep" { count (3); return (PARSEOP_SLEEP); } +"Stall" { count (3); return (PARSEOP_STALL); } "Store" { count (3); return (PARSEOP_STORE); } "Subtract" { count (3); return (PARSEOP_SUBTRACT); } +"Switch" { count (3); return (PARSEOP_SWITCH); } +"ThermalZone" { count (2); return (PARSEOP_THERMALZONE); } "Timer" { count (3); return (PARSEOP_TIMER); } -"ToBCD" { count (3); return (PARSEOP_TOBCD); } +"ToBcd" { count (3); return (PARSEOP_TOBCD); } "ToBuffer" { count (3); return (PARSEOP_TOBUFFER); } "ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); } "ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); } "ToInteger" { count (3); return (PARSEOP_TOINTEGER); } "ToString" { count (3); return (PARSEOP_TOSTRING); } +"ToUuid" { count (1); return (PARSEOP_TOUUID); } +"Unicode" { count (1); return (PARSEOP_UNICODE); } +"Unload" { count (3); return (PARSEOP_UNLOAD); } "Wait" { count (3); return (PARSEOP_WAIT); } +"While" { count (3); return (PARSEOP_WHILE); } "XOr" { count (3); return (PARSEOP_XOR); } +"Zero" { count (1); return (PARSEOP_ZERO); } + + /* Control method arguments and locals */ "Arg0" { count (1); return (PARSEOP_ARG0); } "Arg1" { count (1); return (PARSEOP_ARG1); } @@ -225,7 +242,6 @@ NamePathTail [.]{NameSeg} "Arg4" { count (1); return (PARSEOP_ARG4); } "Arg5" { count (1); return (PARSEOP_ARG5); } "Arg6" { count (1); return (PARSEOP_ARG6); } - "Local0" { count (1); return (PARSEOP_LOCAL0); } "Local1" { count (1); return (PARSEOP_LOCAL1); } "Local2" { count (1); return (PARSEOP_LOCAL2); } @@ -235,16 +251,16 @@ NamePathTail [.]{NameSeg} "Local6" { count (1); return (PARSEOP_LOCAL6); } "Local7" { count (1); return (PARSEOP_LOCAL7); } -"Debug" { count (1); return (PARSEOP_DEBUG); } -"DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); } -"Buffer" { count (1); return (PARSEOP_BUFFER); } -"Package" { count (1); return (PARSEOP_PACKAGE); } + /**************************************************************************** + * + * Resource Descriptor macros + * + ****************************************************************************/ -"EISAID" { count (1); return (PARSEOP_EISAID); } "ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); } -"ToUUID" { count (1); return (PARSEOP_TOUUID); } -"Unicode" { count (1); return (PARSEOP_UNICODE); } +"RawDataBuffer" { count (1); return (PARSEOP_DATABUFFER); } + "DMA" { count (1); return (PARSEOP_DMA); } "DWordIO" { count (1); return (PARSEOP_DWORDIO); } "DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); } @@ -253,26 +269,188 @@ NamePathTail [.]{NameSeg} "ExtendedIO" { count (1); return (PARSEOP_EXTENDEDIO); } "ExtendedMemory" { count (1); return (PARSEOP_EXTENDEDMEMORY); } "ExtendedSpace" { count (1); return (PARSEOP_EXTENDEDSPACE); } +"FixedDma" { count (1); return (PARSEOP_FIXEDDMA); } "FixedIO" { count (1); return (PARSEOP_FIXEDIO); } +"GpioInt" { count (1); return (PARSEOP_GPIO_INT); } +"GpioIo" { count (1); return (PARSEOP_GPIO_IO); } +"I2cSerialBus" { count (1); return (PARSEOP_I2C_SERIALBUS); } "Interrupt" { count (1); return (PARSEOP_INTERRUPT); } "IO" { count (1); return (PARSEOP_IO); } -"IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); } "IRQ" { count (1); return (PARSEOP_IRQ); } +"IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); } "Memory24" { count (1); return (PARSEOP_MEMORY24); } -"Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } "Memory32" { count (1); return (PARSEOP_MEMORY32); } +"Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } "QWordIO" { count (1); return (PARSEOP_QWORDIO); } "QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); } "QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); } "Register" { count (1); return (PARSEOP_REGISTER); } +"SpiSerialBus" { count (1); return (PARSEOP_SPI_SERIALBUS); } "StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); } "StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); } +"UartSerialBus" { count (1); return (PARSEOP_UART_SERIALBUS); } "VendorLong" { count (1); return (PARSEOP_VENDORLONG); } "VendorShort" { count (1); return (PARSEOP_VENDORSHORT); } "WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); } "WordIO" { count (1); return (PARSEOP_WORDIO); } "WordSpace" { count (1); return (PARSEOP_WORDSPACE); } + + /**************************************************************************** + * + * Keywords used as arguments to ASL operators and macros + * + ****************************************************************************/ + + /* AccessAttribKeyword: Serial Bus Attributes (ACPI 5.0) */ + +"AttribQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } +"AttribSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } +"AttribByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } +"AttribWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } +"AttribBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } +"AttribProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } +"AttribBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } + + /* AccessAttribKeyword: Legacy synonyms for above (pre-ACPI 5.0) */ + +"SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } +"SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } +"SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } +"SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } +"SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } +"SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } +"SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } + + /* AccessTypeKeyword: Field Access Types */ + +"AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); } +"ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); } +"WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); } +"DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); } +"QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); } +"BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); } + + /* AddressingModeKeyword: Mode - Resource Descriptors (ACPI 5.0) */ + +"AddressingMode7Bit" { count (0); return (PARSEOP_ADDRESSINGMODE_7BIT); } +"AddressingMode10Bit" { count (0); return (PARSEOP_ADDRESSINGMODE_10BIT); } + + /* AddressKeyword: ACPI memory range types */ + +"AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); } +"AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); } +"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); } +"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); } + + /* BusMasterKeyword: DMA Bus Mastering */ + +"BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); } +"NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); } + + /* ByteLengthKeyword: Bits per Byte - Resource Descriptors (ACPI 5.0) */ + +"DataBitsFive" { count (0); return (PARSEOP_BITSPERBYTE_FIVE); } +"DataBitsSix" { count (0); return (PARSEOP_BITSPERBYTE_SIX); } +"DataBitsSeven" { count (0); return (PARSEOP_BITSPERBYTE_SEVEN); } +"DataBitsEight" { count (0); return (PARSEOP_BITSPERBYTE_EIGHT); } +"DataBitsNine" { count (0); return (PARSEOP_BITSPERBYTE_NINE); } + + /* ClockPhaseKeyword: Resource Descriptors (ACPI 5.0) */ + +"ClockPhaseFirst" { count (0); return (PARSEOP_CLOCKPHASE_FIRST); } +"ClockPhaseSecond" { count (0); return (PARSEOP_CLOCKPHASE_SECOND); } + + /* ClockPolarityKeyword: Resource Descriptors (ACPI 5.0) */ + +"ClockPolarityLow" { count (0); return (PARSEOP_CLOCKPOLARITY_LOW); } +"ClockPolarityHigh" { count (0); return (PARSEOP_CLOCKPOLARITY_HIGH); } + + /* DecodeKeyword: Type of Memory Decoding - Resource Descriptors */ + +"PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); } +"SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); } + + /* DmaTypeKeyword: DMA Types - DMA Resource Descriptor */ + +"Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); } +"TypeA" { count (0); return (PARSEOP_DMATYPE_A); } +"TypeB" { count (0); return (PARSEOP_DMATYPE_B); } +"TypeF" { count (0); return (PARSEOP_DMATYPE_F); } + + /* EndianKeyword: Endian type - Resource Descriptor (ACPI 5.0) */ + +"LittleEndian" { count (0); return (PARSEOP_ENDIAN_LITTLE); } +"BigEndian" { count (0); return (PARSEOP_ENDIAN_BIG); } + + /* ExtendedAttribKeyword: Bus attributes, AccessAs operator (ACPI 5.0) */ + +"AttribBytes" { count (0); return (PARSEOP_ACCESSATTRIB_MULTIBYTE); } +"AttribRawBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_BYTES); } +"AttribRawProcessBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_PROCESS); } + + /* FlowControlKeyword: Resource Descriptors (ACPI 5.0) */ + +"FlowControlHardware" { count (0); return (PARSEOP_FLOWCONTROL_HW); } +"FlowControlNone" { count (0); return (PARSEOP_FLOWCONTROL_NONE); } +"FlowControlXon" { count (0); return (PARSEOP_FLOWCONTROL_SW); } + + /* InterruptLevelKeyword: Interrupt Active Types */ + +"ActiveBoth" { count (0); return (PARSEOP_INTLEVEL_ACTIVEBOTH); } +"ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); } +"ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); } + + /* InterruptTypeKeyword: Interrupt Types */ + +"Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); } +"Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); } + + /* IoDecodeKeyword: Type of Memory Decoding - Resource Descriptors */ + +"Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); } +"Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); } + + /* IoRestrictionKeyword: I/O Restriction - GPIO Resource Descriptors (ACPI 5.0) */ + +"IoRestrictionNone" { count (0); return (PARSEOP_IORESTRICT_NONE); } +"IoRestrictionInputOnly" { count (0); return (PARSEOP_IORESTRICT_IN); } +"IoRestrictionOutputOnly" { count (0); return (PARSEOP_IORESTRICT_OUT); } +"IoRestrictionNoneAndPreserve" { count (0); return (PARSEOP_IORESTRICT_PRESERVE); } + + /* LockRuleKeyword: Global Lock use for Field Operator */ + +"Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); } +"NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); } + + /* MatchOpKeyword: Types for Match Operator */ + +"MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); } +"MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); } +"MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); } +"MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); } +"MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); } +"MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); } + + /* MaxKeyword: Max Range Type - Resource Descriptors */ + +"MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); } +"MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); } + + /* MemTypeKeyword: Memory Types - Resource Descriptors */ + +"Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); } +"WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); } +"Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); } +"NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); } + + /* MinKeyword: Min Range Type - Resource Descriptors */ + +"MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); } +"MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); } + + /* ObjectTypeKeyword: ACPI Object Types */ + "UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); } "IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); } "StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); } @@ -290,22 +468,38 @@ NamePathTail [.]{NameSeg} "BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); } "DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); } -"AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); } -"ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); } -"WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); } -"DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); } -"QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); } -"BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); } + /* ParityKeyword: Resource Descriptors (ACPI 5.0) */ -"Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); } -"NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); } +"ParityTypeSpace" { count (0); return (PARSEOP_PARITYTYPE_SPACE); } +"ParityTypeMark" { count (0); return (PARSEOP_PARITYTYPE_MARK); } +"ParityTypeOdd" { count (0); return (PARSEOP_PARITYTYPE_ODD); } +"ParityTypeEven" { count (0); return (PARSEOP_PARITYTYPE_EVEN); } +"ParityTypeNone" { count (0); return (PARSEOP_PARITYTYPE_NONE); } -"Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); } -"WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); } -"WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); } + /* PinConfigKeyword: Pin Configuration - GPIO Resource Descriptors (ACPI 5.0) */ -"Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); } -"NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); } +"PullDefault" { count (0); return (PARSEOP_PIN_PULLDEFAULT); } +"PullUp" { count (0); return (PARSEOP_PIN_PULLUP); } +"PullDown" { count (0); return (PARSEOP_PIN_PULLDOWN); } +"PullNone" { count (0); return (PARSEOP_PIN_NOPULL); } + + /* PolarityKeyword: Resource Descriptors (ACPI 5.0) */ + +"PolarityLow" { count (0); return (PARSEOP_DEVICEPOLARITY_LOW); } +"PolarityHigh" { count (0); return (PARSEOP_DEVICEPOLARITY_HIGH); } + + /* RangeTypeKeyword: I/O Range Types - Resource Descriptors */ + +"ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); } +"NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); } +"EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); } + + /* ReadWriteKeyword: Memory Access Types - Resource Descriptors */ + +"ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); } +"ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); } + + /* RegionSpaceKeyword: Operation Region Address Space Types */ "SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); } "SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); } @@ -315,86 +509,82 @@ NamePathTail [.]{NameSeg} "SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); } "PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); } "IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } +"GeneralPurposeIo" { count (0); return (PARSEOP_REGIONSPACE_GPIO); } /* ACPI 5.0 */ +"GenericSerialBus" { count (0); return (PARSEOP_REGIONSPACE_GSBUS); } /* ACPI 5.0 */ +"FFixedHW" { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); } -"FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); } - -"SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } -"SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } -"SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } -"SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } -"SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } -"SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } -"SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } - -"MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); } -"MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); } -"MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); } -"MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); } -"MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); } -"MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); } + /* ResourceTypeKeyword: Resource Usage - Resource Descriptors */ -"Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); } -"TypeA" { count (0); return (PARSEOP_DMATYPE_A); } -"TypeB" { count (0); return (PARSEOP_DMATYPE_B); } -"TypeF" { count (0); return (PARSEOP_DMATYPE_F); } +"ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); } +"ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); } -"BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); } -"NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); } + /* SerializeRuleKeyword: Control Method Serialization */ -"Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); } -"Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); } -"Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); } +"Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); } +"NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); } -"ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); } -"ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); } + /* ShareTypeKeyword: Interrupt Sharing - Resource Descriptors */ -"MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); } -"MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); } +"Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); } +"Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); } +"SharedAndWake" { count (0); return (PARSEOP_SHARETYPE_SHAREDWAKE); } /* ACPI 5.0 */ +"ExclusiveAndWake" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVEWAKE); } /* ACPI 5.0 */ -"MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); } -"MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); } + /* SlaveModeKeyword: Resource Descriptors (ACPI 5.0) */ -"PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); } -"SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); } +"ControllerInitiated" { count (0); return (PARSEOP_SLAVEMODE_CONTROLLERINIT); } +"DeviceInitiated" { count (0); return (PARSEOP_SLAVEMODE_DEVICEINIT); } -"ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); } -"NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); } -"EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); } + /* StopBitsKeyword: Resource Descriptors (ACPI 5.0) */ -"Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); } -"WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); } -"Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); } -"NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); } +"StopBitsOne" { count (0); return (PARSEOP_STOPBITS_ONE); } +"StopBitsOnePlusHalf" { count (0); return (PARSEOP_STOPBITS_ONEPLUSHALF); } +"StopBitsTwo" { count (0); return (PARSEOP_STOPBITS_TWO); } +"StopBitsZero" { count (0); return (PARSEOP_STOPBITS_ZERO); } -"ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); } -"ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); } + /* TransferWidthKeyword: DMA Widths - Fixed DMA Resource Descriptor (ACPI 5.0) */ -"Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); } -"Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); } +"Width8bit" { count (0); return (PARSEOP_XFERSIZE_8); } +"Width16bit" { count (0); return (PARSEOP_XFERSIZE_16); } +"Width32bit" { count (0); return (PARSEOP_XFERSIZE_32); } +"Width64bit" { count (0); return (PARSEOP_XFERSIZE_64); } +"Width128bit" { count (0); return (PARSEOP_XFERSIZE_128); } +"Width256bit" { count (0); return (PARSEOP_XFERSIZE_256); } -"ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); } -"ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); } + /* TranslationKeyword: Translation Density Types - Resource Descriptors */ -"Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); } -"Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); } +"SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); } +"DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); } -"Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); } -"Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); } + /* TypeKeyword: Translation Types - Resource Descriptors */ "TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); } "TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); } -"SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); } -"DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); } + /* UpdateRuleKeyword: Field Update Rules */ -"AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); } -"AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); } -"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); } -"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); } +"Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); } +"WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); } +"WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); } + + /* WireModeKeyword: SPI Wire Mode - Resource Descriptors (ACPI 5.0) */ + +"FourWireMode" { count (0); return (PARSEOP_WIREMODE_FOUR); } +"ThreeWireMode" { count (0); return (PARSEOP_WIREMODE_THREE); } + + /* XferTypeKeyword: DMA Transfer Types */ + +"Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); } +"Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); } +"Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); } + + /* Predefined compiler names */ "__DATE__" { count (0); return (PARSEOP___DATE__); } "__FILE__" { count (0); return (PARSEOP___FILE__); } "__LINE__" { count (0); return (PARSEOP___LINE__); } +"__PATH__" { count (0); return (PARSEOP___PATH__); } + "{" { count (0); return('{'); } "}" { count (0); return('}'); } @@ -402,7 +592,6 @@ NamePathTail [.]{NameSeg} "(" { count (0); return('('); } ")" { count (0); return(')'); } - {NameSeg} { char *s; count (0); s=malloc (ACPI_NAME_SIZE + 1); @@ -478,7 +667,6 @@ AslPopInputFileStack ( void) { ASL_FILE_NODE *Fnode; - FILE *InputFile = NULL; Fnode = InputStack; @@ -497,7 +685,6 @@ AslPopInputFileStack ( /* Update the top-of-stack */ InputStack = Fnode->Next; - InputFile = Fnode->File; /* Reset global line counter and filename */ diff --git a/compiler/aslcompiler.y b/compiler/aslcompiler.y index 22d703947750..b5f801b63f5c 100644 --- a/compiler/aslcompiler.y +++ b/compiler/aslcompiler.y @@ -1,8 +1,7 @@ - %{ /****************************************************************************** * - * Module Name: aslcompiler.y - Bison input file (ASL grammar and actions) + * Module Name: aslcompiler.y - Bison/Yacc input file (ASL grammar and actions) * *****************************************************************************/ @@ -106,22 +105,28 @@ void * AslLocalAllocate (unsigned int Size); * These shift/reduce conflicts are expected. There should be zero * reduce/reduce conflicts. */ -%expect 60 +%expect 86 -/* +/****************************************************************************** + * * Token types: These are returned by the lexer * * NOTE: This list MUST match the AslKeywordMapping table found * in aslmap.c EXACTLY! Double check any changes! - */ + * + *****************************************************************************/ + %token <i> PARSEOP_ACCESSAS %token <i> PARSEOP_ACCESSATTRIB_BLOCK %token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL %token <i> PARSEOP_ACCESSATTRIB_BYTE -%token <i> PARSEOP_ACCESSATTRIB_WORD_CALL +%token <i> PARSEOP_ACCESSATTRIB_MULTIBYTE %token <i> PARSEOP_ACCESSATTRIB_QUICK +%token <i> PARSEOP_ACCESSATTRIB_RAW_BYTES +%token <i> PARSEOP_ACCESSATTRIB_RAW_PROCESS %token <i> PARSEOP_ACCESSATTRIB_SND_RCV %token <i> PARSEOP_ACCESSATTRIB_WORD +%token <i> PARSEOP_ACCESSATTRIB_WORD_CALL %token <i> PARSEOP_ACCESSTYPE_ANY %token <i> PARSEOP_ACCESSTYPE_BUF %token <i> PARSEOP_ACCESSTYPE_BYTE @@ -130,7 +135,8 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_ACCESSTYPE_WORD %token <i> PARSEOP_ACQUIRE %token <i> PARSEOP_ADD -%token <i> PARSEOP_ADDRESSSPACE_FFIXEDHW +%token <i> PARSEOP_ADDRESSINGMODE_7BIT +%token <i> PARSEOP_ADDRESSINGMODE_10BIT %token <i> PARSEOP_ADDRESSTYPE_ACPI %token <i> PARSEOP_ADDRESSTYPE_MEMORY %token <i> PARSEOP_ADDRESSTYPE_NVS @@ -145,6 +151,11 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_ARG5 %token <i> PARSEOP_ARG6 %token <i> PARSEOP_BANKFIELD +%token <i> PARSEOP_BITSPERBYTE_EIGHT +%token <i> PARSEOP_BITSPERBYTE_FIVE +%token <i> PARSEOP_BITSPERBYTE_NINE +%token <i> PARSEOP_BITSPERBYTE_SEVEN +%token <i> PARSEOP_BITSPERBYTE_SIX %token <i> PARSEOP_BREAK %token <i> PARSEOP_BREAKPOINT %token <i> PARSEOP_BUFFER @@ -152,9 +163,14 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_BUSMASTERTYPE_NOTMASTER %token <i> PARSEOP_BYTECONST %token <i> PARSEOP_CASE +%token <i> PARSEOP_CLOCKPHASE_FIRST +%token <i> PARSEOP_CLOCKPHASE_SECOND +%token <i> PARSEOP_CLOCKPOLARITY_HIGH +%token <i> PARSEOP_CLOCKPOLARITY_LOW %token <i> PARSEOP_CONCATENATE %token <i> PARSEOP_CONCATENATERESTEMPLATE %token <i> PARSEOP_CONDREFOF +%token <i> PARSEOP_CONNECTION %token <i> PARSEOP_CONTINUE %token <i> PARSEOP_COPYOBJECT %token <i> PARSEOP_CREATEBITFIELD @@ -163,6 +179,7 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_CREATEFIELD %token <i> PARSEOP_CREATEQWORDFIELD %token <i> PARSEOP_CREATEWORDFIELD +%token <i> PARSEOP_DATABUFFER %token <i> PARSEOP_DATATABLEREGION %token <i> PARSEOP_DEBUG %token <i> PARSEOP_DECODETYPE_POS @@ -173,6 +190,8 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_DEFINITIONBLOCK %token <i> PARSEOP_DEREFOF %token <i> PARSEOP_DEVICE +%token <i> PARSEOP_DEVICEPOLARITY_HIGH +%token <i> PARSEOP_DEVICEPOLARITY_LOW %token <i> PARSEOP_DIVIDE %token <i> PARSEOP_DMA %token <i> PARSEOP_DMATYPE_A @@ -187,6 +206,8 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_ELSE %token <i> PARSEOP_ELSEIF %token <i> PARSEOP_ENDDEPENDENTFN +%token <i> PARSEOP_ENDIAN_BIG +%token <i> PARSEOP_ENDIAN_LITTLE %token <i> PARSEOP_ENDTAG %token <i> PARSEOP_ERRORNODE %token <i> PARSEOP_EVENT @@ -198,9 +219,16 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_FIELD %token <i> PARSEOP_FINDSETLEFTBIT %token <i> PARSEOP_FINDSETRIGHTBIT +%token <i> PARSEOP_FIXEDDMA %token <i> PARSEOP_FIXEDIO +%token <i> PARSEOP_FLOWCONTROL_HW +%token <i> PARSEOP_FLOWCONTROL_NONE +%token <i> PARSEOP_FLOWCONTROL_SW %token <i> PARSEOP_FROMBCD %token <i> PARSEOP_FUNCTION +%token <i> PARSEOP_GPIO_INT +%token <i> PARSEOP_GPIO_IO +%token <i> PARSEOP_I2C_SERIALBUS %token <i> PARSEOP_IF %token <i> PARSEOP_INCLUDE %token <i> PARSEOP_INCLUDE_CSTYLE @@ -210,6 +238,7 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_INDEXFIELD %token <i> PARSEOP_INTEGER %token <i> PARSEOP_INTERRUPT +%token <i> PARSEOP_INTLEVEL_ACTIVEBOTH %token <i> PARSEOP_INTLEVEL_ACTIVEHIGH %token <i> PARSEOP_INTLEVEL_ACTIVELOW %token <i> PARSEOP_INTTYPE_EDGE @@ -217,6 +246,10 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_IO %token <i> PARSEOP_IODECODETYPE_10 %token <i> PARSEOP_IODECODETYPE_16 +%token <i> PARSEOP_IORESTRICT_IN +%token <i> PARSEOP_IORESTRICT_NONE +%token <i> PARSEOP_IORESTRICT_OUT +%token <i> PARSEOP_IORESTRICT_PRESERVE %token <i> PARSEOP_IRQ %token <i> PARSEOP_IRQNOFLAGS %token <i> PARSEOP_LAND @@ -297,6 +330,15 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_OR %token <i> PARSEOP_PACKAGE %token <i> PARSEOP_PACKAGE_LENGTH +%token <i> PARSEOP_PARITYTYPE_EVEN +%token <i> PARSEOP_PARITYTYPE_MARK +%token <i> PARSEOP_PARITYTYPE_NONE +%token <i> PARSEOP_PARITYTYPE_ODD +%token <i> PARSEOP_PARITYTYPE_SPACE +%token <i> PARSEOP_PIN_NOPULL +%token <i> PARSEOP_PIN_PULLDEFAULT +%token <i> PARSEOP_PIN_PULLDOWN +%token <i> PARSEOP_PIN_PULLUP %token <i> PARSEOP_POWERRESOURCE %token <i> PARSEOP_PROCESSOR %token <i> PARSEOP_QWORDCONST @@ -312,6 +354,9 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_REFOF %token <i> PARSEOP_REGIONSPACE_CMOS %token <i> PARSEOP_REGIONSPACE_EC +%token <i> PARSEOP_REGIONSPACE_FFIXEDHW +%token <i> PARSEOP_REGIONSPACE_GPIO +%token <i> PARSEOP_REGIONSPACE_GSBUS %token <i> PARSEOP_REGIONSPACE_IO %token <i> PARSEOP_REGIONSPACE_IPMI %token <i> PARSEOP_REGIONSPACE_MEM @@ -331,15 +376,24 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_SERIALIZERULE_NOTSERIAL %token <i> PARSEOP_SERIALIZERULE_SERIAL %token <i> PARSEOP_SHARETYPE_EXCLUSIVE +%token <i> PARSEOP_SHARETYPE_EXCLUSIVEWAKE %token <i> PARSEOP_SHARETYPE_SHARED +%token <i> PARSEOP_SHARETYPE_SHAREDWAKE %token <i> PARSEOP_SHIFTLEFT %token <i> PARSEOP_SHIFTRIGHT %token <i> PARSEOP_SIGNAL %token <i> PARSEOP_SIZEOF +%token <i> PARSEOP_SLAVEMODE_CONTROLLERINIT +%token <i> PARSEOP_SLAVEMODE_DEVICEINIT %token <i> PARSEOP_SLEEP +%token <i> PARSEOP_SPI_SERIALBUS %token <i> PARSEOP_STALL %token <i> PARSEOP_STARTDEPENDENTFN %token <i> PARSEOP_STARTDEPENDENTFN_NOPRI +%token <i> PARSEOP_STOPBITS_ONE +%token <i> PARSEOP_STOPBITS_ONEPLUSHALF +%token <i> PARSEOP_STOPBITS_TWO +%token <i> PARSEOP_STOPBITS_ZERO %token <i> PARSEOP_STORE %token <s> PARSEOP_STRING_LITERAL %token <i> PARSEOP_SUBTRACT @@ -357,6 +411,7 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_TRANSLATIONTYPE_SPARSE %token <i> PARSEOP_TYPE_STATIC %token <i> PARSEOP_TYPE_TRANSLATION +%token <i> PARSEOP_UART_SERIALBUS %token <i> PARSEOP_UNICODE %token <i> PARSEOP_UNLOAD %token <i> PARSEOP_UPDATERULE_ONES @@ -367,10 +422,18 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_VENDORSHORT %token <i> PARSEOP_WAIT %token <i> PARSEOP_WHILE +%token <i> PARSEOP_WIREMODE_FOUR +%token <i> PARSEOP_WIREMODE_THREE %token <i> PARSEOP_WORDBUSNUMBER %token <i> PARSEOP_WORDCONST %token <i> PARSEOP_WORDIO %token <i> PARSEOP_WORDSPACE +%token <i> PARSEOP_XFERSIZE_8 +%token <i> PARSEOP_XFERSIZE_16 +%token <i> PARSEOP_XFERSIZE_32 +%token <i> PARSEOP_XFERSIZE_64 +%token <i> PARSEOP_XFERSIZE_128 +%token <i> PARSEOP_XFERSIZE_256 %token <i> PARSEOP_XFERTYPE_8 %token <i> PARSEOP_XFERTYPE_8_16 %token <i> PARSEOP_XFERTYPE_16 @@ -384,64 +447,64 @@ void * AslLocalAllocate (unsigned int Size); %token <i> PARSEOP___DATE__ %token <i> PARSEOP___FILE__ %token <i> PARSEOP___LINE__ +%token <i> PARSEOP___PATH__ -/* + +/****************************************************************************** + * * Production names - */ + * + *****************************************************************************/ +%type <n> ArgList %type <n> ASLCode -%type <n> DefinitionBlockTerm -%type <n> TermList -%type <n> Term +%type <n> BufferData +%type <n> BufferTermData %type <n> CompilerDirective -%type <n> ObjectList -%type <n> Object %type <n> DataObject -%type <n> BufferData -%type <n> PackageData +%type <n> DefinitionBlockTerm %type <n> IntegerData -%type <n> StringData %type <n> NamedObject %type <n> NameSpaceModifier -%type <n> UserTerm -%type <n> ArgList -%type <n> TermArg -%type <n> Target -%type <n> RequiredTarget -%type <n> SimpleTarget -%type <n> BufferTermData +%type <n> Object +%type <n> ObjectList +%type <n> PackageData %type <n> ParameterTypePackage %type <n> ParameterTypePackageList %type <n> ParameterTypesPackage %type <n> ParameterTypesPackageList +%type <n> RequiredTarget +%type <n> SimpleTarget +%type <n> StringData +%type <n> Target +%type <n> Term +%type <n> TermArg +%type <n> TermList +%type <n> UserTerm + +/* Type4Opcode is obsolete */ %type <n> Type1Opcode -%type <n> Type2Opcode -%type <n> Type2IntegerOpcode -%type <n> Type2StringOpcode %type <n> Type2BufferOpcode %type <n> Type2BufferOrStringOpcode +%type <n> Type2IntegerOpcode +%type <n> Type2Opcode +%type <n> Type2StringOpcode %type <n> Type3Opcode - -/* Obsolete %type <n> Type4Opcode */ - %type <n> Type5Opcode %type <n> Type6Opcode -%type <n> LineTerm -%type <n> IncludeTerm -%type <n> IncludeCStyleTerm +%type <n> AccessAsTerm %type <n> ExternalTerm - -%type <n> FieldUnitList %type <n> FieldUnit %type <n> FieldUnitEntry - +%type <n> FieldUnitList +%type <n> IncludeCStyleTerm +%type <n> IncludeTerm +%type <n> LineTerm %type <n> OffsetTerm -%type <n> AccessAsTerm %type <n> OptionalAccessAttribTerm - /* Named Objects */ %type <n> BankFieldTerm @@ -465,7 +528,6 @@ void * AslLocalAllocate (unsigned int Size); %type <n> ProcessorTerm %type <n> ThermalZoneTerm - /* Namespace modifiers */ %type <n> AliasTerm @@ -474,13 +536,16 @@ void * AslLocalAllocate (unsigned int Size); /* Type 1 opcodes */ -%type <n> BreakTerm %type <n> BreakPointTerm +%type <n> BreakTerm +%type <n> CaseDefaultTermList +%type <n> CaseTerm %type <n> ContinueTerm +%type <n> DefaultTerm +%type <n> ElseTerm %type <n> FatalTerm %type <n> IfElseTerm %type <n> IfTerm -%type <n> ElseTerm %type <n> LoadTerm %type <n> NoOpTerm %type <n> NotifyTerm @@ -491,20 +556,17 @@ void * AslLocalAllocate (unsigned int Size); %type <n> SleepTerm %type <n> StallTerm %type <n> SwitchTerm -%type <n> CaseDefaultTermList -//%type <n> CaseTermList -%type <n> CaseTerm -%type <n> DefaultTerm %type <n> UnloadTerm %type <n> WhileTerm +//%type <n> CaseTermList /* Type 2 opcodes */ %type <n> AcquireTerm %type <n> AddTerm %type <n> AndTerm -%type <n> ConcatTerm %type <n> ConcatResTerm +%type <n> ConcatTerm %type <n> CondRefOfTerm %type <n> CopyObjectTerm %type <n> DecTerm @@ -517,12 +579,12 @@ void * AslLocalAllocate (unsigned int Size); %type <n> IndexTerm %type <n> LAndTerm %type <n> LEqualTerm -%type <n> LGreaterTerm %type <n> LGreaterEqualTerm -%type <n> LLessTerm +%type <n> LGreaterTerm %type <n> LLessEqualTerm -%type <n> LNotTerm +%type <n> LLessTerm %type <n> LNotEqualTerm +%type <n> LNotTerm %type <n> LoadTableTerm %type <n> LOrTerm %type <n> MatchTerm @@ -550,39 +612,49 @@ void * AslLocalAllocate (unsigned int Size); %type <n> WaitTerm %type <n> XOrTerm -%type <n> OptionalTermArg -%type <n> OptionalReturnArg -%type <n> OptionalListString - - /* Keywords */ -%type <n> ObjectTypeKeyword -%type <n> AccessTypeKeyword %type <n> AccessAttribKeyword -%type <n> LockRuleKeyword -%type <n> UpdateRuleKeyword -%type <n> RegionSpaceKeyword +%type <n> AccessTypeKeyword +%type <n> AddressingModeKeyword +%type <n> AddressKeyword %type <n> AddressSpaceKeyword -%type <n> MatchOpKeyword -%type <n> SerializeRuleKeyword +%type <n> BitsPerByteKeyword +%type <n> ClockPhaseKeyword +%type <n> ClockPolarityKeyword +%type <n> DecodeKeyword +%type <n> DevicePolarityKeyword %type <n> DMATypeKeyword -%type <n> OptionalBusMasterKeyword -%type <n> XferTypeKeyword -%type <n> ResourceTypeKeyword -%type <n> MinKeyword +%type <n> EndianKeyword +%type <n> FlowControlKeyword +%type <n> InterruptLevel +%type <n> InterruptTypeKeyword +%type <n> IODecodeKeyword +%type <n> IoRestrictionKeyword +%type <n> LockRuleKeyword +%type <n> MatchOpKeyword %type <n> MaxKeyword -%type <n> DecodeKeyword -%type <n> RangeTypeKeyword %type <n> MemTypeKeyword +%type <n> MinKeyword +%type <n> ObjectTypeKeyword +%type <n> OptionalBusMasterKeyword %type <n> OptionalReadWriteKeyword -%type <n> InterruptTypeKeyword -%type <n> InterruptLevel +%type <n> ParityTypeKeyword +%type <n> PinConfigByte +%type <n> PinConfigKeyword +%type <n> RangeTypeKeyword +%type <n> RegionSpaceKeyword +%type <n> ResourceTypeKeyword +%type <n> SerializeRuleKeyword %type <n> ShareTypeKeyword -%type <n> IODecodeKeyword -%type <n> TypeKeyword +%type <n> SlaveModeKeyword +%type <n> StopBitsKeyword %type <n> TranslationKeyword -%type <n> AddressKeyword +%type <n> TypeKeyword +%type <n> UpdateRuleKeyword +%type <n> WireModeKeyword +%type <n> XferSizeKeyword +%type <n> XferTypeKeyword /* Types */ @@ -599,31 +671,34 @@ void * AslLocalAllocate (unsigned int Size); %type <n> String %type <n> ConstTerm +%type <n> ConstExprTerm %type <n> ByteConstExpr %type <n> WordConstExpr %type <n> DWordConstExpr %type <n> QWordConstExpr -%type <n> ConstExprTerm +%type <n> DWordList %type <n> BufferTerm %type <n> ByteList -%type <n> DWordList -%type <n> PackageTerm -%type <n> PackageList %type <n> PackageElement - +%type <n> PackageList +%type <n> PackageTerm %type <n> VarPackageLengthTerm /* Macros */ %type <n> EISAIDTerm +%type <n> ResourceMacroList +%type <n> ResourceMacroTerm %type <n> ResourceTemplateTerm %type <n> ToUUIDTerm %type <n> UnicodeTerm -%type <n> ResourceMacroList -%type <n> ResourceMacroTerm +/* Resource Descriptors */ + +%type <n> ConnectionTerm +%type <n> DataBufferTerm %type <n> DMATerm %type <n> DWordIOTerm %type <n> DWordMemoryTerm @@ -632,7 +707,11 @@ void * AslLocalAllocate (unsigned int Size); %type <n> ExtendedIOTerm %type <n> ExtendedMemoryTerm %type <n> ExtendedSpaceTerm +%type <n> FixedDmaTerm %type <n> FixedIOTerm +%type <n> GpioIntTerm +%type <n> GpioIoTerm +%type <n> I2cSerialBusTerm %type <n> InterruptTerm %type <n> IOTerm %type <n> IRQNoFlagsTerm @@ -640,59 +719,75 @@ void * AslLocalAllocate (unsigned int Size); %type <n> Memory24Term %type <n> Memory32FixedTerm %type <n> Memory32Term +%type <n> NameSeg +%type <n> NameString %type <n> QWordIOTerm %type <n> QWordMemoryTerm %type <n> QWordSpaceTerm %type <n> RegisterTerm -%type <n> StartDependentFnTerm +%type <n> SpiSerialBusTerm %type <n> StartDependentFnNoPriTerm +%type <n> StartDependentFnTerm +%type <n> UartSerialBusTerm %type <n> VendorLongTerm %type <n> VendorShortTerm %type <n> WordBusNumberTerm %type <n> WordIOTerm %type <n> WordSpaceTerm -%type <n> NameString -%type <n> NameSeg - - /* Local types that help construct the AML, not in ACPI spec */ -%type <n> IncludeEndTerm %type <n> AmlPackageLengthTerm +%type <n> IncludeEndTerm +%type <n> NameStringItem +%type <n> TermArgItem + +%type <n> OptionalAccessSize +%type <n> OptionalAddressingMode +%type <n> OptionalAddressRange +%type <n> OptionalBitsPerByte +%type <n> OptionalBuffer_Last %type <n> OptionalByteConstExpr +%type <n> OptionalCount +%type <n> OptionalDecodeType +%type <n> OptionalDevicePolarity %type <n> OptionalDWordConstExpr -%type <n> OptionalQWordConstExpr -%type <n> OptionalSerializeRuleKeyword -%type <n> OptionalResourceType_First -%type <n> OptionalResourceType -%type <n> OptionalMinType +%type <n> OptionalEndian +%type <n> OptionalFlowControl +%type <n> OptionalIoRestriction +%type <n> OptionalListString %type <n> OptionalMaxType %type <n> OptionalMemType -%type <n> OptionalCount -%type <n> OptionalDecodeType -%type <n> OptionalRangeType -%type <n> OptionalShareType -%type <n> OptionalType -%type <n> OptionalType_Last -%type <n> OptionalTranslationType_Last -%type <n> OptionalStringData +%type <n> OptionalMinType %type <n> OptionalNameString %type <n> OptionalNameString_First %type <n> OptionalNameString_Last -%type <n> OptionalAddressRange %type <n> OptionalObjectTypeKeyword %type <n> OptionalParameterTypePackage %type <n> OptionalParameterTypesPackage +%type <n> OptionalParityType +%type <n> OptionalQWordConstExpr +%type <n> OptionalRangeType %type <n> OptionalReference -%type <n> OptionalAccessSize - -%type <n> TermArgItem -%type <n> NameStringItem +%type <n> OptionalResourceType +%type <n> OptionalResourceType_First +%type <n> OptionalReturnArg +%type <n> OptionalSerializeRuleKeyword +%type <n> OptionalShareType +%type <n> OptionalShareType_First +%type <n> OptionalSlaveMode +%type <n> OptionalStopBits +%type <n> OptionalStringData +%type <n> OptionalTermArg +%type <n> OptionalTranslationType_Last +%type <n> OptionalType +%type <n> OptionalType_Last +%type <n> OptionalWireMode +%type <n> OptionalWordConst +%type <n> OptionalWordConstExpr +%type <n> OptionalXferSize %% - - /******************************************************************************* * * Production rules start here @@ -745,7 +840,9 @@ DefinitionBlockTerm TermList : {$$ = NULL;} | TermList Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} + | TermList Term ';' {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);} | TermList ';' Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} + | TermList ';' Term ';' {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);} ; Term @@ -1107,6 +1204,7 @@ FieldUnit : FieldUnitEntry {} | OffsetTerm {} | AccessAsTerm {} + | ConnectionTerm {} ; FieldUnitEntry @@ -1132,6 +1230,21 @@ AccessAsTerm error ')' {$$ = AslDoError(); yyclearin;} ; +ConnectionTerm + : PARSEOP_CONNECTION '(' + NameString + ')' {$$ = TrCreateNode (PARSEOP_CONNECTION,1,$3);} + | PARSEOP_CONNECTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONNECTION);} + ResourceMacroTerm + ')' {$$ = TrLinkChildren ($<n>3, 1, + TrLinkChildren (TrCreateLeafNode (PARSEOP_RESOURCETEMPLATE), 3, + TrCreateLeafNode (PARSEOP_DEFAULT_ARG), + TrCreateLeafNode (PARSEOP_DEFAULT_ARG), + $4));} + | PARSEOP_CONNECTION '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + CreateBitFieldTerm : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} TermArg @@ -2052,23 +2165,23 @@ XOrTerm /******* Keywords *************************************************************/ -ObjectTypeKeyword - : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} - | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} - | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} - | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} - | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} - | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} - | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} - | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} - | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} - | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} - | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} - | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} - | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} - | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} - | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} +AccessAttribKeyword + : PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} + | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} + | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} + | PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} + | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} + | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} + | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} + | PARSEOP_ACCESSATTRIB_MULTIBYTE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_BYTES '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_PROCESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} ; AccessTypeKeyword @@ -2080,49 +2193,95 @@ AccessTypeKeyword | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} ; -AccessAttribKeyword - : PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} - | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} - | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} - | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} - | PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} - | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} - | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} +AddressingModeKeyword + : PARSEOP_ADDRESSINGMODE_7BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);} + | PARSEOP_ADDRESSINGMODE_10BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);} ; -LockRuleKeyword - : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} - | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} +AddressKeyword + : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} + | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} + | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} + | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} ; -UpdateRuleKeyword - : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} - | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} - | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} +AddressSpaceKeyword + : ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + | RegionSpaceKeyword {} ; +BitsPerByteKeyword + : PARSEOP_BITSPERBYTE_FIVE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);} + | PARSEOP_BITSPERBYTE_SIX {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);} + | PARSEOP_BITSPERBYTE_SEVEN {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);} + | PARSEOP_BITSPERBYTE_EIGHT {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);} + | PARSEOP_BITSPERBYTE_NINE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);} + ; -RegionSpaceKeyword - : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} - | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} - | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} - | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} - | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} - | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} - | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} - | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} +ClockPhaseKeyword + : PARSEOP_CLOCKPHASE_FIRST {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);} + | PARSEOP_CLOCKPHASE_SECOND {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);} ; -AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - | RegionSpaceKeyword {} - | PARSEOP_ADDRESSSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_ADDRESSSPACE_FFIXEDHW);} +ClockPolarityKeyword + : PARSEOP_CLOCKPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);} + | PARSEOP_CLOCKPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);} ; +DecodeKeyword + : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} + | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} + ; -SerializeRuleKeyword - : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} - | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} +DevicePolarityKeyword + : PARSEOP_DEVICEPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);} + | PARSEOP_DEVICEPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);} + ; + +DMATypeKeyword + : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} + | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} + | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} + | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} + ; + +EndianKeyword + : PARSEOP_ENDIAN_LITTLE {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);} + | PARSEOP_ENDIAN_BIG {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);} + ; + +FlowControlKeyword + : PARSEOP_FLOWCONTROL_HW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);} + | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);} + | PARSEOP_FLOWCONTROL_SW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);} + ; + +InterruptLevel + : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);} + | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} + | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} + ; + +InterruptTypeKeyword + : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} + | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} + ; + +IODecodeKeyword + : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} + | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} + ; + +IoRestrictionKeyword + : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);} + | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);} + | PARSEOP_IORESTRICT_NONE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);} + | PARSEOP_IORESTRICT_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);} + ; + +LockRuleKeyword + : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} + | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} ; MatchOpKeyword @@ -2134,22 +2293,16 @@ MatchOpKeyword | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} ; -DMATypeKeyword - : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} - | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} - | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} - | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} - ; - -XferTypeKeyword - : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} - | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} - | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);} +MaxKeyword + : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} + | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} ; -ResourceTypeKeyword - : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} +MemTypeKeyword + : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} + | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} + | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} + | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} ; MinKeyword @@ -2157,14 +2310,43 @@ MinKeyword | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} ; -MaxKeyword - : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} - | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} +ObjectTypeKeyword + : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} + | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} + | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} + | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} + | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} + | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} + | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} + | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} + | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} + | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} + | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} + | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} + | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} + | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} + | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} + | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} ; -DecodeKeyword - : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} - | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} +ParityTypeKeyword + : PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);} + | PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);} + | PARSEOP_PARITYTYPE_ODD {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);} + | PARSEOP_PARITYTYPE_EVEN {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);} + | PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);} + ; + +PinConfigByte + : PinConfigKeyword {$$ = $1;} + | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + +PinConfigKeyword + : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);} + | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);} + | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);} + | PARSEOP_PIN_PULLDEFAULT {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);} ; RangeTypeKeyword @@ -2173,37 +2355,52 @@ RangeTypeKeyword | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} ; -MemTypeKeyword - : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} - | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} - | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} - | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} - ; - -OptionalReadWriteKeyword - : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);} +RegionSpaceKeyword + : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} + | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} + | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} + | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} + | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} + | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} + | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} + | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} + | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);} + | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);} + | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);} ; -InterruptTypeKeyword - : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} - | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} +ResourceTypeKeyword + : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} ; -InterruptLevel - : PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} - | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} +SerializeRuleKeyword + : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} + | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} ; ShareTypeKeyword : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} + | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);} + | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);} + ; + +SlaveModeKeyword + : PARSEOP_SLAVEMODE_CONTROLLERINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);} + | PARSEOP_SLAVEMODE_DEVICEINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);} ; -IODecodeKeyword - : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} - | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} +StopBitsKeyword + : PARSEOP_STOPBITS_TWO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);} + | PARSEOP_STOPBITS_ONEPLUSHALF {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);} + | PARSEOP_STOPBITS_ONE {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);} + | PARSEOP_STOPBITS_ZERO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);} + ; + +TranslationKeyword + : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} + | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} ; TypeKeyword @@ -2211,16 +2408,30 @@ TypeKeyword | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} ; -TranslationKeyword - : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} - | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} +UpdateRuleKeyword + : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} + | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} + | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} ; -AddressKeyword - : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} - | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} - | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} - | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} +WireModeKeyword + : PARSEOP_WIREMODE_FOUR {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);} + | PARSEOP_WIREMODE_THREE {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_THREE);} + ; + +XferSizeKeyword + : PARSEOP_XFERSIZE_8 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_8, 0);} + | PARSEOP_XFERSIZE_16 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_16, 1);} + | PARSEOP_XFERSIZE_32 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} + | PARSEOP_XFERSIZE_64 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_64, 3);} + | PARSEOP_XFERSIZE_128 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_128, 4);} + | PARSEOP_XFERSIZE_256 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_256, 5);} + ; + +XferTypeKeyword + : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} + | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} + | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);} ; @@ -2291,6 +2502,16 @@ ConstTerm | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);} ; +ConstExprTerm + : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} + | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} + | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);} + | PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);} + | PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);} + | PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);} + | PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);} + ; + ByteConstExpr : Type3Opcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} | Type2IntegerOpcode {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} @@ -2319,15 +2540,6 @@ QWordConstExpr | QWordConst {} ; -ConstExprTerm - : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} - | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} - | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);} - | PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);} - | PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);} - | PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);} - ; - /* OptionalCount must appear before ByteList or an incorrect reduction will result */ OptionalCount @@ -2336,7 +2548,6 @@ OptionalCount | ',' TermArg {$$ = $2;} ; - BufferTerm : PARSEOP_BUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);} OptionalTermArg @@ -2359,6 +2570,15 @@ ByteList ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);} ; +DataBufferTerm + : PARSEOP_DATABUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);} + OptionalWordConst + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_DATABUFFER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + DWordList : {$$ = NULL;} | DWordConstExpr @@ -2376,11 +2596,6 @@ PackageTerm error ')' {$$ = AslDoError(); yyclearin;} ; -VarPackageLengthTerm - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | TermArg {$$ = $1;} - ; - PackageList : {$$ = NULL;} | PackageElement @@ -2394,6 +2609,15 @@ PackageElement | NameString {} ; +VarPackageLengthTerm + : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} + | TermArg {$$ = $1;} + ; + + +/******* Macros ***********************************************/ + + EISAIDTerm : PARSEOP_EISAID '(' StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);} @@ -2401,6 +2625,14 @@ EISAIDTerm error ')' {$$ = AslDoError(); yyclearin;} ; +UnicodeTerm + : PARSEOP_UNICODE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);} + StringData + ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);} + | PARSEOP_UNICODE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + /******* Resources and Memory ***********************************************/ @@ -2419,14 +2651,6 @@ ResourceTemplateTerm TrCreateLeafNode (PARSEOP_ENDTAG));} ; -UnicodeTerm - : PARSEOP_UNICODE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);} - StringData - ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);} - | PARSEOP_UNICODE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - ResourceMacroList : {$$ = NULL;} | ResourceMacroList @@ -2442,7 +2666,11 @@ ResourceMacroTerm | ExtendedIOTerm {} | ExtendedMemoryTerm {} | ExtendedSpaceTerm {} + | FixedDmaTerm {} | FixedIOTerm {} + | GpioIntTerm {} + | GpioIoTerm {} + | I2cSerialBusTerm {} | InterruptTerm {} | IOTerm {} | IRQNoFlagsTerm {} @@ -2454,8 +2682,10 @@ ResourceMacroTerm | QWordMemoryTerm {} | QWordSpaceTerm {} | RegisterTerm {} - | StartDependentFnTerm {} + | SpiSerialBusTerm {} | StartDependentFnNoPriTerm {} + | StartDependentFnTerm {} + | UartSerialBusTerm {} | VendorLongTerm {} | VendorShortTerm {} | WordBusNumberTerm {} @@ -2612,6 +2842,17 @@ ExtendedSpaceTerm error ')' {$$ = AslDoError(); yyclearin;} ; +FixedDmaTerm + : PARSEOP_FIXEDDMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);} + WordConstExpr // 04: DMA RequestLines + ',' WordConstExpr // 06: DMA Channels + OptionalXferSize // 07: DMA TransferSize + OptionalNameString // 08: DescriptorName + ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);} + | PARSEOP_FIXEDDMA '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + FixedIOTerm : PARSEOP_FIXEDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDIO);} WordConstExpr @@ -2622,6 +2863,58 @@ FixedIOTerm error ')' {$$ = AslDoError(); yyclearin;} ; +GpioIntTerm + : PARSEOP_GPIO_INT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_INT);} + InterruptTypeKeyword // 04: InterruptType + ',' InterruptLevel // 06: InterruptLevel + OptionalShareType // 07: SharedType + ',' PinConfigByte // 09: PinConfig + OptionalWordConstExpr // 10: DebounceTimeout + ',' StringData // 12: ResourceSource + OptionalByteConstExpr // 13: ResourceSourceIndex + OptionalResourceType // 14: ResourceType + OptionalNameString // 15: DescriptorName + OptionalBuffer_Last // 16: VendorData + ')' '{' + DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);} + | PARSEOP_GPIO_INT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +GpioIoTerm + : PARSEOP_GPIO_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_IO);} + OptionalShareType_First // 04: SharedType + ',' PinConfigByte // 06: PinConfig + OptionalWordConstExpr // 07: DebounceTimeout + OptionalWordConstExpr // 08: DriveStrength + OptionalIoRestriction // 09: IoRestriction + ',' StringData // 11: ResourceSource + OptionalByteConstExpr // 12: ResourceSourceIndex + OptionalResourceType // 13: ResourceType + OptionalNameString // 14: DescriptorName + OptionalBuffer_Last // 15: VendorData + ')' '{' + DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);} + | PARSEOP_GPIO_IO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +I2cSerialBusTerm + : PARSEOP_I2C_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_I2C_SERIALBUS);} + WordConstExpr // 04: SlaveAddress + OptionalSlaveMode // 05: SlaveMode + ',' DWordConstExpr // 07: ConnectionSpeed + OptionalAddressingMode // 08: AddressingMode + ',' StringData // 10: ResourceSource + OptionalByteConstExpr // 11: ResourceSourceIndex + OptionalResourceType // 12: ResourceType + OptionalNameString // 13: DescriptorName + OptionalBuffer_Last // 14: VendorData + ')' {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);} + | PARSEOP_I2C_SERIALBUS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + InterruptTerm : PARSEOP_INTERRUPT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INTERRUPT);} OptionalResourceType_First @@ -2787,6 +3080,34 @@ RegisterTerm error ')' {$$ = AslDoError(); yyclearin;} ; +SpiSerialBusTerm + : PARSEOP_SPI_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SPI_SERIALBUS);} + WordConstExpr // 04: DeviceSelection + OptionalDevicePolarity // 05: DevicePolarity + OptionalWireMode // 06: WireMode + ',' ByteConstExpr // 08: DataBitLength + OptionalSlaveMode // 09: SlaveMode + ',' DWordConstExpr // 11: ConnectionSpeed + ',' ClockPolarityKeyword // 13: ClockPolarity + ',' ClockPhaseKeyword // 15: ClockPhase + ',' StringData // 17: ResourceSource + OptionalByteConstExpr // 18: ResourceSourceIndex + OptionalResourceType // 19: ResourceType + OptionalNameString // 20: DescriptorName + OptionalBuffer_Last // 21: VendorData + ')' {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);} + | PARSEOP_SPI_SERIALBUS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +StartDependentFnNoPriTerm + : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} + ')' '{' + ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,1,$6);} + | PARSEOP_STARTDEPENDENTFN_NOPRI '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + StartDependentFnTerm : PARSEOP_STARTDEPENDENTFN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);} ByteConstExpr @@ -2797,11 +3118,24 @@ StartDependentFnTerm error ')' {$$ = AslDoError(); yyclearin;} ; -StartDependentFnNoPriTerm - : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} - ')' '{' - ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,1,$6);} - | PARSEOP_STARTDEPENDENTFN_NOPRI '(' +UartSerialBusTerm + : PARSEOP_UART_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);} + DWordConstExpr // 04: ConnectionSpeed + OptionalBitsPerByte // 05: BitsPerByte + OptionalStopBits // 06: StopBits + ',' ByteConstExpr // 08: LinesInUse + OptionalEndian // 09: Endianess + OptionalParityType // 10: Parity + OptionalFlowControl // 11: FlowControl + ',' WordConstExpr // 13: Rx BufferSize + ',' WordConstExpr // 15: Tx BufferSize + ',' StringData // 17: ResourceSource + OptionalByteConstExpr // 18: ResourceSourceIndex + OptionalResourceType // 19: ResourceType + OptionalNameString // 20: DescriptorName + OptionalBuffer_Last // 21: VendorData + ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);} + | PARSEOP_UART_SERIALBUS '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -2910,6 +3244,16 @@ AmlPackageLengthTerm : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);} ; +NameStringItem + : ',' NameString {$$ = $2;} + | ',' error {$$ = AslDoError (); yyclearin;} + ; + +TermArgItem + : ',' TermArg {$$ = $2;} + | ',' error {$$ = AslDoError (); yyclearin;} + ; + OptionalBusMasterKeyword : ',' {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} @@ -2929,12 +3273,28 @@ OptionalAccessSize | ',' ByteConstExpr {$$ = $2;} ; +OptionalAddressingMode + : ',' {$$ = NULL;} + | ',' AddressingModeKeyword {$$ = $2;} + ; + OptionalAddressRange : {$$ = NULL;} | ',' {$$ = NULL;} | ',' AddressKeyword {$$ = $2;} ; +OptionalBitsPerByte + : ',' {$$ = NULL;} + | ',' BitsPerByteKeyword {$$ = $2;} + ; + +OptionalBuffer_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' DataBufferTerm {$$ = $2;} + ; + OptionalByteConstExpr : {$$ = NULL;} | ',' {$$ = NULL;} @@ -2946,12 +3306,32 @@ OptionalDecodeType | ',' DecodeKeyword {$$ = $2;} ; +OptionalDevicePolarity + : ',' {$$ = NULL;} + | ',' DevicePolarityKeyword {$$ = $2;} + ; + OptionalDWordConstExpr : {$$ = NULL;} | ',' {$$ = NULL;} | ',' DWordConstExpr {$$ = $2;} ; +OptionalEndian + : ',' {$$ = NULL;} + | ',' EndianKeyword {$$ = $2;} + ; + +OptionalFlowControl + : ',' {$$ = NULL;} + | ',' FlowControlKeyword {$$ = $2;} + ; + +OptionalIoRestriction + : ',' {$$ = NULL;} + | ',' IoRestrictionKeyword {$$ = $2;} + ; + OptionalListString : {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ @@ -2995,6 +3375,11 @@ OptionalObjectTypeKeyword | ',' ObjectTypeKeyword {$$ = $2;} ; +OptionalParityType + : ',' {$$ = NULL;} + | ',' ParityTypeKeyword {$$ = $2;} + ; + OptionalQWordConstExpr : {$$ = NULL;} | ',' {$$ = NULL;} @@ -3006,6 +3391,12 @@ OptionalRangeType | ',' RangeTypeKeyword {$$ = $2;} ; +OptionalReadWriteKeyword + : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);} + ; + OptionalReference : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ | ',' {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ @@ -3013,27 +3404,48 @@ OptionalReference ; OptionalResourceType_First - : {$$ = NULL;} + : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} | ResourceTypeKeyword {$$ = $1;} ; OptionalResourceType - : ',' {$$ = NULL;} + : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | ',' {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} | ',' ResourceTypeKeyword {$$ = $2;} ; +OptionalReturnArg + : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */ + | TermArg {$$ = $1;} + ; + OptionalSerializeRuleKeyword : {$$ = NULL;} | ',' {$$ = NULL;} | ',' SerializeRuleKeyword {$$ = $2;} ; +OptionalSlaveMode + : ',' {$$ = NULL;} + | ',' SlaveModeKeyword {$$ = $2;} + ; + OptionalShareType : {$$ = NULL;} | ',' {$$ = NULL;} | ',' ShareTypeKeyword {$$ = $2;} ; +OptionalShareType_First + : {$$ = NULL;} + | ShareTypeKeyword {$$ = $1;} + ; + +OptionalStopBits + : ',' {$$ = NULL;} + | ',' StopBitsKeyword {$$ = $2;} + ; + OptionalStringData : {$$ = NULL;} | ',' {$$ = NULL;} @@ -3045,11 +3457,6 @@ OptionalTermArg | TermArg {$$ = $1;} ; -OptionalReturnArg - : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */ - | TermArg {$$ = $1;} - ; - OptionalType : {$$ = NULL;} | ',' {$$ = NULL;} @@ -3068,23 +3475,33 @@ OptionalTranslationType_Last | ',' TranslationKeyword {$$ = $2;} ; - -TermArgItem - : ',' TermArg {$$ = $2;} - | ',' error {$$ = AslDoError (); yyclearin;} +OptionalWireMode + : ',' {$$ = NULL;} + | ',' WireModeKeyword {$$ = $2;} ; -NameStringItem - : ',' NameString {$$ = $2;} - | ',' error {$$ = AslDoError (); yyclearin;} +OptionalWordConst + : {$$ = NULL;} + | WordConst {$$ = $1;} ; -%% +OptionalWordConstExpr + : ',' {$$ = NULL;} + | ',' WordConstExpr {$$ = $2;} + ; +OptionalXferSize + : {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} + | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} + | ',' XferSizeKeyword {$$ = $2;} + ; -/* +%% +/****************************************************************************** + * * Local support functions - */ + * + *****************************************************************************/ int AslCompilerwrap(void) diff --git a/compiler/asldefine.h b/compiler/asldefine.h index 4fae94b618cc..eafd70009d5a 100644 --- a/compiler/asldefine.h +++ b/compiler/asldefine.h @@ -56,7 +56,7 @@ #define ASL_INVOCATION_NAME "iasl" #define ASL_CREATOR_ID "INTL" -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 4.0a" +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 5.0" /* Configuration constants */ diff --git a/compiler/aslerror.c b/compiler/aslerror.c index 12f108a268b6..951aa3274267 100644 --- a/compiler/aslerror.c +++ b/compiler/aslerror.c @@ -319,10 +319,23 @@ AePrintException ( if (Enode->LineNumber) { + /* Main message: try to use string from AslMessages first */ + + if (!MainMessage) + { + MainMessage = ""; + } + MsgLength = strlen (MainMessage); if (MsgLength == 0) { + /* Use the secondary/extra message as main message */ + MainMessage = Enode->Message; + if (!MainMessage) + { + MainMessage = ""; + } MsgLength = strlen (MainMessage); ExtraMessage = NULL; diff --git a/compiler/aslload.c b/compiler/aslload.c index ed5a0a3b8be2..84a9476bf322 100644 --- a/compiler/aslload.c +++ b/compiler/aslload.c @@ -189,7 +189,7 @@ LdLoadFieldElements ( { case AML_INT_RESERVEDFIELD_OP: case AML_INT_ACCESSFIELD_OP: - + case AML_INT_CONNECTION_OP: break; default: @@ -224,8 +224,10 @@ LdLoadFieldElements ( } break; } + Child = Child->Asl.Next; } + return (AE_OK); } diff --git a/compiler/asllookup.c b/compiler/asllookup.c index bbe00cb83e51..50e6f0adfde4 100644 --- a/compiler/asllookup.c +++ b/compiler/asllookup.c @@ -1288,6 +1288,7 @@ LkNamespaceLocateBegin ( { case ACPI_ADR_SPACE_EC: case ACPI_ADR_SPACE_CMOS: + case ACPI_ADR_SPACE_GPIO: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) { @@ -1297,6 +1298,7 @@ LkNamespaceLocateBegin ( case ACPI_ADR_SPACE_SMBUS: case ACPI_ADR_SPACE_IPMI: + case ACPI_ADR_SPACE_GSBUS: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) { diff --git a/compiler/aslmain.c b/compiler/aslmain.c index d29c24c6f791..a2482234e72b 100644 --- a/compiler/aslmain.c +++ b/compiler/aslmain.c @@ -96,7 +96,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:T:G^v:w:x:z" +#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^mno:p:r:s:t:T:G^v:w:x:z" /******************************************************************************* @@ -158,6 +158,7 @@ Options ( ACPI_OPTION ("-dc [file]", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)"); ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution"); + ACPI_OPTION ("-m", "Do not translate Buffers to Resource Templates"); ACPI_OPTION ("-2", "Emit ACPI 2.0 compatible ASL code"); ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); @@ -601,6 +602,20 @@ AslDoOptions ( break; + case 'm': + + AcpiGbl_NoResourceDisassembly = TRUE; + break; + + + case 'n': + + /* Parse only */ + + Gbl_ParseOnlyFlag = TRUE; + break; + + case 'o': switch (AcpiGbl_Optarg[0]) @@ -649,14 +664,6 @@ AslDoOptions ( break; - case 'n': - - /* Parse only */ - - Gbl_ParseOnlyFlag = TRUE; - break; - - case 'p': /* Override default AML output filename */ diff --git a/compiler/aslmap.c b/compiler/aslmap.c index 6ea096200683..25e0ad716bc2 100644 --- a/compiler/aslmap.c +++ b/compiler/aslmap.c @@ -126,13 +126,16 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), -/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK, 0, 0), -/* ACCESSATTRIB_BLOCK_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK_CALL,0, 0), -/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BYTE, 0, 0), -/* ACCESSATTRIB_WORD_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD_CALL, 0, 0), -/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_QUICK, 0, 0), -/* ACCESSATTRIB_SND_RCV */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_SEND_RCV, 0, 0), -/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD, 0, 0), +/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK, 0, 0), +/* ACCESSATTRIB_BLOCK_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK_CALL, 0, 0), +/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BYTE, 0, 0), +/* ACCESSATTRIB_MULTIBYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_MULTIBYTE, 0, 0), +/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_QUICK, 0, 0), +/* ACCESSATTRIB_RAW_BYTES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_RAW_BYTES, 0, 0), +/* ACCESSATTRIB_RAW_PROCESS */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_RAW_PROCESS, 0, 0), +/* ACCESSATTRIB_SND_RCV */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SEND_RCV, 0, 0), +/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_WORD, 0, 0), +/* ACCESSATTRIB_WORD_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_WORD_CALL, 0, 0), /* ACCESSTYPE_ANY */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_ANY, 0, 0), /* ACCESSTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BUFFER, 0, 0), /* ACCESSTYPE_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BYTE, 0, 0), @@ -141,7 +144,8 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* ACCESSTYPE_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_WORD, 0, 0), /* ACQUIRE */ OP_TABLE_ENTRY (AML_ACQUIRE_OP, 0, 0, ACPI_BTYPE_INTEGER), /* ADD */ OP_TABLE_ENTRY (AML_ADD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0), +/* ADDRESSINGMODE_7BIT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* ADDRESSINGMODE_10BIT */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* ADDRESSTYPE_ACPI */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* ADDRESSTYPE_MEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* ADDRESSTYPE_NVS */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), @@ -156,6 +160,11 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* ARG5 */ OP_TABLE_ENTRY (AML_ARG5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), /* ARG6 */ OP_TABLE_ENTRY (AML_ARG6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), /* BANKFIELD */ OP_TABLE_ENTRY (AML_BANK_FIELD_OP, 0, NODE_AML_PACKAGE, 0), +/* BITSPERBYTE_EIGHT */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), +/* BITSPERBYTE_FIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* BITSPERBYTE_NINE */ OP_TABLE_ENTRY (AML_BYTE_OP, 4, 0, 0), +/* BITSPERBYTE_SEVEN */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), +/* BITSPERBYTE_SIX */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* BREAK */ OP_TABLE_ENTRY (AML_BREAK_OP, 0, 0, 0), /* BREAKPOINT */ OP_TABLE_ENTRY (AML_BREAK_POINT_OP, 0, 0, 0), /* BUFFER */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_BUFFER), @@ -163,9 +172,14 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* BUSMASTERTYPE_NOTMASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* BYTECONST */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, 0, 0, ACPI_BTYPE_INTEGER), /* CASE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* CLOCKPHASE_FIRST */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* CLOCKPHASE_SECOND */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* CLOCKPOLARITY_HIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* CLOCKPOLARITY_LOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* CONCATENATE */ OP_TABLE_ENTRY (AML_CONCAT_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA), /* CONCATENATERESTEMPLATE */ OP_TABLE_ENTRY (AML_CONCAT_RES_OP, 0, 0, ACPI_BTYPE_BUFFER), /* CONDREFOF */ OP_TABLE_ENTRY (AML_COND_REF_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), +/* CONNECTION */ OP_TABLE_ENTRY (AML_INT_CONNECTION_OP, 0, 0, 0), /* CONTINUE */ OP_TABLE_ENTRY (AML_CONTINUE_OP, 0, 0, 0), /* COPY */ OP_TABLE_ENTRY (AML_COPY_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), /* CREATEBITFIELD */ OP_TABLE_ENTRY (AML_CREATE_BIT_FIELD_OP, 0, 0, 0), @@ -174,6 +188,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* CREATEFIELD */ OP_TABLE_ENTRY (AML_CREATE_FIELD_OP, 0, 0, 0), /* CREATEQWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_QWORD_FIELD_OP, 0, 0, 0), /* CREATEWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_WORD_FIELD_OP, 0, 0, 0), +/* DATABUFFER */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* DATATABLEREGION */ OP_TABLE_ENTRY (AML_DATA_REGION_OP, 0, 0, 0), /* DEBUG */ OP_TABLE_ENTRY (AML_DEBUG_OP, 0, 0, ACPI_BTYPE_DEBUG_OBJECT), /* DECODETYPE_POS */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), @@ -184,6 +199,8 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* DEFINITIONBLOCK */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* DEREFOF */ OP_TABLE_ENTRY (AML_DEREF_OF_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_STRING), /* DEVICE */ OP_TABLE_ENTRY (AML_DEVICE_OP, 0, NODE_AML_PACKAGE, 0), +/* DEVICEPOLARITY_HIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* DEVICEPOLARITY_LOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* DIVIDE */ OP_TABLE_ENTRY (AML_DIVIDE_OP, 0, 0, ACPI_BTYPE_INTEGER), /* DMA */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* DMATYPE_A */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), @@ -198,6 +215,8 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0), /* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0), /* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* ENDIAN_BIG */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* ENDIAN_LITTLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* ENDTAG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* ERRORNODE */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0), /* EVENT */ OP_TABLE_ENTRY (AML_EVENT_OP, 0, 0, 0), @@ -209,9 +228,16 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* FIELD */ OP_TABLE_ENTRY (AML_FIELD_OP, 0, NODE_AML_PACKAGE, 0), /* FINDSETLEFTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_LEFT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), /* FINDSETRIGHTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), +/* FIXEDDMA */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* FIXEDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* FLOWCONTROL_HW */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* FLOWCONTROL_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* FLOWCONTROL_SW */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* FROMBCD */ OP_TABLE_ENTRY (AML_FROM_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER), /* FUNCTION */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0), +/* GPIOINT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* GPIOIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* I2CSERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0), /* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* INCLUDE_CSTYLE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), @@ -221,6 +247,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0), /* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER), /* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* INTLEVEL_ACTIVEBOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* INTLEVEL_ACTIVEHIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* INTLEVEL_ACTIVELOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* INTTYPE_EDGE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), @@ -228,6 +255,10 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* IO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* IODECODETYPE_10 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* IODECODETYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* IORESTRICT_IN */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* IORESTRICT_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* IORESTRICT_OUT */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), +/* IORESTRICT_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), /* IRQ */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* IRQNOFLAGS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* LAND */ OP_TABLE_ENTRY (AML_LAND_OP, 0, 0, ACPI_BTYPE_INTEGER), @@ -308,6 +339,15 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* OR */ OP_TABLE_ENTRY (AML_BIT_OR_OP, 0, 0, ACPI_BTYPE_INTEGER), /* PACKAGE */ OP_TABLE_ENTRY (AML_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE), /* PACKAGEP_LENGTH */ OP_TABLE_ENTRY (AML_PACKAGE_LENGTH, 0, NODE_AML_PACKAGE, 0), +/* PARITYTYPE_EVEN */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* PARITYTYPE_MARK */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), +/* PARITYTYPE_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* PARITYTYPE_ODD */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), +/* PARITYTYPE_SPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 4, 0, 0), +/* PIN_NOPULL */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), +/* PIN_PULLDEFAULT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* PIN_PULLDOWN */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), +/* PIN_PULLUP */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RES_OP, 0, NODE_AML_PACKAGE, 0), /* PROCESSOR */ OP_TABLE_ENTRY (AML_PROCESSOR_OP, 0, NODE_AML_PACKAGE, 0), /* QWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER), @@ -323,6 +363,9 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE), /* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_CMOS, 0, 0), /* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_EC, 0, 0), +/* REGIONSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0), +/* REGIONSPACE_GPIO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_GPIO, 0, 0), +/* REGIONSPACE_GSBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_GSBUS, 0, 0), /* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_IO, 0, 0), /* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_IPMI, 0, 0), /* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_MEMORY, 0, 0), @@ -342,15 +385,24 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* SERIALIZERULE_NOTSERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* SERIALIZERULE_SERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* SHARETYPE_EXCLUSIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* SHARETYPE_EXCLUSIVEWAKE */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* SHARETYPE_SHARED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* SHARETYPE_SHAREDWAKE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), /* SHIFTLEFT */ OP_TABLE_ENTRY (AML_SHIFT_LEFT_OP, 0, 0, ACPI_BTYPE_INTEGER), /* SHIFTRIGHT */ OP_TABLE_ENTRY (AML_SHIFT_RIGHT_OP, 0, 0, ACPI_BTYPE_INTEGER), /* SIGNAL */ OP_TABLE_ENTRY (AML_SIGNAL_OP, 0, 0, 0), /* SIZEOF */ OP_TABLE_ENTRY (AML_SIZE_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), +/* SLAVEMODE_CONTROLLERINIT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* SLAVEMODE_DEVICEINIT */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* SLEEP */ OP_TABLE_ENTRY (AML_SLEEP_OP, 0, 0, 0), +/* SPISERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* STALL */ OP_TABLE_ENTRY (AML_STALL_OP, 0, 0, 0), /* STARTDEPENDENTFN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* STARTDEPENDENTFN_NOPRI */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* STOPBITS_ONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* STOPBITS_ONEPLUSHALF */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), +/* STOPBITS_TWO */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), +/* STOPBITS_ZERO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* STORE */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), /* STRING_LITERAL */ OP_TABLE_ENTRY (AML_STRING_OP, 0, 0, ACPI_BTYPE_STRING), /* SUBTRACT */ OP_TABLE_ENTRY (AML_SUBTRACT_OP, 0, 0, ACPI_BTYPE_INTEGER), @@ -368,6 +420,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* TRANSLATIONTYPE_SPARSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* TYPE_STATIC */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), +/* UART_SERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, 0), /* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0), /* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0), @@ -378,10 +431,18 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* VENDORSHORT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* WAIT */ OP_TABLE_ENTRY (AML_WAIT_OP, 0, 0, ACPI_BTYPE_INTEGER), /* WHILE */ OP_TABLE_ENTRY (AML_WHILE_OP, 0, NODE_AML_PACKAGE, 0), +/* WIREMODE_FOUR */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* WIREMODE_THREE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* WORDBUSNUMBER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* WORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_WORD, 0, 0, ACPI_BTYPE_INTEGER), /* WORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* WORDSPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* XFERSIZE_8 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* XFERSIZE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* XFERSIZE_32 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* XFERSIZE_64 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* XFERSIZE_128 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* XFERSIZE_256 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* XFERTYPE_8 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* XFERTYPE_8_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* XFERTYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), diff --git a/compiler/aslmessages.h b/compiler/aslmessages.h index cc015be0bc92..77a5c026b755 100644 --- a/compiler/aslmessages.h +++ b/compiler/aslmessages.h @@ -73,6 +73,8 @@ typedef enum ASL_MSG_CLOSE, ASL_MSG_COMPILER_INTERNAL, ASL_MSG_COMPILER_RESERVED, + ASL_MSG_CONNECTION_MISSING, + ASL_MSG_CONNECTION_INVALID, ASL_MSG_CONSTANT_EVALUATION, ASL_MSG_CONSTANT_FOLDED, ASL_MSG_CORE_EXCEPTION, @@ -93,6 +95,8 @@ typedef enum ASL_MSG_FIELD_UNIT_OFFSET, ASL_MSG_GPE_NAME_CONFLICT, ASL_MSG_HID_LENGTH, + ASL_MSG_HID_PREFIX, + ASL_MSG_HID_SUFFIX, ASL_MSG_INCLUDE_FILE_OPEN, ASL_MSG_INPUT_FILE_OPEN, ASL_MSG_INTEGER_LENGTH, @@ -229,6 +233,8 @@ char *AslMessages [] = { /* ASL_MSG_CLOSE */ "Could not close file", /* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error", /* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", +/* ASL_MSG_CONNECTION_MISSING */ "A Connection operator is required for this field SpaceId", +/* ASL_MSG_CONNECTION_INVALID */ "Invalid OpRegion SpaceId for use of Connection operator", /* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression", /* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced", /* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem", @@ -249,6 +255,8 @@ char *AslMessages [] = { /* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit", /* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method", /* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters", +/* ASL_MSG_HID_PREFIX */ "_HID prefix must be all uppercase or decimal digits", +/* ASL_MSG_HID_SUFFIX */ "_HID suffix must be all hex digits", /* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", /* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", /* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating", diff --git a/compiler/aslopcodes.c b/compiler/aslopcodes.c index b66db04a86c4..6317ad31877b 100644 --- a/compiler/aslopcodes.c +++ b/compiler/aslopcodes.c @@ -58,6 +58,10 @@ OpcDoAccessAs ( ACPI_PARSE_OBJECT *Op); static void +OpcDoConnection ( + ACPI_PARSE_OBJECT *Op); + +static void OpcDoUnicode ( ACPI_PARSE_OBJECT *Op); @@ -321,26 +325,128 @@ static void OpcDoAccessAs ( ACPI_PARSE_OBJECT *Op) { - ACPI_PARSE_OBJECT *Next; + ACPI_PARSE_OBJECT *TypeOp; + ACPI_PARSE_OBJECT *AttribOp; + ACPI_PARSE_OBJECT *LengthOp; + UINT8 Attribute; Op->Asl.AmlOpcodeLength = 1; - Next = Op->Asl.Child; + TypeOp = Op->Asl.Child; /* First child is the access type */ - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; + TypeOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; + TypeOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; /* Second child is the optional access attribute */ - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + AttribOp = TypeOp->Asl.Next; + if (AttribOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + AttribOp->Asl.Value.Integer = 0; + } + AttribOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; + AttribOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; + + /* Only a few AccessAttributes support AccessLength */ + + Attribute = (UINT8) AttribOp->Asl.Value.Integer; + if ((Attribute != AML_FIELD_ATTRIB_MULTIBYTE) && + (Attribute != AML_FIELD_ATTRIB_RAW_BYTES) && + (Attribute != AML_FIELD_ATTRIB_RAW_PROCESS)) + { + return; + } + + Op->Asl.AmlOpcode = AML_FIELD_EXT_ACCESS_OP; + + /* + * Child of Attributes is the AccessLength (required for Multibyte, + * RawBytes, RawProcess.) + */ + LengthOp = AttribOp->Asl.Child; + if (!LengthOp) + { + return; + } + + /* TBD: probably can remove */ + + if (LengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + LengthOp->Asl.Value.Integer = 16; + } + + LengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; + LengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; +} + + +/******************************************************************************* + * + * FUNCTION: OpcDoConnection + * + * PARAMETERS: Op - Parse node + * + * RETURN: None + * + * DESCRIPTION: Implement the Connection ASL keyword. + * + ******************************************************************************/ + +static void +OpcDoConnection ( + ACPI_PARSE_OBJECT *Op) +{ + ASL_RESOURCE_NODE *Rnode; + ACPI_PARSE_OBJECT *BufferOp; + ACPI_PARSE_OBJECT *BufferLengthOp; + ACPI_PARSE_OBJECT *BufferDataOp; + UINT8 State; + + + Op->Asl.AmlOpcodeLength = 1; + + if (Op->Asl.Child->Asl.AmlOpcode == AML_INT_NAMEPATH_OP) + { + return; + } + + BufferOp = Op->Asl.Child; + BufferLengthOp = BufferOp->Asl.Child; + BufferDataOp = BufferLengthOp->Asl.Next; + + State = ACPI_RSTATE_NORMAL; + Rnode = RsDoOneResourceDescriptor (BufferDataOp->Asl.Next, 0, &State); + if (!Rnode) { - Next->Asl.Value.Integer = 0; + return; /* error */ } - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; + + /* + * Transform the nodes into the following + * + * Op -> AML_BUFFER_OP + * First Child -> BufferLength + * Second Child -> Descriptor Buffer (raw byte data) + */ + BufferOp->Asl.ParseOpcode = PARSEOP_BUFFER; + BufferOp->Asl.AmlOpcode = AML_BUFFER_OP; + BufferOp->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; + UtSetParseOpName (BufferOp); + + BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; + BufferLengthOp->Asl.Value.Integer = Rnode->BufferLength; + (void) OpcSetOptimalIntegerSize (BufferLengthOp); + UtSetParseOpName (BufferLengthOp); + + BufferDataOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; + BufferDataOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; + BufferDataOp->Asl.AmlOpcodeLength = 0; + BufferDataOp->Asl.AmlLength = Rnode->BufferLength; + BufferDataOp->Asl.Value.Buffer = (UINT8 *) Rnode; + UtSetParseOpName (BufferDataOp); } @@ -545,7 +651,7 @@ OpcDoEisaId ( /******************************************************************************* * - * FUNCTION: OpcDoUiId + * FUNCTION: OpcDoUuId * * PARAMETERS: Op - Parse node * @@ -665,6 +771,11 @@ OpcGenerateAmlOpcode ( OpcDoAccessAs (Op); break; + case PARSEOP_CONNECTION: + + OpcDoConnection (Op); + break; + case PARSEOP_EISAID: OpcDoEisaId (Op); diff --git a/compiler/aslpredef.c b/compiler/aslpredef.c index f1fec290bc3f..d03a40adebfd 100644 --- a/compiler/aslpredef.c +++ b/compiler/aslpredef.c @@ -100,30 +100,49 @@ static const ACPI_PREDEFINED_INFO ResourceNames[] = { {{"_ATT", 0, 0}}, {{"_BAS", 0, 0}}, {{"_BM_", 0, 0}}, + {{"_DBT", 0, 0}}, /* Acpi 5.0 */ {{"_DEC", 0, 0}}, + {{"_DPL", 0, 0}}, /* Acpi 5.0 */ + {{"_DRS", 0, 0}}, /* Acpi 5.0 */ + {{"_END", 0, 0}}, /* Acpi 5.0 */ + {{"_FLC", 0, 0}}, /* Acpi 5.0 */ {{"_GRA", 0, 0}}, {{"_HE_", 0, 0}}, {{"_INT", 0, 0}}, + {{"_IOR", 0, 0}}, /* Acpi 5.0 */ {{"_LEN", 0, 0}}, + {{"_LIN", 0, 0}}, /* Acpi 5.0 */ {{"_LL_", 0, 0}}, {{"_MAF", 0, 0}}, {{"_MAX", 0, 0}}, {{"_MEM", 0, 0}}, {{"_MIF", 0, 0}}, {{"_MIN", 0, 0}}, + {{"_MOD", 0, 0}}, /* Acpi 5.0 */ {{"_MTP", 0, 0}}, + {{"_PAR", 0, 0}}, /* Acpi 5.0 */ + {{"_PHA", 0, 0}}, /* Acpi 5.0 */ + {{"_PIN", 0, 0}}, /* Acpi 5.0 */ + {{"_PPI", 0, 0}}, /* Acpi 5.0 */ + {{"_POL", 0, 0}}, /* Acpi 5.0 */ {{"_RBO", 0, 0}}, {{"_RBW", 0, 0}}, {{"_RNG", 0, 0}}, {{"_RT_", 0, 0}}, /* Acpi 3.0 */ {{"_RW_", 0, 0}}, + {{"_RXL", 0, 0}}, /* Acpi 5.0 */ {{"_SHR", 0, 0}}, {{"_SIZ", 0, 0}}, + {{"_SLV", 0, 0}}, /* Acpi 5.0 */ + {{"_SPE", 0, 0}}, /* Acpi 5.0 */ + {{"_STB", 0, 0}}, /* Acpi 5.0 */ {{"_TRA", 0, 0}}, {{"_TRS", 0, 0}}, {{"_TSF", 0, 0}}, /* Acpi 3.0 */ {{"_TTP", 0, 0}}, + {{"_TXL", 0, 0}}, /* Acpi 5.0 */ {{"_TYP", 0, 0}}, + {{"_VEN", 0, 0}}, /* Acpi 5.0 */ {{{0,0,0,0}, 0, 0}} /* Table terminator */ }; @@ -818,4 +837,3 @@ ApGetExpectedTypes ( ThisRtype <<= 1; /* Next Rtype */ } } - diff --git a/compiler/aslresource.c b/compiler/aslresource.c index 0954b8460d5d..d614f1ad4e04 100644 --- a/compiler/aslresource.c +++ b/compiler/aslresource.c @@ -513,6 +513,29 @@ RsSetFlagBits ( } +void +RsSetFlagBits16 ( + UINT16 *Flags, + ACPI_PARSE_OBJECT *Op, + UINT8 Position, + UINT8 DefaultBit) +{ + + if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Use the default bit */ + + *Flags |= (DefaultBit << Position); + } + else + { + /* Use the bit specified in the initialization node */ + + *Flags |= (((UINT16) Op->Asl.Value.Integer) << Position); + } +} + + /******************************************************************************* * * FUNCTION: RsCompleteNodeAndGetNext @@ -637,6 +660,11 @@ RsDoOneResourceDescriptor ( CurrentByteOffset); break; + case PARSEOP_FIXEDDMA: + Rnode = RsDoFixedDmaDescriptor (DescriptorTypeOp, + CurrentByteOffset); + break; + case PARSEOP_DWORDIO: Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset); @@ -820,6 +848,31 @@ RsDoOneResourceDescriptor ( CurrentByteOffset); break; + case PARSEOP_GPIO_INT: + Rnode = RsDoGpioIntDescriptor (DescriptorTypeOp, + CurrentByteOffset); + break; + + case PARSEOP_GPIO_IO: + Rnode = RsDoGpioIoDescriptor (DescriptorTypeOp, + CurrentByteOffset); + break; + + case PARSEOP_I2C_SERIALBUS: + Rnode = RsDoI2cSerialBusDescriptor (DescriptorTypeOp, + CurrentByteOffset); + break; + + case PARSEOP_SPI_SERIALBUS: + Rnode = RsDoSpiSerialBusDescriptor (DescriptorTypeOp, + CurrentByteOffset); + break; + + case PARSEOP_UART_SERIALBUS: + Rnode = RsDoUartSerialBusDescriptor (DescriptorTypeOp, + CurrentByteOffset); + break; + case PARSEOP_DEFAULT_ARG: /* Just ignore any of these, they are used as fillers/placeholders */ break; @@ -994,10 +1047,12 @@ RsDoResourceTemplate ( Op->Asl.ParseOpcode = PARSEOP_BUFFER; Op->Asl.AmlOpcode = AML_BUFFER_OP; Op->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC; + UtSetParseOpName (Op); BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; (void) OpcSetOptimalIntegerSize (BufferLengthOp); + UtSetParseOpName (BufferLengthOp); BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; @@ -1005,8 +1060,7 @@ RsDoResourceTemplate ( BufferOp->Asl.AmlLength = CurrentByteOffset; BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; BufferOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DATA; + UtSetParseOpName (BufferOp); return; } - - diff --git a/compiler/aslrestype1i.c b/compiler/aslrestype1i.c index 2c8c79044369..a2def60b9003 100644 --- a/compiler/aslrestype1i.c +++ b/compiler/aslrestype1i.c @@ -53,6 +53,7 @@ * This module contains the I/O-related small resource descriptors: * * DMA + * FixedDMA * FixedIO * IO * IRQ @@ -182,6 +183,81 @@ RsDoDmaDescriptor ( /******************************************************************************* * + * FUNCTION: RsDoFixedDmaDescriptor + * + * PARAMETERS: Op - Parent resource descriptor parse node + * CurrentByteOffset - Offset into the resource template AML + * buffer (to track references to the desc) + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a short "FixedDMA" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoFixedDmaDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + UINT32 i; + + + InitializerOp = Op->Asl.Child; + Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_DMA)); + + Descriptor = Rnode->Buffer; + Descriptor->FixedDma.DescriptorType = + ACPI_RESOURCE_NAME_FIXED_DMA | ASL_RDESC_FIXED_DMA_SIZE; + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* DMA Request Lines [WORD] (_DMA) */ + + Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA, + CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines)); + break; + + case 1: /* DMA Channel [WORD] (_TYP) */ + + Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels)); + break; + + case 2: /* Transfer Width [BYTE] (_SIZ) */ + + Descriptor->FixedDma.Width = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_XFERTYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Width)); + break; + + case 3: /* Descriptor Name (optional) */ + + UtAttachNamepathToOwner (Op, InitializerOp); + break; + + default: /* Ignore any extra nodes */ + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * * FUNCTION: RsDoFixedIoDescriptor * * PARAMETERS: Op - Parent resource descriptor parse node diff --git a/compiler/aslrestype2.c b/compiler/aslrestype2.c index 31119d75d5dd..bf7649408bec 100644 --- a/compiler/aslrestype2.c +++ b/compiler/aslrestype2.c @@ -1,4 +1,3 @@ - /****************************************************************************** * * Module Name: aslrestype2 - Miscellaneous Large resource descriptors diff --git a/compiler/aslrestype2s.c b/compiler/aslrestype2s.c new file mode 100644 index 000000000000..1b6ebf748fef --- /dev/null +++ b/compiler/aslrestype2s.c @@ -0,0 +1,1187 @@ +/****************************************************************************** + * + * Module Name: aslrestype2s - Serial Large resource descriptors + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "amlcode.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslrestype2s") + + +static UINT16 +RsGetBufferDataLength ( + ACPI_PARSE_OBJECT *InitializerOp); + +static UINT16 +RsGetInterruptDataLength ( + ACPI_PARSE_OBJECT *InitializerOp); + +static BOOLEAN +RsGetVendorData ( + ACPI_PARSE_OBJECT *InitializerOp, + UINT8 *VendorData, + ACPI_SIZE DescriptorOffset); + +/* + * This module contains descriptors for serial buses and GPIO: + * + * GpioInt + * GpioIo + * I2cSerialBus + * SpiSerialBus + * UartSerialBus + */ + + +/******************************************************************************* + * + * FUNCTION: RsGetBufferDataLength + * + * PARAMETERS: InitializerOp - Current parse op, start of the resource + * descriptor + * + * RETURN: Length of the data buffer + * + * DESCRIPTION: Get the length of a RawDataBuffer, used for vendor data. + * + ******************************************************************************/ + +static UINT16 +RsGetBufferDataLength ( + ACPI_PARSE_OBJECT *InitializerOp) +{ + UINT16 ExtraDataSize = 0; + ACPI_PARSE_OBJECT *DataList; + + + /* Find the byte-initializer list */ + + while (InitializerOp) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DATABUFFER) + { + /* First child is the optional length (ignore it here) */ + + DataList = InitializerOp->Asl.Child; + DataList = ASL_GET_PEER_NODE (DataList); + + /* Count the data items (each one is a byte of data) */ + + while (DataList) + { + ExtraDataSize++; + DataList = ASL_GET_PEER_NODE (DataList); + } + + return (ExtraDataSize); + } + + InitializerOp = ASL_GET_PEER_NODE (InitializerOp); + } + + return (ExtraDataSize); +} + + +/******************************************************************************* + * + * FUNCTION: RsGetInterruptDataLength + * + * PARAMETERS: InitializerOp - Current parse op, start of the resource + * descriptor + * + * RETURN: Length of the interrupt data list + * + * DESCRIPTION: Get the length of a list of interrupt DWORDs for the GPIO + * descriptors. + * + ******************************************************************************/ + +static UINT16 +RsGetInterruptDataLength ( + ACPI_PARSE_OBJECT *InitializerOp) +{ + UINT16 InterruptLength; + UINT32 i; + + + /* Count the interrupt numbers */ + + InterruptLength = 0; + for (i = 0; InitializerOp; i++) + { + InitializerOp = ASL_GET_PEER_NODE (InitializerOp); + + /* Interrupt list starts at offset 10 (Gpio descriptors) */ + + if (i >= 10) + { + InterruptLength += 2; + } + } + + return (InterruptLength); +} + + +/******************************************************************************* + * + * FUNCTION: RsGetVendorData + * + * PARAMETERS: InitializerOp - Current parse op, start of the resource + * descriptor. + * VendorData - Where the vendor data is returned + * DescriptorOffset - Where vendor data begins in descriptor + * + * RETURN: TRUE if valid vendor data was returned, FALSE otherwise. + * + * DESCRIPTION: Extract the vendor data and construct a vendor data buffer. + * + ******************************************************************************/ + +static BOOLEAN +RsGetVendorData ( + ACPI_PARSE_OBJECT *InitializerOp, + UINT8 *VendorData, + ACPI_SIZE DescriptorOffset) +{ + ACPI_PARSE_OBJECT *BufferOp; + UINT32 SpecifiedLength = ACPI_UINT32_MAX; + UINT16 ActualLength = 0; + + + /* VendorData field is always optional */ + + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + return (FALSE); + } + + BufferOp = InitializerOp->Asl.Child; + if (!BufferOp) + { + AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, ""); + return (FALSE); + } + + /* First child is the optional buffer length (WORD) */ + + if (BufferOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + SpecifiedLength = (UINT16) BufferOp->Asl.Value.Integer; + } + + /* Insert field tag _VEN */ + + RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA, + (UINT16) DescriptorOffset); + + /* Walk the list of buffer initializers (each is one byte) */ + + BufferOp = RsCompleteNodeAndGetNext (BufferOp); + if (BufferOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + while (BufferOp) + { + *VendorData = (UINT8) BufferOp->Asl.Value.Integer; + VendorData++; + ActualLength++; + BufferOp = RsCompleteNodeAndGetNext (BufferOp); + } + } + + /* Length validation. Buffer cannot be of zero length */ + + if ((SpecifiedLength == 0) || + ((SpecifiedLength == ACPI_UINT32_MAX) && (ActualLength == 0))) + { + AslError (ASL_ERROR, ASL_MSG_BUFFER_LENGTH, InitializerOp, NULL); + return (FALSE); + } + + if (SpecifiedLength != ACPI_UINT32_MAX) + { + /* ActualLength > SpecifiedLength -> error */ + + if (ActualLength > SpecifiedLength) + { + AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG, InitializerOp, NULL); + return (FALSE); + } + + /* ActualLength < SpecifiedLength -> remark */ + + else if (ActualLength < SpecifiedLength) + { + AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT, InitializerOp, NULL); + return (FALSE); + } + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoGpioIntDescriptor + * + * PARAMETERS: Op - Parent resource descriptor parse node + * CurrentByteOffset - Offset into the resource template AML + * buffer (to track references to the desc) + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "GpioInt" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoGpioIntDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 *InterruptList = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 InterruptLength; + UINT16 DescriptorSize; + UINT32 i; + + + InitializerOp = Op->Asl.Child; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + InterruptLength = RsGetInterruptDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + + ResSourceLength + VendorLength + InterruptLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->Gpio.ResourceLength = DescriptorSize; + Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO; + Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION; + Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT; + + /* Build pointers to optional areas */ + + InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO)); + ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); + + /* Setup offsets within the descriptor */ + + Descriptor->Gpio.PinTableOffset = (UINT16) + ACPI_PTR_DIFF (InterruptList, Descriptor); + + Descriptor->Gpio.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + + DbgPrint (ASL_DEBUG_OUTPUT, + "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, IntLen: %.2X\n", + "GpioInt", Descriptor->Gpio.ResourceLength, (UINT16) sizeof (AML_RESOURCE_GPIO), + ResSourceLength, VendorLength, InterruptLength); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */ + + RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0); + break; + + case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */ + + RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 1, 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_POLARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 1, 2); + break; + + case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3, 2); + break; + + case 3: /* Pin Config [BYTE] (_PPI) */ + + Descriptor->Gpio.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.PinConfig)); + break; + + case 4: /* DebounceTimeout [WORD] (_DBT) */ + + Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout)); + break; + + case 5: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, + InitializerOp->Asl.Value.String); + } + break; + + case 6: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->Gpio.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 7: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1); + break; + + case 8: /* ResourceTag (Descriptor Name) */ + + UtAttachNamepathToOwner (Op, InitializerOp); + break; + + case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->Gpio.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->Gpio.VendorOffset))) + { + Descriptor->Gpio.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a DWORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; + InterruptList++; + + /* Case 10: First interrupt number in list */ + + if (i == 10) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->Gpio.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoGpioIoDescriptor + * + * PARAMETERS: Op - Parent resource descriptor parse node + * CurrentByteOffset - Offset into the resource template AML + * buffer (to track references to the desc) + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "GpioIo" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoGpioIoDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 *InterruptList = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 InterruptLength; + UINT16 DescriptorSize; + UINT32 i; + + + InitializerOp = Op->Asl.Child; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + InterruptLength = RsGetInterruptDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + + ResSourceLength + VendorLength + InterruptLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->Gpio.ResourceLength = DescriptorSize; + Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO; + Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION; + Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO; + + /* Build pointers to optional areas */ + + InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO)); + ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); + + /* Setup offsets within the descriptor */ + + Descriptor->Gpio.PinTableOffset = (UINT16) + ACPI_PTR_DIFF (InterruptList, Descriptor); + + Descriptor->Gpio.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + + DbgPrint (ASL_DEBUG_OUTPUT, + "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, IntLen: %.2X\n", + "GpioIo", Descriptor->Gpio.ResourceLength, (UINT16) sizeof (AML_RESOURCE_GPIO), + ResSourceLength, VendorLength, InterruptLength); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3); + break; + + case 1: /* Pin Config [BYTE] (_PPI) */ + + Descriptor->Gpio.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.PinConfig)); + break; + + case 2: /* DebounceTimeout [WORD] (_DBT) */ + + Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout)); + break; + + case 3: /* Drive Strength [WORD] (_DRS) */ + + Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength)); + break; + + case 4: /* I/O Restriction [Flag] (_IOR) */ + + RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION, + CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2); + break; + + case 5: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, + InitializerOp->Asl.Value.String); + } + break; + + case 6: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->Gpio.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 7: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1); + break; + + case 8: /* ResourceTag (Descriptor Name) */ + + UtAttachNamepathToOwner (Op, InitializerOp); + break; + + case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->Gpio.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->Gpio.VendorOffset))) + { + Descriptor->Gpio.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a DWORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; + InterruptList++; + + /* Case 10: First interrupt number in list */ + + if (i == 10) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->Gpio.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoI2cSerialBusDescriptor + * + * PARAMETERS: Op - Parent resource descriptor parse node + * CurrentByteOffset - Offset into the resource template AML + * buffer (to track references to the desc) + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "I2cSerialBus" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoI2cSerialBusDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 DescriptorSize; + UINT32 i; + + + InitializerOp = Op->Asl.Child; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS) + + ResSourceLength + VendorLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->I2cSerialBus.ResourceLength = DescriptorSize; + Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; + Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION; + Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION; + Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE; + Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength; + + /* Build pointers to optional areas */ + + VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS)); + ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); + + DbgPrint (ASL_DEBUG_OUTPUT, + "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n", + "I2cSerialBus", Descriptor->I2cSerialBus.ResourceLength, + (UINT16) sizeof (AML_RESOURCE_I2C_SERIALBUS), ResSourceLength, + VendorLength, Descriptor->I2cSerialBus.TypeDataLength); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Slave Address [WORD] (_ADR) */ + + Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, + CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress)); + break; + + case 1: /* Slave Mode [Flag] (_SLV) */ + + RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 0); + break; + + case 2: /* ConnectionSpeed [DWORD] (_SPE) */ + + Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, + CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed)); + break; + + case 3: /* Addresssing Mode [Flag] (_MOD) */ + + RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0); + break; + + case 4: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, + InitializerOp->Asl.Value.String); + } + break; + + case 5: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->I2cSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 6: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 1, 1); + break; + + case 7: /* ResourceTag (Descriptor Name) */ + + UtAttachNamepathToOwner (Op, InitializerOp); + break; + + case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + + RsGetVendorData (InitializerOp, VendorData, + CurrentByteOffset + sizeof (AML_RESOURCE_I2C_SERIALBUS)); + break; + + default: /* Ignore any extra nodes */ + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoSpiSerialBusDescriptor + * + * PARAMETERS: Op - Parent resource descriptor parse node + * CurrentByteOffset - Offset into the resource template AML + * buffer (to track references to the desc) + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "SPI Serial Bus" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoSpiSerialBusDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 DescriptorSize; + UINT32 i; + + + InitializerOp = Op->Asl.Child; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS) + + ResSourceLength + VendorLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->SpiSerialBus.ResourceLength = DescriptorSize; + Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; + Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION; + Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION; + Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE; + Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength; + + /* Build pointers to optional areas */ + + VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_SPI_SERIALBUS)); + ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); + + DbgPrint (ASL_DEBUG_OUTPUT, + "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n", + "SpiSerialBus", Descriptor->SpiSerialBus.ResourceLength, + (UINT16) sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength, + VendorLength, Descriptor->SpiSerialBus.TypeDataLength); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Device Selection [WORD] (_ADR) */ + + Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection)); + break; + + case 1: /* Device Polarity [Flag] (_DPL) */ + + RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1); + break; + + case 2: /* Wire Mode [Flag] (_MOD) */ + + RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0); + break; + + case 3: /* Device Bit Length [BYTE] (_LEN) */ + + Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DataBitLength)); + break; + + case 4: /* Slave Mode [Flag] (_SLV) */ + + RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 0); + break; + + case 5: /* ConnectionSpeed [DWORD] (_SPE) */ + + Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed)); + break; + + case 6: /* Clock Polarity [BYTE] (_POL) */ + + Descriptor->SpiSerialBus.ClockPolarity = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_POLARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPolarity)); + break; + + case 7: /* Clock Phase [BYTE] (_PHA) */ + + Descriptor->SpiSerialBus.ClockPhase = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PHASE, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPhase)); + break; + + case 8: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, + InitializerOp->Asl.Value.String); + } + break; + + case 9: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->SpiSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 10: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 1, 1); + break; + + case 11: /* ResourceTag (Descriptor Name) */ + + UtAttachNamepathToOwner (Op, InitializerOp); + break; + + case 12: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + + RsGetVendorData (InitializerOp, VendorData, + CurrentByteOffset + sizeof (AML_RESOURCE_SPI_SERIALBUS)); + break; + + default: /* Ignore any extra nodes */ + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoUartSerialBusDescriptor + * + * PARAMETERS: Op - Parent resource descriptor parse node + * CurrentByteOffset - Offset into the resource template AML + * buffer (to track references to the desc) + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "UART Serial Bus" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoUartSerialBusDescriptor ( + ACPI_PARSE_OBJECT *Op, + UINT32 CurrentByteOffset) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 DescriptorSize; + UINT32 i; + + + InitializerOp = Op->Asl.Child; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS) + + ResSourceLength + VendorLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->UartSerialBus.ResourceLength = DescriptorSize; + Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; + Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION; + Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION; + Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE; + Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength; + + /* Build pointers to optional areas */ + + VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS)); + ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); + + DbgPrint (ASL_DEBUG_OUTPUT, + "%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n", + "UartSerialBus", Descriptor->UartSerialBus.ResourceLength, + (UINT16) sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength, + VendorLength, Descriptor->UartSerialBus.TypeDataLength); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* ConnectionSpeed (Baud Rate) [DWORD] (_SPE) */ + + Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate)); + break; + + case 1: /* Bits Per Byte [Flags] (_LEN) */ + + RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3); + break; + + case 2: /* Stop Bits [Flags] (_STB) */ + + RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2); + break; + + case 3: /* Lines In Use [BYTE] (_LIN) */ + + Descriptor->UartSerialBus.LinesEnabled = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_LINE, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.LinesEnabled)); + break; + + case 4: /* Endianness [Flag] (_END) */ + + RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7); + break; + + case 5: /* Parity [BYTE] (_PAR) */ + + Descriptor->UartSerialBus.Parity = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Parity)); + break; + + case 6: /* Flow Control [Flags] (_FLC) */ + + RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2); + break; + + case 7: /* Rx Buffer Size [WORD] (_RXL) */ + + Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize)); + break; + + case 8: /* Tx Buffer Size [WORD] (_TXL) */ + + Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize)); + break; + + case 9: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, + InitializerOp->Asl.Value.String); + } + break; + + case 10: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->UartSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 11: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 1, 1); + + /* + * Slave Mode [Flag] (_SLV) + * + * Note: There is no SlaveMode argument to the UartSerialBus macro, but + * we add this name anyway to allow the flag to be set by ASL in the + * rare case where there is a slave mode associated with the UART. + */ + RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 0); + break; + + case 12: /* ResourceTag (Descriptor Name) */ + + UtAttachNamepathToOwner (Op, InitializerOp); + break; + + case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + + RsGetVendorData (InitializerOp, VendorData, + CurrentByteOffset + sizeof (AML_RESOURCE_UART_SERIALBUS)); + break; + + default: /* Ignore any extra nodes */ + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} diff --git a/compiler/asltransform.c b/compiler/asltransform.c index 384ea3877ffb..f1af3979a4c6 100644 --- a/compiler/asltransform.c +++ b/compiler/asltransform.c @@ -398,6 +398,7 @@ TrDoSwitch ( ACPI_PARSE_OBJECT *MethodOp; ACPI_PARSE_OBJECT *StoreOp; ACPI_PARSE_OBJECT *BreakOp; + ACPI_PARSE_OBJECT *BufferOp; char *PredicateValueName; UINT16 Index; UINT32 Btype; @@ -647,6 +648,7 @@ TrDoSwitch ( Predicate = StartNode->Asl.Child; NewOp = TrCreateLeafNode (PARSEOP_NAME); + TrAmlInitLineNumbers (NewOp, StartNode); /* Find the parent method */ @@ -690,6 +692,7 @@ TrDoSwitch ( NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (UINT64) ACPI_TO_INTEGER (PredicateValueName)); + TrAmlInitLineNumbers (NewOp2, NewOp); NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION; NewOp->Asl.Child = NewOp2; @@ -700,21 +703,27 @@ TrDoSwitch ( case ACPI_BTYPE_INTEGER: NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO, (UINT64) 0); + TrAmlInitLineNumbers (NewOp2->Asl.Next, NewOp); break; case ACPI_BTYPE_STRING: NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (UINT64) ACPI_TO_INTEGER ("")); + TrAmlInitLineNumbers (NewOp2->Asl.Next, NewOp); break; case ACPI_BTYPE_BUFFER: (void) TrLinkPeerNode (NewOp2, TrCreateValuedLeafNode (PARSEOP_BUFFER, (UINT64) 0)); Next = NewOp2->Asl.Next; + TrAmlInitLineNumbers (Next, NewOp2); (void) TrLinkChildren (Next, 1, TrCreateValuedLeafNode (PARSEOP_ZERO, (UINT64) 1)); - (void) TrLinkPeerNode (Next->Asl.Child, - TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (UINT64) 0)); + TrAmlInitLineNumbers (Next->Asl.Child, Next); + + BufferOp = TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (UINT64) 0); + TrAmlInitLineNumbers (BufferOp, Next->Asl.Child); + (void) TrLinkPeerNode (Next->Asl.Child, BufferOp); TrAmlSetSubtreeParent (Next->Asl.Child, Next); break; @@ -733,6 +742,7 @@ TrDoSwitch ( */ TrAmlInitNode (StartNode, PARSEOP_WHILE); NewOp = TrCreateLeafNode (PARSEOP_ONE); + TrAmlInitLineNumbers (NewOp, StartNode); NewOp->Asl.Next = Predicate->Asl.Next; NewOp->Asl.Parent = StartNode; StartNode->Asl.Child = NewOp; @@ -740,6 +750,7 @@ TrDoSwitch ( /* Create a Store() node */ StoreOp = TrCreateLeafNode (PARSEOP_STORE); + TrAmlInitLineNumbers (StoreOp, NewOp); StoreOp->Asl.Parent = StartNode; TrAmlInsertPeer (NewOp, StoreOp); @@ -750,6 +761,7 @@ TrDoSwitch ( NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (UINT64) ACPI_TO_INTEGER (PredicateValueName)); + TrAmlInitLineNumbers (NewOp, StoreOp); NewOp->Asl.Parent = StoreOp; Predicate->Asl.Next = NewOp; @@ -762,6 +774,7 @@ TrDoSwitch ( } BreakOp = TrCreateLeafNode (PARSEOP_BREAK); + TrAmlInitLineNumbers (BreakOp, NewOp); BreakOp->Asl.Parent = StartNode; TrAmlInsertPeer (Conditional, BreakOp); } diff --git a/compiler/asltree.c b/compiler/asltree.c index 3874ff6e23e4..80f26be2bed2 100644 --- a/compiler/asltree.c +++ b/compiler/asltree.c @@ -45,6 +45,7 @@ #include "aslcompiler.h" #include "aslcompiler.y.h" +#include "acapps.h" #include <time.h> #define _COMPONENT ACPI_COMPILER @@ -425,6 +426,8 @@ TrCreateConstantLeafNode ( time_t CurrentTime; char *StaticTimeString; char *TimeString; + char *Path; + char *Filename; switch (ParseOpcode) @@ -434,7 +437,7 @@ TrCreateConstantLeafNode ( Op->Asl.Value.Integer = Op->Asl.LineNumber; break; - case PARSEOP___FILE__: + case PARSEOP___PATH__: Op = TrAllocateNode (PARSEOP_STRING_LITERAL); /* Op.Asl.Filename contains the full pathname to the file */ @@ -442,7 +445,17 @@ TrCreateConstantLeafNode ( Op->Asl.Value.String = Op->Asl.Filename; break; - case PARSEOP___DATE__: + case PARSEOP___FILE__: + Op = TrAllocateNode (PARSEOP_STRING_LITERAL); + + /* Get the simple filename from the full path */ + + FlSplitInputPathname (Op->Asl.Filename, &Path, &Filename); + ACPI_FREE (Path); + Op->Asl.Value.String = Filename; + break; + + case PARSEOP___DATE__: Op = TrAllocateNode (PARSEOP_STRING_LITERAL); /* Get a copy of the current time */ diff --git a/compiler/aslwalks.c b/compiler/aslwalks.c index 388b653ab40d..d9e3cc092dd4 100644 --- a/compiler/aslwalks.c +++ b/compiler/aslwalks.c @@ -1032,6 +1032,7 @@ AnOtherSemanticAnalysisWalkBegin ( ACPI_PARSE_OBJECT *ArgNode; ACPI_PARSE_OBJECT *PrevArgNode = NULL; const ACPI_OPCODE_INFO *OpInfo; + ACPI_NAMESPACE_NODE *Node; OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); @@ -1156,6 +1157,78 @@ AnOtherSemanticAnalysisWalkBegin ( } break; + case PARSEOP_CONNECTION: + /* + * Ensure that the referenced operation region has the correct SPACE_ID. + * From the grammar/parser, we know the parent is a FIELD definition. + */ + ArgNode = Op->Asl.Parent; /* Field definition */ + ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */ + Node = ArgNode->Asl.Node; /* OpRegion namespace node */ + + ArgNode = Node->Op; /* OpRegion definition */ + ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */ + ArgNode = ArgNode->Asl.Next; /* Next peer is the SPACE_ID (what we want) */ + + /* + * The Connection() operator is only valid for the following operation + * region SpaceIds: GeneralPurposeIo and GenericSerialBus. + */ + if ((ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) && + (ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS)) + { + AslError (ASL_ERROR, ASL_MSG_CONNECTION_INVALID, Op, NULL); + } + break; + + case PARSEOP_FIELD: + /* + * Ensure that fields for GeneralPurposeIo and GenericSerialBus + * contain at least one Connection() operator + */ + ArgNode = Op->Asl.Child; /* 1st child is the OpRegion Name */ + Node = ArgNode->Asl.Node; /* OpRegion namespace node */ + if (!Node) + { + break; + } + + ArgNode = Node->Op; /* OpRegion definition */ + ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */ + ArgNode = ArgNode->Asl.Next; /* Next peer is the SPACE_ID (what we want) */ + + /* We are only interested in GeneralPurposeIo and GenericSerialBus */ + + if ((ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) && + (ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS)) + { + break; + } + + ArgNode = Op->Asl.Child; /* 1st child is the OpRegion Name */ + ArgNode = ArgNode->Asl.Next; /* AccessType */ + ArgNode = ArgNode->Asl.Next; /* LockRule */ + ArgNode = ArgNode->Asl.Next; /* UpdateRule */ + ArgNode = ArgNode->Asl.Next; /* Start of FieldUnitList */ + + /* Walk the FieldUnitList */ + + while (ArgNode) + { + if (ArgNode->Asl.ParseOpcode == PARSEOP_CONNECTION) + { + break; + } + else if (ArgNode->Asl.ParseOpcode == PARSEOP_NAMESEG) + { + AslError (ASL_ERROR, ASL_MSG_CONNECTION_MISSING, ArgNode, NULL); + break; + } + + ArgNode = ArgNode->Asl.Next; + } + break; + default: break; } diff --git a/compiler/dtcompile.c b/compiler/dtcompile.c index 91c32ac2e571..c0e6ac15a7ee 100644 --- a/compiler/dtcompile.c +++ b/compiler/dtcompile.c @@ -310,6 +310,17 @@ DtCompileDataTable ( Status = DtCompileRsdp (FieldList); return (Status); } + else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_S3PT)) + { + Status = DtCompileS3pt (FieldList); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtSetTableLength (); + return (Status); + } /* * All other tables must use the common ACPI table header. Insert the @@ -411,6 +422,7 @@ DtCompileTable ( UINT8 FieldType; UINT8 *Buffer; UINT8 *FlagBuffer = NULL; + UINT32 CurrentFlagByteOffset = 0; ACPI_STATUS Status; @@ -442,6 +454,11 @@ DtCompileTable ( */ for (; Info->Name; Info++) { + if (Info->Opcode == ACPI_DMT_EXTRA_TEXT) + { + continue; + } + if (!LocalField) { sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed", @@ -472,6 +489,7 @@ DtCompileTable ( *Field = LocalField; FlagBuffer = Buffer; + CurrentFlagByteOffset = Info->Offset; break; case DT_FIELD_TYPE_FLAG: @@ -480,6 +498,14 @@ DtCompileTable ( if (FlagBuffer) { + /* + * We must increment the FlagBuffer when we have crossed + * into the next flags byte within the flags field + * of type DT_FIELD_TYPE_FLAGS_INTEGER. + */ + FlagBuffer += (Info->Offset - CurrentFlagByteOffset); + CurrentFlagByteOffset = Info->Offset; + DtCompileFlag (FlagBuffer, LocalField, Info); } else diff --git a/compiler/dtcompiler.h b/compiler/dtcompiler.h index f68e4b5f18b0..656e12de87c9 100644 --- a/compiler/dtcompiler.h +++ b/compiler/dtcompiler.h @@ -399,6 +399,10 @@ DtCompileFadt ( void **PFieldList); ACPI_STATUS +DtCompileFpdt ( + void **PFieldList); + +ACPI_STATUS DtCompileHest ( void **PFieldList); @@ -415,14 +419,26 @@ DtCompileMcfg ( void **PFieldList); ACPI_STATUS +DtCompileMpst ( + void **PFieldList); + +ACPI_STATUS DtCompileMsct ( void **PFieldList); ACPI_STATUS +DtCompilePmtt ( + void **PFieldList); + +ACPI_STATUS DtCompileRsdt ( void **PFieldList); ACPI_STATUS +DtCompileS3pt ( + DT_FIELD **PFieldList); + +ACPI_STATUS DtCompileSlic ( void **PFieldList); @@ -459,6 +475,7 @@ DtGetGenericTableInfo ( extern const unsigned char TemplateAsf[]; extern const unsigned char TemplateBoot[]; extern const unsigned char TemplateBert[]; +extern const unsigned char TemplateBgrt[]; extern const unsigned char TemplateCpep[]; extern const unsigned char TemplateDbgp[]; extern const unsigned char TemplateDmar[]; @@ -466,14 +483,19 @@ extern const unsigned char TemplateEcdt[]; extern const unsigned char TemplateEinj[]; extern const unsigned char TemplateErst[]; extern const unsigned char TemplateFadt[]; +extern const unsigned char TemplateFpdt[]; +extern const unsigned char TemplateGtdt[]; extern const unsigned char TemplateHest[]; extern const unsigned char TemplateHpet[]; extern const unsigned char TemplateIvrs[]; extern const unsigned char TemplateMadt[]; extern const unsigned char TemplateMcfg[]; extern const unsigned char TemplateMchi[]; +extern const unsigned char TemplateMpst[]; extern const unsigned char TemplateMsct[]; +extern const unsigned char TemplatePmtt[]; extern const unsigned char TemplateRsdt[]; +extern const unsigned char TemplateS3pt[]; extern const unsigned char TemplateSbst[]; extern const unsigned char TemplateSlic[]; extern const unsigned char TemplateSlit[]; diff --git a/compiler/dtfield.c b/compiler/dtfield.c index 8c9885bb9df1..f2b4092a6041 100644 --- a/compiler/dtfield.c +++ b/compiler/dtfield.c @@ -523,12 +523,25 @@ DtCompileFlag ( break; + case ACPI_DMT_FLAGS1: + + BitPosition = 1; + BitLength = 2; + break; + + case ACPI_DMT_FLAGS2: BitPosition = 2; BitLength = 2; break; + case ACPI_DMT_FLAGS4: + + BitPosition = 4; + BitLength = 2; + break; + default: DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid flag opcode"); diff --git a/compiler/dtsubtable.c b/compiler/dtsubtable.c index 40659764e775..219db977cf3e 100644 --- a/compiler/dtsubtable.c +++ b/compiler/dtsubtable.c @@ -296,6 +296,11 @@ DtGetSubtableLength ( for (; Info->Name; Info++) { + if (Info->Opcode == ACPI_DMT_EXTRA_TEXT) + { + continue; + } + if (!Field) { goto Error; diff --git a/compiler/dttable.c b/compiler/dttable.c index f43403598dbf..bfdf29ed7068 100644 --- a/compiler/dttable.c +++ b/compiler/dttable.c @@ -660,6 +660,90 @@ DtCompileFadt ( } DtInsertSubtable (ParentTable, Subtable); + + if (Revision >= 5) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt5, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: DtCompileFpdt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile FPDT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileFpdt ( + void **List) +{ + ACPI_STATUS Status; + ACPI_FPDT_HEADER *FpdtHeader; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFpdtHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer); + + switch (FpdtHeader->Type) + { + case ACPI_FPDT_TYPE_BOOT: + InfoTable = AcpiDmTableInfoFpdt0; + break; + + case ACPI_FPDT_TYPE_S3PERF: + InfoTable = AcpiDmTableInfoFpdt1; + break; + + default: + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "FPDT"); + return (AE_ERROR); + break; + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); } return (AE_OK); @@ -1025,6 +1109,12 @@ DtCompileMadt ( case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: InfoTable = AcpiDmTableInfoMadt10; break; + case ACPI_MADT_TYPE_GENERIC_INTERRUPT: + InfoTable = AcpiDmTableInfoMadt11; + break; + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + InfoTable = AcpiDmTableInfoMadt12; + break; default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT"); return (AE_ERROR); @@ -1072,6 +1162,143 @@ DtCompileMcfg ( /****************************************************************************** * + * FUNCTION: DtCompileMpst + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile MPST. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileMpst ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + ACPI_MPST_CHANNEL *MpstChannelInfo; + ACPI_MPST_POWER_NODE *MpstPowerNode; + ACPI_MPST_DATA_HDR *MpstDataHeader; + UINT16 SubtableCount; + UINT8 PowerStateCount; + UINT8 ComponentCount; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer); + SubtableCount = MpstChannelInfo->PowerNodeCount; + + while (*PFieldList && SubtableCount) + { + /* Subtable: Memory Power Node(s) */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer); + PowerStateCount = MpstPowerNode->NumPowerStates; + ComponentCount = MpstPowerNode->NumPhysicalComponents; + + ParentTable = DtPeekSubtable (); + + /* Sub-subtables - Memory Power State Structure(s) */ + + while (*PFieldList && PowerStateCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0A, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + PowerStateCount--; + } + + /* Sub-subtables - Physical Component ID Structure(s) */ + + while (*PFieldList && ComponentCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst0B, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + ComponentCount--; + } + + SubtableCount--; + DtPopSubtable (); + } + + /* Subtable: Count of Memory Power State Characteristic structures */ + + DtPopSubtable (); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst1, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer); + SubtableCount = MpstDataHeader->CharacteristicsCount; + + ParentTable = DtPeekSubtable (); + + /* Subtable: Memory Power State Characteristics structure(s) */ + + while (*PFieldList && SubtableCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoMpst2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + SubtableCount--; + } + + DtPopSubtable (); + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileMsct * * PARAMETERS: List - Current field list pointer @@ -1097,6 +1324,147 @@ DtCompileMsct ( /****************************************************************************** * + * FUNCTION: DtCompilePmtt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile PMTT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePmtt ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_PMTT_HEADER *PmttHeader; + ACPI_PMTT_CONTROLLER *PmttController; + UINT16 DomainCount; + UINT8 PrevType = ACPI_PMTT_TYPE_SOCKET; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmttHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + PmttHeader = ACPI_CAST_PTR (ACPI_PMTT_HEADER, Subtable->Buffer); + while (PrevType >= PmttHeader->Type) + { + DtPopSubtable (); + + if (PrevType == ACPI_PMTT_TYPE_SOCKET) + { + break; + } + PrevType--; + } + PrevType = PmttHeader->Type; + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + switch (PmttHeader->Type) + { + case ACPI_PMTT_TYPE_SOCKET: + + /* Subtable: Socket Structure */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + break; + + case ACPI_PMTT_TYPE_CONTROLLER: + + /* Subtable: Memory Controller Structure */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER, + (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER))); + DomainCount = PmttController->DomainCount; + + while (DomainCount) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + DomainCount--; + } + break; + + case ACPI_PMTT_TYPE_DIMM: + + /* Subtable: Physical Component Structure */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPmtt2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PMTT"); + return (AE_ERROR); + } + } + + return (Status); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileRsdt * * PARAMETERS: List - Current field list pointer @@ -1134,6 +1502,85 @@ DtCompileRsdt ( /****************************************************************************** * + * FUNCTION: DtCompileS3pt + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile S3PT (Pointed to by FPDT) + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileS3pt ( + DT_FIELD **PFieldList) +{ + ACPI_STATUS Status; + ACPI_S3PT_HEADER *S3ptHeader; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD *SubtableStart; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt, + &Gbl_RootTable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtPushSubtable (Gbl_RootTable); + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3ptHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + S3ptHeader = ACPI_CAST_PTR (ACPI_S3PT_HEADER, Subtable->Buffer); + + switch (S3ptHeader->Type) + { + case ACPI_S3PT_TYPE_RESUME: + InfoTable = AcpiDmTableInfoS3pt0; + break; + + case ACPI_S3PT_TYPE_SUSPEND: + InfoTable = AcpiDmTableInfoS3pt1; + break; + + default: + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "S3PT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileSlic * * PARAMETERS: List - Current field list pointer diff --git a/compiler/dttemplate.h b/compiler/dttemplate.h index 19545919b390..e3302547d3f4 100644 --- a/compiler/dttemplate.h +++ b/compiler/dttemplate.h @@ -87,6 +87,17 @@ const unsigned char TemplateAsf[] = 0x01,0x00 /* 00000070 ".." */ }; +const unsigned char TemplateBgrt[] = +{ + 0x42,0x47,0x52,0x54,0x38,0x00,0x00,0x00, /* 00000000 "BGRT8..." */ + 0x01,0x0D,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x23,0x06,0x11,0x20,0x01,0x00,0x00,0x00, /* 00000020 "#.. ...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000030 "........" */ +}; + const unsigned char TemplateBert[] = { 0x42,0x45,0x52,0x54,0x30,0x00,0x00,0x00, /* 00000000 "BERT0..." */ @@ -326,6 +337,37 @@ const unsigned char TemplateFadt[] = 0x00,0x00,0x00,0x00 /* 000000F0 "...." */ }; +const unsigned char TemplateFpdt[] = +{ + 0x46,0x50,0x44,0x54,0x64,0x00,0x00,0x00, /* 00000000 "FPDTd..." */ + 0x01,0xBD,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x04,0x08,0x11,0x20,0x00,0x00,0x30,0x01, /* 00000020 "... ..0." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x10,0x01, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x00,0x00,0x00,0x00 /* 00000060 "...." */ +}; + +const unsigned char TemplateGtdt[] = +{ + 0x47,0x54,0x44,0x54,0x50,0x00,0x00,0x00, /* 00000000 "GTDTP..." */ + 0x01,0xF1,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x23,0x06,0x11,0x20,0x00,0x00,0x00,0x00, /* 00000020 "#.. ...." */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000048 "........" */ +}; + const unsigned char TemplateHest[] = { 0x48,0x45,0x53,0x54,0xD4,0x01,0x00,0x00, /* 00000000 "HEST...." */ @@ -428,13 +470,15 @@ const unsigned char TemplateIvrs[] = 0x00,0x00,0x00,0x00 /* 000000B8 "...." */ }; +/* MADT with ACPI 5.0 subtables */ + const unsigned char TemplateMadt[] = { - 0x41,0x50,0x49,0x43,0xB6,0x00,0x00,0x00, /* 00000000 "APIC...." */ - 0x01,0x45,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".EINTEL " */ + 0x41,0x50,0x49,0x43,0xF6,0x00,0x00,0x00, /* 00000000 "APIC...." */ + 0x01,0xB0,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */ + 0x23,0x06,0x11,0x20,0x00,0x00,0x00,0x00, /* 00000020 "#.. ...." */ 0x01,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */ 0x01,0x00,0x00,0x00,0x01,0x0C,0x01,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ @@ -452,7 +496,15 @@ const unsigned char TemplateMadt[] = 0x00,0x00,0x09,0x10,0x00,0x00,0x00,0x00, /* 00000098 "........" */ 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ 0x00,0x00,0x0A,0x0C,0x05,0x00,0x00,0x00, /* 000000A8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00 /* 000000B0 "......" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x28, /* 000000B0 ".......(" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18, /* 000000D8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00 /* 000000F0 "......" */ }; const unsigned char TemplateMcfg[] = @@ -480,6 +532,24 @@ const unsigned char TemplateMchi[] = 0x00,0x00,0x00,0x00,0x00 /* 00000040 "....." */ }; +const unsigned char TemplateMpst[] = +{ + 0x4D,0x50,0x53,0x54,0x6E,0x00,0x00,0x00, /* 00000000 "MPSTn..." */ + 0x01,0x98,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x04,0x08,0x11,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x02,0x03,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x01,0x00,0x41,0x00,0x00,0x00,0x00,0x00, /* 00000050 "..A....." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00 /* 00000068 "......" */ +}; + const unsigned char TemplateMsct[] = { 0x4D,0x53,0x43,0x54,0x90,0x00,0x00,0x00, /* 00000000 "MSCT...." */ @@ -502,6 +572,33 @@ const unsigned char TemplateMsct[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000088 "........" */ }; +const unsigned char TemplatePmtt[] = +{ + 0x50,0x4D,0x54,0x54,0xB4,0x00,0x00,0x00, /* 00000000 "PMTT...." */ + 0x01,0x3A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".:INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x26,0x08,0x11,0x20,0x00,0x00,0x00,0x00, /* 00000020 "&.. ...." */ + 0x00,0x00,0x80,0x00,0x01,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x54,0x00, /* 00000030 "......T." */ + 0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x02,0x00,0x14,0x00,0x02,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00,0x00,0x00,0x02,0x00,0x14,0x00, /* 00000070 "........" */ + 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x01,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000088 ".. ....." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x00,0x00,0x0C,0x00,0x01,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x00,0x00,0x00,0x00 /* 000000B0 "...." */ +}; + const unsigned char TemplateRsdp[] = { 0x52,0x53,0x44,0x20,0x50,0x54,0x52,0x20, /* 00000000 "RSD PTR " */ @@ -524,6 +621,17 @@ const unsigned char TemplateRsdt[] = 0x80,0x00,0x00,0x00 /* 00000040 "...." */ }; +const unsigned char TemplateS3pt[] = +{ + 0x53,0x33,0x50,0x54,0x34,0x00,0x00,0x00, /* 00000000 "S3PT4..." */ + 0x00,0x00,0x18,0x01,0x00,0x00,0x00,0x00, /* 00000008 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000010 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */ + 0x01,0x00,0x14,0x01,0x00,0x00,0x00,0x00, /* 00000020 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00 /* 00000030 "...." */ +}; + const unsigned char TemplateSbst[] = { 0x53,0x42,0x53,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SBST0..." */ diff --git a/compiler/dtutils.c b/compiler/dtutils.c index a733046df744..d6e8167e1d45 100644 --- a/compiler/dtutils.c +++ b/compiler/dtutils.c @@ -384,7 +384,9 @@ DtGetFieldType ( case ACPI_DMT_FLAG6: case ACPI_DMT_FLAG7: case ACPI_DMT_FLAGS0: + case ACPI_DMT_FLAGS1: case ACPI_DMT_FLAGS2: + case ACPI_DMT_FLAGS4: Type = DT_FIELD_TYPE_FLAG; break; @@ -510,8 +512,11 @@ DtGetFieldLength ( case ACPI_DMT_FLAG6: case ACPI_DMT_FLAG7: case ACPI_DMT_FLAGS0: + case ACPI_DMT_FLAGS1: case ACPI_DMT_FLAGS2: + case ACPI_DMT_FLAGS4: case ACPI_DMT_LABEL: + case ACPI_DMT_EXTRA_TEXT: ByteLength = 0; break; @@ -521,6 +526,7 @@ DtGetFieldLength ( case ACPI_DMT_ACCWIDTH: case ACPI_DMT_IVRS: case ACPI_DMT_MADT: + case ACPI_DMT_PMTT: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -550,6 +556,11 @@ DtGetFieldLength ( ByteLength = 4; break; + case ACPI_DMT_UINT40: + ByteLength = 5; + break; + + case ACPI_DMT_UINT48: case ACPI_DMT_NAME6: ByteLength = 6; break; diff --git a/debugger/dbcmds.c b/debugger/dbcmds.c index 73387b872c6b..68af5fcaf319 100644 --- a/debugger/dbcmds.c +++ b/debugger/dbcmds.c @@ -46,6 +46,7 @@ #include "accommon.h" #include "acevents.h" #include "acdebug.h" +#include "acnamesp.h" #include "acresrc.h" #include "actables.h" @@ -69,6 +70,18 @@ AcpiDmTestResourceConversion ( ACPI_NAMESPACE_NODE *Node, char *Name); +static ACPI_STATUS +AcpiDbResourceCallback ( + ACPI_RESOURCE *Resource, + void *Context); + +static ACPI_STATUS +AcpiDbDeviceResources ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + /******************************************************************************* * @@ -456,6 +469,78 @@ AcpiDbDisplayInterfaces ( /******************************************************************************* * + * FUNCTION: AcpiDbDisplayTemplate + * + * PARAMETERS: BufferArg - Buffer name or addrss + * + * RETURN: None + * + * DESCRIPTION: Dump a buffer that contains a resource template + * + ******************************************************************************/ + +void +AcpiDbDisplayTemplate ( + char *BufferArg) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + ACPI_BUFFER ReturnObj; + + + /* Translate BufferArg to an Named object */ + + Node = AcpiDbConvertToNode (BufferArg); + if (!Node || (Node == AcpiGbl_RootNode)) + { + AcpiOsPrintf ("Invalid argument: %s\n", BufferArg); + return; + } + + /* We must have a buffer object */ + + if (Node->Type != ACPI_TYPE_BUFFER) + { + AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n", + BufferArg); + return; + } + + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + + /* Attempt to convert the raw buffer to a resource list */ + + Status = AcpiRsCreateResourceList (Node->Object, &ReturnObj); + + AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); + AcpiDbgLevel |= ACPI_LV_RESOURCES; + + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not convert Buffer to a resource list: %s, %s\n", + BufferArg, AcpiFormatException (Status)); + goto DumpBuffer; + } + + /* Now we can dump the resource list */ + + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, + ReturnObj.Pointer)); + +DumpBuffer: + AcpiOsPrintf ("\nRaw data buffer:\n"); + AcpiUtDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer, + Node->Object->Buffer.Length, + DB_BYTE_DISPLAY, ACPI_UINT32_MAX); + + AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); + return; +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmCompareAmlResources * * PARAMETERS: Aml1Buffer - Contains first resource list @@ -479,11 +564,14 @@ AcpiDmCompareAmlResources ( { UINT8 *Aml1; UINT8 *Aml2; + UINT8 *Aml1End; + UINT8 *Aml2End; ACPI_RSDESC_SIZE Aml1Length; ACPI_RSDESC_SIZE Aml2Length; ACPI_RSDESC_SIZE Offset = 0; UINT8 ResourceType; UINT32 Count = 0; + UINT32 i; /* Compare overall buffer sizes (may be different due to size rounding) */ @@ -491,16 +579,18 @@ AcpiDmCompareAmlResources ( if (Aml1BufferLength != Aml2BufferLength) { AcpiOsPrintf ( - "**** Buffer length mismatch in converted AML: original %X new %X ****\n", + "**** Buffer length mismatch in converted AML: Original %X, New %X ****\n", Aml1BufferLength, Aml2BufferLength); } Aml1 = Aml1Buffer; Aml2 = Aml2Buffer; + Aml1End = Aml1Buffer + Aml1BufferLength; + Aml2End = Aml2Buffer + Aml2BufferLength; /* Walk the descriptor lists, comparing each descriptor */ - while (Aml1 < (Aml1Buffer + Aml1BufferLength)) + while ((Aml1 < Aml1End) && (Aml2 < Aml2End)) { /* Get the lengths of each descriptor */ @@ -513,7 +603,7 @@ AcpiDmCompareAmlResources ( if (Aml1Length != Aml2Length) { AcpiOsPrintf ( - "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n", + "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X Len1 %X, Len2 %X ****\n", Count, ResourceType, Offset, Aml1Length, Aml2Length); } @@ -524,6 +614,15 @@ AcpiDmCompareAmlResources ( AcpiOsPrintf ( "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", Count, ResourceType, Offset); + + for (i = 0; i < Aml1Length; i++) + { + if (Aml1[i] != Aml2[i]) + { + AcpiOsPrintf ("Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n", + i, Aml2[i], Aml1[i]); + } + } } /* Exit on EndTag descriptor */ @@ -626,157 +725,297 @@ Exit1: /******************************************************************************* * - * FUNCTION: AcpiDbDisplayResources + * FUNCTION: AcpiDbResourceCallback * - * PARAMETERS: ObjectArg - String with hex value of the object + * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Display the resource objects associated with a device. + * DESCRIPTION: Simple callback to exercise AcpiWalkResources * ******************************************************************************/ -void -AcpiDbDisplayResources ( - char *ObjectArg) +static ACPI_STATUS +AcpiDbResourceCallback ( + ACPI_RESOURCE *Resource, + void *Context) +{ + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDeviceResources + * + * PARAMETERS: ACPI_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbDeviceResources ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) { ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *PrtNode = NULL; + ACPI_NAMESPACE_NODE *CrsNode = NULL; + ACPI_NAMESPACE_NODE *PrsNode = NULL; + ACPI_NAMESPACE_NODE *AeiNode = NULL; + char *ParentPath; ACPI_BUFFER ReturnObj; + ACPI_STATUS Status; - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiDbgLevel |= ACPI_LV_RESOURCES; + Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); + ParentPath = AcpiNsGetExternalPathname (Node); + if (!ParentPath) + { + return (AE_NO_MEMORY); + } - /* Convert string to object pointer */ + /* Get handles to the resource methods for this device */ - Node = AcpiDbConvertToNode (ObjectArg); - if (!Node) + (void) AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode)); + (void) AcpiGetHandle (Node, METHOD_NAME__CRS, ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode)); + (void) AcpiGetHandle (Node, METHOD_NAME__PRS, ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode)); + (void) AcpiGetHandle (Node, METHOD_NAME__AEI, ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode)); + if (!PrtNode && !CrsNode && !PrsNode && !AeiNode) { - return; + goto Cleanup; /* Nothing to do */ } + AcpiOsPrintf ("\nDevice: %s\n", ParentPath); + /* Prepare for a return object of arbitrary size */ ReturnObj.Pointer = AcpiGbl_DbBuffer; ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + /* _PRT */ - AcpiOsPrintf ("Evaluating _PRT\n"); + if (PrtNode) + { + AcpiOsPrintf ("Evaluating _PRT\n"); - /* Check if _PRT exists */ + Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not evaluate _PRT: %s\n", + AcpiFormatException (Status)); + goto GetCrs; + } - Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain _PRT: %s\n", - AcpiFormatException (Status)); - goto GetCrs; - } + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", + AcpiFormatException (Status)); + goto GetCrs; + } - Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", - AcpiFormatException (Status)); - goto GetCrs; + AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer)); } - AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer)); - /* _CRS */ GetCrs: - AcpiOsPrintf ("Evaluating _CRS\n"); + if (CrsNode) + { + AcpiOsPrintf ("Evaluating _CRS\n"); - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - /* Check if _CRS exists */ + Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not evaluate _CRS: %s\n", + AcpiFormatException (Status)); + goto GetPrs; + } - Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain _CRS: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } + /* This code is here to exercise the AcpiWalkResources interface */ - /* Get the _CRS resource list */ + Status = AcpiWalkResources (Node, METHOD_NAME__CRS, + AcpiDbResourceCallback, NULL); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiWalkResources failed: %s\n", + AcpiFormatException (Status)); + goto GetPrs; + } - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + /* Get the _CRS resource list */ - Status = AcpiGetCurrentResources (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - /* Dump the _CRS resource list */ + Status = AcpiGetCurrentResources (Node, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", + AcpiFormatException (Status)); + goto GetPrs; + } - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, - ReturnObj.Pointer)); + /* Dump the _CRS resource list */ - /* - * Perform comparison of original AML to newly created AML. This tests both - * the AML->Resource conversion and the Resource->Aml conversion. - */ - Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, + ReturnObj.Pointer)); - /* Execute _SRS with the resource list */ + /* + * Perform comparison of original AML to newly created AML. This tests both + * the AML->Resource conversion and the Resource->Aml conversion. + */ + Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); - Status = AcpiSetCurrentResources (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto GetPrs; + /* Execute _SRS with the resource list */ + + Status = AcpiSetCurrentResources (Node, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", + AcpiFormatException (Status)); + goto GetPrs; + } } /* _PRS */ GetPrs: - AcpiOsPrintf ("Evaluating _PRS\n"); + if (PrsNode) + { + AcpiOsPrintf ("Evaluating _PRS\n"); - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + + Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not evaluate _PRS: %s\n", + AcpiFormatException (Status)); + goto GetAei; + } - /* Check if _PRS exists */ + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain _PRS: %s\n", - AcpiFormatException (Status)); - goto Cleanup; + Status = AcpiGetPossibleResources (Node, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", + AcpiFormatException (Status)); + goto GetAei; + } + + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); } - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - Status = AcpiGetPossibleResources (Node, &ReturnObj); - if (ACPI_FAILURE (Status)) + /* _AEI */ + +GetAei: + if (AeiNode) { - AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", - AcpiFormatException (Status)); - goto Cleanup; + AcpiOsPrintf ("Evaluating _AEI\n"); + + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + + Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not evaluate _AEI: %s\n", + AcpiFormatException (Status)); + goto Cleanup; + } + + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + + Status = AcpiGetEventResources (Node, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiGetEventResources failed: %s\n", + AcpiFormatException (Status)); + goto Cleanup; + } + + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); } - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); Cleanup: + ACPI_FREE (ParentPath); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDisplayResources + * + * PARAMETERS: ObjectArg - String object name or object pointer. + * "*" means "display resources for all devices" + * + * RETURN: None + * + * DESCRIPTION: Display the resource objects associated with a device. + * + ******************************************************************************/ + +void +AcpiDbDisplayResources ( + char *ObjectArg) +{ + ACPI_NAMESPACE_NODE *Node; + + + AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); + AcpiDbgLevel |= ACPI_LV_RESOURCES; + + /* Asterisk means "display resources for all devices" */ + + if (!ACPI_STRCMP (ObjectArg, "*")) + { + (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL); + } + else + { + /* Convert string to object pointer */ + + Node = AcpiDbConvertToNode (ObjectArg); + if (Node) + { + if (Node->Type != ACPI_TYPE_DEVICE) + { + AcpiOsPrintf ("%4.4s: Name is not a device object (%s)\n", + Node->Name.Ascii, AcpiUtGetTypeName (Node->Type)); + } + else + { + (void) AcpiDbDeviceResources (Node, 0, NULL, NULL); + } + } + } AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - return; } diff --git a/debugger/dbdisply.c b/debugger/dbdisply.c index 61e837e751aa..2c6b36193f45 100644 --- a/debugger/dbdisply.c +++ b/debugger/dbdisply.c @@ -90,6 +90,8 @@ static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] = ACPI_ADR_SPACE_CMOS, ACPI_ADR_SPACE_PCI_BAR_TARGET, ACPI_ADR_SPACE_IPMI, + ACPI_ADR_SPACE_GPIO, + ACPI_ADR_SPACE_GSBUS, ACPI_ADR_SPACE_DATA_TABLE, ACPI_ADR_SPACE_FIXED_HARDWARE }; @@ -971,7 +973,7 @@ AcpiDbDisplayHandlers ( while (HandlerObj) { - if (i == HandlerObj->AddressSpace.SpaceId) + if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & @@ -989,6 +991,24 @@ AcpiDbDisplayHandlers ( FoundHandler:; } + + /* Find all handlers for user-defined SpaceIDs */ + + HandlerObj = ObjDesc->Device.Handler; + while (HandlerObj) + { + if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) + { + AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, + "User-defined ID", HandlerObj->AddressSpace.SpaceId); + AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, + (HandlerObj->AddressSpace.HandlerFlags & + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", + HandlerObj->AddressSpace.Handler); + } + + HandlerObj = HandlerObj->AddressSpace.Next; + } } /* Fixed event handlers */ diff --git a/debugger/dbfileio.c b/debugger/dbfileio.c index 8d0ef0aaa891..7854de37bdd2 100644 --- a/debugger/dbfileio.c +++ b/debugger/dbfileio.c @@ -271,10 +271,11 @@ AcpiDbReadTable ( fseek (fp, 0, SEEK_SET); - /* The RSDT and FACS tables do not have standard ACPI headers */ + /* The RSDT, FACS and S3PT tables do not have standard ACPI headers */ if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") || - ACPI_COMPARE_NAME (TableHeader.Signature, "FACS")) + ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") || + ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT")) { *TableLength = FileSize; StandardHeader = FALSE; diff --git a/debugger/dbinput.c b/debugger/dbinput.c index 1d716cfb1bd2..88d78df03531 100644 --- a/debugger/dbinput.c +++ b/debugger/dbinput.c @@ -131,6 +131,7 @@ enum AcpiExDebuggerCommands CMD_STATS, CMD_STOP, CMD_TABLES, + CMD_TEMPLATE, CMD_TERMINATE, CMD_THREADS, CMD_TRACE, @@ -199,6 +200,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"STATS", 0}, {"STOP", 0}, {"TABLES", 0}, + {"TEMPLATE", 1}, {"TERMINATE", 0}, {"THREADS", 3}, {"TRACE", 1}, @@ -268,9 +270,10 @@ AcpiDbDisplayHelp ( AcpiOsPrintf (" Predefined Check all predefined names\n"); AcpiOsPrintf (" Prefix [<NamePath>] Set or Get current execution prefix\n"); AcpiOsPrintf (" References <Addr> Find all references to object at addr\n"); - AcpiOsPrintf (" Resources <Device> Get and display Device resources\n"); + AcpiOsPrintf (" Resources <DeviceName | *> Display Device resources (* = all devices)\n"); AcpiOsPrintf (" Set N <NamedObject> <Value> Set value for named integer\n"); AcpiOsPrintf (" Sleep <SleepState> Simulate sleep/wake sequence\n"); + AcpiOsPrintf (" Template <Object> Format/dump a Buffer/ResourceTemplate\n"); AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n"); AcpiOsPrintf (" Type <Object> Display object type\n"); @@ -854,6 +857,10 @@ AcpiDbCommandDispatch ( AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); break; + case CMD_TEMPLATE: + AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]); + break; + case CMD_TERMINATE: AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); AcpiUtSubsystemShutdown (); diff --git a/debugger/dbutils.c b/debugger/dbutils.c index 5b071e87b61b..ef5c3b0abb8f 100644 --- a/debugger/dbutils.c +++ b/debugger/dbutils.c @@ -208,7 +208,7 @@ AcpiDbDumpExternalObject ( AcpiOsPrintf ("\n"); } AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), - ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); + ObjDesc->Buffer.Length, DB_BYTE_DISPLAY, _COMPONENT); } else { diff --git a/disassembler/dmbuffer.c b/disassembler/dmbuffer.c index f223f89f4319..b8d65a324711 100644 --- a/disassembler/dmbuffer.c +++ b/disassembler/dmbuffer.c @@ -108,19 +108,19 @@ AcpiDmDisasmByteList ( } AcpiDmIndent (Level); - if (ByteCount > 7) + if (ByteCount > 8) { - AcpiOsPrintf ("/* %04X */ ", i); + AcpiOsPrintf ("/* %04X */ ", i); } } - AcpiOsPrintf ("0x%2.2X", (UINT32) ByteData[i]); + AcpiOsPrintf (" 0x%2.2X", (UINT32) ByteData[i]); /* Add comma if there are more bytes to display */ if (i < (ByteCount -1)) { - AcpiOsPrintf (", "); + AcpiOsPrintf (","); } } diff --git a/disassembler/dmopcode.c b/disassembler/dmopcode.c index 5da38477149c..70ac14f0c79d 100644 --- a/disassembler/dmopcode.c +++ b/disassembler/dmopcode.c @@ -303,6 +303,7 @@ AcpiDmDisassembleOneOp ( UINT32 Length; ACPI_PARSE_OBJECT *Child; ACPI_STATUS Status; + UINT8 *Aml; if (!Op) @@ -426,16 +427,19 @@ AcpiDmDisassembleOneOp ( * types of buffers, we have to closely look at the data in the * buffer to determine the type. */ - Status = AcpiDmIsResourceTemplate (Op); - if (ACPI_SUCCESS (Status)) + if (!AcpiGbl_NoResourceDisassembly) { - Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; - AcpiOsPrintf ("ResourceTemplate"); - break; - } - else if (Status == AE_AML_NO_RESOURCE_END_TAG) - { - AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ "); + Status = AcpiDmIsResourceTemplate (Op); + if (ACPI_SUCCESS (Status)) + { + Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; + AcpiOsPrintf ("ResourceTemplate"); + break; + } + else if (Status == AE_AML_NO_RESOURCE_END_TAG) + { + AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ "); + } } if (AcpiDmIsUnicodeBuffer (Op)) @@ -495,7 +499,7 @@ AcpiDmDisassembleOneOp ( if (Info->BitOffset % 8 == 0) { - AcpiOsPrintf (" Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset)); + AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset)); } else { @@ -507,16 +511,59 @@ AcpiDmDisassembleOneOp ( case AML_INT_ACCESSFIELD_OP: + case AML_INT_EXTACCESSFIELD_OP: - AcpiOsPrintf (" AccessAs (%s, ", - AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]); + AcpiOsPrintf ("AccessAs (%s, ", + AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer & 0x7)]); + + AcpiDmDecodeAttribute ((UINT8) (Op->Common.Value.Integer >> 8)); + + if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP) + { + AcpiOsPrintf (" (0x%2.2X)", (unsigned) ((Op->Common.Value.Integer >> 16) & 0xFF)); + } - AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer); AcpiOsPrintf (")"); AcpiDmCommaIfFieldMember (Op); break; + case AML_INT_CONNECTION_OP: + + /* + * Two types of Connection() - one with a buffer object, the + * other with a namestring that points to a buffer object. + */ + AcpiOsPrintf ("Connection ("); + Child = Op->Common.Value.Arg; + + if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP) + { + AcpiOsPrintf ("\n"); + + Aml = Child->Named.Data; + Length = (UINT32) Child->Common.Value.Integer; + + Info->Level += 1; + Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; + AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length); + + Info->Level -= 1; + AcpiDmIndent (Info->Level); + } + else + { + AcpiDmNamestring (Child->Common.Value.Name); + } + + AcpiOsPrintf (")"); + AcpiDmCommaIfFieldMember (Op); + AcpiOsPrintf ("\n"); + + Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; /* for now, ignore in AcpiDmAscendingOp */ + Child->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + break; + case AML_INT_BYTELIST_OP: AcpiDmByteList (Info, Op); diff --git a/disassembler/dmresrc.c b/disassembler/dmresrc.c index fe208d526034..d4d7d21cf902 100644 --- a/disassembler/dmresrc.c +++ b/disassembler/dmresrc.c @@ -55,12 +55,6 @@ /* Dispatch tables for Resource disassembly functions */ -typedef -void (*ACPI_RESOURCE_HANDLER) ( - AML_RESOURCE *Resource, - UINT32 Length, - UINT32 Level); - static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] = { /* Small descriptors */ @@ -75,7 +69,7 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] = AcpiDmEndDependentDescriptor, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ AcpiDmIoDescriptor, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */ AcpiDmFixedIoDescriptor, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */ - NULL, /* 0x0A, Reserved */ + AcpiDmFixedDmaDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */ NULL, /* 0x0B, Reserved */ NULL, /* 0x0C, Reserved */ NULL, /* 0x0D, Reserved */ @@ -95,7 +89,10 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] = AcpiDmWordDescriptor, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */ AcpiDmInterruptDescriptor, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */ AcpiDmQwordDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */ - AcpiDmExtendedDescriptor /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ + AcpiDmExtendedDescriptor, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ + AcpiDmGpioDescriptor, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ + NULL, /* 0x0D, Reserved */ + AcpiDmSerialBusDescriptor /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS */ }; diff --git a/disassembler/dmresrcl.c b/disassembler/dmresrcl.c index 2284928752c9..7493957f5535 100644 --- a/disassembler/dmresrcl.c +++ b/disassembler/dmresrcl.c @@ -1050,4 +1050,3 @@ AcpiDmVendorLargeDescriptor ( } #endif - diff --git a/disassembler/dmresrcl2.c b/disassembler/dmresrcl2.c new file mode 100644 index 000000000000..a87b8a279e06 --- /dev/null +++ b/disassembler/dmresrcl2.c @@ -0,0 +1,700 @@ +/******************************************************************************* + * + * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2) + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + + +#include "acpi.h" +#include "accommon.h" +#include "acdisasm.h" + + +#ifdef ACPI_DISASSEMBLER + +#define _COMPONENT ACPI_CA_DEBUGGER + ACPI_MODULE_NAME ("dbresrcl2") + +/* Local prototypes */ + +static void +AcpiDmI2cSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +static void +AcpiDmSpiSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +static void +AcpiDmUartSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +static void +AcpiDmGpioCommon ( + AML_RESOURCE *Resource, + UINT32 Level); + +static void +AcpiDmDumpRawDataBuffer ( + UINT8 *Buffer, + UINT32 Length, + UINT32 Level); + + +/* Dispatch table for the serial bus descriptors */ + +static ACPI_RESOURCE_HANDLER SerialBusResourceDispatch [] = +{ + NULL, + AcpiDmI2cSerialBusDescriptor, + AcpiDmSpiSerialBusDescriptor, + AcpiDmUartSerialBusDescriptor +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpRawDataBuffer + * + * PARAMETERS: Buffer - Pointer to the data bytes + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for + * vendor data bytes. + * + ******************************************************************************/ + +static void +AcpiDmDumpRawDataBuffer ( + UINT8 *Buffer, + UINT32 Length, + UINT32 Level) +{ + UINT32 Index; + UINT32 i; + UINT32 j; + + + if (!Length) + { + return; + } + + AcpiOsPrintf ("RawDataBuffer (0x%.2X) // Vendor Data", Length); + + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("{\n"); + AcpiDmIndent (Level + 2); + + for (i = 0; i < Length;) + { + for (j = 0; j < 8; j++) + { + Index = i + j; + if (Index >= Length) + { + goto Finish; + } + + AcpiOsPrintf ("0x%2.2X", Buffer[Index]); + if ((Index + 1) >= Length) + { + goto Finish; + } + + AcpiOsPrintf (", "); + } + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 2); + + i += 8; + } + +Finish: + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmGpioCommon + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor + * + ******************************************************************************/ + +static void +AcpiDmGpioCommon ( + AML_RESOURCE *Resource, + UINT32 Level) +{ + UINT32 PinCount; + UINT16 *PinList; + UINT8 *VendorData; + UINT32 i; + + + /* ResourceSource, ResourceSourceIndex, ResourceType */ + + AcpiDmIndent (Level + 1); + if (Resource->Gpio.ResSourceOffset) + { + AcpiUtPrintString ( + ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset), + ACPI_UINT8_MAX); + } + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex); + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [(Resource->Gpio.Flags & 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->Gpio.VendorOffset) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->Gpio.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->Gpio.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); + + /* Dump the interrupt list */ + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("{ // Pin list\n"); + + PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset - + Resource->Gpio.PinTableOffset)) / + sizeof (UINT16); + + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, + Resource->Gpio.PinTableOffset); + + for (i = 0; i < PinCount; i++) + { + AcpiDmIndent (Level + 2); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], ((i + 1) < PinCount) ? "," : ""); + } + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmGpioIntDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a GPIO Interrupt descriptor + * + ******************************************************************************/ + +static void +AcpiDmGpioIntDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + + /* Dump the GpioInt-specific portion of the descriptor */ + + /* EdgeLevel, ActiveLevel, Shared */ + + AcpiDmIndent (Level); + AcpiOsPrintf ("GpioInt (%s, %s, %s, ", + AcpiGbl_HeDecode [(Resource->Gpio.IntFlags & 1)], + AcpiGbl_LlDecode [(Resource->Gpio.IntFlags >> 1) & 1], + AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]); + + /* PinConfig, DebounceTimeout */ + + if (Resource->Gpio.PinConfig <= 3) + { + AcpiOsPrintf ("%s, ", + AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]); + } + else + { + AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig); + } + AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout); + + /* Dump the GpioInt/GpioIo common portion of the descriptor */ + + AcpiDmGpioCommon (Resource, Level); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmGpioIoDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a GPIO Interrupt descriptor + * + ******************************************************************************/ + +static void +AcpiDmGpioIoDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + + /* Dump the GpioIo-specific portion of the descriptor */ + + /* Shared, PinConfig */ + + AcpiDmIndent (Level); + AcpiOsPrintf ("GpioIo (%s, ", + AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]); + + if (Resource->Gpio.PinConfig <= 3) + { + AcpiOsPrintf ("%s, ", + AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]); + } + else + { + AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig); + } + + /* DebounceTimeout, DriveStrength, IoRestriction */ + + AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout); + AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength); + AcpiOsPrintf ("%s,\n", + AcpiGbl_IorDecode [Resource->Gpio.IntFlags & 3]); + + /* Dump the GpioInt/GpioIo common portion of the descriptor */ + + AcpiDmGpioCommon (Resource, Level); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmGpioDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor + * + ******************************************************************************/ + +void +AcpiDmGpioDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT8 ConnectionType; + + + ConnectionType = Resource->Gpio.ConnectionType; + + switch (ConnectionType) + { + case AML_RESOURCE_GPIO_TYPE_INT: + AcpiDmGpioIntDescriptor (Resource, Length, Level); + break; + + case AML_RESOURCE_GPIO_TYPE_IO: + AcpiDmGpioIoDescriptor (Resource, Length, Level); + break; + + default: + AcpiOsPrintf ("Unknown GPIO type\n"); + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpSerialBusVendorData + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump optional serial bus vendor data + * + ******************************************************************************/ + +static void +AcpiDmDumpSerialBusVendorData ( + AML_RESOURCE *Resource, + UINT32 Level) +{ + UINT8 *VendorData; + UINT32 VendorLength; + + + /* Get the (optional) vendor data and length */ + + switch (Resource->CommonSerialBus.Type) + { + case AML_RESOURCE_I2C_SERIALBUSTYPE: + + VendorLength = Resource->CommonSerialBus.TypeDataLength - + AML_RESOURCE_I2C_MIN_DATA_LEN; + + VendorData = ACPI_ADD_PTR (UINT8, Resource, + sizeof (AML_RESOURCE_I2C_SERIALBUS)); + break; + + case AML_RESOURCE_SPI_SERIALBUSTYPE: + + VendorLength = Resource->CommonSerialBus.TypeDataLength - + AML_RESOURCE_SPI_MIN_DATA_LEN; + + VendorData = ACPI_ADD_PTR (UINT8, Resource, + sizeof (AML_RESOURCE_SPI_SERIALBUS)); + break; + + case AML_RESOURCE_UART_SERIALBUSTYPE: + + VendorLength = Resource->CommonSerialBus.TypeDataLength - + AML_RESOURCE_UART_MIN_DATA_LEN; + + VendorData = ACPI_ADD_PTR (UINT8, Resource, + sizeof (AML_RESOURCE_UART_SERIALBUS)); + break; + + default: + return; + } + + /* Dump the vendor bytes as a RawDataBuffer object */ + + AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmI2cSerialBusDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a I2C serial bus descriptor + * + ******************************************************************************/ + +static void +AcpiDmI2cSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT32 ResourceSourceOffset; + + + /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */ + + AcpiDmIndent (Level); + AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n", + Resource->I2cSerialBus.SlaveAddress, + AcpiGbl_SmDecode [(Resource->I2cSerialBus.Flags & 1)], + Resource->I2cSerialBus.ConnectionSpeed); + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("%s, ", + AcpiGbl_AmDecode [(Resource->I2cSerialBus.TypeSpecificFlags & 1)]); + + /* ResourceSource is a required field */ + + ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + + Resource->CommonSerialBus.TypeDataLength; + + AcpiUtPrintString ( + ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + ACPI_UINT8_MAX); + + /* ResourceSourceIndex, ResourceUsage */ + + AcpiOsPrintf (",\n"); + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [(Resource->I2cSerialBus.Flags & 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + AcpiOsPrintf (",\n"); + + /* Dump the vendor data */ + + AcpiDmIndent (Level + 1); + AcpiDmDumpSerialBusVendorData (Resource, Level); + AcpiOsPrintf (")\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmSpiSerialBusDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a SPI serial bus descriptor + * + ******************************************************************************/ + +static void +AcpiDmSpiSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT32 ResourceSourceOffset; + + + /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */ + + AcpiDmIndent (Level); + AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n", + Resource->SpiSerialBus.DeviceSelection, + AcpiGbl_DpDecode [(Resource->SpiSerialBus.TypeSpecificFlags >> 1) & 1], + AcpiGbl_WmDecode [(Resource->SpiSerialBus.TypeSpecificFlags & 1)], + Resource->SpiSerialBus.DataBitLength); + + /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */ + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("%s, 0x%8.8X, %s,\n", + AcpiGbl_SmDecode [(Resource->SpiSerialBus.Flags & 1)], + Resource->SpiSerialBus.ConnectionSpeed, + AcpiGbl_CpoDecode [(Resource->SpiSerialBus.ClockPolarity & 1)]); + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("%s, ", + AcpiGbl_CphDecode [(Resource->SpiSerialBus.ClockPhase & 1)]); + + /* ResourceSource is a required field */ + + ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + + Resource->CommonSerialBus.TypeDataLength; + + AcpiUtPrintString ( + ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + ACPI_UINT8_MAX); + + /* ResourceSourceIndex, ResourceUsage */ + + AcpiOsPrintf (",\n"); + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [(Resource->SpiSerialBus.Flags & 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + AcpiOsPrintf (",\n"); + + /* Dump the vendor data */ + + AcpiDmIndent (Level + 1); + AcpiDmDumpSerialBusVendorData (Resource, Level); + AcpiOsPrintf (")\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmUartSerialBusDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a UART serial bus descriptor + * + ******************************************************************************/ + +static void +AcpiDmUartSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT32 ResourceSourceOffset; + + + /* ConnectionSpeed, BitsPerByte, StopBits */ + + AcpiDmIndent (Level); + AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n", + Resource->UartSerialBus.DefaultBaudRate, + AcpiGbl_BpbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 4) & 3], + AcpiGbl_SbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 2) & 3]); + + /* LinesInUse, IsBigEndian, Parity, FlowControl */ + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n", + Resource->UartSerialBus.LinesEnabled, + AcpiGbl_EdDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 7) & 1], + AcpiGbl_PtDecode [Resource->UartSerialBus.Parity & 7], + AcpiGbl_FcDecode [Resource->UartSerialBus.TypeSpecificFlags & 3]); + + /* ReceiveBufferSize, TransmitBufferSize */ + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ", + Resource->UartSerialBus.RxFifoSize, + Resource->UartSerialBus.TxFifoSize); + + /* ResourceSource is a required field */ + + ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + + Resource->CommonSerialBus.TypeDataLength; + + AcpiUtPrintString ( + ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + ACPI_UINT8_MAX); + + /* ResourceSourceIndex, ResourceUsage */ + + AcpiOsPrintf (",\n"); + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [(Resource->UartSerialBus.Flags & 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + AcpiOsPrintf (",\n"); + + /* Dump the vendor data */ + + AcpiDmIndent (Level + 1); + AcpiDmDumpSerialBusVendorData (Resource, Level); + AcpiOsPrintf (")\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmSerialBusDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor + * + ******************************************************************************/ + +void +AcpiDmSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + + SerialBusResourceDispatch [Resource->CommonSerialBus.Type] ( + Resource, Length, Level); +} + +#endif + diff --git a/disassembler/dmresrcs.c b/disassembler/dmresrcs.c index 52b0fa3ea35a..456658d80e56 100644 --- a/disassembler/dmresrcs.c +++ b/disassembler/dmresrcs.c @@ -121,9 +121,9 @@ AcpiDmDmaDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("DMA (%s, %s, %s, ", - AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3], - AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1], - AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]); + AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3], + AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1], + AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]); /* Insert a descriptor name */ @@ -137,6 +137,49 @@ AcpiDmDmaDescriptor ( /******************************************************************************* * + * FUNCTION: AcpiDmFixedDmaDescriptor + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a FixedDMA descriptor + * + ******************************************************************************/ + +void +AcpiDmFixedDmaDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + + AcpiDmIndent (Level); + AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ", + Resource->FixedDma.RequestLines, + Resource->FixedDma.Channels); + + if (Resource->FixedDma.Width <= 5) + { + AcpiOsPrintf ("%s, ", + AcpiGbl_DtsDecode [Resource->FixedDma.Width]); + } + else + { + AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", Resource->FixedDma.Width); + } + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + AcpiOsPrintf (")\n"); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmIoDescriptor * * PARAMETERS: Resource - Pointer to the resource descriptor diff --git a/disassembler/dmutils.c b/disassembler/dmutils.c index b3db9312d518..55a1bb07eebf 100644 --- a/disassembler/dmutils.c +++ b/disassembler/dmutils.c @@ -135,7 +135,8 @@ const char *AcpiGbl_IrqDecode[] = * * RETURN: None * - * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus stuff) + * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus and + * GenericSerialBus stuff.) * ******************************************************************************/ @@ -146,44 +147,61 @@ AcpiDmDecodeAttribute ( switch (Attribute) { - case AML_FIELD_ATTRIB_SMB_QUICK: + case AML_FIELD_ATTRIB_QUICK: - AcpiOsPrintf ("SMBQuick"); + AcpiOsPrintf ("AttribQuick"); break; - case AML_FIELD_ATTRIB_SMB_SEND_RCV: + case AML_FIELD_ATTRIB_SEND_RCV: - AcpiOsPrintf ("SMBSendReceive"); + AcpiOsPrintf ("AttribSendReceive"); break; - case AML_FIELD_ATTRIB_SMB_BYTE: + case AML_FIELD_ATTRIB_BYTE: - AcpiOsPrintf ("SMBByte"); + AcpiOsPrintf ("AttribByte"); break; - case AML_FIELD_ATTRIB_SMB_WORD: + case AML_FIELD_ATTRIB_WORD: - AcpiOsPrintf ("SMBWord"); + AcpiOsPrintf ("AttribWord"); break; - case AML_FIELD_ATTRIB_SMB_WORD_CALL: + case AML_FIELD_ATTRIB_BLOCK: - AcpiOsPrintf ("SMBProcessCall"); + AcpiOsPrintf ("AttribBlock"); break; - case AML_FIELD_ATTRIB_SMB_BLOCK: + case AML_FIELD_ATTRIB_MULTIBYTE: - AcpiOsPrintf ("SMBBlock"); + AcpiOsPrintf ("AttribBytes"); break; - case AML_FIELD_ATTRIB_SMB_BLOCK_CALL: + case AML_FIELD_ATTRIB_WORD_CALL: - AcpiOsPrintf ("SMBBlockProcessCall"); + AcpiOsPrintf ("AttribProcessCall"); + break; + + case AML_FIELD_ATTRIB_BLOCK_CALL: + + AcpiOsPrintf ("AttribBlockProcessCall"); + break; + + case AML_FIELD_ATTRIB_RAW_BYTES: + + AcpiOsPrintf ("AttribRawBytes"); + break; + + case AML_FIELD_ATTRIB_RAW_PROCESS: + + AcpiOsPrintf ("AttribRawProcessBytes"); break; default: - AcpiOsPrintf ("0x%.2X", Attribute); + /* A ByteConst is allowed by the grammar */ + + AcpiOsPrintf ("0x%2.2X", Attribute); break; } } diff --git a/disassembler/dmwalk.c b/disassembler/dmwalk.c index 2a4b5e545fa1..1a63b798ac13 100644 --- a/disassembler/dmwalk.c +++ b/disassembler/dmwalk.c @@ -464,7 +464,8 @@ AcpiDmDescendingOp ( AcpiDmDisassembleOneOp (NULL, Info, Op); - if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) + if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) || + (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP)) { return (AE_OK); } diff --git a/dispatcher/dsargs.c b/dispatcher/dsargs.c index 87def860516c..580002805c45 100644 --- a/dispatcher/dsargs.c +++ b/dispatcher/dsargs.c @@ -424,7 +424,7 @@ AcpiDsGetRegionArguments ( /* Execute the argument AML */ - Status = AcpiDsExecuteArguments (Node, Node->Parent, + Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode, ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } diff --git a/dispatcher/dsfield.c b/dispatcher/dsfield.c index 886b6c24c5e8..5194fefe2269 100644 --- a/dispatcher/dsfield.c +++ b/dispatcher/dsfield.c @@ -243,6 +243,7 @@ AcpiDsGetFieldNames ( { ACPI_STATUS Status; UINT64 Position; + ACPI_PARSE_OBJECT *Child; ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info); @@ -257,10 +258,11 @@ AcpiDsGetFieldNames ( while (Arg) { /* - * Three types of field elements are handled: - * 1) Offset - specifies a bit offset - * 2) AccessAs - changes the access mode - * 3) Name - Enters a new named field into the namespace + * Four types of field elements are handled: + * 1) Name - Enters a new named field into the namespace + * 2) Offset - specifies a bit offset + * 3) AccessAs - changes the access mode/attributes + * 4) Connection - Associate a resource template with the field */ switch (Arg->Common.AmlOpcode) { @@ -279,24 +281,67 @@ AcpiDsGetFieldNames ( Info->FieldBitPosition = (UINT32) Position; break; - case AML_INT_ACCESSFIELD_OP: - + case AML_INT_EXTACCESSFIELD_OP: /* - * Get a new AccessType and AccessAttribute -- to be used for all - * field units that follow, until field end or another AccessAs - * keyword. + * Get new AccessType, AccessAttribute, and AccessLength fields + * -- to be used for all field units that follow, until the + * end-of-field or another AccessAs keyword is encountered. + * NOTE. These three bytes are encoded in the integer value + * of the parseop for convenience. * * In FieldFlags, preserve the flag bits other than the - * ACCESS_TYPE bits + * ACCESS_TYPE bits. */ + + /* AccessType (ByteAcc, WordAcc, etc.) */ + Info->FieldFlags = (UINT8) ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | - ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8))); + ((UINT8) ((UINT32) (Arg->Common.Value.Integer & 0x07)))); + + /* AccessAttribute (AttribQuick, AttribByte, etc.) */ + + Info->Attribute = (UINT8) ((Arg->Common.Value.Integer >> 8) & 0xFF); + + /* AccessLength (for serial/buffer protocols) */ - Info->Attribute = (UINT8) (Arg->Common.Value.Integer); + Info->AccessLength = (UINT8) ((Arg->Common.Value.Integer >> 16) & 0xFF); break; + case AML_INT_CONNECTION_OP: + /* + * Clear any previous connection. New connection is used for all + * fields that follow, similar to AccessAs + */ + Info->ResourceBuffer = NULL; + Info->ConnectionNode = NULL; + + /* + * A Connection() is either an actual resource descriptor (buffer) + * or a named reference to a resource template + */ + Child = Arg->Common.Value.Arg; + if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP) + { + Info->ResourceBuffer = Child->Named.Data; + Info->ResourceLength = (UINT16) Child->Named.Value.Integer; + } + else + { + /* Lookup the Connection() namepath, it should already exist */ + + Status = AcpiNsLookup (WalkState->ScopeInfo, + Child->Common.Value.Name, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Info->ConnectionNode); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR_NAMESPACE (Child->Common.Value.Name, Status); + return_ACPI_STATUS (Status); + } + } + break; case AML_INT_NAMEDFIELD_OP: @@ -348,7 +393,6 @@ AcpiDsGetFieldNames ( Info->FieldBitPosition += Info->FieldBitLength; break; - default: ACPI_ERROR ((AE_INFO, @@ -406,6 +450,8 @@ AcpiDsCreateField ( } } + ACPI_MEMSET (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); + /* Second arg is the field flags */ Arg = Arg->Common.Next; @@ -418,7 +464,6 @@ AcpiDsCreateField ( Info.RegionNode = RegionNode; Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); - return_ACPI_STATUS (Status); } @@ -514,8 +559,8 @@ AcpiDsInitFieldObjects ( while (Arg) { /* - * Ignore OFFSET and ACCESSAS terms here; we are only interested in the - * field names in order to enter them into the namespace. + * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested + * in the field names in order to enter them into the namespace. */ if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { @@ -697,7 +742,6 @@ AcpiDsCreateIndexField ( Info.RegionNode = RegionNode; Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); - return_ACPI_STATUS (Status); } diff --git a/events/evevent.c b/events/evevent.c index 0f5785a6347d..7f9642ac5cad 100644 --- a/events/evevent.c +++ b/events/evevent.c @@ -81,6 +81,13 @@ AcpiEvInitializeEvents ( ACPI_FUNCTION_TRACE (EvInitializeEvents); + /* If Hardware Reduced flag is set, there are no fixed events */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* * Initialize the Fixed and General Purpose Events. This is done prior to * enabling SCIs to prevent interrupts from occurring before the handlers @@ -128,6 +135,13 @@ AcpiEvInstallXruptHandlers ( ACPI_FUNCTION_TRACE (EvInstallXruptHandlers); + /* If Hardware Reduced flag is set, there is no ACPI h/w */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Install the SCI handler */ Status = AcpiEvInstallSciHandler (); diff --git a/events/evglock.c b/events/evglock.c index cab444d06d67..5ab54e787629 100644 --- a/events/evglock.c +++ b/events/evglock.c @@ -79,6 +79,13 @@ AcpiEvInitGlobalLockHandler ( ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); + /* If Hardware Reduced flag is set, there is no global lock */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Attempt installation of the global lock handler */ Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, diff --git a/events/evregion.c b/events/evregion.c index 193eb07b9257..461476355239 100644 --- a/events/evregion.c +++ b/events/evregion.c @@ -372,6 +372,7 @@ Cleanup1: * FUNCTION: AcpiEvAddressSpaceDispatch * * PARAMETERS: RegionObj - Internal region object + * FieldObj - Corresponding field. Can be NULL. * Function - Read or Write operation * RegionOffset - Where in the region to read or write * BitWidth - Field width in bits (8, 16, 32, or 64) @@ -388,6 +389,7 @@ Cleanup1: ACPI_STATUS AcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj, + ACPI_OPERAND_OBJECT *FieldObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, @@ -399,6 +401,7 @@ AcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; + ACPI_CONNECTION_INFO *Context; ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch); @@ -423,6 +426,8 @@ AcpiEvAddressSpaceDispatch ( return_ACPI_STATUS (AE_NOT_EXIST); } + Context = HandlerDesc->AddressSpace.Context; + /* * It may be the case that the region has never been initialized. * Some types of regions require special init code @@ -450,7 +455,7 @@ AcpiEvAddressSpaceDispatch ( AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, - HandlerDesc->AddressSpace.Context, &RegionContext); + Context, &RegionContext); /* Re-enter the interpreter */ @@ -499,6 +504,27 @@ AcpiEvAddressSpaceDispatch ( ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + + /* + * Special handling for GenericSerialBus and GeneralPurposeIo: + * There are three extra parameters that must be passed to the + * handler via the context: + * 1) Connection buffer, a resource template from Connection() op. + * 2) Length of the above buffer. + * 3) Actual access length from the AccessAs() op. + */ + if (((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) || + (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) && + Context && + FieldObj) + { + /* Get the Connection (ResourceTemplate) buffer */ + + Context->Connection = FieldObj->Field.ResourceBuffer; + Context->Length = FieldObj->Field.ResourceLength; + Context->AccessLength = FieldObj->Field.AccessLength; + } + if (!(HandlerDesc->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { @@ -514,7 +540,7 @@ AcpiEvAddressSpaceDispatch ( Status = Handler (Function, (RegionObj->Region.Address + RegionOffset), BitWidth, Value, - HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext); + Context, RegionObj2->Extra.RegionContext); if (ACPI_FAILURE (Status)) { diff --git a/executer/exconfig.c b/executer/exconfig.c index d7677e99ce67..72f45bece61a 100644 --- a/executer/exconfig.c +++ b/executer/exconfig.c @@ -334,7 +334,7 @@ AcpiExRegionRead ( for (i = 0; i < Length; i++) { - Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, + Status = AcpiEvAddressSpaceDispatch (ObjDesc, NULL, ACPI_READ, RegionOffset, 8, &Value); if (ACPI_FAILURE (Status)) { diff --git a/executer/excreate.c b/executer/excreate.c index fe93e0e9409a..7d52e0172c31 100644 --- a/executer/excreate.c +++ b/executer/excreate.c @@ -284,7 +284,7 @@ Cleanup: * * PARAMETERS: AmlStart - Pointer to the region declaration AML * AmlLength - Max length of the declaration AML - * RegionSpace - SpaceID for the region + * SpaceId - Address space ID for the region * WalkState - Current state * * RETURN: Status @@ -297,7 +297,7 @@ ACPI_STATUS AcpiExCreateRegion ( UINT8 *AmlStart, UINT32 AmlLength, - UINT8 RegionSpace, + UINT8 SpaceId, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; @@ -326,16 +326,18 @@ AcpiExCreateRegion ( * Space ID must be one of the predefined IDs, or in the user-defined * range */ - if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && - (RegionSpace < ACPI_USER_REGION_BEGIN) && - (RegionSpace != ACPI_ADR_SPACE_DATA_TABLE)) + if (!AcpiIsValidSpaceId (SpaceId)) { - ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace)); - return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); + /* + * Print an error message, but continue. We don't want to abort + * a table load for this exception. Instead, if the region is + * actually used at runtime, abort the executing method. + */ + ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); } ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n", - AcpiUtGetRegionName (RegionSpace), RegionSpace)); + AcpiUtGetRegionName (SpaceId), SpaceId)); /* Create the region descriptor */ @@ -353,10 +355,18 @@ AcpiExCreateRegion ( RegionObj2 = ObjDesc->Common.NextObject; RegionObj2->Extra.AmlStart = AmlStart; RegionObj2->Extra.AmlLength = AmlLength; + if (WalkState->ScopeInfo) + { + RegionObj2->Extra.ScopeNode = WalkState->ScopeInfo->Scope.Node; + } + else + { + RegionObj2->Extra.ScopeNode = Node; + } /* Init the region from the operands */ - ObjDesc->Region.SpaceId = RegionSpace; + ObjDesc->Region.SpaceId = SpaceId; ObjDesc->Region.Address = 0; ObjDesc->Region.Length = 0; ObjDesc->Region.Node = Node; diff --git a/executer/exdump.c b/executer/exdump.c index 60003e61544e..e6f71006fcca 100644 --- a/executer/exdump.c +++ b/executer/exdump.c @@ -209,11 +209,13 @@ static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"} }; -static ACPI_EXDUMP_INFO AcpiExDumpRegionField[3] = +static ACPI_EXDUMP_INFO AcpiExDumpRegionField[5] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL}, {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"} + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Field.AccessLength), "AccessLength"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.ResourceBuffer), "ResourceBuffer"} }; static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] = diff --git a/executer/exfield.c b/executer/exfield.c index 098a18650e65..62dcc092d4c0 100644 --- a/executer/exfield.c +++ b/executer/exfield.c @@ -113,19 +113,25 @@ AcpiExReadDataFromField ( } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus or IPMI read. We must create a buffer to hold + * This is an SMBus, GSBus or IPMI read. We must create a buffer to hold * the data and then directly access the region handler. * - * Note: Smbus protocol value is passed in upper 16-bits of Function + * Note: SMBus and GSBus protocol value is passed in upper 16-bits of Function */ if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) { Length = ACPI_SMBUS_BUFFER_SIZE; Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); } + else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) + { + Length = ACPI_GSBUS_BUFFER_SIZE; + Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); + } else /* IPMI */ { Length = ACPI_IPMI_BUFFER_SIZE; @@ -274,23 +280,24 @@ AcpiExWriteDataToField ( } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus or IPMI write. We will bypass the entire field + * This is an SMBus, GSBus or IPMI write. We will bypass the entire field * mechanism and handoff the buffer directly to the handler. For * these address spaces, the buffer is bi-directional; on a write, * return data is returned in the same buffer. * * Source must be a buffer of sufficient size: - * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE. + * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE. * - * Note: SMBus protocol type is passed in upper 16-bits of Function + * Note: SMBus and GSBus protocol type is passed in upper 16-bits of Function */ if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { ACPI_ERROR ((AE_INFO, - "SMBus or IPMI write requires Buffer, found type %s", + "SMBus/IPMI/GenericSerialBus write requires Buffer, found type %s", AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -301,6 +308,11 @@ AcpiExWriteDataToField ( Length = ACPI_SMBUS_BUFFER_SIZE; Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); } + else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) + { + Length = ACPI_GSBUS_BUFFER_SIZE; + Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); + } else /* IPMI */ { Length = ACPI_IPMI_BUFFER_SIZE; @@ -310,7 +322,7 @@ AcpiExWriteDataToField ( if (SourceDesc->Buffer.Length < Length) { ACPI_ERROR ((AE_INFO, - "SMBus or IPMI write requires Buffer of length %u, found length %u", + "SMBus/IPMI/GenericSerialBus write requires Buffer of length %u, found length %u", Length, SourceDesc->Buffer.Length)); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); diff --git a/executer/exfldio.c b/executer/exfldio.c index bf663a2f5ecc..a4a884645506 100644 --- a/executer/exfldio.c +++ b/executer/exfldio.c @@ -98,6 +98,7 @@ AcpiExSetupRegion ( { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *RgnDesc; + UINT8 SpaceId; ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset); @@ -116,6 +117,16 @@ AcpiExSetupRegion ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } + SpaceId = RgnDesc->Region.SpaceId; + + /* Validate the Space ID */ + + if (!AcpiIsValidSpaceId (SpaceId)) + { + ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId)); + return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); + } + /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. @@ -130,11 +141,12 @@ AcpiExSetupRegion ( } /* - * Exit now for SMBus or IPMI address space, it has a non-linear + * Exit now for SMBus, GSBus or IPMI address space, it has a non-linear * address space and the request cannot be directly validated */ - if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || - RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI) + if (SpaceId == ACPI_ADR_SPACE_SMBUS || + SpaceId == ACPI_ADR_SPACE_GSBUS || + SpaceId == ACPI_ADR_SPACE_IPMI) { /* SMBus or IPMI has a non-linear address space */ @@ -290,7 +302,8 @@ AcpiExAccessRegion ( /* Invoke the appropriate AddressSpace/OpRegion handler */ - Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, RegionOffset, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ObjDesc, + Function, RegionOffset, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); if (ACPI_FAILURE (Status)) @@ -337,6 +350,8 @@ AcpiExRegisterOverflow ( ACPI_OPERAND_OBJECT *ObjDesc, UINT64 Value) { + ACPI_FUNCTION_NAME (ExRegisterOverflow); + if (ObjDesc->CommonField.BitLength >= ACPI_INTEGER_BIT_SIZE) { @@ -353,6 +368,11 @@ AcpiExRegisterOverflow ( * The Value is larger than the maximum value that can fit into * the register. */ + ACPI_ERROR ((AE_INFO, + "Index value 0x%8.8X%8.8X overflows field width 0x%X", + ACPI_FORMAT_UINT64 (Value), + ObjDesc->CommonField.BitLength)); + return (TRUE); } diff --git a/executer/exprep.c b/executer/exprep.c index ee96a6a09023..d7347d5e6f71 100644 --- a/executer/exprep.c +++ b/executer/exprep.c @@ -49,6 +49,7 @@ #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" +#include "acdispat.h" #define _COMPONENT ACPI_EXECUTER @@ -484,6 +485,32 @@ AcpiExPrepFieldValue ( ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); + /* Fields specific to GenericSerialBus fields */ + + ObjDesc->Field.AccessLength = Info->AccessLength; + + if (Info->ConnectionNode) + { + SecondDesc = Info->ConnectionNode->Object; + if (!(SecondDesc->Common.Flags & AOPOBJ_DATA_VALID)) + { + Status = AcpiDsGetBufferArguments (SecondDesc); + if (ACPI_FAILURE (Status)) + { + AcpiUtDeleteObjectDesc (ObjDesc); + return_ACPI_STATUS (Status); + } + } + + ObjDesc->Field.ResourceBuffer = SecondDesc->Buffer.Pointer; + ObjDesc->Field.ResourceLength = (UINT16) SecondDesc->Buffer.Length; + } + else if (Info->ResourceBuffer) + { + ObjDesc->Field.ResourceBuffer = Info->ResourceBuffer; + ObjDesc->Field.ResourceLength = Info->ResourceLength; + } + /* Allow full data read from EC address space */ if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && diff --git a/executer/exutils.c b/executer/exutils.c index 4daa44f52792..bbc9e0ddfa07 100644 --- a/executer/exutils.c +++ b/executer/exutils.c @@ -499,4 +499,34 @@ AcpiExIntegerToString ( } } + +/******************************************************************************* + * + * FUNCTION: AcpiIsValidSpaceId + * + * PARAMETERS: SpaceId - ID to be validated + * + * RETURN: TRUE if valid/supported ID. + * + * DESCRIPTION: Validate an operation region SpaceID. + * + ******************************************************************************/ + +BOOLEAN +AcpiIsValidSpaceId ( + UINT8 SpaceId) +{ + + if ((SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) && + (SpaceId < ACPI_USER_REGION_BEGIN) && + (SpaceId != ACPI_ADR_SPACE_DATA_TABLE) && + (SpaceId != ACPI_ADR_SPACE_FIXED_HARDWARE)) + { + return (FALSE); + } + + return (TRUE); +} + + #endif diff --git a/generate/unix/Makefile b/generate/unix/Makefile index e75523c26bb7..34c61fd81133 100644 --- a/generate/unix/Makefile +++ b/generate/unix/Makefile @@ -12,29 +12,95 @@ # include Makefile.config +# +# Get the OS machine architecture. Anything with a "64" in the returned +# string will be treated as a 64-bit OS. Otherwise, the default is 32-bit. +# +HARDWARE_NAME := $(shell uname -m) +# +# Main rule will only generate versions that are appropriate for the running +# OS, either 64-bit or 32-bit. +# all: ${PROGS} ${PROGS}: FORCE - @cd $@; make; ls -al $@ + @cd $@; \ + if [ $(findstring 64,$(HARDWARE_NAME)) ]; then \ + mkdir -p obj64; \ + make BITS=64; \ + echo "64-bit version of $@:"; \ + ls -al obj64/$@; \ + else \ + mkdir -p obj32; \ + make BITS=32; \ + echo "32-bit version of $@:"; \ + ls -al obj32/$@; \ + fi; + +# +# Make 32-bit and 64-bit versions of all the tools +# +both: 32 64 + +# +# Make only 32-bit versions of all the tools +# +32: FORCE + @for toolname in ${PROGS}; do \ + (cd $$toolname; \ + pwd; \ + mkdir -p obj32; \ + make BITS=32; \ + echo "32-bit version of $$toolname:"; \ + ls -al obj32/$$toolname \ + ); \ + done; + +# +# Make only 64-bit versions of all the tools +# +64: FORCE + @for toolname in ${PROGS}; do \ + (cd $$toolname; \ + pwd; \ + mkdir -p obj64; \ + make BITS=64; \ + echo "64-bit version of $$toolname:"; \ + ls -al obj64/$$toolname \ + ); \ + done; clean: FORCE - @for d in ${PROGS}; do \ - (cd $$d; \ - if [ $$? -ne 0 ]; then \ - echo "Bad element of PROGS: <$$d>"; \ - else \ - pwd; make clean; \ - fi); \ - done + @for toolname in ${PROGS}; do \ + (cd $$toolname; \ + pwd; \ + make BITS=32 clean; \ + make BITS=64 clean; \ + rmdir obj32; \ + rmdir obj64; \ + ); \ + done; +# +# Install all tools, either 32-bit or 64-bit as appropriate for the host OS +# install: FORCE - @for d in ${PROGS}; do \ - (cd $$d; \ - if [ $$? -ne 0 ]; then \ - echo "Bad element of PROGS: <$$d>"; \ + @for toolname in ${PROGS}; do \ + (cd $$toolname; \ + pwd; \ + if [ $(findstring 64,$(HARDWARE_NAME)) ]; then \ + make BITS=64 install; \ + echo "Installed 64-bit version of $$toolname"; \ else \ - pwd; make install; \ - fi); \ - done + make BITS=32 install; \ + echo "Installed 32-bit version of $$toolname"; \ + fi; \ + ); \ + done; + +machine: FORCE + @echo "Machine architecture: $(HARDWARE_NAME), $(XBITS)"; + @echo "Findstring: $(findstring 64, $(HARDWARE_NAME))"; FORCE: + diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config index d4899c4cfaec..3cd224e3a50f 100644 --- a/generate/unix/Makefile.config +++ b/generate/unix/Makefile.config @@ -20,22 +20,28 @@ # # Configuration # Notes: +# $(BITS) must be set to either 32 or 64 # gcc should be version 4 or greater, otherwise some of the options # used will not be recognized. # Global optimization flags (such as -O2, -Os) are not used, since # they cause issues on some compilers. # The _GNU_SOURCE symbol is required for many hosts. # +.SUFFIXES : PROGS = acpibin acpiexec acpihelp acpinames acpisrc acpixtract iasl - HOST = _CYGWIN CC = gcc -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< # # Common defines # -COPYPROG = @mkdir -p ../bin; rm -f ../bin/$(PROG); cp --remove-destination $(PROG) ../bin +OBJDIR = obj$(BITS) +BINDIR = bin$(BITS) +BITSFLAG = -m$(BITS) +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< +COPYPROG = @mkdir -p ../$(BINDIR); \ + rm -f ../$(BINDIR)/$(PROG); \ + cp --remove-destination $(PROG) ../$(BINDIR); INSTALLDIR = /usr/bin INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) @@ -83,10 +89,13 @@ ACPICA_HEADERS = \ # automatically included in -Wall. # CFLAGS += \ + $(BITSFLAG) \ -D$(HOST) \ -D_GNU_SOURCE \ -I$(ACPICA_INCLUDE) +LDFLAGS += $(BITSFLAG) + CWARNINGFLAGS = \ -ansi \ -Wall \ @@ -148,3 +157,4 @@ YFLAGS += -v -d -y LEX= flex LFLAGS += -i -s + diff --git a/generate/unix/acpibin/Makefile b/generate/unix/acpibin/Makefile index 57648d99faf3..d1113c1aa55d 100644 --- a/generate/unix/acpibin/Makefile +++ b/generate/unix/acpibin/Makefile @@ -11,7 +11,7 @@ # compile options, and prevents pollution of the source code. # include ../Makefile.config -PROG = acpibin +PROG = $(OBJDIR)/acpibin # # Search paths for source files @@ -26,21 +26,21 @@ HEADERS = \ $(wildcard $(ACPIBIN)/*.h) OBJECTS = \ - abcompare.o \ - abmain.o \ - utalloc.o \ - utcache.o \ - utdebug.o \ - utdecode.o \ - utglobal.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utstate.o \ - utxferror.o \ - osunixxf.o \ - getopt.o + $(OBJDIR)/abcompare.o \ + $(OBJDIR)/abmain.o \ + $(OBJDIR)/utalloc.o \ + $(OBJDIR)/utcache.o \ + $(OBJDIR)/utdebug.o \ + $(OBJDIR)/utdecode.o \ + $(OBJDIR)/utglobal.o \ + $(OBJDIR)/utlock.o \ + $(OBJDIR)/utmath.o \ + $(OBJDIR)/utmisc.o \ + $(OBJDIR)/utmutex.o \ + $(OBJDIR)/utstate.o \ + $(OBJDIR)/utxferror.o \ + $(OBJDIR)/osunixxf.o \ + $(OBJDIR)/getopt.o # # Flags specific to acpibin @@ -56,7 +56,7 @@ $(PROG) : $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) +$(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 96fe50d99cb4..b7b7d0179d3e 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -13,7 +13,7 @@ # compile options, and prevents pollution of the source code. # include ../Makefile.config -PROG = acpiexec +PROG = $(OBJDIR)/acpiexec # # Search paths for source files @@ -38,158 +38,161 @@ HEADERS = \ $(wildcard $(ACPIEXEC)/*.h) OBJECTS = \ - aeexec.o \ - aehandlers.o \ - aemain.o \ - aetables.o \ - dbcmds.o \ - dbdisply.o \ - dbexec.o \ - dbfileio.o \ - dbhistry.o \ - dbinput.o \ - dbmethod.o \ - dbnames.o \ - dbstats.o \ - dbutils.o \ - dbxface.o \ - dmbuffer.o \ - dmnames.o \ - dmobject.o \ - dmopcode.o \ - dmresrc.o \ - dmresrcl.o \ - dmresrcs.o \ - dmutils.o \ - dmwalk.o \ - dsargs.o \ - dscontrol.o \ - dsfield.o \ - dsinit.o \ - dsmethod.o \ - dsmthdat.o \ - dsobject.o \ - dsopcode.o \ - dsutils.o \ - dswexec.o \ - dswload.o \ - dswload2.o \ - dswscope.o \ - dswstate.o \ - evevent.o \ - evglock.o \ - evgpe.o \ - evgpeblk.o \ - evgpeinit.o \ - evgpeutil.o \ - evmisc.o \ - evregion.o \ - evrgnini.o \ - evsci.o \ - evxface.o \ - evxfevnt.o \ - evxfgpe.o \ - evxfregn.o \ - exconfig.o \ - exconvrt.o \ - excreate.o \ - exdebug.o \ - exdump.o \ - exfield.o \ - exfldio.o \ - exmisc.o \ - exmutex.o \ - exnames.o \ - exoparg1.o \ - exoparg2.o \ - exoparg3.o \ - exoparg6.o \ - exprep.o \ - exregion.o \ - exresnte.o \ - exresolv.o \ - exresop.o \ - exstore.o \ - exstoren.o \ - exstorob.o \ - exsystem.o \ - exutils.o \ - getopt.o \ - hwacpi.o \ - hwgpe.o \ - hwpci.o \ - hwregs.o \ - hwsleep.o \ - hwvalid.o \ - hwxface.o \ - nsaccess.o \ - nsalloc.o \ - nsdump.o \ - nsdumpdv.o \ - nseval.o \ - nsinit.o \ - nsload.o \ - nsnames.o \ - nsobject.o \ - nsparse.o \ - nspredef.o \ - nsrepair.o \ - nsrepair2.o \ - nssearch.o \ - nsutils.o \ - nswalk.o \ - nsxfeval.o \ - nsxfname.o \ - nsxfobj.o \ - osunixxf.o \ - psargs.o \ - psloop.o \ - psopcode.o \ - psparse.o \ - psscope.o \ - pstree.o \ - psutils.o \ - pswalk.o \ - psxface.o \ - rsaddr.o \ - rscalc.o \ - rscreate.o \ - rsdump.o \ - rsinfo.o \ - rsio.o \ - rsirq.o \ - rslist.o \ - rsmemory.o \ - rsmisc.o \ - rsutils.o \ - rsxface.o \ - tbfadt.o \ - tbfind.o \ - tbinstal.o \ - tbutils.o \ - tbxface.o \ - tbxfroot.o \ - utalloc.o \ - utcache.o \ - utcopy.o \ - utdebug.o \ - utdecode.o \ - utdelete.o \ - uteval.o \ - utglobal.o \ - utids.o \ - utinit.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utobject.o \ - utresrc.o \ - utstate.o \ - uttrack.o \ - utosi.o \ - utxferror.o \ - utxface.o + $(OBJDIR)/aeexec.o \ + $(OBJDIR)/aehandlers.o \ + $(OBJDIR)/aemain.o \ + $(OBJDIR)/aetables.o \ + $(OBJDIR)/dbcmds.o \ + $(OBJDIR)/dbdisply.o \ + $(OBJDIR)/dbexec.o \ + $(OBJDIR)/dbfileio.o \ + $(OBJDIR)/dbhistry.o \ + $(OBJDIR)/dbinput.o \ + $(OBJDIR)/dbmethod.o \ + $(OBJDIR)/dbnames.o \ + $(OBJDIR)/dbstats.o \ + $(OBJDIR)/dbutils.o \ + $(OBJDIR)/dbxface.o \ + $(OBJDIR)/dmbuffer.o \ + $(OBJDIR)/dmnames.o \ + $(OBJDIR)/dmobject.o \ + $(OBJDIR)/dmopcode.o \ + $(OBJDIR)/dmresrc.o \ + $(OBJDIR)/dmresrcl.o \ + $(OBJDIR)/dmresrcl2.o \ + $(OBJDIR)/dmresrcs.o \ + $(OBJDIR)/dmutils.o \ + $(OBJDIR)/dmwalk.o \ + $(OBJDIR)/dsargs.o \ + $(OBJDIR)/dscontrol.o \ + $(OBJDIR)/dsfield.o \ + $(OBJDIR)/dsinit.o \ + $(OBJDIR)/dsmethod.o \ + $(OBJDIR)/dsmthdat.o \ + $(OBJDIR)/dsobject.o \ + $(OBJDIR)/dsopcode.o \ + $(OBJDIR)/dsutils.o \ + $(OBJDIR)/dswexec.o \ + $(OBJDIR)/dswload.o \ + $(OBJDIR)/dswload2.o \ + $(OBJDIR)/dswscope.o \ + $(OBJDIR)/dswstate.o \ + $(OBJDIR)/evevent.o \ + $(OBJDIR)/evglock.o \ + $(OBJDIR)/evgpe.o \ + $(OBJDIR)/evgpeblk.o \ + $(OBJDIR)/evgpeinit.o \ + $(OBJDIR)/evgpeutil.o \ + $(OBJDIR)/evmisc.o \ + $(OBJDIR)/evregion.o \ + $(OBJDIR)/evrgnini.o \ + $(OBJDIR)/evsci.o \ + $(OBJDIR)/evxface.o \ + $(OBJDIR)/evxfevnt.o \ + $(OBJDIR)/evxfgpe.o \ + $(OBJDIR)/evxfregn.o \ + $(OBJDIR)/exconfig.o \ + $(OBJDIR)/exconvrt.o \ + $(OBJDIR)/excreate.o \ + $(OBJDIR)/exdebug.o \ + $(OBJDIR)/exdump.o \ + $(OBJDIR)/exfield.o \ + $(OBJDIR)/exfldio.o \ + $(OBJDIR)/exmisc.o \ + $(OBJDIR)/exmutex.o \ + $(OBJDIR)/exnames.o \ + $(OBJDIR)/exoparg1.o \ + $(OBJDIR)/exoparg2.o \ + $(OBJDIR)/exoparg3.o \ + $(OBJDIR)/exoparg6.o \ + $(OBJDIR)/exprep.o \ + $(OBJDIR)/exregion.o \ + $(OBJDIR)/exresnte.o \ + $(OBJDIR)/exresolv.o \ + $(OBJDIR)/exresop.o \ + $(OBJDIR)/exstore.o \ + $(OBJDIR)/exstoren.o \ + $(OBJDIR)/exstorob.o \ + $(OBJDIR)/exsystem.o \ + $(OBJDIR)/exutils.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/hwacpi.o \ + $(OBJDIR)/hwgpe.o \ + $(OBJDIR)/hwpci.o \ + $(OBJDIR)/hwregs.o \ + $(OBJDIR)/hwsleep.o \ + $(OBJDIR)/hwvalid.o \ + $(OBJDIR)/hwxface.o \ + $(OBJDIR)/nsaccess.o \ + $(OBJDIR)/nsalloc.o \ + $(OBJDIR)/nsdump.o \ + $(OBJDIR)/nsdumpdv.o \ + $(OBJDIR)/nseval.o \ + $(OBJDIR)/nsinit.o \ + $(OBJDIR)/nsload.o \ + $(OBJDIR)/nsnames.o \ + $(OBJDIR)/nsobject.o \ + $(OBJDIR)/nsparse.o \ + $(OBJDIR)/nspredef.o \ + $(OBJDIR)/nsrepair.o \ + $(OBJDIR)/nsrepair2.o \ + $(OBJDIR)/nssearch.o \ + $(OBJDIR)/nsutils.o \ + $(OBJDIR)/nswalk.o \ + $(OBJDIR)/nsxfeval.o \ + $(OBJDIR)/nsxfname.o \ + $(OBJDIR)/nsxfobj.o \ + $(OBJDIR)/osunixxf.o \ + $(OBJDIR)/psargs.o \ + $(OBJDIR)/psloop.o \ + $(OBJDIR)/psopcode.o \ + $(OBJDIR)/psparse.o \ + $(OBJDIR)/psscope.o \ + $(OBJDIR)/pstree.o \ + $(OBJDIR)/psutils.o \ + $(OBJDIR)/pswalk.o \ + $(OBJDIR)/psxface.o \ + $(OBJDIR)/rsaddr.o \ + $(OBJDIR)/rscalc.o \ + $(OBJDIR)/rscreate.o \ + $(OBJDIR)/rsdump.o \ + $(OBJDIR)/rsinfo.o \ + $(OBJDIR)/rsio.o \ + $(OBJDIR)/rsirq.o \ + $(OBJDIR)/rslist.o \ + $(OBJDIR)/rsmemory.o \ + $(OBJDIR)/rsmisc.o \ + $(OBJDIR)/rsserial.o \ + $(OBJDIR)/rsutils.o \ + $(OBJDIR)/rsxface.o \ + $(OBJDIR)/tbfadt.o \ + $(OBJDIR)/tbfind.o \ + $(OBJDIR)/tbinstal.o \ + $(OBJDIR)/tbutils.o \ + $(OBJDIR)/tbxface.o \ + $(OBJDIR)/tbxfroot.o \ + $(OBJDIR)/utalloc.o \ + $(OBJDIR)/utcache.o \ + $(OBJDIR)/utcopy.o \ + $(OBJDIR)/utdebug.o \ + $(OBJDIR)/utdecode.o \ + $(OBJDIR)/utdelete.o \ + $(OBJDIR)/uteval.o \ + $(OBJDIR)/utglobal.o \ + $(OBJDIR)/utids.o \ + $(OBJDIR)/utinit.o \ + $(OBJDIR)/utlock.o \ + $(OBJDIR)/utmath.o \ + $(OBJDIR)/utmisc.o \ + $(OBJDIR)/utmutex.o \ + $(OBJDIR)/utobject.o \ + $(OBJDIR)/utresrc.o \ + $(OBJDIR)/utstate.o \ + $(OBJDIR)/uttrack.o \ + $(OBJDIR)/utosi.o \ + $(OBJDIR)/utxface.o \ + $(OBJDIR)/utxferror.o \ + $(OBJDIR)/utxfmutex.o # # Flags specific to acpiexec utility @@ -206,7 +209,7 @@ $(PROG) : $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) +$(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile index 2ce6e59d7e51..aee76ed17aea 100644 --- a/generate/unix/acpihelp/Makefile +++ b/generate/unix/acpihelp/Makefile @@ -12,7 +12,7 @@ # compile options, and prevents pollution of the source code. # include ../Makefile.config -PROG = acpihelp +PROG = $(OBJDIR)/acpihelp # # Search paths for source files @@ -25,13 +25,13 @@ HEADERS = \ $(wildcard $(ACPIHELP)/*.h) OBJECTS = \ - ahamlops.o \ - ahaslkey.o \ - ahaslops.o \ - ahdecode.o \ - ahpredef.o \ - ahmain.o \ - getopt.o + $(OBJDIR)/ahamlops.o \ + $(OBJDIR)/ahaslkey.o \ + $(OBJDIR)/ahaslops.o \ + $(OBJDIR)/ahdecode.o \ + $(OBJDIR)/ahpredef.o \ + $(OBJDIR)/ahmain.o \ + $(OBJDIR)/getopt.o # # Flags specific to acpihelp @@ -47,7 +47,7 @@ $(PROG) : $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) +$(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : diff --git a/generate/unix/acpinames/Makefile b/generate/unix/acpinames/Makefile index dd0757c3014f..6cdc2c2065f3 100644 --- a/generate/unix/acpinames/Makefile +++ b/generate/unix/acpinames/Makefile @@ -13,7 +13,7 @@ # compile options, and prevents pollution of the source code. # include ../Makefile.config -PROG = acpinames +PROG = $(OBJDIR)/acpinames # # Search paths for source files @@ -34,69 +34,69 @@ HEADERS = \ $(wildcard $(ACPINAMES)/*.h) OBJECTS = \ - anmain.o \ - anstubs.o \ - antables.o \ - dbfileio.o \ - dsfield.o \ - dsmthdat.o \ - dsobject.o \ - dsutils.o \ - dswload.o \ - dswload2.o \ - dswscope.o \ - dswstate.o \ - excreate.o \ - exnames.o \ - exresnte.o \ - exresolv.o \ - exutils.o \ - getopt.o \ - nsaccess.o \ - nsalloc.o \ - nsdump.o \ - nsinit.o \ - nsload.o \ - nsnames.o \ - nsobject.o \ - nsparse.o \ - nssearch.o \ - nsutils.o \ - nswalk.o \ - nsxfeval.o \ - nsxfname.o \ - nsxfobj.o \ - osunixxf.o \ - psargs.o \ - psloop.o \ - psopcode.o \ - psparse.o \ - psscope.o \ - pstree.o \ - psutils.o \ - pswalk.o \ - psxface.o \ - tbfadt.o \ - tbfind.o \ - tbinstal.o \ - tbutils.o \ - tbxface.o \ - tbxfroot.o \ - utalloc.o \ - utcache.o \ - utdebug.o \ - utdecode.o \ - utdelete.o \ - utglobal.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utobject.o \ - utstate.o \ - utosi.o \ - utxferror.o \ - utxface.o + $(OBJDIR)/anmain.o \ + $(OBJDIR)/anstubs.o \ + $(OBJDIR)/antables.o \ + $(OBJDIR)/dbfileio.o \ + $(OBJDIR)/dsfield.o \ + $(OBJDIR)/dsmthdat.o \ + $(OBJDIR)/dsobject.o \ + $(OBJDIR)/dsutils.o \ + $(OBJDIR)/dswload.o \ + $(OBJDIR)/dswload2.o \ + $(OBJDIR)/dswscope.o \ + $(OBJDIR)/dswstate.o \ + $(OBJDIR)/excreate.o \ + $(OBJDIR)/exnames.o \ + $(OBJDIR)/exresnte.o \ + $(OBJDIR)/exresolv.o \ + $(OBJDIR)/exutils.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/nsaccess.o \ + $(OBJDIR)/nsalloc.o \ + $(OBJDIR)/nsdump.o \ + $(OBJDIR)/nsinit.o \ + $(OBJDIR)/nsload.o \ + $(OBJDIR)/nsnames.o \ + $(OBJDIR)/nsobject.o \ + $(OBJDIR)/nsparse.o \ + $(OBJDIR)/nssearch.o \ + $(OBJDIR)/nsutils.o \ + $(OBJDIR)/nswalk.o \ + $(OBJDIR)/nsxfeval.o \ + $(OBJDIR)/nsxfname.o \ + $(OBJDIR)/nsxfobj.o \ + $(OBJDIR)/osunixxf.o \ + $(OBJDIR)/psargs.o \ + $(OBJDIR)/psloop.o \ + $(OBJDIR)/psopcode.o \ + $(OBJDIR)/psparse.o \ + $(OBJDIR)/psscope.o \ + $(OBJDIR)/pstree.o \ + $(OBJDIR)/psutils.o \ + $(OBJDIR)/pswalk.o \ + $(OBJDIR)/psxface.o \ + $(OBJDIR)/tbfadt.o \ + $(OBJDIR)/tbfind.o \ + $(OBJDIR)/tbinstal.o \ + $(OBJDIR)/tbutils.o \ + $(OBJDIR)/tbxface.o \ + $(OBJDIR)/tbxfroot.o \ + $(OBJDIR)/utalloc.o \ + $(OBJDIR)/utcache.o \ + $(OBJDIR)/utdebug.o \ + $(OBJDIR)/utdecode.o \ + $(OBJDIR)/utdelete.o \ + $(OBJDIR)/utglobal.o \ + $(OBJDIR)/utlock.o \ + $(OBJDIR)/utmath.o \ + $(OBJDIR)/utmisc.o \ + $(OBJDIR)/utmutex.o \ + $(OBJDIR)/utobject.o \ + $(OBJDIR)/utstate.o \ + $(OBJDIR)/utosi.o \ + $(OBJDIR)/utxferror.o \ + $(OBJDIR)/utxface.o # # Flags specific to acpinames utility @@ -112,7 +112,7 @@ $(PROG) : $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) +$(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : diff --git a/generate/unix/acpisrc/Makefile b/generate/unix/acpisrc/Makefile index 22d919723216..abc8c2959ff3 100644 --- a/generate/unix/acpisrc/Makefile +++ b/generate/unix/acpisrc/Makefile @@ -11,7 +11,7 @@ # compile options, and prevents pollution of the source code. # include ../Makefile.config -PROG = acpisrc +PROG = $(OBJDIR)/acpisrc # # Search path for source files and individual source files @@ -25,15 +25,15 @@ HEADERS = \ $(wildcard $(ACPISRC)/*.h) OBJECTS = \ - ascase.o \ - asconvrt.o \ - asfile.o \ - asmain.o \ - asremove.o \ - astable.o \ - asutils.o \ - osunixdir.o \ - getopt.o + $(OBJDIR)/ascase.o \ + $(OBJDIR)/asconvrt.o \ + $(OBJDIR)/asfile.o \ + $(OBJDIR)/asmain.o \ + $(OBJDIR)/asremove.o \ + $(OBJDIR)/astable.o \ + $(OBJDIR)/asutils.o \ + $(OBJDIR)/osunixdir.o \ + $(OBJDIR)/getopt.o # # Compile flags specific to acpisrc @@ -49,7 +49,7 @@ $(PROG) : $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) +$(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : diff --git a/generate/unix/acpixtract/Makefile b/generate/unix/acpixtract/Makefile index 2a734fd2c34a..9c0b2997e8f1 100644 --- a/generate/unix/acpixtract/Makefile +++ b/generate/unix/acpixtract/Makefile @@ -11,7 +11,7 @@ # compile options, and prevents pollution of the source code. # include ../Makefile.config -PROG = acpixtract +PROG = $(OBJDIR)/acpixtract # # Search paths for source files @@ -24,9 +24,9 @@ HEADERS = \ $(wildcard $(ACPIXTRACT)/*.h) OBJECTS = \ - acpixtract.o \ - axmain.o \ - getopt.o + $(OBJDIR)/acpixtract.o \ + $(OBJDIR)/axmain.o \ + $(OBJDIR)/getopt.o # # Flags specific to acpixtract @@ -41,7 +41,7 @@ $(PROG) : $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) +$(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index e03f296aa645..76724e2da02d 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -11,7 +11,7 @@ # compile options, and prevents pollution of the source code. # include ../Makefile.config -PROG = iasl +PROG = $(OBJDIR)/iasl # # Search paths for source files @@ -31,158 +31,160 @@ vpath %.c \ HEADERS = \ $(wildcard $(ASL_COMPILER)/*.h) \ - aslcompiler.y.h \ - dtparser.y.h + $(OBJDIR)/aslcompiler.y.h \ + $(OBJDIR)/dtparser.y.h OBJECTS = \ - aslcompilerlex.o \ - aslcompilerparse.o \ - dtparserlex.o \ - dtparserparse.o \ - adfile.o \ - adisasm.o \ - adwalk.o \ - aslanalyze.o \ - aslbtypes.o \ - aslcodegen.o \ - aslcompile.o \ - aslerror.o \ - aslfiles.o \ - aslfold.o \ - asllength.o \ - asllisting.o \ - aslload.o \ - asllookup.o \ - aslmain.o \ - aslmap.o \ - aslopcodes.o \ - asloperands.o \ - aslopt.o \ - aslpredef.o \ - aslresource.o \ - aslrestype1.o \ - aslrestype1i.o \ - aslrestype2.o \ - aslrestype2d.o \ - aslrestype2e.o \ - aslrestype2q.o \ - aslrestype2w.o \ - aslstartup.o \ - aslstubs.o \ - asltransform.o \ - asltree.o \ - aslutils.o \ - asluuid.o \ - aslwalks.o \ - dtcompile.o \ - dtexpress.o \ - dtfield.o \ - dtio.o \ - dtsubtable.o \ - dttable.o \ - dttemplate.o \ - dtutils.o \ - dbfileio.o \ - dmbuffer.o \ - dmextern.o \ - dmnames.o \ - dmobject.o \ - dmopcode.o \ - dmresrc.o \ - dmresrcl.o \ - dmresrcs.o \ - dmrestag.o \ - dmtable.o \ - dmtbdump.o \ - dmtbinfo.o \ - dmutils.o \ - dmwalk.o \ - dsargs.o \ - dscontrol.o \ - dsfield.o \ - dsobject.o \ - dsopcode.o \ - dsutils.o \ - dswexec.o \ - dswload.o \ - dswload2.o \ - dswscope.o \ - dswstate.o \ - exconvrt.o \ - excreate.o \ - exdump.o \ - exmisc.o \ - exmutex.o \ - exnames.o \ - exoparg1.o \ - exoparg2.o \ - exoparg3.o \ - exoparg6.o \ - exprep.o \ - exregion.o \ - exresnte.o \ - exresolv.o \ - exresop.o \ - exstore.o \ - exstoren.o \ - exstorob.o \ - exsystem.o \ - exutils.o \ - getopt.o \ - nsaccess.o \ - nsalloc.o \ - nsdump.o \ - nsnames.o \ - nsobject.o \ - nsparse.o \ - nssearch.o \ - nsutils.o \ - nswalk.o \ - nsxfobj.o \ - osunixxf.o \ - psargs.o \ - psloop.o \ - psopcode.o \ - psparse.o \ - psscope.o \ - pstree.o \ - psutils.o \ - pswalk.o \ - tbfadt.o \ - tbinstal.o \ - tbutils.o \ - tbxface.o \ - utalloc.o \ - utcache.o \ - utcopy.o \ - utdebug.o \ - utdecode.o \ - utdelete.o \ - utglobal.o \ - utinit.o \ - utlock.o \ - utmath.o \ - utmisc.o \ - utmutex.o \ - utobject.o \ - utresrc.o \ - utstate.o \ - utxferror.o \ - utxface.o + $(OBJDIR)/aslcompilerlex.o \ + $(OBJDIR)/aslcompilerparse.o \ + $(OBJDIR)/dtparserlex.o \ + $(OBJDIR)/dtparserparse.o \ + $(OBJDIR)/adfile.o \ + $(OBJDIR)/adisasm.o \ + $(OBJDIR)/adwalk.o \ + $(OBJDIR)/aslanalyze.o \ + $(OBJDIR)/aslbtypes.o \ + $(OBJDIR)/aslcodegen.o \ + $(OBJDIR)/aslcompile.o \ + $(OBJDIR)/aslerror.o \ + $(OBJDIR)/aslfiles.o \ + $(OBJDIR)/aslfold.o \ + $(OBJDIR)/asllength.o \ + $(OBJDIR)/asllisting.o \ + $(OBJDIR)/aslload.o \ + $(OBJDIR)/asllookup.o \ + $(OBJDIR)/aslmain.o \ + $(OBJDIR)/aslmap.o \ + $(OBJDIR)/aslopcodes.o \ + $(OBJDIR)/asloperands.o \ + $(OBJDIR)/aslopt.o \ + $(OBJDIR)/aslpredef.o \ + $(OBJDIR)/aslresource.o \ + $(OBJDIR)/aslrestype1.o \ + $(OBJDIR)/aslrestype1i.o \ + $(OBJDIR)/aslrestype2.o \ + $(OBJDIR)/aslrestype2d.o \ + $(OBJDIR)/aslrestype2e.o \ + $(OBJDIR)/aslrestype2q.o \ + $(OBJDIR)/aslrestype2s.o \ + $(OBJDIR)/aslrestype2w.o \ + $(OBJDIR)/aslstartup.o \ + $(OBJDIR)/aslstubs.o \ + $(OBJDIR)/asltransform.o \ + $(OBJDIR)/asltree.o \ + $(OBJDIR)/aslutils.o \ + $(OBJDIR)/asluuid.o \ + $(OBJDIR)/aslwalks.o \ + $(OBJDIR)/dtcompile.o \ + $(OBJDIR)/dtexpress.o \ + $(OBJDIR)/dtfield.o \ + $(OBJDIR)/dtio.o \ + $(OBJDIR)/dtsubtable.o \ + $(OBJDIR)/dttable.o \ + $(OBJDIR)/dttemplate.o \ + $(OBJDIR)/dtutils.o \ + $(OBJDIR)/dbfileio.o \ + $(OBJDIR)/dmbuffer.o \ + $(OBJDIR)/dmextern.o \ + $(OBJDIR)/dmnames.o \ + $(OBJDIR)/dmobject.o \ + $(OBJDIR)/dmopcode.o \ + $(OBJDIR)/dmresrc.o \ + $(OBJDIR)/dmresrcl.o \ + $(OBJDIR)/dmresrcl2.o \ + $(OBJDIR)/dmresrcs.o \ + $(OBJDIR)/dmrestag.o \ + $(OBJDIR)/dmtable.o \ + $(OBJDIR)/dmtbdump.o \ + $(OBJDIR)/dmtbinfo.o \ + $(OBJDIR)/dmutils.o \ + $(OBJDIR)/dmwalk.o \ + $(OBJDIR)/dsargs.o \ + $(OBJDIR)/dscontrol.o \ + $(OBJDIR)/dsfield.o \ + $(OBJDIR)/dsobject.o \ + $(OBJDIR)/dsopcode.o \ + $(OBJDIR)/dsutils.o \ + $(OBJDIR)/dswexec.o \ + $(OBJDIR)/dswload.o \ + $(OBJDIR)/dswload2.o \ + $(OBJDIR)/dswscope.o \ + $(OBJDIR)/dswstate.o \ + $(OBJDIR)/exconvrt.o \ + $(OBJDIR)/excreate.o \ + $(OBJDIR)/exdump.o \ + $(OBJDIR)/exmisc.o \ + $(OBJDIR)/exmutex.o \ + $(OBJDIR)/exnames.o \ + $(OBJDIR)/exoparg1.o \ + $(OBJDIR)/exoparg2.o \ + $(OBJDIR)/exoparg3.o \ + $(OBJDIR)/exoparg6.o \ + $(OBJDIR)/exprep.o \ + $(OBJDIR)/exregion.o \ + $(OBJDIR)/exresnte.o \ + $(OBJDIR)/exresolv.o \ + $(OBJDIR)/exresop.o \ + $(OBJDIR)/exstore.o \ + $(OBJDIR)/exstoren.o \ + $(OBJDIR)/exstorob.o \ + $(OBJDIR)/exsystem.o \ + $(OBJDIR)/exutils.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/nsaccess.o \ + $(OBJDIR)/nsalloc.o \ + $(OBJDIR)/nsdump.o \ + $(OBJDIR)/nsnames.o \ + $(OBJDIR)/nsobject.o \ + $(OBJDIR)/nsparse.o \ + $(OBJDIR)/nssearch.o \ + $(OBJDIR)/nsutils.o \ + $(OBJDIR)/nswalk.o \ + $(OBJDIR)/nsxfobj.o \ + $(OBJDIR)/osunixxf.o \ + $(OBJDIR)/psargs.o \ + $(OBJDIR)/psloop.o \ + $(OBJDIR)/psopcode.o \ + $(OBJDIR)/psparse.o \ + $(OBJDIR)/psscope.o \ + $(OBJDIR)/pstree.o \ + $(OBJDIR)/psutils.o \ + $(OBJDIR)/pswalk.o \ + $(OBJDIR)/tbfadt.o \ + $(OBJDIR)/tbinstal.o \ + $(OBJDIR)/tbutils.o \ + $(OBJDIR)/tbxface.o \ + $(OBJDIR)/utalloc.o \ + $(OBJDIR)/utcache.o \ + $(OBJDIR)/utcopy.o \ + $(OBJDIR)/utdebug.o \ + $(OBJDIR)/utdecode.o \ + $(OBJDIR)/utdelete.o \ + $(OBJDIR)/utglobal.o \ + $(OBJDIR)/utinit.o \ + $(OBJDIR)/utlock.o \ + $(OBJDIR)/utmath.o \ + $(OBJDIR)/utmisc.o \ + $(OBJDIR)/utmutex.o \ + $(OBJDIR)/utobject.o \ + $(OBJDIR)/utresrc.o \ + $(OBJDIR)/utstate.o \ + $(OBJDIR)/utxferror.o \ + $(OBJDIR)/utxface.o INTERMEDIATES = \ - aslcompilerlex.c \ - aslcompilerparse.c \ - dtparserlex.c \ - dtparserparse.c + $(OBJDIR)/aslcompilerlex.c \ + $(OBJDIR)/aslcompilerparse.c \ + $(OBJDIR)/dtparserlex.c \ + $(OBJDIR)/dtparserparse.c MISC = \ - aslcompilerparse.h \ - aslcompiler.y.h \ - aslcompilerparse.output \ - dtparserparse.h \ - dtparser.y.h \ - dtparserparse.output + $(OBJDIR)/aslcompilerparse.h \ + $(OBJDIR)/aslcompiler.y.h \ + $(OBJDIR)/aslcompilerparse.output \ + $(OBJDIR)/dtparserparse.h \ + $(OBJDIR)/dtparser.y.h \ + $(OBJDIR)/dtparserparse.output # # Flags specific to iASL compiler @@ -190,7 +192,7 @@ MISC = \ CFLAGS+= \ -DACPI_ASL_COMPILER \ -I$(ASL_COMPILER) \ - -I. + -I$(OBJDIR) # # Root rule @@ -202,27 +204,27 @@ $(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS) # # Parser and Lexer - intermediate C files # -aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l +$(OBJDIR)/aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l ${LEX} ${LFLAGS} -PAslCompiler -o$@ $? -aslcompilerparse.c aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y +$(OBJDIR)/aslcompilerparse.c $(OBJDIR)/aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y ${YACC} ${YFLAGS} -pAslCompiler -o$@ $? -dtparserlex.c : $(ASL_COMPILER)/dtparser.l +$(OBJDIR)/dtparserlex.c : $(ASL_COMPILER)/dtparser.l ${LEX} ${LFLAGS} -PDtParser -o$@ $? -dtparserparse.c dtparserparse.h : $(ASL_COMPILER)/dtparser.y +$(OBJDIR)/dtparserparse.c $(OBJDIR)/dtparserparse.h : $(ASL_COMPILER)/dtparser.y ${YACC} ${YFLAGS} -pDtParser -o$@ $? # Rename headers produced by bison/yacc -dtparser.y.h: dtparserparse.h +$(OBJDIR)/dtparser.y.h: $(OBJDIR)/dtparserparse.h @echo Copy intermediate file: - @cp -f -v dtparserparse.h dtparser.y.h + @cp -f -v $(OBJDIR)/dtparserparse.h $(OBJDIR)/dtparser.y.h -aslcompiler.y.h : aslcompilerparse.h +$(OBJDIR)/aslcompiler.y.h : $(OBJDIR)/aslcompilerparse.h @echo Copy intermediate file: - @cp -f -v aslcompilerparse.h aslcompiler.y.h + @cp -f -v $(OBJDIR)/aslcompilerparse.h $(OBJDIR)/aslcompiler.y.h # @@ -231,20 +233,20 @@ aslcompiler.y.h : aslcompilerparse.h # Cannot use the common compile warning flags since the C files are created # by the utilities above and they are not necessarily ANSI C, etc. # -aslcompilerlex.o : aslcompilerlex.c +$(OBJDIR)/aslcompilerlex.o : $(OBJDIR)/aslcompilerlex.c $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? -aslcompilerparse.o : aslcompilerparse.c +$(OBJDIR)/aslcompilerparse.o : $(OBJDIR)/aslcompilerparse.c $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? -dtparserlex.o : dtparserlex.c +$(OBJDIR)/dtparserlex.o : $(OBJDIR)/dtparserlex.c $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? -dtparserparse.o : dtparserparse.c +$(OBJDIR)/dtparserparse.o : $(OBJDIR)/dtparserparse.c $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? -%.o : %.c $(HEADERS) $(ACPICA_HEADERS) +$(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : diff --git a/hardware/hwvalid.c b/hardware/hwvalid.c index 869c9f18fdfa..58a0abfb9bbc 100644 --- a/hardware/hwvalid.c +++ b/hardware/hwvalid.c @@ -149,6 +149,8 @@ AcpiHwValidateIoRequest ( (BitWidth != 16) && (BitWidth != 32)) { + ACPI_ERROR ((AE_INFO, + "Bad BitWidth parameter: %8.8X", BitWidth)); return (AE_BAD_PARAMETER); } diff --git a/include/acconfig.h b/include/acconfig.h index d484e483410e..f6532667cc61 100644 --- a/include/acconfig.h +++ b/include/acconfig.h @@ -183,9 +183,10 @@ #define ACPI_RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_XCHECKSUM_LENGTH 36 -/* SMBus and IPMI bidirectional buffer size */ +/* SMBus, GSBus and IPMI bidirectional buffer size */ #define ACPI_SMBUS_BUFFER_SIZE 34 +#define ACPI_GSBUS_BUFFER_SIZE 34 #define ACPI_IPMI_BUFFER_SIZE 66 /* _SxD and _SxW control methods */ diff --git a/include/acdebug.h b/include/acdebug.h index 2c1fe73429d1..9a96c74f47f0 100644 --- a/include/acdebug.h +++ b/include/acdebug.h @@ -107,6 +107,10 @@ AcpiDbDisplayTableInfo ( char *TableArg); void +AcpiDbDisplayTemplate ( + char *BufferArg); + +void AcpiDbUnloadAcpiTable ( char *TableArg, char *InstanceArg); diff --git a/include/acdisasm.h b/include/acdisasm.h index aaaac11d861e..2df2fe8a8793 100644 --- a/include/acdisasm.h +++ b/include/acdisasm.h @@ -80,57 +80,82 @@ typedef const struct acpi_dmtable_info /* * Values for Opcode above. - * Note: 0-7 must not change, used as a flag shift value + * Note: 0-7 must not change, they are used as a flag shift value. Other + * than those, new values can be added wherever appropriate. */ -#define ACPI_DMT_FLAG0 0 -#define ACPI_DMT_FLAG1 1 -#define ACPI_DMT_FLAG2 2 -#define ACPI_DMT_FLAG3 3 -#define ACPI_DMT_FLAG4 4 -#define ACPI_DMT_FLAG5 5 -#define ACPI_DMT_FLAG6 6 -#define ACPI_DMT_FLAG7 7 -#define ACPI_DMT_FLAGS0 8 -#define ACPI_DMT_FLAGS2 9 -#define ACPI_DMT_UINT8 10 -#define ACPI_DMT_UINT16 11 -#define ACPI_DMT_UINT24 12 -#define ACPI_DMT_UINT32 13 -#define ACPI_DMT_UINT56 14 -#define ACPI_DMT_UINT64 15 -#define ACPI_DMT_STRING 16 -#define ACPI_DMT_NAME4 17 -#define ACPI_DMT_NAME6 18 -#define ACPI_DMT_NAME8 19 -#define ACPI_DMT_CHKSUM 20 -#define ACPI_DMT_SPACEID 21 -#define ACPI_DMT_GAS 22 -#define ACPI_DMT_ASF 23 -#define ACPI_DMT_DMAR 24 -#define ACPI_DMT_HEST 25 -#define ACPI_DMT_HESTNTFY 26 -#define ACPI_DMT_HESTNTYP 27 -#define ACPI_DMT_MADT 28 -#define ACPI_DMT_SRAT 29 -#define ACPI_DMT_EXIT 30 -#define ACPI_DMT_SIG 31 -#define ACPI_DMT_FADTPM 32 -#define ACPI_DMT_BUF16 33 -#define ACPI_DMT_IVRS 34 -#define ACPI_DMT_BUFFER 35 -#define ACPI_DMT_PCI_PATH 36 -#define ACPI_DMT_EINJACT 37 -#define ACPI_DMT_EINJINST 38 -#define ACPI_DMT_ERSTACT 39 -#define ACPI_DMT_ERSTINST 40 -#define ACPI_DMT_ACCWIDTH 41 -#define ACPI_DMT_UNICODE 42 -#define ACPI_DMT_UUID 43 -#define ACPI_DMT_DEVICE_PATH 44 -#define ACPI_DMT_LABEL 45 -#define ACPI_DMT_BUF7 46 -#define ACPI_DMT_BUF128 47 -#define ACPI_DMT_SLIC 48 +typedef enum +{ + /* Simple Data Types */ + + ACPI_DMT_FLAG0 = 0, + ACPI_DMT_FLAG1 = 1, + ACPI_DMT_FLAG2 = 2, + ACPI_DMT_FLAG3 = 3, + ACPI_DMT_FLAG4 = 4, + ACPI_DMT_FLAG5 = 5, + ACPI_DMT_FLAG6 = 6, + ACPI_DMT_FLAG7 = 7, + ACPI_DMT_FLAGS0, + ACPI_DMT_FLAGS1, + ACPI_DMT_FLAGS2, + ACPI_DMT_FLAGS4, + ACPI_DMT_UINT8, + ACPI_DMT_UINT16, + ACPI_DMT_UINT24, + ACPI_DMT_UINT32, + ACPI_DMT_UINT40, + ACPI_DMT_UINT48, + ACPI_DMT_UINT56, + ACPI_DMT_UINT64, + ACPI_DMT_BUF7, + ACPI_DMT_BUF16, + ACPI_DMT_BUF128, + ACPI_DMT_SIG, + ACPI_DMT_STRING, + ACPI_DMT_NAME4, + ACPI_DMT_NAME6, + ACPI_DMT_NAME8, + + /* Types that are decoded to strings and miscellaneous */ + + ACPI_DMT_ACCWIDTH, + ACPI_DMT_CHKSUM, + ACPI_DMT_GAS, + ACPI_DMT_SPACEID, + ACPI_DMT_UNICODE, + ACPI_DMT_UUID, + + /* Types used only for the Data Table Compiler */ + + ACPI_DMT_BUFFER, + ACPI_DMT_DEVICE_PATH, + ACPI_DMT_LABEL, + ACPI_DMT_PCI_PATH, + + /* Types that are specific to particular ACPI tables */ + + ACPI_DMT_ASF, + ACPI_DMT_DMAR, + ACPI_DMT_EINJACT, + ACPI_DMT_EINJINST, + ACPI_DMT_ERSTACT, + ACPI_DMT_ERSTINST, + ACPI_DMT_FADTPM, + ACPI_DMT_HEST, + ACPI_DMT_HESTNTFY, + ACPI_DMT_HESTNTYP, + ACPI_DMT_IVRS, + ACPI_DMT_MADT, + ACPI_DMT_PMTT, + ACPI_DMT_SLIC, + ACPI_DMT_SRAT, + + /* Special opcodes */ + + ACPI_DMT_EXTRA_TEXT, + ACPI_DMT_EXIT + +} ACPI_ENTRY_TYPES; typedef void (*ACPI_DMTABLE_HANDLER) ( @@ -175,6 +200,11 @@ ACPI_STATUS (*ASL_WALK_CALLBACK) ( #define ASL_WALK_CALLBACK_DEFINED #endif +typedef +void (*ACPI_RESOURCE_HANDLER) ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); typedef struct acpi_resource_tag { @@ -202,6 +232,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[]; @@ -212,6 +243,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; @@ -221,7 +253,13 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdtHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[]; @@ -254,14 +292,34 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0A[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0B[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmttHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3ptHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[]; @@ -354,6 +412,10 @@ AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpFpdt ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); @@ -362,17 +424,29 @@ AcpiDmDumpIvrs ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpMadt ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpMcfg ( ACPI_TABLE_HEADER *Table); void -AcpiDmDumpMadt ( +AcpiDmDumpMpst ( ACPI_TABLE_HEADER *Table); void AcpiDmDumpMsct ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpPcct ( + ACPI_TABLE_HEADER *Table); + +void +AcpiDmDumpPmtt ( + ACPI_TABLE_HEADER *Table); + UINT32 AcpiDmDumpRsdp ( ACPI_TABLE_HEADER *Table); @@ -381,6 +455,10 @@ void AcpiDmDumpRsdt ( ACPI_TABLE_HEADER *Table); +UINT32 +AcpiDmDumpS3pt ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpSlic ( ACPI_TABLE_HEADER *Table); @@ -671,6 +749,18 @@ AcpiDmVendorLargeDescriptor ( UINT32 Level); void +AcpiDmGpioDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmSerialBusDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +void AcpiDmVendorCommon ( char *Name, UINT8 *ByteData, @@ -694,6 +784,12 @@ AcpiDmDmaDescriptor ( UINT32 Level); void +AcpiDmFixedDmaDescriptor ( + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +void AcpiDmIoDescriptor ( AML_RESOURCE *Resource, UINT32 Length, diff --git a/include/acevents.h b/include/acevents.h index 8681ed5f389c..9f03a51df07b 100644 --- a/include/acevents.h +++ b/include/acevents.h @@ -228,7 +228,8 @@ AcpiEvInitializeOpRegions ( ACPI_STATUS AcpiEvAddressSpaceDispatch ( - ACPI_OPERAND_OBJECT *RegionObj, + ACPI_OPERAND_OBJECT *RegionObj, + ACPI_OPERAND_OBJECT *FieldObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, diff --git a/include/acglobal.h b/include/acglobal.h index ceb26b0b150c..8a23fa9a3a34 100644 --- a/include/acglobal.h +++ b/include/acglobal.h @@ -143,8 +143,20 @@ UINT32 AcpiGbl_TraceFlags; ACPI_NAME AcpiGbl_TraceMethodName; BOOLEAN AcpiGbl_SystemAwakeAndRunning; +/* + * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning + * that the ACPI hardware is no longer required. A flag in the FADT indicates + * a reduced HW machine, and that flag is duplicated here for convenience. + */ +BOOLEAN AcpiGbl_ReducedHardware; + + #endif +/* Do not disassemble buffers to resource descriptors */ + +ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_NoResourceDisassembly, FALSE); + /***************************************************************************** * * ACPI Table globals @@ -183,7 +195,7 @@ ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; /***************************************************************************** * - * Mutual exlusion within ACPICA subsystem + * Mutual exclusion within ACPICA subsystem * ****************************************************************************/ diff --git a/include/acinterp.h b/include/acinterp.h index 8ac828c59c4d..94e6e1d7702d 100644 --- a/include/acinterp.h +++ b/include/acinterp.h @@ -642,6 +642,10 @@ AcpiExIntegerToString ( char *Dest, UINT64 Value); +BOOLEAN +AcpiIsValidSpaceId ( + UINT8 SpaceId); + /* * exregion - default OpRegion handlers diff --git a/include/aclocal.h b/include/aclocal.h index 436c493472fa..2ad9521103c1 100644 --- a/include/aclocal.h +++ b/include/aclocal.h @@ -54,7 +54,7 @@ typedef UINT32 ACPI_MUTEX_HANDLE; /* Total number of aml opcodes defined */ -#define AML_NUM_OPCODES 0x7F +#define AML_NUM_OPCODES 0x81 /* Forward declarations */ @@ -285,12 +285,16 @@ typedef struct acpi_create_field_info ACPI_NAMESPACE_NODE *FieldNode; ACPI_NAMESPACE_NODE *RegisterNode; ACPI_NAMESPACE_NODE *DataRegisterNode; + ACPI_NAMESPACE_NODE *ConnectionNode; + UINT8 *ResourceBuffer; UINT32 BankValue; UINT32 FieldBitPosition; UINT32 FieldBitLength; + UINT16 ResourceLength; UINT8 FieldFlags; UINT8 Attribute; UINT8 FieldType; + UINT8 AccessLength; } ACPI_CREATE_FIELD_INFO; @@ -358,7 +362,8 @@ typedef struct acpi_name_info /* * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, - * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT + * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT, + * ACPI_PTYPE2_FIX_VAR */ typedef struct acpi_package_info { @@ -1124,7 +1129,7 @@ typedef struct acpi_port_info #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 #define ACPI_RESOURCE_NAME_IO 0x40 #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 -#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 +#define ACPI_RESOURCE_NAME_FIXED_DMA 0x50 #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 @@ -1146,7 +1151,9 @@ typedef struct acpi_port_info #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B -#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B +#define ACPI_RESOURCE_NAME_GPIO 0x8C +#define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E +#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E /***************************************************************************** diff --git a/include/acnames.h b/include/acnames.h index e08302dd300f..af2920027175 100644 --- a/include/acnames.h +++ b/include/acnames.h @@ -58,6 +58,7 @@ #define METHOD_NAME__PRT "_PRT" #define METHOD_NAME__CRS "_CRS" #define METHOD_NAME__PRS "_PRS" +#define METHOD_NAME__AEI "_AEI" #define METHOD_NAME__PRW "_PRW" #define METHOD_NAME__SRS "_SRS" diff --git a/include/acobject.h b/include/acobject.h index 27a21e685883..8281547e588e 100644 --- a/include/acobject.h +++ b/include/acobject.h @@ -320,6 +320,7 @@ typedef struct acpi_object_thermal_zone UINT32 BaseByteOffset; /* Byte offset within containing object */\ UINT32 Value; /* Value to store into the Bank or Index register */\ UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\ + UINT8 AccessLength; /* For serial regions/fields */ typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ @@ -335,7 +336,9 @@ typedef struct acpi_object_region_field { ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO + UINT16 ResourceLength; union acpi_operand_object *RegionObj; /* Containing OpRegion object */ + UINT8 *ResourceBuffer; /* ResourceTemplate for serial regions/fields */ } ACPI_OBJECT_REGION_FIELD; @@ -463,6 +466,7 @@ typedef struct acpi_object_extra { ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */ + ACPI_NAMESPACE_NODE *ScopeNode; void *RegionContext; /* Region-specific data */ UINT8 *AmlStart; UINT32 AmlLength; diff --git a/include/acopcode.h b/include/acopcode.h index d8e1c75a7b45..fc854a162976 100644 --- a/include/acopcode.h +++ b/include/acopcode.h @@ -94,6 +94,7 @@ #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) +#define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) #define ARGP_CONTINUE_OP ARG_NONE #define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) @@ -165,6 +166,7 @@ #define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) #define ARGP_REVISION_OP ARG_NONE #define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) +#define ARGP_SERIALFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) #define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) @@ -225,6 +227,7 @@ #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) +#define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE #define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE #define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) #define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) @@ -296,6 +299,7 @@ #define ARGI_RETURN_OP ARGI_INVALID_OPCODE #define ARGI_REVISION_OP ARG_NONE #define ARGI_SCOPE_OP ARGI_INVALID_OPCODE +#define ARGI_SERIALFIELD_OP ARGI_INVALID_OPCODE #define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) diff --git a/include/acpixf.h b/include/acpixf.h index 7e246bdb3754..82c097ac859c 100644 --- a/include/acpixf.h +++ b/include/acpixf.h @@ -48,7 +48,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20110922 +#define ACPI_CA_VERSION 0x20111123 #include "actypes.h" #include "actbl.h" @@ -59,6 +59,7 @@ extern UINT32 AcpiCurrentGpeCount; extern ACPI_TABLE_FADT AcpiGbl_FADT; extern BOOLEAN AcpiGbl_SystemAwakeAndRunning; +extern BOOLEAN AcpiGbl_ReducedHardware; /* ACPI 5.0 */ /* Runtime configuration of debug print levels */ @@ -393,6 +394,21 @@ AcpiReleaseGlobalLock ( /* + * Interfaces to AML mutex objects + */ +ACPI_STATUS +AcpiAcquireMutex ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname, + UINT16 Timeout); + +ACPI_STATUS +AcpiReleaseMutex ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname); + + +/* * Fixed Event interfaces */ ACPI_STATUS @@ -517,6 +533,11 @@ AcpiGetPossibleResources ( ACPI_BUFFER *RetBuffer); ACPI_STATUS +AcpiGetEventResources ( + ACPI_HANDLE DeviceHandle, + ACPI_BUFFER *RetBuffer); + +ACPI_STATUS AcpiWalkResources ( ACPI_HANDLE Device, char *Name, @@ -538,6 +559,12 @@ AcpiResourceToAddress64 ( ACPI_RESOURCE *Resource, ACPI_RESOURCE_ADDRESS64 *Out); +ACPI_STATUS +AcpiBufferToResource ( + UINT8 *AmlBuffer, + UINT16 AmlBufferLength, + ACPI_RESOURCE **ResourcePtr); + /* * Hardware (ACPI device) interfaces diff --git a/include/acpredef.h b/include/acpredef.h index 0496767a8675..f39e283f24e3 100644 --- a/include/acpredef.h +++ b/include/acpredef.h @@ -94,6 +94,14 @@ * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length * (Used for _ART, _FPS) * + * ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements + * followed by an optional element + * object type + * count + * object type + * count = 0 (optional) + * (Used for _DLM) + * *****************************************************************************/ enum AcpiReturnPackageTypes @@ -106,7 +114,8 @@ enum AcpiReturnPackageTypes ACPI_PTYPE2_PKG_COUNT = 6, ACPI_PTYPE2_FIXED = 7, ACPI_PTYPE2_MIN = 8, - ACPI_PTYPE2_REV_FIXED = 9 + ACPI_PTYPE2_REV_FIXED = 9, + ACPI_PTYPE2_FIX_VAR = 10 }; @@ -159,6 +168,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_AC8", 0, ACPI_RTYPE_INTEGER}}, {{"_AC9", 0, ACPI_RTYPE_INTEGER}}, {{"_ADR", 0, ACPI_RTYPE_INTEGER}}, + {{"_AEI", 0, ACPI_RTYPE_BUFFER}}, {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, @@ -231,6 +241,12 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}}, + {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0}, 0,0}}, + + {{"_CPC", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Bufs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0}, 0,0}}, + {{"_CRS", 0, ACPI_RTYPE_BUFFER}}, {{"_CRT", 0, ACPI_RTYPE_INTEGER}}, {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */ @@ -239,12 +255,20 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}}, + {{"_CWS", 1, ACPI_RTYPE_INTEGER}}, {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, {{"_DCS", 0, ACPI_RTYPE_INTEGER}}, {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, {{"_DDN", 0, ACPI_RTYPE_STRING}}, + {{"_DEP", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_DGS", 0, ACPI_RTYPE_INTEGER}}, {{"_DIS", 0, 0}}, + + {{"_DLM", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */ + {{{ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1, ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER}, 0,0}}, + {{"_DMA", 0, ACPI_RTYPE_BUFFER}}, {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, @@ -264,6 +288,8 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_EJ3", 1, 0}}, {{"_EJ4", 1, 0}}, {{"_EJD", 0, ACPI_RTYPE_STRING}}, + {{"_ERR", 3, ACPI_RTYPE_INTEGER}}, /* Internal use only, used by ACPICA test suites */ + {{"_EVT", 1, 0}}, {{"_FDE", 0, ACPI_RTYPE_BUFFER}}, {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */ {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}}, @@ -284,14 +310,17 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_GAI", 0, ACPI_RTYPE_INTEGER}}, + {{"_GCP", 0, ACPI_RTYPE_INTEGER}}, {{"_GHL", 0, ACPI_RTYPE_INTEGER}}, {{"_GLK", 0, ACPI_RTYPE_INTEGER}}, {{"_GPD", 0, ACPI_RTYPE_INTEGER}}, {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ + {{"_GRT", 0, ACPI_RTYPE_BUFFER}}, {{"_GSB", 0, ACPI_RTYPE_INTEGER}}, {{"_GTF", 0, ACPI_RTYPE_BUFFER}}, {{"_GTM", 0, ACPI_RTYPE_BUFFER}}, {{"_GTS", 1, 0}}, + {{"_GWS", 1, ACPI_RTYPE_INTEGER}}, {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, {{"_HOT", 0, ACPI_RTYPE_INTEGER}}, {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ @@ -306,6 +335,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */ {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + {{"_HRV", 0, ACPI_RTYPE_INTEGER}}, {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ {{"_INI", 0, 0}}, {{"_IRC", 0, 0}}, @@ -363,6 +393,9 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_PRE", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, @@ -393,6 +426,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */ {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}}, + {{"_PSE", 1, 0}}, {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, @@ -459,6 +493,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_SLI", 0, ACPI_RTYPE_BUFFER}}, {{"_SPD", 1, ACPI_RTYPE_INTEGER}}, {{"_SRS", 1, 0}}, + {{"_SRT", 1, ACPI_RTYPE_INTEGER}}, {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ {{"_SST", 1, 0}}, {{"_STA", 0, ACPI_RTYPE_INTEGER}}, @@ -466,6 +501,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_STP", 2, ACPI_RTYPE_INTEGER}}, {{"_STR", 0, ACPI_RTYPE_BUFFER}}, {{"_STV", 2, ACPI_RTYPE_INTEGER}}, + {{"_SUB", 0, ACPI_RTYPE_STRING}}, {{"_SUN", 0, ACPI_RTYPE_INTEGER}}, {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, diff --git a/include/acresrc.h b/include/acresrc.h index 00c4bb253054..a58f1abdb554 100644 --- a/include/acresrc.h +++ b/include/acresrc.h @@ -75,28 +75,42 @@ typedef const struct acpi_rsconvert_info /* Resource conversion opcodes */ -#define ACPI_RSC_INITGET 0 -#define ACPI_RSC_INITSET 1 -#define ACPI_RSC_FLAGINIT 2 -#define ACPI_RSC_1BITFLAG 3 -#define ACPI_RSC_2BITFLAG 4 -#define ACPI_RSC_COUNT 5 -#define ACPI_RSC_COUNT16 6 -#define ACPI_RSC_LENGTH 7 -#define ACPI_RSC_MOVE8 8 -#define ACPI_RSC_MOVE16 9 -#define ACPI_RSC_MOVE32 10 -#define ACPI_RSC_MOVE64 11 -#define ACPI_RSC_SET8 12 -#define ACPI_RSC_DATA8 13 -#define ACPI_RSC_ADDRESS 14 -#define ACPI_RSC_SOURCE 15 -#define ACPI_RSC_SOURCEX 16 -#define ACPI_RSC_BITMASK 17 -#define ACPI_RSC_BITMASK16 18 -#define ACPI_RSC_EXIT_NE 19 -#define ACPI_RSC_EXIT_LE 20 -#define ACPI_RSC_EXIT_EQ 21 +typedef enum +{ + ACPI_RSC_INITGET = 0, + ACPI_RSC_INITSET, + ACPI_RSC_FLAGINIT, + ACPI_RSC_1BITFLAG, + ACPI_RSC_2BITFLAG, + ACPI_RSC_3BITFLAG, + ACPI_RSC_ADDRESS, + ACPI_RSC_BITMASK, + ACPI_RSC_BITMASK16, + ACPI_RSC_COUNT, + ACPI_RSC_COUNT16, + ACPI_RSC_COUNT_GPIO_PIN, + ACPI_RSC_COUNT_GPIO_RES, + ACPI_RSC_COUNT_GPIO_VEN, + ACPI_RSC_COUNT_SERIAL_RES, + ACPI_RSC_COUNT_SERIAL_VEN, + ACPI_RSC_DATA8, + ACPI_RSC_EXIT_EQ, + ACPI_RSC_EXIT_LE, + ACPI_RSC_EXIT_NE, + ACPI_RSC_LENGTH, + ACPI_RSC_MOVE_GPIO_PIN, + ACPI_RSC_MOVE_GPIO_RES, + ACPI_RSC_MOVE_SERIAL_RES, + ACPI_RSC_MOVE_SERIAL_VEN, + ACPI_RSC_MOVE8, + ACPI_RSC_MOVE16, + ACPI_RSC_MOVE32, + ACPI_RSC_MOVE64, + ACPI_RSC_SET8, + ACPI_RSC_SOURCE, + ACPI_RSC_SOURCEX + +} ACPI_RSCONVERT_OPCODES; /* Resource Conversion sub-opcodes */ @@ -109,6 +123,9 @@ typedef const struct acpi_rsconvert_info #define AML_OFFSET(f) (UINT8) ACPI_OFFSET (AML_RESOURCE,f) +/* + * Individual entry for the resource dump tables + */ typedef const struct acpi_rsdump_info { UINT8 Opcode; @@ -120,20 +137,27 @@ typedef const struct acpi_rsdump_info /* Values for the Opcode field above */ -#define ACPI_RSD_TITLE 0 -#define ACPI_RSD_LITERAL 1 -#define ACPI_RSD_STRING 2 -#define ACPI_RSD_UINT8 3 -#define ACPI_RSD_UINT16 4 -#define ACPI_RSD_UINT32 5 -#define ACPI_RSD_UINT64 6 -#define ACPI_RSD_1BITFLAG 7 -#define ACPI_RSD_2BITFLAG 8 -#define ACPI_RSD_SHORTLIST 9 -#define ACPI_RSD_LONGLIST 10 -#define ACPI_RSD_DWORDLIST 11 -#define ACPI_RSD_ADDRESS 12 -#define ACPI_RSD_SOURCE 13 +typedef enum +{ + ACPI_RSD_TITLE = 0, + ACPI_RSD_1BITFLAG, + ACPI_RSD_2BITFLAG, + ACPI_RSD_3BITFLAG, + ACPI_RSD_ADDRESS, + ACPI_RSD_DWORDLIST, + ACPI_RSD_LITERAL, + ACPI_RSD_LONGLIST, + ACPI_RSD_SHORTLIST, + ACPI_RSD_SHORTLISTX, + ACPI_RSD_SOURCE, + ACPI_RSD_STRING, + ACPI_RSD_UINT8, + ACPI_RSD_UINT16, + ACPI_RSD_UINT32, + ACPI_RSD_UINT64, + ACPI_RSD_WORDLIST + +} ACPI_RSDUMP_OPCODES; /* restore default alignment */ @@ -143,13 +167,16 @@ typedef const struct acpi_rsdump_info /* Resource tables indexed by internal resource type */ extern const UINT8 AcpiGbl_AmlResourceSizes[]; +extern const UINT8 AcpiGbl_AmlResourceSerialBusSizes[]; extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[]; /* Resource tables indexed by raw AML resource descriptor type */ extern const UINT8 AcpiGbl_ResourceStructSizes[]; +extern const UINT8 AcpiGbl_ResourceStructSerialBusSizes[]; extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[]; +extern ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[]; typedef struct acpi_vendor_walk_info { @@ -208,6 +235,10 @@ AcpiRsSetSrsMethodData ( ACPI_NAMESPACE_NODE *Node, ACPI_BUFFER *RetBuffer); +ACPI_STATUS +AcpiRsGetAeiMethodData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_BUFFER *RetBuffer); /* * rscalc @@ -348,6 +379,11 @@ extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[]; extern ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[]; extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[]; extern ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertGpio[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[]; /* These resources require separate get/set tables */ @@ -366,6 +402,7 @@ extern ACPI_RSCONVERT_INFO AcpiRsSetVendor[]; * rsinfo */ extern ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[]; +extern ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[]; /* * rsdump @@ -387,6 +424,12 @@ extern ACPI_RSDUMP_INFO AcpiRsDumpAddress64[]; extern ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[]; extern ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[]; extern ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpGpio[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[]; #endif #endif /* __ACRESRC_H__ */ diff --git a/include/acrestyp.h b/include/acrestyp.h index 03e7e2ce0840..d61f86b40356 100644 --- a/include/acrestyp.h +++ b/include/acrestyp.h @@ -62,11 +62,14 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr #define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02 #define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03 +/*! [Begin] no source code translation */ /* * IO Attributes * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. */ +/*! [End] no source code translation !*/ + #define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01 #define ACPI_ISA_ONLY_RANGES (UINT8) 0x02 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) @@ -82,16 +85,26 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr #define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */ /* - * IRQ Attributes + * Interrupt attributes - used in multiple descriptors */ + +/* Triggering */ + #define ACPI_LEVEL_SENSITIVE (UINT8) 0x00 #define ACPI_EDGE_SENSITIVE (UINT8) 0x01 +/* Polarity */ + #define ACPI_ACTIVE_HIGH (UINT8) 0x00 #define ACPI_ACTIVE_LOW (UINT8) 0x01 +#define ACPI_ACTIVE_BOTH (UINT8) 0x02 + +/* Sharing */ #define ACPI_EXCLUSIVE (UINT8) 0x00 #define ACPI_SHARED (UINT8) 0x01 +#define ACPI_EXCLUSIVE_AND_WAKE (UINT8) 0x02 +#define ACPI_SHARED_AND_WAKE (UINT8) 0x03 /* * DMA Attributes @@ -128,6 +141,8 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr #define ACPI_POS_DECODE (UINT8) 0x00 #define ACPI_SUB_DECODE (UINT8) 0x01 +/* Producer/Consumer */ + #define ACPI_PRODUCER (UINT8) 0x00 #define ACPI_CONSUMER (UINT8) 0x01 @@ -167,7 +182,7 @@ typedef struct acpi_resource_irq } ACPI_RESOURCE_IRQ; -typedef struct ACPI_RESOURCE_DMA +typedef struct acpi_resource_dma { UINT8 Type; UINT8 BusMaster; @@ -209,6 +224,24 @@ typedef struct acpi_resource_fixed_io } ACPI_RESOURCE_FIXED_IO; +typedef struct acpi_resource_fixed_dma +{ + UINT16 RequestLines; + UINT16 Channels; + UINT8 Width; + +} ACPI_RESOURCE_FIXED_DMA; + +/* Values for Width field above */ + +#define ACPI_DMA_WIDTH8 0 +#define ACPI_DMA_WIDTH16 1 +#define ACPI_DMA_WIDTH32 2 +#define ACPI_DMA_WIDTH64 3 +#define ACPI_DMA_WIDTH128 4 +#define ACPI_DMA_WIDTH256 5 + + typedef struct acpi_resource_vendor { UINT16 ByteLength; @@ -385,6 +418,184 @@ typedef struct acpi_resource_generic_register } ACPI_RESOURCE_GENERIC_REGISTER; +typedef struct acpi_resource_gpio +{ + UINT8 RevisionId; + UINT8 ConnectionType; + UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ + UINT8 PinConfig; + UINT8 Sharable; /* For values, see Interrupt Attributes above */ + UINT8 IoRestriction; + UINT8 Triggering; /* For values, see Interrupt Attributes above */ + UINT8 Polarity; /* For values, see Interrupt Attributes above */ + UINT16 DriveStrength; + UINT16 DebounceTimeout; + UINT16 PinTableLength; + UINT16 VendorLength; + ACPI_RESOURCE_SOURCE ResourceSource; + UINT16 *PinTable; + UINT8 *VendorData; + +} ACPI_RESOURCE_GPIO; + +/* Values for GPIO ConnectionType field above */ + +#define ACPI_RESOURCE_GPIO_TYPE_INT 0 +#define ACPI_RESOURCE_GPIO_TYPE_IO 1 + +/* Values for PinConfig field above */ + +#define ACPI_PIN_CONFIG_DEFAULT 0 +#define ACPI_PIN_CONFIG_PULLUP 1 +#define ACPI_PIN_CONFIG_PULLDOWN 2 +#define ACPI_PIN_CONFIG_NOPULL 3 + +/* Values for IoRestriction field above */ + +#define ACPI_IO_RESTRICT_NONE 0 +#define ACPI_IO_RESTRICT_INPUT 1 +#define ACPI_IO_RESTRICT_OUTPUT 2 +#define ACPI_IO_RESTRICT_NONE_PRESERVE 3 + + +/* Common structure for I2C, SPI, and UART serial descriptors */ + +#define ACPI_RESOURCE_SERIAL_COMMON \ + UINT8 RevisionId; \ + UINT8 Type; \ + UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */\ + UINT8 SlaveMode; \ + UINT8 TypeRevisionId; \ + UINT16 TypeDataLength; \ + UINT16 VendorLength; \ + ACPI_RESOURCE_SOURCE ResourceSource; \ + UINT8 *VendorData; + +typedef struct acpi_resource_common_serialbus +{ + ACPI_RESOURCE_SERIAL_COMMON + +} ACPI_RESOURCE_COMMON_SERIALBUS; + +/* Values for the Type field above */ + +#define ACPI_RESOURCE_SERIAL_TYPE_I2C 1 +#define ACPI_RESOURCE_SERIAL_TYPE_SPI 2 +#define ACPI_RESOURCE_SERIAL_TYPE_UART 3 + +/* Values for SlaveMode field above */ + +#define ACPI_CONTROLLER_INITIATED 0 +#define ACPI_DEVICE_INITIATED 1 + + +typedef struct acpi_resource_i2c_serialbus +{ + ACPI_RESOURCE_SERIAL_COMMON + UINT8 AccessMode; + UINT16 SlaveAddress; + UINT32 ConnectionSpeed; + +} ACPI_RESOURCE_I2C_SERIALBUS; + +/* Values for AccessMode field above */ + +#define ACPI_I2C_7BIT_MODE 0 +#define ACPI_I2C_10BIT_MODE 1 + + +typedef struct acpi_resource_spi_serialbus +{ + ACPI_RESOURCE_SERIAL_COMMON + UINT8 WireMode; + UINT8 DevicePolarity; + UINT8 DataBitLength; + UINT8 ClockPhase; + UINT8 ClockPolarity; + UINT16 DeviceSelection; + UINT32 ConnectionSpeed; + +} ACPI_RESOURCE_SPI_SERIALBUS; + +/* Values for WireMode field above */ + +#define ACPI_SPI_4WIRE_MODE 0 +#define ACPI_SPI_3WIRE_MODE 1 + +/* Values for DevicePolarity field above */ + +#define ACPI_SPI_ACTIVE_LOW 0 +#define ACPI_SPI_ACTIVE_HIGH 1 + +/* Values for ClockPhase field above */ + +#define ACPI_SPI_FIRST_PHASE 0 +#define ACPI_SPI_SECOND_PHASE 1 + +/* Values for ClockPolarity field above */ + +#define ACPI_SPI_START_LOW 0 +#define ACPI_SPI_START_HIGH 1 + + +typedef struct acpi_resource_uart_serialbus +{ + ACPI_RESOURCE_SERIAL_COMMON + UINT8 Endian; + UINT8 DataBits; + UINT8 StopBits; + UINT8 FlowControl; + UINT8 Parity; + UINT8 LinesEnabled; + UINT16 RxFifoSize; + UINT16 TxFifoSize; + UINT32 DefaultBaudRate; + +} ACPI_RESOURCE_UART_SERIALBUS; + +/* Values for Endian field above */ + +#define ACPI_UART_LITTLE_ENDIAN 0 +#define ACPI_UART_BIG_ENDIAN 1 + +/* Values for DataBits field above */ + +#define ACPI_UART_5_DATA_BITS 0 +#define ACPI_UART_6_DATA_BITS 1 +#define ACPI_UART_7_DATA_BITS 2 +#define ACPI_UART_8_DATA_BITS 3 +#define ACPI_UART_9_DATA_BITS 4 + +/* Values for StopBits field above */ + +#define ACPI_UART_NO_STOP_BITS 0 +#define ACPI_UART_1_STOP_BIT 1 +#define ACPI_UART_1P5_STOP_BITS 2 +#define ACPI_UART_2_STOP_BITS 3 + +/* Values for FlowControl field above */ + +#define ACPI_UART_FLOW_CONTROL_NONE 0 +#define ACPI_UART_FLOW_CONTROL_HW 1 +#define ACPI_UART_FLOW_CONTROL_XON_XOFF 2 + +/* Values for Parity field above */ + +#define ACPI_UART_PARITY_NONE 0 +#define ACPI_UART_PARITY_EVEN 1 +#define ACPI_UART_PARITY_ODD 2 +#define ACPI_UART_PARITY_MARK 3 +#define ACPI_UART_PARITY_SPACE 4 + +/* Values for LinesEnabled bitfield above */ + +#define ACPI_UART_CARRIER_DETECT (1<<2) +#define ACPI_UART_RING_INDICATOR (1<<3) +#define ACPI_UART_DATA_SET_READY (1<<4) +#define ACPI_UART_DATA_TERMINAL_READY (1<<5) +#define ACPI_UART_CLEAR_TO_SEND (1<<6) +#define ACPI_UART_REQUEST_TO_SEND (1<<7) + /* ACPI_RESOURCE_TYPEs */ @@ -405,7 +616,10 @@ typedef struct acpi_resource_generic_register #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 -#define ACPI_RESOURCE_TYPE_MAX 16 +#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */ +#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */ +#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */ +#define ACPI_RESOURCE_TYPE_MAX 19 /* Master union for resource descriptors */ @@ -416,6 +630,7 @@ typedef union acpi_resource_data ACPI_RESOURCE_START_DEPENDENT StartDpf; ACPI_RESOURCE_IO Io; ACPI_RESOURCE_FIXED_IO FixedIo; + ACPI_RESOURCE_FIXED_DMA FixedDma; ACPI_RESOURCE_VENDOR Vendor; ACPI_RESOURCE_VENDOR_TYPED VendorTyped; ACPI_RESOURCE_END_TAG EndTag; @@ -428,6 +643,11 @@ typedef union acpi_resource_data ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq; ACPI_RESOURCE_GENERIC_REGISTER GenericReg; + ACPI_RESOURCE_GPIO Gpio; + ACPI_RESOURCE_I2C_SERIALBUS I2cSerialBus; + ACPI_RESOURCE_SPI_SERIALBUS SpiSerialBus; + ACPI_RESOURCE_UART_SERIALBUS UartSerialBus; + ACPI_RESOURCE_COMMON_SERIALBUS CommonSerialBus; /* Common fields */ diff --git a/include/actbl.h b/include/actbl.h index e632291cd0fe..4b0db9604e9d 100644 --- a/include/actbl.h +++ b/include/actbl.h @@ -298,6 +298,7 @@ typedef struct acpi_table_fadt ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ + ACPI_GENERIC_ADDRESS SleepRegister; /* 64-bit address of the Sleep register */ } ACPI_TABLE_FADT; @@ -309,6 +310,7 @@ typedef struct acpi_table_fadt #define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */ #define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */ #define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ +#define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */ /* Masks for FADT flags */ @@ -332,6 +334,9 @@ typedef struct acpi_table_fadt #define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ #define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ #define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */ +#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */ +#define ACPI_FADT_PREFER_S0_IDLE (1<<21) /* 21: [V5] Use advanced idle capabilities (ACPI 5.0) */ +#define ACPI_FADT_USE_SLEEP_REG (1<<22) /* 22: [V5] Use the sleep register for sleep (ACPI 5.0) */ /* Values for PreferredProfile (Prefered Power Management Profiles) */ @@ -344,7 +349,9 @@ enum AcpiPreferedPmProfiles PM_WORKSTATION = 3, PM_ENTERPRISE_SERVER = 4, PM_SOHO_SERVER = 5, - PM_APPLIANCE_PC = 6 + PM_APPLIANCE_PC = 6, + PM_PERFORMANCE_SERVER = 7, + PM_SLATE = 8 }; @@ -392,6 +399,7 @@ typedef struct acpi_table_desc */ #include "actbl1.h" #include "actbl2.h" +#include "actbl3.h" /* Macros used to generate offsets to specific table fields */ @@ -405,12 +413,15 @@ typedef struct acpi_table_desc * FADT is the bottom line as to what the version really is. * * For reference, the values below are as follows: - * FADT V1 size: 0x74 - * FADT V2 size: 0x84 - * FADT V3+ size: 0xF4 + * FADT V1 size: 0x074 + * FADT V2 size: 0x084 + * FADT V3 size: 0x0F4 + * FADT V4 size: 0x0F4 + * FADT V5 size: 0x100 */ #define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) #define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3) -#define ACPI_FADT_V3_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) +#define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepRegister)) +#define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) #endif /* __ACTBL_H__ */ diff --git a/include/actbl1.h b/include/actbl1.h index ad6c82fc3c9d..0458d8b16f55 100644 --- a/include/actbl1.h +++ b/include/actbl1.h @@ -252,16 +252,17 @@ typedef struct acpi_einj_entry enum AcpiEinjActions { - ACPI_EINJ_BEGIN_OPERATION = 0, - ACPI_EINJ_GET_TRIGGER_TABLE = 1, - ACPI_EINJ_SET_ERROR_TYPE = 2, - ACPI_EINJ_GET_ERROR_TYPE = 3, - ACPI_EINJ_END_OPERATION = 4, - ACPI_EINJ_EXECUTE_OPERATION = 5, - ACPI_EINJ_CHECK_BUSY_STATUS = 6, - ACPI_EINJ_GET_COMMAND_STATUS = 7, - ACPI_EINJ_ACTION_RESERVED = 8, /* 8 and greater are reserved */ - ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ + ACPI_EINJ_BEGIN_OPERATION = 0, + ACPI_EINJ_GET_TRIGGER_TABLE = 1, + ACPI_EINJ_SET_ERROR_TYPE = 2, + ACPI_EINJ_GET_ERROR_TYPE = 3, + ACPI_EINJ_END_OPERATION = 4, + ACPI_EINJ_EXECUTE_OPERATION = 5, + ACPI_EINJ_CHECK_BUSY_STATUS = 6, + ACPI_EINJ_GET_COMMAND_STATUS = 7, + ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8, + ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */ + ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ }; /* Values for Instruction field above */ @@ -273,9 +274,33 @@ enum AcpiEinjInstructions ACPI_EINJ_WRITE_REGISTER = 2, ACPI_EINJ_WRITE_REGISTER_VALUE = 3, ACPI_EINJ_NOOP = 4, - ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */ + ACPI_EINJ_FLUSH_CACHELINE = 5, + ACPI_EINJ_INSTRUCTION_RESERVED = 6 /* 6 and greater are reserved */ }; +typedef struct acpi_einj_error_type_with_addr +{ + UINT32 ErrorType; + UINT32 VendorStructOffset; + UINT32 Flags; + UINT32 ApicId; + UINT64 Address; + UINT64 Range; + UINT32 PcieId; + +} ACPI_EINJ_ERROR_TYPE_WITH_ADDR; + +typedef struct acpi_einj_vendor +{ + UINT32 Length; + UINT32 PcieId; + UINT16 VendorId; + UINT16 DeviceId; + UINT8 RevisionId; + UINT8 Reserved[3]; + +} ACPI_EINJ_VENDOR; + /* EINJ Trigger Error Action Table */ @@ -313,6 +338,7 @@ enum AcpiEinjCommandStatus #define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) #define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) #define ACPI_EINJ_PLATFORM_FATAL (1<<11) +#define ACPI_EINJ_VENDOR_DEFINED (1<<31) /******************************************************************************* @@ -731,7 +757,9 @@ enum AcpiMadtType ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, ACPI_MADT_TYPE_LOCAL_X2APIC = 9, ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, - ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */ + ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, + ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, + ACPI_MADT_TYPE_RESERVED = 13 /* 13 and greater are reserved */ }; @@ -886,11 +914,42 @@ typedef struct acpi_madt_local_x2apic_nmi } ACPI_MADT_LOCAL_X2APIC_NMI; +/* 11: Generic Interrupt (ACPI 5.0) */ + +typedef struct acpi_madt_generic_interrupt +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* Reserved - must be zero */ + UINT32 GicId; + UINT32 Uid; + UINT32 Flags; + UINT32 ParkingVersion; + UINT32 PerformanceInterrupt; + UINT64 ParkedAddress; + UINT64 BaseAddress; + +} ACPI_MADT_GENERIC_INTERRUPT; + + +/* 12: Generic Distributor (ACPI 5.0) */ + +typedef struct acpi_madt_generic_distributor +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* Reserved - must be zero */ + UINT32 GicId; + UINT64 BaseAddress; + UINT32 GlobalIrqBase; + UINT32 Reserved2; /* Reserved - must be zero */ + +} ACPI_MADT_GENERIC_DISTRIBUTOR; + + /* * Common flags fields for MADT subtables */ -/* MADT Local APIC flags (LapicFlags) */ +/* MADT Local APIC flags (LapicFlags) and GIC flags */ #define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ diff --git a/include/actbl3.h b/include/actbl3.h new file mode 100644 index 000000000000..ee19cacf5bd1 --- /dev/null +++ b/include/actbl3.h @@ -0,0 +1,650 @@ +/****************************************************************************** + * + * Name: actbl3.h - ACPI Table Definitions + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACTBL3_H__ +#define __ACTBL3_H__ + + +/******************************************************************************* + * + * Additional ACPI Tables (3) + * + * These tables are not consumed directly by the ACPICA subsystem, but are + * included here to support device drivers and the AML disassembler. + * + * The tables in this file are fully defined within the ACPI specification. + * + ******************************************************************************/ + + +/* + * Values for description table header signatures for tables defined in this + * file. Useful because they make it more difficult to inadvertently type in + * the wrong signature. + */ +#define ACPI_SIG_BGRT "BGRT" /* Boot Graphics Resource Table */ +#define ACPI_SIG_DRTM "DRTM" /* Dynamic Root of Trust for Measurement table */ +#define ACPI_SIG_FPDT "FPDT" /* Firmware Performance Data Table */ +#define ACPI_SIG_GTDT "GTDT" /* Generic Timer Description Table */ +#define ACPI_SIG_MPST "MPST" /* Memory Power State Table */ +#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */ +#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ +#define ACPI_SIG_RASF "RASF" /* RAS Feature table */ + +#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */ +#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */ + +/* Reserved table signatures */ + +#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */ +#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */ +#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ +#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ +#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ + +/* + * All tables must be byte-packed to match the ACPI specification, since + * the tables are provided by the system BIOS. + */ +#pragma pack(1) + +/* + * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. + * This is the only type that is even remotely portable. Anything else is not + * portable, so do not use any other bitfield types. + */ + + +/******************************************************************************* + * + * BGRT - Boot Graphics Resource Table (ACPI 5.0) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_bgrt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 Version; + UINT8 Status; + UINT8 ImageType; + UINT64 ImageAddress; + UINT32 ImageOffsetX; + UINT32 ImageOffsetY; + +} ACPI_TABLE_BGRT; + + +/******************************************************************************* + * + * DRTM - Dynamic Root of Trust for Measurement table + * + ******************************************************************************/ + +typedef struct acpi_table_drtm +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT64 EntryBaseAddress; + UINT64 EntryLength; + UINT32 EntryAddress32; + UINT64 EntryAddress64; + UINT64 ExitAddress; + UINT64 LogAreaAddress; + UINT32 LogAreaLength; + UINT64 ArchDependentAddress; + UINT32 Flags; + +} ACPI_TABLE_DRTM; + +/* 1) Validated Tables List */ + +typedef struct acpi_drtm_vtl_list +{ + UINT32 ValidatedTableListCount; + +} ACPI_DRTM_VTL_LIST; + +/* 2) Resources List */ + +typedef struct acpi_drtm_resource_list +{ + UINT32 ResourceListCount; + +} ACPI_DRTM_RESOURCE_LIST; + +/* 3) Platform-specific Identifiers List */ + +typedef struct acpi_drtm_id_list +{ + UINT32 IdListCount; + +} ACPI_DRTM_ID_LIST; + + +/******************************************************************************* + * + * FPDT - Firmware Performance Data Table (ACPI 5.0) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_fpdt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_FPDT; + + +/* FPDT subtable header */ + +typedef struct acpi_fpdt_header +{ + UINT16 Type; + UINT8 Length; + UINT8 Revision; + +} ACPI_FPDT_HEADER; + +/* Values for Type field above */ + +enum AcpiFpdtType +{ + ACPI_FPDT_TYPE_BOOT = 0, + ACPI_FPDT_TYPE_S3PERF = 1, +}; + + +/* + * FPDT subtables + */ + +/* 0: Firmware Basic Boot Performance Record */ + +typedef struct acpi_fpdt_boot +{ + ACPI_FPDT_HEADER Header; + UINT8 Reserved[4]; + UINT64 ResetEnd; + UINT64 LoadStart; + UINT64 StartupStart; + UINT64 ExitServicesEntry; + UINT64 ExitServicesExit; + +} ACPI_FPDT_BOOT; + + +/* 1: S3 Performance Table Pointer Record */ + +typedef struct acpi_fpdt_s3pt_ptr +{ + ACPI_FPDT_HEADER Header; + UINT8 Reserved[4]; + UINT64 Address; + +} ACPI_FPDT_S3PT_PTR; + + +/* + * S3PT - S3 Performance Table. This table is pointed to by the + * FPDT S3 Pointer Record above. + */ +typedef struct acpi_table_s3pt +{ + UINT8 Signature[4]; /* "S3PT" */ + UINT32 Length; + +} ACPI_TABLE_S3PT; + + +/* + * S3PT Subtables + */ +typedef struct acpi_s3pt_header +{ + UINT16 Type; + UINT8 Length; + UINT8 Revision; + +} ACPI_S3PT_HEADER; + +/* Values for Type field above */ + +enum AcpiS3ptType +{ + ACPI_S3PT_TYPE_RESUME = 0, + ACPI_S3PT_TYPE_SUSPEND = 1, +}; + +typedef struct acpi_s3pt_resume +{ + ACPI_S3PT_HEADER Header; + UINT32 ResumeCount; + UINT64 FullResume; + UINT64 AverageResume; + +} ACPI_S3PT_RESUME; + +typedef struct acpi_s3pt_suspend +{ + ACPI_S3PT_HEADER Header; + UINT64 SuspendStart; + UINT64 SuspendEnd; + +} ACPI_S3PT_SUSPEND; + + +/******************************************************************************* + * + * GTDT - Generic Timer Description Table (ACPI 5.0) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_gtdt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT64 Address; + UINT32 Flags; + UINT32 SecurePl1Interrupt; + UINT32 SecurePl1Flags; + UINT32 NonSecurePl1Interrupt; + UINT32 NonSecurePl1Flags; + UINT32 VirtualTimerInterrupt; + UINT32 VirtualTimerFlags; + UINT32 NonSecurePl2Interrupt; + UINT32 NonSecurePl2Flags; + +} ACPI_TABLE_GTDT; + +/* Values for Flags field above */ + +#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1 + +/* Values for all "TimerFlags" fields above */ + +#define ACPI_GTDT_INTERRUPT_MODE 1 +#define ACPI_GTDT_INTERRUPT_POLARITY 2 + + +/******************************************************************************* + * + * MPST - Memory Power State Table (ACPI 5.0) + * Version 1 + * + ******************************************************************************/ + +#define ACPI_MPST_CHANNEL_INFO \ + UINT16 Reserved1; \ + UINT8 ChannelId; \ + UINT8 Reserved2; \ + UINT16 PowerNodeCount; + +/* Main table */ + +typedef struct acpi_table_mpst +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */ + +} ACPI_TABLE_MPST; + + +/* Memory Platform Communication Channel Info */ + +typedef struct acpi_mpst_channel +{ + ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */ + +} ACPI_MPST_CHANNEL; + + +/* Memory Power Node Structure */ + +typedef struct acpi_mpst_power_node +{ + UINT8 Flags; + UINT8 Reserved1; + UINT16 NodeId; + UINT32 Length; + UINT64 RangeAddress; + UINT64 RangeLength; + UINT8 NumPowerStates; + UINT8 NumPhysicalComponents; + UINT16 Reserved2; + +} ACPI_MPST_POWER_NODE; + +/* Values for Flags field above */ + +#define ACPI_MPST_ENABLED 1 +#define ACPI_MPST_POWER_MANAGED 2 +#define ACPI_MPST_HOT_PLUG_CAPABLE 4 + + +/* Memory Power State Structure (follows POWER_NODE above) */ + +typedef struct acpi_mpst_power_state +{ + UINT8 PowerState; + UINT8 InfoIndex; + +} ACPI_MPST_POWER_STATE; + + +/* Physical Component ID Structure (follows POWER_STATE above) */ + +typedef struct acpi_mpst_component +{ + UINT16 ComponentId; + +} ACPI_MPST_COMPONENT; + + +/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */ + +typedef struct acpi_mpst_data_hdr +{ + UINT16 CharacteristicsCount; + +} ACPI_MPST_DATA_HDR; + +typedef struct acpi_mpst_power_data +{ + UINT8 Revision; + UINT8 Flags; + UINT16 Reserved1; + UINT32 AveragePower; + UINT32 PowerSaving; + UINT64 ExitLatency; + UINT64 Reserved2; + +} ACPI_MPST_POWER_DATA; + +/* Values for Flags field above */ + +#define ACPI_MPST_PRESERVE 1 +#define ACPI_MPST_AUTOENTRY 2 +#define ACPI_MPST_AUTOEXIT 4 + + +/* Shared Memory Region (not part of an ACPI table) */ + +typedef struct acpi_mpst_shared +{ + UINT32 Signature; + UINT16 PccCommand; + UINT16 PccStatus; + UINT16 CommandRegister; + UINT16 StatusRegister; + UINT16 PowerStateId; + UINT16 PowerNodeId; + UINT64 EnergyConsumed; + UINT64 AveragePower; + +} ACPI_MPST_SHARED; + + +/******************************************************************************* + * + * PCCT - Platform Communications Channel Table (ACPI 5.0) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_pcct +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 Flags; + UINT32 Latency; + UINT32 Reserved; + +} ACPI_TABLE_PCCT; + +/* Values for Flags field above */ + +#define ACPI_PCCT_DOORBELL 1 + +/* + * PCCT subtables + */ + +/* 0: Generic Communications Subspace */ + +typedef struct acpi_pcct_subspace +{ + ACPI_SUBTABLE_HEADER Header; + UINT8 Reserved[6]; + UINT64 BaseAddress; + UINT64 Length; + ACPI_GENERIC_ADDRESS DoorbellRegister; + UINT64 PreserveMask; + UINT64 WriteMask; + +} ACPI_PCCT_SUBSPACE; + + +/* + * PCC memory structures (not part of the ACPI table) + */ + +/* Shared Memory Region */ + +typedef struct acpi_pcct_shared_memory +{ + UINT32 Signature; + UINT16 Command; + UINT16 Status; + +} ACPI_PCCT_SHARED_MEMORY; + + +/******************************************************************************* + * + * PMTT - Platform Memory Topology Table (ACPI 5.0) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_pmtt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 Reserved; + +} ACPI_TABLE_PMTT; + + +/* Common header for PMTT subtables that follow main table */ + +typedef struct acpi_pmtt_header +{ + UINT8 Type; + UINT8 Reserved1; + UINT16 Length; + UINT16 Flags; + UINT16 Reserved2; + +} ACPI_PMTT_HEADER; + +/* Values for Type field above */ + +#define ACPI_PMTT_TYPE_SOCKET 0 +#define ACPI_PMTT_TYPE_CONTROLLER 1 +#define ACPI_PMTT_TYPE_DIMM 2 +#define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFF are reserved */ + +/* Values for Flags field above */ + +#define ACPI_PMTT_TOP_LEVEL 0x0001 +#define ACPI_PMTT_PHYSICAL 0x0002 +#define ACPI_PMTT_MEMORY_TYPE 0x000C + + +/* + * PMTT subtables, correspond to Type in acpi_pmtt_header + */ + + +/* 0: Socket Structure */ + +typedef struct acpi_pmtt_socket +{ + ACPI_PMTT_HEADER Header; + UINT16 SocketId; + UINT16 Reserved; + +} ACPI_PMTT_SOCKET; + + +/* 1: Memory Controller subtable */ + +typedef struct acpi_pmtt_controller +{ + ACPI_PMTT_HEADER Header; + UINT32 ReadLatency; + UINT32 WriteLatency; + UINT32 ReadBandwidth; + UINT32 WriteBandwidth; + UINT16 AccessWidth; + UINT16 Alignment; + UINT16 Reserved; + UINT16 DomainCount; + +} ACPI_PMTT_CONTROLLER; + +/* 1a: Proximity Domain substructure */ + +typedef struct acpi_pmtt_domain +{ + UINT32 ProximityDomain; + +} ACPI_PMTT_DOMAIN; + + +/* 2: Physical Component Identifier (DIMM) */ + +typedef struct acpi_pmtt_physical_component +{ + ACPI_PMTT_HEADER Header; + UINT16 ComponentId; + UINT16 Reserved; + UINT32 MemorySize; + UINT32 BiosHandle; + +} ACPI_PMTT_PHYSICAL_COMPONENT; + + +/******************************************************************************* + * + * RASF - RAS Feature Table (ACPI 5.0) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_rasf +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 ChannelId[12]; + +} ACPI_TABLE_RASF; + +/* RASF Platform Communication Channel Shared Memory Region */ + +typedef struct acpi_rasf_shared_memory +{ + UINT32 Signature; + UINT16 Command; + UINT16 Status; + UINT64 RequestedAddress; + UINT64 RequestedLength; + UINT64 ActualAddress; + UINT64 ActualLength; + UINT16 Flags; + UINT8 Speed; + +} ACPI_RASF_SHARED_MEMORY; + +/* Masks for Flags and Speed fields above */ + +#define ACPI_RASF_SCRUBBER_RUNNING 1 +#define ACPI_RASF_SPEED (7<<1) + +/* Channel Commands */ + +enum AcpiRasfCommands +{ + ACPI_RASF_GET_RAS_CAPABILITIES = 1, + ACPI_RASF_GET_PATROL_PARAMETERS = 2, + ACPI_RASF_START_PATROL_SCRUBBER = 3, + ACPI_RASF_STOP_PATROL_SCRUBBER = 4 +}; + +/* Channel Command flags */ + +#define ACPI_RASF_GENERATE_SCI (1<<15) + +/* Status values */ + +enum AcpiRasfStatus +{ + ACPI_RASF_SUCCESS = 0, + ACPI_RASF_NOT_VALID = 1, + ACPI_RASF_NOT_SUPPORTED = 2, + ACPI_RASF_BUSY = 3, + ACPI_RASF_FAILED = 4, + ACPI_RASF_ABORTED = 5, + ACPI_RASF_INVALID_DATA = 6 +}; + +/* Status flags */ + +#define ACPI_RASF_COMMAND_COMPLETE (1) +#define ACPI_RASF_SCI_DOORBELL (1<<1) +#define ACPI_RASF_ERROR (1<<2) +#define ACPI_RASF_STATUS (0x1F<<3) + + +/* Reset to default packing */ + +#pragma pack() + +#endif /* __ACTBL3_H__ */ diff --git a/include/actypes.h b/include/actypes.h index 095e589607ea..43f66f176a67 100644 --- a/include/actypes.h +++ b/include/actypes.h @@ -716,8 +716,10 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 #define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 +#define ACPI_ADR_SPACE_GPIO (ACPI_ADR_SPACE_TYPE) 8 +#define ACPI_ADR_SPACE_GSBUS (ACPI_ADR_SPACE_TYPE) 9 -#define ACPI_NUM_PREDEFINED_REGIONS 8 +#define ACPI_NUM_PREDEFINED_REGIONS 10 /* * Special Address Spaces @@ -1030,6 +1032,17 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( #define ACPI_DEFAULT_HANDLER NULL +/* Special Context data for GenericSerialBus/GeneralPurposeIo (ACPI 5.0) */ + +typedef struct acpi_connection_info +{ + UINT8 *Connection; + UINT16 Length; + UINT8 AccessLength; + +} ACPI_CONNECTION_INFO; + + typedef ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( ACPI_HANDLE RegionHandle, diff --git a/include/acutils.h b/include/acutils.h index 489f195eb99b..185e3610377a 100644 --- a/include/acutils.h +++ b/include/acutils.h @@ -46,6 +46,7 @@ extern const UINT8 AcpiGbl_ResourceAmlSizes[]; +extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[]; /* Strings used by the disassembler and debugger resource dump routines */ @@ -69,6 +70,22 @@ extern const char *AcpiGbl_SizDecode[]; extern const char *AcpiGbl_TrsDecode[]; extern const char *AcpiGbl_TtpDecode[]; extern const char *AcpiGbl_TypDecode[]; +extern const char *AcpiGbl_PpcDecode[]; +extern const char *AcpiGbl_IorDecode[]; +extern const char *AcpiGbl_DtsDecode[]; +extern const char *AcpiGbl_CtDecode[]; +extern const char *AcpiGbl_SbtDecode[]; +extern const char *AcpiGbl_AmDecode[]; +extern const char *AcpiGbl_SmDecode[]; +extern const char *AcpiGbl_WmDecode[]; +extern const char *AcpiGbl_CphDecode[]; +extern const char *AcpiGbl_CpoDecode[]; +extern const char *AcpiGbl_DpDecode[]; +extern const char *AcpiGbl_EdDecode[]; +extern const char *AcpiGbl_BpbDecode[]; +extern const char *AcpiGbl_SbDecode[]; +extern const char *AcpiGbl_FcDecode[]; +extern const char *AcpiGbl_PtDecode[]; #endif /* Types for Resource descriptor entries */ diff --git a/include/amlcode.h b/include/amlcode.h index f6e0de3b35cb..452c26a7717b 100644 --- a/include/amlcode.h +++ b/include/amlcode.h @@ -191,6 +191,15 @@ /* + * Opcodes for "Field" operators + */ +#define AML_FIELD_OFFSET_OP (UINT8) 0x00 +#define AML_FIELD_ACCESS_OP (UINT8) 0x01 +#define AML_FIELD_CONNECTION_OP (UINT8) 0x02 /* ACPI 5.0 */ +#define AML_FIELD_EXT_ACCESS_OP (UINT8) 0x03 /* ACPI 5.0 */ + + +/* * Internal opcodes * Use only "Unknown" AML opcodes, don't attempt to use * any valid ACPI ASCII values (A-Z, 0-9, '-') @@ -204,7 +213,8 @@ #define AML_INT_METHODCALL_OP (UINT16) 0x0035 #define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036 #define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037 - +#define AML_INT_CONNECTION_OP (UINT16) 0x0038 +#define AML_INT_EXTACCESSFIELD_OP (UINT16) 0x0039 #define ARG_NONE 0x0 @@ -478,13 +488,16 @@ typedef enum */ typedef enum { - AML_FIELD_ATTRIB_SMB_QUICK = 0x02, - AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, - AML_FIELD_ATTRIB_SMB_BYTE = 0x06, - AML_FIELD_ATTRIB_SMB_WORD = 0x08, - AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, - AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, - AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D + AML_FIELD_ATTRIB_QUICK = 0x02, + AML_FIELD_ATTRIB_SEND_RCV = 0x04, + AML_FIELD_ATTRIB_BYTE = 0x06, + AML_FIELD_ATTRIB_WORD = 0x08, + AML_FIELD_ATTRIB_BLOCK = 0x0A, + AML_FIELD_ATTRIB_MULTIBYTE = 0x0B, + AML_FIELD_ATTRIB_WORD_CALL = 0x0C, + AML_FIELD_ATTRIB_BLOCK_CALL = 0x0D, + AML_FIELD_ATTRIB_RAW_BYTES = 0x0E, + AML_FIELD_ATTRIB_RAW_PROCESS = 0x0F } AML_ACCESS_ATTRIBUTE; diff --git a/include/amlresrc.h b/include/amlresrc.h index 1375d96cf885..3cfcb2ad65a7 100644 --- a/include/amlresrc.h +++ b/include/amlresrc.h @@ -59,29 +59,48 @@ #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" #define ACPI_RESTAG_BASEADDRESS "_BAS" #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ +#define ACPI_RESTAG_DEBOUNCETIME "_DBT" #define ACPI_RESTAG_DECODE "_DEC" +#define ACPI_RESTAG_DEVICEPOLARITY "_DPL" #define ACPI_RESTAG_DMA "_DMA" #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ +#define ACPI_RESTAG_DRIVESTRENGTH "_DRS" +#define ACPI_RESTAG_ENDIANNESS "_END" +#define ACPI_RESTAG_FLOWCONTROL "_FLC" #define ACPI_RESTAG_GRANULARITY "_GRA" #define ACPI_RESTAG_INTERRUPT "_INT" #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */ #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */ #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ +#define ACPI_RESTAG_IORESTRICTION "_IOR" #define ACPI_RESTAG_LENGTH "_LEN" +#define ACPI_RESTAG_LINE "_LIN" #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ #define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ #define ACPI_RESTAG_MAXADDR "_MAX" #define ACPI_RESTAG_MINADDR "_MIN" #define ACPI_RESTAG_MAXTYPE "_MAF" #define ACPI_RESTAG_MINTYPE "_MIF" +#define ACPI_RESTAG_MODE "_MOD" +#define ACPI_RESTAG_PARITY "_PAR" +#define ACPI_RESTAG_PHASE "_PHA" +#define ACPI_RESTAG_PIN "_PIN" +#define ACPI_RESTAG_PINCONFIG "_PPI" +#define ACPI_RESTAG_POLARITY "_POL" #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" #define ACPI_RESTAG_RANGETYPE "_RNG" #define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */ +#define ACPI_RESTAG_LENGTH_RX "_RXL" +#define ACPI_RESTAG_LENGTH_TX "_TXL" +#define ACPI_RESTAG_SLAVEMODE "_SLV" +#define ACPI_RESTAG_SPEED "_SPE" +#define ACPI_RESTAG_STOPBITS "_STB" #define ACPI_RESTAG_TRANSLATION "_TRA" #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */ +#define ACPI_RESTAG_VENDORDATA "_VEN" /* Default sizes for "small" resource descriptors */ @@ -92,6 +111,7 @@ #define ASL_RDESC_END_DEPEND_SIZE 0x00 #define ASL_RDESC_IO_SIZE 0x07 #define ASL_RDESC_FIXED_IO_SIZE 0x03 +#define ASL_RDESC_FIXED_DMA_SIZE 0x05 #define ASL_RDESC_END_TAG_SIZE 0x01 @@ -214,6 +234,16 @@ typedef struct aml_resource_end_tag } AML_RESOURCE_END_TAG; +typedef struct aml_resource_fixed_dma +{ + AML_RESOURCE_SMALL_HEADER_COMMON + UINT16 RequestLines; + UINT16 Channels; + UINT8 Width; + +} AML_RESOURCE_FIXED_DMA; + + /* * LARGE descriptors */ @@ -368,6 +398,130 @@ typedef struct aml_resource_generic_register } AML_RESOURCE_GENERIC_REGISTER; + +/* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */ + +typedef struct aml_resource_gpio +{ + AML_RESOURCE_LARGE_HEADER_COMMON + UINT8 RevisionId; + UINT8 ConnectionType; + UINT16 Flags; + UINT16 IntFlags; + UINT8 PinConfig; + UINT16 DriveStrength; + UINT16 DebounceTimeout; + UINT16 PinTableOffset; + UINT8 ResSourceIndex; + UINT16 ResSourceOffset; + UINT16 VendorOffset; + UINT16 VendorLength; + /* + * Optional fields follow immediately: + * 1) PIN list (Words) + * 2) Resource Source String + * 3) Vendor Data bytes + */ + +} AML_RESOURCE_GPIO; + +#define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */ + +/* Values for ConnectionType above */ + +#define AML_RESOURCE_GPIO_TYPE_INT 0 +#define AML_RESOURCE_GPIO_TYPE_IO 1 +#define AML_RESOURCE_MAX_GPIOTYPE 1 + + +/* Common preamble for all serial descriptors (ACPI 5.0) */ + +#define AML_RESOURCE_SERIAL_COMMON \ + UINT8 RevisionId; \ + UINT8 ResSourceIndex; \ + UINT8 Type; \ + UINT8 Flags; \ + UINT16 TypeSpecificFlags; \ + UINT8 TypeRevisionId; \ + UINT16 TypeDataLength; \ + +/* Values for the type field above */ + +#define AML_RESOURCE_I2C_SERIALBUSTYPE 1 +#define AML_RESOURCE_SPI_SERIALBUSTYPE 2 +#define AML_RESOURCE_UART_SERIALBUSTYPE 3 +#define AML_RESOURCE_MAX_SERIALBUSTYPE 3 +#define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */ + +typedef struct aml_resource_common_serialbus +{ + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_SERIAL_COMMON + +} AML_RESOURCE_COMMON_SERIALBUS; + +typedef struct aml_resource_i2c_serialbus +{ + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_SERIAL_COMMON + UINT32 ConnectionSpeed; + UINT16 SlaveAddress; + /* + * Optional fields follow immediately: + * 1) Vendor Data bytes + * 2) Resource Source String + */ + +} AML_RESOURCE_I2C_SERIALBUS; + +#define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */ +#define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */ +#define AML_RESOURCE_I2C_MIN_DATA_LEN 6 + +typedef struct aml_resource_spi_serialbus +{ + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_SERIAL_COMMON + UINT32 ConnectionSpeed; + UINT8 DataBitLength; + UINT8 ClockPhase; + UINT8 ClockPolarity; + UINT16 DeviceSelection; + /* + * Optional fields follow immediately: + * 1) Vendor Data bytes + * 2) Resource Source String + */ + +} AML_RESOURCE_SPI_SERIALBUS; + +#define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */ +#define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */ +#define AML_RESOURCE_SPI_MIN_DATA_LEN 9 + + +typedef struct aml_resource_uart_serialbus +{ + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_SERIAL_COMMON + UINT32 DefaultBaudRate; + UINT16 RxFifoSize; + UINT16 TxFifoSize; + UINT8 Parity; + UINT8 LinesEnabled; + /* + * Optional fields follow immediately: + * 1) Vendor Data bytes + * 2) Resource Source String + */ + +} AML_RESOURCE_UART_SERIALBUS; + +#define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */ +#define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */ +#define AML_RESOURCE_UART_MIN_DATA_LEN 10 + + /* restore default alignment */ #pragma pack() @@ -390,6 +544,7 @@ typedef union aml_resource AML_RESOURCE_END_DEPENDENT EndDpf; AML_RESOURCE_IO Io; AML_RESOURCE_FIXED_IO FixedIo; + AML_RESOURCE_FIXED_DMA FixedDma; AML_RESOURCE_VENDOR_SMALL VendorSmall; AML_RESOURCE_END_TAG EndTag; @@ -405,6 +560,11 @@ typedef union aml_resource AML_RESOURCE_ADDRESS64 Address64; AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; AML_RESOURCE_EXTENDED_IRQ ExtendedIrq; + AML_RESOURCE_GPIO Gpio; + AML_RESOURCE_I2C_SERIALBUS I2cSerialBus; + AML_RESOURCE_SPI_SERIALBUS SpiSerialBus; + AML_RESOURCE_UART_SERIALBUS UartSerialBus; + AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus; /* Utility overlays */ diff --git a/namespace/nspredef.c b/namespace/nspredef.c index 358c63a85dc6..64ad91c900f4 100644 --- a/namespace/nspredef.c +++ b/namespace/nspredef.c @@ -665,6 +665,7 @@ AcpiNsCheckPackage ( case ACPI_PTYPE2_FIXED: case ACPI_PTYPE2_MIN: case ACPI_PTYPE2_COUNT: + case ACPI_PTYPE2_FIX_VAR: /* * These types all return a single Package that consists of a @@ -807,6 +808,29 @@ AcpiNsCheckPackageList ( break; + case ACPI_PTYPE2_FIX_VAR: + /* + * Each subpackage has a fixed number of elements and an + * optional element + */ + ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; + if (SubPackage->Package.Count < ExpectedCount) + { + goto PackageTooSmall; + } + + Status = AcpiNsCheckPackageElements (Data, SubElements, + Package->RetInfo.ObjectType1, + Package->RetInfo.Count1, + Package->RetInfo.ObjectType2, + SubPackage->Package.Count - Package->RetInfo.Count1, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + case ACPI_PTYPE2_FIXED: /* Each sub-package has a fixed length */ diff --git a/namespace/nsrepair.c b/namespace/nsrepair.c index be73953ded0b..e9653fd09e1d 100644 --- a/namespace/nsrepair.c +++ b/namespace/nsrepair.c @@ -696,6 +696,7 @@ AcpiNsRemoveNullElements ( case ACPI_PTYPE2_FIXED: case ACPI_PTYPE2_MIN: case ACPI_PTYPE2_REV_FIXED: + case ACPI_PTYPE2_FIX_VAR: break; default: diff --git a/namespace/nsrepair2.c b/namespace/nsrepair2.c index d8a0420cf94c..db48d8cf096a 100644 --- a/namespace/nsrepair2.c +++ b/namespace/nsrepair2.c @@ -516,11 +516,12 @@ AcpiNsRepair_HID ( } /* - * Copy and uppercase the string. From the ACPI specification: + * Copy and uppercase the string. From the ACPI 5.0 specification: * * A valid PNP ID must be of the form "AAA####" where A is an uppercase * letter and # is a hex digit. A valid ACPI ID must be of the form - * "ACPI####" where # is a hex digit. + * "NNNN####" where N is an uppercase letter or decimal digit, and + * # is a hex digit. */ for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) { diff --git a/os_specific/service_layers/osunixxf.c b/os_specific/service_layers/osunixxf.c index 2ad9780ef42c..3aa0d3dd1ebd 100644 --- a/os_specific/service_layers/osunixxf.c +++ b/os_specific/service_layers/osunixxf.c @@ -277,7 +277,6 @@ AcpiOsVprintf ( const char *Fmt, va_list Args) { - INT32 Count = 0; UINT8 Flags; @@ -290,7 +289,7 @@ AcpiOsVprintf ( { /* Output file is open, send the output there */ - Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args); + vfprintf (AcpiGbl_DebugFile, Fmt, Args); } else { @@ -302,7 +301,7 @@ AcpiOsVprintf ( if (Flags & ACPI_DB_CONSOLE_OUTPUT) { - Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args); + vfprintf (AcpiGbl_OutputFile, Fmt, Args); } } @@ -1172,8 +1171,11 @@ ACPI_THREAD_ID AcpiOsGetThreadId ( void) { + pthread_t thread; + - return (ACPI_CAST_PTHREAD_T (pthread_self())); + thread = pthread_self(); + return (ACPI_CAST_PTHREAD_T (thread)); } diff --git a/os_specific/service_layers/oswinxf.c b/os_specific/service_layers/oswinxf.c index a931c7f22069..8e65e6211d1d 100644 --- a/os_specific/service_layers/oswinxf.c +++ b/os_specific/service_layers/oswinxf.c @@ -1162,6 +1162,8 @@ AcpiOsReadPort ( UINT32 *Value, UINT32 Width) { + ACPI_FUNCTION_NAME (OsReadPort); + switch (Width) { @@ -1178,6 +1180,7 @@ AcpiOsReadPort ( break; default: + ACPI_ERROR ((AE_INFO, "Bad width parameter: %X", Width)); return (AE_BAD_PARAMETER); } @@ -1205,8 +1208,16 @@ AcpiOsWritePort ( UINT32 Value, UINT32 Width) { + ACPI_FUNCTION_NAME (OsWritePort); - return (AE_OK); + + if ((Width == 8) || (Width == 16) || (Width == 32)) + { + return (AE_OK); + } + + ACPI_ERROR ((AE_INFO, "Bad width parameter: %X", Width)); + return (AE_BAD_PARAMETER); } diff --git a/parser/psargs.c b/parser/psargs.c index e383def11e89..8f31bba0826e 100644 --- a/parser/psargs.c +++ b/parser/psargs.c @@ -531,37 +531,57 @@ static ACPI_PARSE_OBJECT * AcpiPsGetNextField ( ACPI_PARSE_STATE *ParserState) { - UINT32 AmlOffset = (UINT32) - ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); + UINT32 AmlOffset; ACPI_PARSE_OBJECT *Field; + ACPI_PARSE_OBJECT *Arg = NULL; UINT16 Opcode; UINT32 Name; + UINT8 AccessType; + UINT8 AccessAttribute; + UINT8 AccessLength; + UINT32 PkgLength; + UINT8 *PkgEnd; + UINT32 BufferLength; ACPI_FUNCTION_TRACE (PsGetNextField); + AmlOffset = (UINT32) ACPI_PTR_DIFF ( + ParserState->Aml, ParserState->AmlStart); + /* Determine field type */ switch (ACPI_GET8 (ParserState->Aml)) { - default: + case AML_FIELD_OFFSET_OP: - Opcode = AML_INT_NAMEDFIELD_OP; + Opcode = AML_INT_RESERVEDFIELD_OP; + ParserState->Aml++; break; - case 0x00: + case AML_FIELD_ACCESS_OP: - Opcode = AML_INT_RESERVEDFIELD_OP; + Opcode = AML_INT_ACCESSFIELD_OP; ParserState->Aml++; break; - case 0x01: + case AML_FIELD_CONNECTION_OP: - Opcode = AML_INT_ACCESSFIELD_OP; + Opcode = AML_INT_CONNECTION_OP; + ParserState->Aml++; + break; + + case AML_FIELD_EXT_ACCESS_OP: + + Opcode = AML_INT_EXTACCESSFIELD_OP; ParserState->Aml++; break; + + default: + + Opcode = AML_INT_NAMEDFIELD_OP; + break; } /* Allocate a new field op */ @@ -601,17 +621,116 @@ AcpiPsGetNextField ( case AML_INT_ACCESSFIELD_OP: + case AML_INT_EXTACCESSFIELD_OP: /* * Get AccessType and AccessAttrib and merge into the field Op - * AccessType is first operand, AccessAttribute is second + * AccessType is first operand, AccessAttribute is second. stuff + * these bytes into the node integer value for convenience. */ - Field->Common.Value.Integer = (((UINT32) ACPI_GET8 (ParserState->Aml) << 8)); + + /* Get the two bytes (Type/Attribute) */ + + AccessType = ACPI_GET8 (ParserState->Aml); ParserState->Aml++; - Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml); + AccessAttribute = ACPI_GET8 (ParserState->Aml); ParserState->Aml++; + + Field->Common.Value.Integer = (UINT8) AccessType; + Field->Common.Value.Integer |= (UINT16) (AccessAttribute << 8); + + /* This opcode has a third byte, AccessLength */ + + if (Opcode == AML_INT_EXTACCESSFIELD_OP) + { + AccessLength = ACPI_GET8 (ParserState->Aml); + ParserState->Aml++; + + Field->Common.Value.Integer |= (UINT32) (AccessLength << 16); + } break; + + case AML_INT_CONNECTION_OP: + + /* + * Argument for Connection operator can be either a Buffer + * (resource descriptor), or a NameString. + */ + if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP) + { + ParserState->Aml++; + + PkgEnd = ParserState->Aml; + PkgLength = AcpiPsGetNextPackageLength (ParserState); + PkgEnd += PkgLength; + + if (ParserState->Aml < PkgEnd) + { + /* Non-empty list */ + + Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP); + if (!Arg) + { + return_PTR (NULL); + } + + /* Get the actual buffer length argument */ + + Opcode = ACPI_GET8 (ParserState->Aml); + ParserState->Aml++; + + switch (Opcode) + { + case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ + BufferLength = ACPI_GET8 (ParserState->Aml); + ParserState->Aml += 1; + break; + + case AML_WORD_OP: /* AML_WORDDATA_ARG */ + BufferLength = ACPI_GET16 (ParserState->Aml); + ParserState->Aml += 2; + break; + + case AML_DWORD_OP: /* AML_DWORDATA_ARG */ + BufferLength = ACPI_GET32 (ParserState->Aml); + ParserState->Aml += 4; + break; + + default: + BufferLength = 0; + break; + } + + /* Fill in bytelist data */ + + Arg->Named.Value.Size = BufferLength; + Arg->Named.Data = ParserState->Aml; + } + + /* Skip to End of byte data */ + + ParserState->Aml = PkgEnd; + } + else + { + Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); + if (!Arg) + { + return_PTR (NULL); + } + + /* Get the Namestring argument */ + + Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState); + } + + /* Link the buffer/namestring to parent (CONNECTION_OP) */ + + AcpiPsAppendArg (Field, Arg); + break; + + default: /* Opcode was set in previous switch */ diff --git a/parser/psopcode.c b/parser/psopcode.c index 0d82976d7fd6..878dc1f486b8 100644 --- a/parser/psopcode.c +++ b/parser/psopcode.c @@ -328,12 +328,17 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), /* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), -/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), +/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), /* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), /* ACPI 3.0 opcodes */ -/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R) +/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R), + +/* ACPI 5.0 opcodes */ + +/* 7F */ ACPI_OP ("-ConnectField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 80 */ ACPI_OP ("-ExtAccessField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0) /*! [End] no source code translation !*/ }; @@ -353,7 +358,7 @@ static const UINT8 AcpiGbl_ShortOpIndex[256] = /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, /* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D, -/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, /* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, /* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, diff --git a/parser/pstree.c b/parser/pstree.c index d62bc7b9db61..ebadc0fefa4e 100644 --- a/parser/pstree.c +++ b/parser/pstree.c @@ -85,7 +85,12 @@ AcpiPsGetArg ( ACPI_FUNCTION_ENTRY (); - +/* + if (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP) + { + return (Op->Common.Value.Arg); + } +*/ /* Get the info structure for this opcode */ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); diff --git a/resources/rscalc.c b/resources/rscalc.c index 15cf68585704..edc51b1b6080 100644 --- a/resources/rscalc.c +++ b/resources/rscalc.c @@ -345,6 +345,26 @@ AcpiRsGetAmlLength ( break; + case ACPI_RESOURCE_TYPE_GPIO: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + (Resource->Data.Gpio.PinTableLength * 2) + + Resource->Data.Gpio.ResourceSource.StringLength + + Resource->Data.Gpio.VendorLength); + + break; + + + case ACPI_RESOURCE_TYPE_SERIAL_BUS: + + TotalSize = AcpiGbl_AmlResourceSerialBusSizes [Resource->Data.CommonSerialBus.Type]; + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + Resource->Data.I2cSerialBus.ResourceSource.StringLength + + Resource->Data.I2cSerialBus.VendorLength); + + break; + + default: break; } @@ -395,12 +415,13 @@ AcpiRsGetListLength ( UINT32 ExtraStructBytes; UINT8 ResourceIndex; UINT8 MinimumAmlResourceLength; + AML_RESOURCE *AmlResource; ACPI_FUNCTION_TRACE (RsGetListLength); - *SizeNeeded = 0; + *SizeNeeded = ACPI_RS_SIZE_MIN; /* Minimum size is one EndTag */ EndAml = AmlBuffer + AmlBufferLength; /* Walk the list of AML resource descriptors */ @@ -412,9 +433,15 @@ AcpiRsGetListLength ( Status = AcpiUtValidateResource (AmlBuffer, &ResourceIndex); if (ACPI_FAILURE (Status)) { + /* + * Exit on failure. Cannot continue because the descriptor length + * may be bogus also. + */ return_ACPI_STATUS (Status); } + AmlResource = (void *) AmlBuffer; + /* Get the resource length and base (minimum) AML size */ ResourceLength = AcpiUtGetResourceLength (AmlBuffer); @@ -460,10 +487,8 @@ AcpiRsGetListLength ( case ACPI_RESOURCE_NAME_END_TAG: /* - * End Tag: - * This is the normal exit, add size of EndTag + * End Tag: This is the normal exit */ - *SizeNeeded += ACPI_RS_SIZE_MIN; return_ACPI_STATUS (AE_OK); @@ -494,6 +519,30 @@ AcpiRsGetListLength ( ResourceLength - ExtraStructBytes, MinimumAmlResourceLength); break; + case ACPI_RESOURCE_NAME_GPIO: + + /* Vendor data is optional */ + + if (AmlResource->Gpio.VendorLength) + { + ExtraStructBytes += AmlResource->Gpio.VendorOffset - + AmlResource->Gpio.PinTableOffset + AmlResource->Gpio.VendorLength; + } + else + { + ExtraStructBytes += AmlResource->LargeHeader.ResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER) - + AmlResource->Gpio.PinTableOffset; + } + break; + + case ACPI_RESOURCE_NAME_SERIAL_BUS: + + MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[ + AmlResource->CommonSerialBus.Type]; + ExtraStructBytes += AmlResource->CommonSerialBus.ResourceLength - + MinimumAmlResourceLength; + break; default: break; @@ -505,8 +554,16 @@ AcpiRsGetListLength ( * Important: Round the size up for the appropriate alignment. This * is a requirement on IA64. */ - BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] + + if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_SERIAL_BUS) + { + BufferSize = AcpiGbl_ResourceStructSerialBusSizes[ + AmlResource->CommonSerialBus.Type] + ExtraStructBytes; + } + else + { + BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] + ExtraStructBytes; + } BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize); *SizeNeeded += BufferSize; diff --git a/resources/rscreate.c b/resources/rscreate.c index 40cf447c2996..83d09d693054 100644 --- a/resources/rscreate.c +++ b/resources/rscreate.c @@ -54,6 +54,79 @@ /******************************************************************************* * + * FUNCTION: AcpiBufferToResource + * + * PARAMETERS: AmlBuffer - Pointer to the resource byte stream + * AmlBufferLength - Length of the AmlBuffer + * ResourcePtr - Where the converted resource is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a raw AML buffer to a resource list + * + ******************************************************************************/ + +ACPI_STATUS +AcpiBufferToResource ( + UINT8 *AmlBuffer, + UINT16 AmlBufferLength, + ACPI_RESOURCE **ResourcePtr) +{ + ACPI_STATUS Status; + ACPI_SIZE ListSizeNeeded; + void *Resource; + void *CurrentResourcePtr; + + /* + * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag + * is not required here. + */ + + /* Get the required length for the converted resource */ + + Status = AcpiRsGetListLength (AmlBuffer, AmlBufferLength, + &ListSizeNeeded); + if (Status == AE_AML_NO_RESOURCE_END_TAG) + { + Status = AE_OK; + } + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Allocate a buffer for the converted resource */ + + Resource = ACPI_ALLOCATE_ZEROED (ListSizeNeeded); + CurrentResourcePtr = Resource; + if (!Resource) + { + return (AE_NO_MEMORY); + } + + /* Perform the AML-to-Resource conversion */ + + Status = AcpiUtWalkAmlResources (AmlBuffer, AmlBufferLength, + AcpiRsConvertAmlToResources, &CurrentResourcePtr); + if (Status == AE_AML_NO_RESOURCE_END_TAG) + { + Status = AE_OK; + } + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (Resource); + } + else + { + *ResourcePtr = Resource; + } + + return (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiRsCreateResourceList * * PARAMETERS: AmlBuffer - Pointer to the resource byte stream diff --git a/resources/rsdump.c b/resources/rsdump.c index 547067744780..6f05d0f8254f 100644 --- a/resources/rsdump.c +++ b/resources/rsdump.c @@ -91,6 +91,11 @@ AcpiRsDumpByteList ( UINT8 *Data); static void +AcpiRsDumpWordList ( + UINT16 Length, + UINT16 *Data); + +static void AcpiRsDumpDwordList ( UINT8 Length, UINT32 *Data); @@ -289,6 +294,87 @@ ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] = {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (GenericReg.Address), "Address", NULL} }; +ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGpio), "GPIO", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.ConnectionType), "ConnectionType", AcpiGbl_CtDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.PinConfig), "PinConfig", AcpiGbl_PpcDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Sharable), "Sharable", AcpiGbl_ShrDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.IoRestriction), "IoRestriction", AcpiGbl_IorDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.Triggering), "Triggering", AcpiGbl_HeDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Polarity), "Polarity", AcpiGbl_LlDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DriveStrength), "DriveStrength", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DebounceTimeout), "DebounceTimeout", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Gpio.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.PinTableLength), "PinTableLength", NULL}, + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (Gpio.PinTable), "PinTable", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (Gpio.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[4] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedDma), "FixedDma", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.RequestLines), "RequestLines", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.Channels), "Channels", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedDma.Width), "TransferWidth", AcpiGbl_DtsDecode}, +}; + +#define ACPI_RS_DUMP_COMMON_SERIAL_BUS \ + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.RevisionId), "RevisionId", NULL}, \ + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.Type), "Type", AcpiGbl_SbtDecode}, \ + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, \ + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.SlaveMode), "SlaveMode", AcpiGbl_SmDecode}, \ + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.TypeRevisionId), "TypeRevisionId", NULL}, \ + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.TypeDataLength), "TypeDataLength", NULL}, \ + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (CommonSerialBus.ResourceSource), "ResourceSource", NULL}, \ + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.VendorLength), "VendorLength", NULL}, \ + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (CommonSerialBus.VendorData), "VendorData", NULL}, + +ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[10] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpCommonSerialBus), "Common Serial Bus", NULL}, + ACPI_RS_DUMP_COMMON_SERIAL_BUS +}; + +ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[13] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpI2cSerialBus), "I2C Serial Bus", NULL}, + ACPI_RS_DUMP_COMMON_SERIAL_BUS + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (I2cSerialBus.AccessMode), "AccessMode", AcpiGbl_AmDecode}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (I2cSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (I2cSerialBus.SlaveAddress), "SlaveAddress", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[17] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpSpiSerialBus), "Spi Serial Bus", NULL}, + ACPI_RS_DUMP_COMMON_SERIAL_BUS + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.WireMode), "WireMode", AcpiGbl_WmDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.DevicePolarity), "DevicePolarity", AcpiGbl_DpDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.DataBitLength), "DataBitLength", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPhase), "ClockPhase", AcpiGbl_CphDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPolarity), "ClockPolarity", AcpiGbl_CpoDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (SpiSerialBus.DeviceSelection), "DeviceSelection", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (SpiSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[19] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpUartSerialBus), "Uart Serial Bus", NULL}, + ACPI_RS_DUMP_COMMON_SERIAL_BUS + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.FlowControl), "FlowControl", AcpiGbl_FcDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.StopBits), "StopBits", AcpiGbl_SbDecode}, + {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.DataBits), "DataBits", AcpiGbl_BpbDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.Endian), "Endian", AcpiGbl_EdDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.Parity), "Parity", AcpiGbl_PtDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.LinesEnabled), "LinesEnabled", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.RxFifoSize), "RxFifoSize", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.TxFifoSize), "TxFifoSize", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (UartSerialBus.DefaultBaudRate), "ConnectionSpeed", NULL}, +}; /* * Tables used for common address descriptor flag fields @@ -391,7 +477,15 @@ AcpiRsDumpDescriptor ( /* Data items, 8/16/32/64 bit */ case ACPI_RSD_UINT8: - AcpiRsOutInteger8 (Name, ACPI_GET8 (Target)); + if (Table->Pointer) + { + AcpiRsOutString (Name, ACPI_CAST_PTR (char, + Table->Pointer [*Target])); + } + else + { + AcpiRsOutInteger8 (Name, ACPI_GET8 (Target)); + } break; case ACPI_RSD_UINT16: @@ -418,6 +512,11 @@ AcpiRsDumpDescriptor ( Table->Pointer [*Target & 0x03])); break; + case ACPI_RSD_3BITFLAG: + AcpiRsOutString (Name, ACPI_CAST_PTR (char, + Table->Pointer [*Target & 0x07])); + break; + case ACPI_RSD_SHORTLIST: /* * Short byte list (single line output) for DMA and IRQ resources @@ -430,6 +529,19 @@ AcpiRsDumpDescriptor ( } break; + case ACPI_RSD_SHORTLISTX: + /* + * Short byte list (single line output) for GPIO vendor data + * Note: The list length is obtained from the previous table entry + */ + if (PreviousTarget) + { + AcpiRsOutTitle (Name); + AcpiRsDumpShortByteList (*PreviousTarget, + *(ACPI_CAST_INDIRECT_PTR (UINT8, Target))); + } + break; + case ACPI_RSD_LONGLIST: /* * Long byte list for Vendor resource data @@ -453,6 +565,18 @@ AcpiRsDumpDescriptor ( } break; + case ACPI_RSD_WORDLIST: + /* + * Word list for GPIO Pin Table + * Note: The list length is obtained from the previous table entry + */ + if (PreviousTarget) + { + AcpiRsDumpWordList (*PreviousTarget, + *(ACPI_CAST_INDIRECT_PTR (UINT16, Target))); + } + break; + case ACPI_RSD_ADDRESS: /* * Common flags for all Address resources @@ -613,13 +737,20 @@ AcpiRsDumpResourceList ( /* Dump the resource descriptor */ - AcpiRsDumpDescriptor (&ResourceList->Data, - AcpiGbl_DumpResourceDispatch[Type]); + if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) + { + AcpiRsDumpDescriptor (&ResourceList->Data, + AcpiGbl_DumpSerialBusDispatch[ResourceList->Data.CommonSerialBus.Type]); + } + else + { + AcpiRsDumpDescriptor (&ResourceList->Data, + AcpiGbl_DumpResourceDispatch[Type]); + } /* Point to the next resource structure */ - ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList, - ResourceList->Length); + ResourceList = ACPI_NEXT_RESOURCE (ResourceList); /* Exit when END_TAG descriptor is reached */ @@ -796,5 +927,20 @@ AcpiRsDumpDwordList ( } } +static void +AcpiRsDumpWordList ( + UINT16 Length, + UINT16 *Data) +{ + UINT16 i; + + + for (i = 0; i < Length; i++) + { + AcpiOsPrintf ("%25s%2.2X : %4.4X\n", + "Word", i, Data[i]); + } +} + #endif diff --git a/resources/rsinfo.c b/resources/rsinfo.c index 5753667806c9..eb950739310c 100644 --- a/resources/rsinfo.c +++ b/resources/rsinfo.c @@ -82,7 +82,10 @@ ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[] = AcpiRsConvertAddress64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ AcpiRsConvertExtAddress64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ AcpiRsConvertExtIrq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - AcpiRsConvertGenericReg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + AcpiRsConvertGenericReg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + AcpiRsConvertGpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */ + AcpiRsConvertFixedDma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */ + NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */ }; /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ @@ -101,7 +104,7 @@ ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] = AcpiRsConvertEndDpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ AcpiRsConvertIo, /* 0x08, ACPI_RESOURCE_NAME_IO */ AcpiRsConvertFixedIo, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ - NULL, /* 0x0A, Reserved */ + AcpiRsConvertFixedDma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */ NULL, /* 0x0B, Reserved */ NULL, /* 0x0C, Reserved */ NULL, /* 0x0D, Reserved */ @@ -121,7 +124,20 @@ ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] = AcpiRsConvertAddress16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ AcpiRsConvertExtIrq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ AcpiRsConvertAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ - AcpiRsConvertExtAddress64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ + AcpiRsConvertExtAddress64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ + AcpiRsConvertGpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ + NULL, /* 0x0D, Reserved */ + NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */ +}; + +/* Subtype table for SerialBus -- I2C, SPI, and UART */ + +ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[] = +{ + NULL, + AcpiRsConvertI2cSerialBus, + AcpiRsConvertSpiSerialBus, + AcpiRsConvertUartSerialBus, }; @@ -148,6 +164,17 @@ ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] = AcpiRsDumpExtAddress64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ AcpiRsDumpGenericReg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */ + AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ + NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ +}; + +ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] = +{ + NULL, + AcpiRsDumpI2cSerialBus, /* AML_RESOURCE_I2C_BUS_TYPE */ + AcpiRsDumpSpiSerialBus, /* AML_RESOURCE_SPI_BUS_TYPE */ + AcpiRsDumpUartSerialBus, /* AML_RESOURCE_UART_BUS_TYPE */ }; #endif @@ -175,7 +202,10 @@ const UINT8 AcpiGbl_AmlResourceSizes[] = sizeof (AML_RESOURCE_ADDRESS64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ sizeof (AML_RESOURCE_EXTENDED_IRQ), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - sizeof (AML_RESOURCE_GENERIC_REGISTER) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + sizeof (AML_RESOURCE_GENERIC_REGISTER), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */ + sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ + sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ }; @@ -193,7 +223,7 @@ const UINT8 AcpiGbl_ResourceStructSizes[] = ACPI_RS_SIZE_MIN, ACPI_RS_SIZE (ACPI_RESOURCE_IO), ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO), - 0, + ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA), 0, 0, 0, @@ -213,6 +243,23 @@ const UINT8 AcpiGbl_ResourceStructSizes[] = ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16), ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ), ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64), - ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64) + ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64), + ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), + ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS) +}; + +const UINT8 AcpiGbl_AmlResourceSerialBusSizes[] = +{ + 0, + sizeof (AML_RESOURCE_I2C_SERIALBUS), + sizeof (AML_RESOURCE_SPI_SERIALBUS), + sizeof (AML_RESOURCE_UART_SERIALBUS), }; +const UINT8 AcpiGbl_ResourceStructSerialBusSizes[] = +{ + 0, + ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS), + ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS), + ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS), +}; diff --git a/resources/rsirq.c b/resources/rsirq.c index ff952f96ffa2..ac86f3641884 100644 --- a/resources/rsirq.c +++ b/resources/rsirq.c @@ -274,3 +274,35 @@ ACPI_RSCONVERT_INFO AcpiRsConvertDma[6] = ACPI_RS_OFFSET (Data.Dma.ChannelCount)} }; + +/******************************************************************************* + * + * AcpiRsConvertFixedDma + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[4] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_DMA, + ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedDma)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_DMA, + sizeof (AML_RESOURCE_FIXED_DMA), + 0}, + + /* + * These fields are contiguous in both the source and destination: + * RequestLines + * Channels + */ + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedDma.RequestLines), + AML_OFFSET (FixedDma.RequestLines), + 2}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedDma.Width), + AML_OFFSET (FixedDma.Width), + 1}, + +}; diff --git a/resources/rslist.c b/resources/rslist.c index c64065f2ca8d..852d8999c570 100644 --- a/resources/rslist.c +++ b/resources/rslist.c @@ -77,6 +77,8 @@ AcpiRsConvertAmlToResources ( ACPI_RESOURCE **ResourcePtr = ACPI_CAST_INDIRECT_PTR ( ACPI_RESOURCE, Context); ACPI_RESOURCE *Resource; + AML_RESOURCE *AmlResource; + ACPI_RSCONVERT_INFO *ConversionTable; ACPI_STATUS Status; @@ -94,11 +96,42 @@ AcpiRsConvertAmlToResources ( "Misaligned resource pointer %p", Resource)); } - /* Convert the AML byte stream resource to a local resource struct */ + /* Get the appropriate conversion info table */ + + AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml); + if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) + { + if (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) + { + ConversionTable = NULL; + } + else + { + /* This is an I2C, SPI, or UART SerialBus descriptor */ + + ConversionTable = + AcpiGbl_ConvertResourceSerialBusDispatch[ + AmlResource->CommonSerialBus.Type]; + } + } + else + { + ConversionTable = + AcpiGbl_GetResourceDispatch[ResourceIndex]; + } + + if (!ConversionTable) + { + ACPI_ERROR ((AE_INFO, + "Invalid/unsupported resource descriptor: Type 0x%2.2X", + ResourceIndex)); + return (AE_AML_INVALID_RESOURCE_TYPE); + } + + /* Convert the AML byte stream resource to a local resource struct */ Status = AcpiRsConvertAmlToResource ( - Resource, ACPI_CAST_PTR (AML_RESOURCE, Aml), - AcpiGbl_GetResourceDispatch[ResourceIndex]); + Resource, AmlResource, ConversionTable); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -113,7 +146,7 @@ AcpiRsConvertAmlToResources ( /* Point to the next structure in the output buffer */ - *ResourcePtr = ACPI_ADD_PTR (void, Resource, Resource->Length); + *ResourcePtr = ACPI_NEXT_RESOURCE (Resource); return_ACPI_STATUS (AE_OK); } @@ -145,6 +178,7 @@ AcpiRsConvertResourcesToAml ( { UINT8 *Aml = OutputBuffer; UINT8 *EndAml = OutputBuffer + AmlSizeNeeded; + ACPI_RSCONVERT_INFO *ConversionTable; ACPI_STATUS Status; @@ -167,9 +201,36 @@ AcpiRsConvertResourcesToAml ( /* Perform the conversion */ + if (Resource->Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) + { + if (Resource->Data.CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) + { + ConversionTable = NULL; + } + else + { + /* This is an I2C, SPI, or UART SerialBus descriptor */ + + ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch[ + Resource->Data.CommonSerialBus.Type]; + } + } + else + { + ConversionTable = AcpiGbl_SetResourceDispatch[Resource->Type]; + } + + if (!ConversionTable) + { + ACPI_ERROR ((AE_INFO, + "Invalid/unsupported resource descriptor: Type 0x%2.2X", + Resource->Type)); + return (AE_AML_INVALID_RESOURCE_TYPE); + } + Status = AcpiRsConvertResourceToAml (Resource, - ACPI_CAST_PTR (AML_RESOURCE, Aml), - AcpiGbl_SetResourceDispatch[Resource->Type]); + ACPI_CAST_PTR (AML_RESOURCE, Aml), + ConversionTable); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -204,7 +265,7 @@ AcpiRsConvertResourcesToAml ( /* Point to the next input resource descriptor */ - Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length); + Resource = ACPI_NEXT_RESOURCE (Resource); } /* Completed buffer, but did not find an EndTag resource descriptor */ diff --git a/resources/rsmisc.c b/resources/rsmisc.c index 45415faacc2b..3cdd5f10add2 100644 --- a/resources/rsmisc.c +++ b/resources/rsmisc.c @@ -94,6 +94,11 @@ AcpiRsConvertAmlToResource ( ACPI_FUNCTION_TRACE (RsConvertAmlToResource); + if (!Info) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + if (((ACPI_SIZE) Resource) & 0x3) { /* Each internal resource struct is expected to be 32-bit aligned */ @@ -112,7 +117,6 @@ AcpiRsConvertAmlToResource ( * table length (# of table entries) */ Count = INIT_TABLE_LENGTH (Info); - while (Count) { /* @@ -162,6 +166,15 @@ AcpiRsConvertAmlToResource ( break; + case ACPI_RSC_3BITFLAG: + /* + * Mask and shift the flag bits + */ + ACPI_SET8 (Destination) = (UINT8) + ((ACPI_GET8 (Source) >> Info->Value) & 0x07); + break; + + case ACPI_RSC_COUNT: ItemCount = ACPI_GET8 (Source); @@ -182,6 +195,75 @@ AcpiRsConvertAmlToResource ( break; + case ACPI_RSC_COUNT_GPIO_PIN: + + Target = ACPI_ADD_PTR (void, Aml, Info->Value); + ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source); + + Resource->Length = Resource->Length + ItemCount; + ItemCount = ItemCount / 2; + ACPI_SET16 (Destination) = ItemCount; + break; + + + case ACPI_RSC_COUNT_GPIO_VEN: + + ItemCount = ACPI_GET8 (Source); + ACPI_SET8 (Destination) = (UINT8) ItemCount; + + Resource->Length = Resource->Length + + (Info->Value * ItemCount); + break; + + + case ACPI_RSC_COUNT_GPIO_RES: + + /* + * Vendor data is optional (length/offset may both be zero) + * Examine vendor data length field first + */ + Target = ACPI_ADD_PTR (void, Aml, (Info->Value + 2)); + if (ACPI_GET16 (Target)) + { + /* Use vendor offset to get resource source length */ + + Target = ACPI_ADD_PTR (void, Aml, Info->Value); + ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source); + } + else + { + /* No vendor data to worry about */ + + ItemCount = Aml->LargeHeader.ResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER) - + ACPI_GET16 (Source); + } + + Resource->Length = Resource->Length + ItemCount; + ACPI_SET16 (Destination) = ItemCount; + break; + + + case ACPI_RSC_COUNT_SERIAL_VEN: + + ItemCount = ACPI_GET16 (Source) - Info->Value; + + Resource->Length = Resource->Length + ItemCount; + ACPI_SET16 (Destination) = ItemCount; + break; + + + case ACPI_RSC_COUNT_SERIAL_RES: + + ItemCount = (AmlResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER)) - + ACPI_GET16 (Source) - Info->Value; + + Resource->Length = Resource->Length + ItemCount; + ACPI_SET16 (Destination) = ItemCount; + break; + + case ACPI_RSC_LENGTH: Resource->Length = Resource->Length + Info->Value; @@ -204,6 +286,66 @@ AcpiRsConvertAmlToResource ( break; + case ACPI_RSC_MOVE_GPIO_PIN: + + /* Generate and set the PIN data pointer */ + + Target = (char *) ACPI_ADD_PTR (void, Resource, + (Resource->Length - ItemCount * 2)); + *(UINT16 **) Destination = ACPI_CAST_PTR (UINT16, Target); + + /* Copy the PIN data */ + + Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source)); + AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); + break; + + + case ACPI_RSC_MOVE_GPIO_RES: + + /* Generate and set the ResourceSource string pointer */ + + Target = (char *) ACPI_ADD_PTR (void, Resource, + (Resource->Length - ItemCount)); + *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); + + /* Copy the ResourceSource string */ + + Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source)); + AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); + break; + + + case ACPI_RSC_MOVE_SERIAL_VEN: + + /* Generate and set the Vendor Data pointer */ + + Target = (char *) ACPI_ADD_PTR (void, Resource, + (Resource->Length - ItemCount)); + *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); + + /* Copy the Vendor Data */ + + Source = ACPI_ADD_PTR (void, Aml, Info->Value); + AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); + break; + + + case ACPI_RSC_MOVE_SERIAL_RES: + + /* Generate and set the ResourceSource string pointer */ + + Target = (char *) ACPI_ADD_PTR (void, Resource, + (Resource->Length - ItemCount)); + *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); + + /* Copy the ResourceSource string */ + + Source = ACPI_ADD_PTR (void, Aml, (ACPI_GET16 (Source) + Info->Value)); + AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); + break; + + case ACPI_RSC_SET8: ACPI_MEMSET (Destination, Info->AmlOffset, Info->Value); @@ -243,11 +385,12 @@ AcpiRsConvertAmlToResource ( * Optional ResourceSource (Index and String). This is the more * complicated case used by the Interrupt() macro */ - Target = ACPI_ADD_PTR (char, Resource, Info->AmlOffset + (ItemCount * 4)); + Target = ACPI_ADD_PTR (char, Resource, + Info->AmlOffset + (ItemCount * 4)); Resource->Length += - AcpiRsGetResourceSource (AmlResourceLength, - (ACPI_RS_LENGTH) (((ItemCount - 1) * sizeof (UINT32)) + Info->Value), + AcpiRsGetResourceSource (AmlResourceLength, (ACPI_RS_LENGTH) + (((ItemCount - 1) * sizeof (UINT32)) + Info->Value), Destination, Aml, Target); break; @@ -356,6 +499,7 @@ AcpiRsConvertResourceToAml ( { void *Source = NULL; void *Destination; + char *Target; ACPI_RSDESC_SIZE AmlLength = 0; UINT8 Count; UINT16 Temp16 = 0; @@ -365,6 +509,11 @@ AcpiRsConvertResourceToAml ( ACPI_FUNCTION_TRACE (RsConvertResourceToAml); + if (!Info) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + /* * First table entry must be ACPI_RSC_INITxxx and must contain the * table length (# of table entries) @@ -420,6 +569,15 @@ AcpiRsConvertResourceToAml ( break; + case ACPI_RSC_3BITFLAG: + /* + * Mask and shift the flag bits + */ + ACPI_SET8 (Destination) |= (UINT8) + ((ACPI_GET8 (Source) & 0x07) << Info->Value); + break; + + case ACPI_RSC_COUNT: ItemCount = ACPI_GET8 (Source); @@ -437,6 +595,68 @@ AcpiRsConvertResourceToAml ( break; + case ACPI_RSC_COUNT_GPIO_PIN: + + ItemCount = ACPI_GET16 (Source); + ACPI_SET16 (Destination) = (UINT16) AmlLength; + + AmlLength = (UINT16) (AmlLength + ItemCount * 2); + Target = ACPI_ADD_PTR (void, Aml, Info->Value); + ACPI_SET16 (Target) = (UINT16) AmlLength; + AcpiRsSetResourceLength (AmlLength, Aml); + break; + + + case ACPI_RSC_COUNT_GPIO_VEN: + + ItemCount = ACPI_GET16 (Source); + ACPI_SET16 (Destination) = (UINT16) ItemCount; + + AmlLength = (UINT16) (AmlLength + (Info->Value * ItemCount)); + AcpiRsSetResourceLength (AmlLength, Aml); + break; + + + case ACPI_RSC_COUNT_GPIO_RES: + + /* Set resource source string length */ + + ItemCount = ACPI_GET16 (Source); + ACPI_SET16 (Destination) = (UINT16) AmlLength; + + /* Compute offset for the Vendor Data */ + + AmlLength = (UINT16) (AmlLength + ItemCount); + Target = ACPI_ADD_PTR (void, Aml, Info->Value); + + /* Set vendor offset only if there is vendor data */ + + if (Resource->Data.Gpio.VendorLength) + { + ACPI_SET16 (Target) = (UINT16) AmlLength; + } + + AcpiRsSetResourceLength (AmlLength, Aml); + break; + + + case ACPI_RSC_COUNT_SERIAL_VEN: + + ItemCount = ACPI_GET16 (Source); + ACPI_SET16 (Destination) = ItemCount + Info->Value; + AmlLength = (UINT16) (AmlLength + ItemCount); + AcpiRsSetResourceLength (AmlLength, Aml); + break; + + + case ACPI_RSC_COUNT_SERIAL_RES: + + ItemCount = ACPI_GET16 (Source); + AmlLength = (UINT16) (AmlLength + ItemCount); + AcpiRsSetResourceLength (AmlLength, Aml); + break; + + case ACPI_RSC_LENGTH: AcpiRsSetResourceLength (Info->Value, Aml); @@ -456,6 +676,44 @@ AcpiRsConvertResourceToAml ( break; + case ACPI_RSC_MOVE_GPIO_PIN: + + Destination = (char *) ACPI_ADD_PTR (void, Aml, + ACPI_GET16 (Destination)); + Source = * (UINT16 **) Source; + AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); + break; + + + case ACPI_RSC_MOVE_GPIO_RES: + + /* Used for both ResourceSource string and VendorData */ + + Destination = (char *) ACPI_ADD_PTR (void, Aml, + ACPI_GET16 (Destination)); + Source = * (UINT8 **) Source; + AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); + break; + + + case ACPI_RSC_MOVE_SERIAL_VEN: + + Destination = (char *) ACPI_ADD_PTR (void, Aml, + (AmlLength - ItemCount)); + Source = * (UINT8 **) Source; + AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); + break; + + + case ACPI_RSC_MOVE_SERIAL_RES: + + Destination = (char *) ACPI_ADD_PTR (void, Aml, + (AmlLength - ItemCount)); + Source = * (UINT8 **) Source; + AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); + break; + + case ACPI_RSC_ADDRESS: /* Set the Resource Type, General Flags, and Type-Specific Flags */ diff --git a/resources/rsserial.c b/resources/rsserial.c new file mode 100644 index 000000000000..d34af6c03868 --- /dev/null +++ b/resources/rsserial.c @@ -0,0 +1,425 @@ +/******************************************************************************* + * + * Module Name: rsserial - GPIO/SerialBus resource descriptors + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#define __RSIRQ_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" + +#define _COMPONENT ACPI_RESOURCES + ACPI_MODULE_NAME ("rsserial") + + +/******************************************************************************* + * + * AcpiRsConvertGpio + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertGpio[17] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO, + ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertGpio)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO, + sizeof (AML_RESOURCE_GPIO), + 0}, + + /* + * These fields are contiguous in both the source and destination: + * RevisionId + * ConnectionType + */ + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.RevisionId), + AML_OFFSET (Gpio.RevisionId), + 2}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.ProducerConsumer), + AML_OFFSET (Gpio.Flags), + 0}, + + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Sharable), + AML_OFFSET (Gpio.IntFlags), + 3}, + + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.IoRestriction), + AML_OFFSET (Gpio.IntFlags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Triggering), + AML_OFFSET (Gpio.IntFlags), + 0}, + + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Polarity), + AML_OFFSET (Gpio.IntFlags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.PinConfig), + AML_OFFSET (Gpio.PinConfig), + 1}, + + /* + * These fields are contiguous in both the source and destination: + * DriveStrength + * DebounceTimeout + */ + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Gpio.DriveStrength), + AML_OFFSET (Gpio.DriveStrength), + 2}, + + /* Pin Table */ + + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.Gpio.PinTableLength), + AML_OFFSET (Gpio.PinTableOffset), + AML_OFFSET (Gpio.ResSourceOffset)}, + + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.Gpio.PinTable), + AML_OFFSET (Gpio.PinTableOffset), + 0}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.Index), + AML_OFFSET (Gpio.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.StringLength), + AML_OFFSET (Gpio.ResSourceOffset), + AML_OFFSET (Gpio.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.StringPtr), + AML_OFFSET (Gpio.ResSourceOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.Gpio.VendorLength), + AML_OFFSET (Gpio.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.VendorData), + AML_OFFSET (Gpio.VendorOffset), + 0}, +}; + + +/******************************************************************************* + * + * AcpiRsConvertI2cSerialBus + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[16] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, + ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertI2cSerialBus)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, + sizeof (AML_RESOURCE_I2C_SERIALBUS), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId), + AML_OFFSET (CommonSerialBus.RevisionId), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type), + AML_OFFSET (CommonSerialBus.Type), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode), + AML_OFFSET (CommonSerialBus.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer), + AML_OFFSET (CommonSerialBus.Flags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), + AML_OFFSET (CommonSerialBus.TypeRevisionId), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + 1}, + + /* Vendor data */ + + {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + AML_RESOURCE_I2C_MIN_DATA_LEN}, + + {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData), + 0, + sizeof (AML_RESOURCE_I2C_SERIALBUS)}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index), + AML_OFFSET (CommonSerialBus.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, + + {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr), + AML_OFFSET (CommonSerialBus.TypeDataLength), + sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, + + /* I2C bus type specific */ + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.I2cSerialBus.AccessMode), + AML_OFFSET (I2cSerialBus.TypeSpecificFlags), + 0}, + + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.I2cSerialBus.ConnectionSpeed), + AML_OFFSET (I2cSerialBus.ConnectionSpeed), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.I2cSerialBus.SlaveAddress), + AML_OFFSET (I2cSerialBus.SlaveAddress), + 1}, +}; + + +/******************************************************************************* + * + * AcpiRsConvertSpiSerialBus + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[20] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, + ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertSpiSerialBus)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, + sizeof (AML_RESOURCE_SPI_SERIALBUS), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId), + AML_OFFSET (CommonSerialBus.RevisionId), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type), + AML_OFFSET (CommonSerialBus.Type), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode), + AML_OFFSET (CommonSerialBus.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer), + AML_OFFSET (CommonSerialBus.Flags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), + AML_OFFSET (CommonSerialBus.TypeRevisionId), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + 1}, + + /* Vendor data */ + + {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + AML_RESOURCE_SPI_MIN_DATA_LEN}, + + {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData), + 0, + sizeof (AML_RESOURCE_SPI_SERIALBUS)}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index), + AML_OFFSET (CommonSerialBus.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, + + {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr), + AML_OFFSET (CommonSerialBus.TypeDataLength), + sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, + + /* Spi bus type specific */ + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.SpiSerialBus.WireMode), + AML_OFFSET (SpiSerialBus.TypeSpecificFlags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.SpiSerialBus.DevicePolarity), + AML_OFFSET (SpiSerialBus.TypeSpecificFlags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.DataBitLength), + AML_OFFSET (SpiSerialBus.DataBitLength), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.ClockPhase), + AML_OFFSET (SpiSerialBus.ClockPhase), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.ClockPolarity), + AML_OFFSET (SpiSerialBus.ClockPolarity), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.SpiSerialBus.DeviceSelection), + AML_OFFSET (SpiSerialBus.DeviceSelection), + 1}, + + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.SpiSerialBus.ConnectionSpeed), + AML_OFFSET (SpiSerialBus.ConnectionSpeed), + 1}, +}; + + +/******************************************************************************* + * + * AcpiRsConvertUartSerialBus + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[22] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, + ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertUartSerialBus)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, + sizeof (AML_RESOURCE_UART_SERIALBUS), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId), + AML_OFFSET (CommonSerialBus.RevisionId), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type), + AML_OFFSET (CommonSerialBus.Type), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode), + AML_OFFSET (CommonSerialBus.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer), + AML_OFFSET (CommonSerialBus.Flags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId), + AML_OFFSET (CommonSerialBus.TypeRevisionId), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + 1}, + + /* Vendor data */ + + {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + AML_RESOURCE_UART_MIN_DATA_LEN}, + + {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData), + 0, + sizeof (AML_RESOURCE_UART_SERIALBUS)}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index), + AML_OFFSET (CommonSerialBus.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength), + AML_OFFSET (CommonSerialBus.TypeDataLength), + sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, + + {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr), + AML_OFFSET (CommonSerialBus.TypeDataLength), + sizeof (AML_RESOURCE_COMMON_SERIALBUS)}, + + /* Uart bus type specific */ + + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.FlowControl), + AML_OFFSET (UartSerialBus.TypeSpecificFlags), + 0}, + + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.StopBits), + AML_OFFSET (UartSerialBus.TypeSpecificFlags), + 2}, + + {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.DataBits), + AML_OFFSET (UartSerialBus.TypeSpecificFlags), + 4}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.Endian), + AML_OFFSET (UartSerialBus.TypeSpecificFlags), + 7}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.UartSerialBus.Parity), + AML_OFFSET (UartSerialBus.Parity), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.UartSerialBus.LinesEnabled), + AML_OFFSET (UartSerialBus.LinesEnabled), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.UartSerialBus.RxFifoSize), + AML_OFFSET (UartSerialBus.RxFifoSize), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.UartSerialBus.TxFifoSize), + AML_OFFSET (UartSerialBus.TxFifoSize), + 1}, + + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.UartSerialBus.DefaultBaudRate), + AML_OFFSET (UartSerialBus.DefaultBaudRate), + 1}, +}; diff --git a/resources/rsutils.c b/resources/rsutils.c index 400bbcd91f1b..6031c14f80ce 100644 --- a/resources/rsutils.c +++ b/resources/rsutils.c @@ -173,6 +173,9 @@ AcpiRsMoveData ( * since there are no alignment or endian issues */ case ACPI_RSC_MOVE8: + case ACPI_RSC_MOVE_GPIO_RES: + case ACPI_RSC_MOVE_SERIAL_VEN: + case ACPI_RSC_MOVE_SERIAL_RES: ACPI_MEMCPY (Destination, Source, ItemCount); return; @@ -182,6 +185,7 @@ AcpiRsMoveData ( * misaligned memory transfers */ case ACPI_RSC_MOVE16: + case ACPI_RSC_MOVE_GPIO_PIN: ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i], &ACPI_CAST_PTR (UINT16, Source)[i]); break; @@ -653,6 +657,61 @@ AcpiRsGetPrsMethodData ( /******************************************************************************* * + * FUNCTION: AcpiRsGetAeiMethodData + * + * PARAMETERS: Node - Device node + * RetBuffer - Pointer to a buffer structure for the + * results + * + * RETURN: Status + * + * DESCRIPTION: This function is called to get the _AEI value of an object + * contained in an object specified by the handle passed in + * + * If the function fails an appropriate status will be returned + * and the contents of the callers buffer is undefined. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRsGetAeiMethodData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_BUFFER *RetBuffer) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (RsGetAeiMethodData); + + + /* Parameters guaranteed valid by caller */ + + /* Execute the method, no parameters */ + + Status = AcpiUtEvaluateObject (Node, METHOD_NAME__AEI, + ACPI_BTYPE_BUFFER, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Make the call to create a resource linked list from the + * byte stream buffer that comes back from the _CRS method + * execution. + */ + Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); + + /* On exit, we must delete the object returned by evaluateObject */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiRsGetMethodData * * PARAMETERS: Handle - Handle to the containing object diff --git a/resources/rsxface.c b/resources/rsxface.c index 0aea206b73eb..ade4525e1ca7 100644 --- a/resources/rsxface.c +++ b/resources/rsxface.c @@ -351,6 +351,52 @@ AcpiSetCurrentResources ( ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources) +/******************************************************************************* + * + * FUNCTION: AcpiGetEventResources + * + * PARAMETERS: DeviceHandle - Handle to the device object for the + * device we are getting resources + * InBuffer - Pointer to a buffer containing the + * resources to be set for the device + * + * RETURN: Status + * + * DESCRIPTION: This function is called to get the event resources for a + * specific device. The caller must first acquire a handle for + * the desired device. The resource data is passed to the routine + * the buffer pointed to by the InBuffer variable. Uses the + * _AEI method. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetEventResources ( + ACPI_HANDLE DeviceHandle, + ACPI_BUFFER *RetBuffer) +{ + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + + + ACPI_FUNCTION_TRACE (AcpiGetEventResources); + + + /* Validate parameters then dispatch to internal routine */ + + Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiRsGetAeiMethodData (Node, RetBuffer); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGetEventResources) + + /****************************************************************************** * * FUNCTION: AcpiResourceToAddress64 @@ -544,8 +590,9 @@ AcpiRsMatchVendorResource ( * * PARAMETERS: DeviceHandle - Handle to the device object for the * device we are querying - * Name - Method name of the resources we want - * (METHOD_NAME__CRS or METHOD_NAME__PRS) + * Name - Method name of the resources we want. + * (METHOD_NAME__CRS, METHOD_NAME__PRS, or + * METHOD_NAME__AEI) * UserFunction - Called for each resource * Context - Passed to UserFunction * @@ -577,12 +624,13 @@ AcpiWalkResources ( if (!DeviceHandle || !UserFunction || !Name || (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) && - !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS))) + !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS) && + !ACPI_COMPARE_NAME (Name, METHOD_NAME__AEI))) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get the _CRS or _PRS resource list */ + /* Get the _CRS/_PRS/_AEI resource list */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer); diff --git a/tables/tbfadt.c b/tables/tbfadt.c index f8c63408b9f5..90d670b68210 100644 --- a/tables/tbfadt.c +++ b/tables/tbfadt.c @@ -280,8 +280,13 @@ AcpiTbParseFadt ( AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); - AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + /* If Hardware Reduced flag is set, there is no FACS */ + + if (!AcpiGbl_ReducedHardware) + { + AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, + ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + } } @@ -309,13 +314,13 @@ AcpiTbCreateLocalFadt ( /* * Check if the FADT is larger than the largest table that we expect - * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue + * (the ACPI 5.0 version). If so, truncate the table, and issue * a warning. */ if (Length > sizeof (ACPI_TABLE_FADT)) { ACPI_WARNING ((AE_INFO, - "FADT (revision %u) is longer than ACPI 2.0 version, " + "FADT (revision %u) is longer than ACPI 5.0 version, " "truncating length %u to %u", Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT))); } @@ -329,6 +334,14 @@ AcpiTbCreateLocalFadt ( ACPI_MEMCPY (&AcpiGbl_FADT, Table, ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); + /* Take a copy of the Hardware Reduced flag */ + + AcpiGbl_ReducedHardware = FALSE; + if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED) + { + AcpiGbl_ReducedHardware = TRUE; + } + /* Convert the local copy of the FADT to the common internal format */ AcpiTbConvertFadt (); @@ -530,6 +543,13 @@ AcpiTbValidateFadt ( AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; } + /* If Hardware Reduced flag is set, we are all done */ + + if (AcpiGbl_ReducedHardware) + { + return; + } + /* Examine all of the 64-bit extended address fields (X fields) */ for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) diff --git a/tables/tbutils.c b/tables/tbutils.c index bff6540e07a1..e2259f1341a3 100644 --- a/tables/tbutils.c +++ b/tables/tbutils.c @@ -88,6 +88,14 @@ AcpiTbInitializeFacs ( ACPI_STATUS Status; + /* If Hardware Reduced flag is set, there is no FACS */ + + if (AcpiGbl_ReducedHardware) + { + AcpiGbl_FACS = NULL; + return (AE_OK); + } + Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS)); return (Status); diff --git a/tests/misc/badcode.asl b/tests/misc/badcode.asl index 4e90eac312d4..0363c64226f5 100644 --- a/tests/misc/badcode.asl +++ b/tests/misc/badcode.asl @@ -9,6 +9,10 @@ * * To compile, use: * iasl badcode.asl + * + * Output: + * Compilation complete. 45 Errors, 22 Warnings, 3 Remarks, 16 Optimizations + * */ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) { @@ -117,10 +121,10 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) } // Method MTH4 does not explicitly return a value - - Method (MTH4) {Return} + + Method (MTH4) {} Method (MTH5) {Store (MTH4(), Local0)} - + // Invalid _HID values Device (H1) @@ -363,5 +367,34 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) EndDependentFn () }) + + // Test descriptor for CreateXxxxField operators in REM1 below + + Name (RSC3, ResourceTemplate () + { + DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, + 0x00000000, // Granularity + 0x000C8000, // Range Minimum + 0x000C8FFF, // Range Maximum + 0x00000000, // Translation Offset + 0x00001000, // Length + ,, DWI1) + }) + + Method (REM1) + { + // Tagged resource field larger than field being created + + CreateWordField (RSC3, \DWI1._LEN, LEN) + CreateByteField (RSC3, \DWI1._MIN, MIN) + CreateBitField (RSC3, \DWI1._RNG, RNG1) + + // Tagged resource field smaller than field being created + + CreateQWordField (RSC3, \DWI1._MAX, MAX) + CreateBitField (RSC3, \DWI1._GRA, GRA) + CreateField (RSC3, \DWI1._MIF, 5, MIF) + CreateField (RSC3, \DWI1._RNG, 3, RNG2) + } } diff --git a/tools/acpiexec/Makefile b/tools/acpiexec/Makefile index ba6b5340fb82..8d6c9c1ea49a 100644 --- a/tools/acpiexec/Makefile +++ b/tools/acpiexec/Makefile @@ -94,6 +94,7 @@ OBJECTS = \ dmopcode.o \ dmresrc.o \ dmresrcl.o \ + dmresrcl2.o \ dmresrcs.o \ dmutils.o \ dmwalk.o \ @@ -195,6 +196,7 @@ OBJECTS = \ rsirq.o \ rslist.o \ rsmemory.o \ + rsserial.o \ rsmisc.o \ rsutils.o \ rsxface.o \ @@ -224,7 +226,8 @@ OBJECTS = \ uttrack.o \ utosi.o \ utxferror.o \ - utxface.o + utxface.o \ + utxfmutex.o CFLAGS+= \ -D$(HOST) \ diff --git a/tools/acpiexec/aecommon.h b/tools/acpiexec/aecommon.h index 0baee381232a..3a18ea46853e 100644 --- a/tools/acpiexec/aecommon.h +++ b/tools/acpiexec/aecommon.h @@ -66,6 +66,8 @@ extern FILE *AcpiGbl_DebugFile; extern BOOLEAN AcpiGbl_IgnoreErrors; extern UINT8 AcpiGbl_RegionFillValue; +extern UINT8 AcpiGbl_UseHwReducedFadt; +extern BOOLEAN AcpiGbl_DisplayRegionAccess; /* Check for unexpected exceptions */ diff --git a/tools/acpiexec/aeexec.c b/tools/acpiexec/aeexec.c index 02a23f52064d..63f408a0e9d1 100644 --- a/tools/acpiexec/aeexec.c +++ b/tools/acpiexec/aeexec.c @@ -77,6 +77,10 @@ ExecuteOSI ( UINT32 ExpectedResult); static void +AeMutexInterfaces ( + void); + +static void AeHardwareInterfaces ( void); @@ -405,6 +409,52 @@ AeGenericRegisters ( /****************************************************************************** * + * FUNCTION: AeMutexInterfaces + * + * DESCRIPTION: Exercise the AML mutex access interfaces + * + *****************************************************************************/ + +static void +AeMutexInterfaces ( + void) +{ + ACPI_STATUS Status; + ACPI_HANDLE MutexHandle; + + + /* Get a handle to an AML mutex */ + + Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle); + if (Status == AE_NOT_FOUND) + { + return; + } + + AE_CHECK_OK (AcpiGetHandle, Status); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Acquire the mutex */ + + Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF); + AE_CHECK_OK (AcpiAcquireMutex, Status); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Release mutex with different parameters */ + + Status = AcpiReleaseMutex (MutexHandle, NULL); + AE_CHECK_OK (AcpiReleaseMutex, Status); +} + + +/****************************************************************************** + * * FUNCTION: AeHardwareInterfaces * * DESCRIPTION: Call various hardware support interfaces @@ -419,6 +469,13 @@ AeHardwareInterfaces ( UINT32 Value; + /* If Hardware Reduced flag is set, we are all done */ + + if (AcpiGbl_ReducedHardware) + { + return; + } + Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1); AE_CHECK_OK (AcpiWriteBitRegister, Status); @@ -474,7 +531,7 @@ AeMiscellaneousTests ( AeTestBufferArgument(); AeTestPackageArgument (); - + AeMutexInterfaces (); Status = AcpiInstallInterface (""); AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER); @@ -511,12 +568,27 @@ AeMiscellaneousTests ( Status = AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf); AE_CHECK_OK (AcpiGetName, Status); - Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0); - AE_CHECK_OK (AcpiEnableEvent, Status); - Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL); AE_CHECK_OK (AcpiInstallGlobalEventHandler, Status); + /* Get Devices */ + + Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL); + AE_CHECK_OK (AcpiGetDevices, Status); + + Status = AcpiGetStatistics (&Stats); + AE_CHECK_OK (AcpiGetStatistics, Status); + + /* If Hardware Reduced flag is set, we are all done */ + + if (AcpiGbl_ReducedHardware) + { + return; + } + + Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0); + AE_CHECK_OK (AcpiEnableEvent, Status); + /* * GPEs: Handlers, enable/disable, etc. */ @@ -629,12 +701,5 @@ AeMiscellaneousTests ( Status = AcpiReleaseGlobalLock (LockHandle2); AE_CHECK_OK (AcpiReleaseGlobalLock, Status); - /* Get Devices */ - - Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL); - AE_CHECK_OK (AcpiGetDevices, Status); - - Status = AcpiGetStatistics (&Stats); - AE_CHECK_OK (AcpiGetStatistics, Status); } diff --git a/tools/acpiexec/aehandlers.c b/tools/acpiexec/aehandlers.c index 701804e78a0b..bbd506d37d88 100644 --- a/tools/acpiexec/aehandlers.c +++ b/tools/acpiexec/aehandlers.c @@ -97,6 +97,7 @@ AeEventHandler ( static UINT32 SigintCount = 0; static AE_DEBUG_REGIONS AeRegions; +BOOLEAN AcpiGbl_DisplayRegionAccess = FALSE; /* @@ -108,27 +109,35 @@ static AE_DEBUG_REGIONS AeRegions; * declares that they must "always be available". Cannot override the * DataTable region handler either -- needed for test execution. */ -static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] = { +static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] = +{ ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_ADR_SPACE_SYSTEM_IO }; /* - * We will install handlers for some of the various address space IDs + * We will install handlers for some of the various address space IDs. * Test one user-defined address space (used by aslts.) */ -#define ACPI_ADR_SPACE_USER_DEFINED 0x80 +#define ACPI_ADR_SPACE_USER_DEFINED1 0x80 +#define ACPI_ADR_SPACE_USER_DEFINED2 0xE4 -static ACPI_ADR_SPACE_TYPE SpaceIdList[] = { +static ACPI_ADR_SPACE_TYPE SpaceIdList[] = +{ ACPI_ADR_SPACE_EC, ACPI_ADR_SPACE_SMBUS, + ACPI_ADR_SPACE_GSBUS, + ACPI_ADR_SPACE_GPIO, ACPI_ADR_SPACE_PCI_BAR_TARGET, ACPI_ADR_SPACE_IPMI, ACPI_ADR_SPACE_FIXED_HARDWARE, - ACPI_ADR_SPACE_USER_DEFINED + ACPI_ADR_SPACE_USER_DEFINED1, + ACPI_ADR_SPACE_USER_DEFINED2 }; +static ACPI_CONNECTION_INFO AeMyContext; + /****************************************************************************** * * FUNCTION: AeCtrlCHandler @@ -581,13 +590,19 @@ AeInstallLateHandlers ( UINT32 i; - /* Install some fixed event handlers */ + if (!AcpiGbl_ReducedHardware) + { + /* Install some fixed event handlers */ + + Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL); + AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL); - AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); + Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL); + AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); + } - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL); - AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); + AeMyContext.Connection = NULL; + AeMyContext.AccessLength = 0xA5; /* * Install handlers for some of the "device driver" address spaces @@ -598,7 +613,8 @@ AeInstallLateHandlers ( /* Install handler at the root object */ Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, - SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL); + SpaceIdList[i], AeRegionHandler, + AeRegionInit, &AeMyContext); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -738,7 +754,7 @@ AeInstallEarlyHandlers ( Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, DefaultSpaceIdList[i], AeRegionHandler, - AeRegionInit, NULL); + AeRegionInit, &AeMyContext); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -793,6 +809,10 @@ AeRegionHandler ( UINT32 ByteWidth; UINT32 i; UINT8 SpaceId; + ACPI_CONNECTION_INFO *MyContext; + UINT32 Value1; + UINT32 Value2; + ACPI_RESOURCE *Resource; ACPI_FUNCTION_NAME (AeRegionHandler); @@ -805,6 +825,28 @@ AeRegionHandler ( return (AE_OK); } + /* Check that we actually got back our context parameter */ + + if (HandlerContext != &AeMyContext) + { + printf ("Region handler received incorrect context %p, should be %p\n", + HandlerContext, &AeMyContext); + } + + MyContext = ACPI_CAST_PTR (ACPI_CONNECTION_INFO, HandlerContext); + + /* + * Find the region's address space and length before searching + * the linked list. + */ + BaseAddress = RegionObject->Region.Address; + Length = (ACPI_SIZE) RegionObject->Region.Length; + SpaceId = RegionObject->Region.SpaceId; + + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Operation Region request on %s at 0x%X\n", + AcpiUtGetRegionName (RegionObject->Region.SpaceId), + (UINT32) Address)); + /* * Region support can be disabled with the -r option. * We use this to support dynamically loaded tables where we pass a valid @@ -822,34 +864,52 @@ AeRegionHandler ( goto DoFunction; } - /* - * Find the region's address space and length before searching - * the linked list. - */ - BaseAddress = RegionObject->Region.Address; - Length = (ACPI_SIZE) RegionObject->Region.Length; - SpaceId = RegionObject->Region.SpaceId; - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Operation Region request on %s at 0x%X\n", - AcpiUtGetRegionName (RegionObject->Region.SpaceId), - (UINT32) Address)); - switch (SpaceId) { case ACPI_ADR_SPACE_SYSTEM_IO: /* * For I/O space, exercise the port validation + * Note: ReadPort currently always returns all ones, length=BitLength */ switch (Function & ACPI_IO_MASK) { case ACPI_READ: - Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth); - AE_CHECK_OK (AcpiHwReadPort, Status); + + if (BitWidth == 64) + { + /* Split the 64-bit request into two 32-bit requests */ + + Status = AcpiHwReadPort (Address, &Value1, 32); + AE_CHECK_OK (AcpiHwReadPort, Status); + Status = AcpiHwReadPort (Address+4, &Value2, 32); + AE_CHECK_OK (AcpiHwReadPort, Status); + + *Value = Value1 | ((UINT64) Value2 << 32); + } + else + { + Status = AcpiHwReadPort (Address, &Value1, BitWidth); + AE_CHECK_OK (AcpiHwReadPort, Status); + *Value = (UINT64) Value1; + } break; case ACPI_WRITE: - Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth); - AE_CHECK_OK (AcpiHwWritePort, Status); + + if (BitWidth == 64) + { + /* Split the 64-bit request into two 32-bit requests */ + + Status = AcpiHwWritePort (Address, ACPI_LODWORD (*Value), 32); + AE_CHECK_OK (AcpiHwWritePort, Status); + Status = AcpiHwWritePort (Address+4, ACPI_HIDWORD (*Value), 32); + AE_CHECK_OK (AcpiHwWritePort, Status); + } + else + { + Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth); + AE_CHECK_OK (AcpiHwWritePort, Status); + } break; default: @@ -865,8 +925,12 @@ AeRegionHandler ( /* Now go ahead and simulate the hardware */ break; - + /* + * SMBus and GenericSerialBus support the various bidirectional + * protocols. + */ case ACPI_ADR_SPACE_SMBUS: + case ACPI_ADR_SPACE_GSBUS: /* ACPI 5.0 */ Length = 0; @@ -875,22 +939,31 @@ AeRegionHandler ( case ACPI_READ: switch (Function >> 16) { - case AML_FIELD_ATTRIB_SMB_QUICK: - case AML_FIELD_ATTRIB_SMB_SEND_RCV: - case AML_FIELD_ATTRIB_SMB_BYTE: + case AML_FIELD_ATTRIB_QUICK: + case AML_FIELD_ATTRIB_SEND_RCV: + case AML_FIELD_ATTRIB_BYTE: Length = 1; break; - case AML_FIELD_ATTRIB_SMB_WORD: - case AML_FIELD_ATTRIB_SMB_WORD_CALL: + case AML_FIELD_ATTRIB_WORD: + case AML_FIELD_ATTRIB_WORD_CALL: Length = 2; break; - case AML_FIELD_ATTRIB_SMB_BLOCK: - case AML_FIELD_ATTRIB_SMB_BLOCK_CALL: + case AML_FIELD_ATTRIB_BLOCK: + case AML_FIELD_ATTRIB_BLOCK_CALL: Length = 32; break; + + case AML_FIELD_ATTRIB_MULTIBYTE: + case AML_FIELD_ATTRIB_RAW_BYTES: + case AML_FIELD_ATTRIB_RAW_PROCESS: + + /* (-2) for status/length */ + Length = MyContext->AccessLength - 2; + break; + default: break; } @@ -899,22 +972,30 @@ AeRegionHandler ( case ACPI_WRITE: switch (Function >> 16) { - case AML_FIELD_ATTRIB_SMB_QUICK: - case AML_FIELD_ATTRIB_SMB_SEND_RCV: - case AML_FIELD_ATTRIB_SMB_BYTE: - case AML_FIELD_ATTRIB_SMB_WORD: - case AML_FIELD_ATTRIB_SMB_BLOCK: + case AML_FIELD_ATTRIB_QUICK: + case AML_FIELD_ATTRIB_SEND_RCV: + case AML_FIELD_ATTRIB_BYTE: + case AML_FIELD_ATTRIB_WORD: + case AML_FIELD_ATTRIB_BLOCK: Length = 0; break; - case AML_FIELD_ATTRIB_SMB_WORD_CALL: + case AML_FIELD_ATTRIB_WORD_CALL: Length = 2; break; - case AML_FIELD_ATTRIB_SMB_BLOCK_CALL: + case AML_FIELD_ATTRIB_BLOCK_CALL: Length = 32; break; + case AML_FIELD_ATTRIB_MULTIBYTE: + case AML_FIELD_ATTRIB_RAW_BYTES: + case AML_FIELD_ATTRIB_RAW_PROCESS: + + /* (-2) for status/length */ + Length = MyContext->AccessLength - 2; + break; + default: break; } @@ -924,6 +1005,31 @@ AeRegionHandler ( break; } + if (AcpiGbl_DisplayRegionAccess) + { + AcpiOsPrintf ("AcpiExec: %s " + "%s: Attr %X Addr %.4X BaseAddr %.4X Len %.2X Width %X BufLen %X", + AcpiUtGetRegionName (SpaceId), + (Function & ACPI_IO_MASK) ? "Write" : "Read ", + (UINT32) (Function >> 16), + (UINT32) Address, (UINT32) BaseAddress, + Length, BitWidth, Buffer[1]); + + /* GenericSerialBus has a Connection() parameter */ + + if (SpaceId == ACPI_ADR_SPACE_GSBUS) + { + Status = AcpiBufferToResource (MyContext->Connection, + MyContext->Length, &Resource); + + AcpiOsPrintf (" [AccLen %.2X Conn %p]", + MyContext->AccessLength, MyContext->Connection); + } + AcpiOsPrintf ("\n"); + } + + /* Setup the return buffer. Note: ASLTS depends on these fill values */ + for (i = 0; i < Length; i++) { Buffer[i+2] = (UINT8) (0xA0 + i); @@ -936,10 +1042,14 @@ AeRegionHandler ( case ACPI_ADR_SPACE_IPMI: /* ACPI 4.0 */ - AcpiOsPrintf ("AcpiExec: Received IPMI request: " - "Address %X BaseAddress %X Length %X Width %X BufferLength %u\n", - (UINT32) Address, (UINT32) BaseAddress, - Length, BitWidth, Buffer[1]); + if (AcpiGbl_DisplayRegionAccess) + { + AcpiOsPrintf ("AcpiExec: IPMI " + "%s: Attr %X Addr %.4X BaseAddr %.4X Len %.2X Width %X BufLen %X\n", + (Function & ACPI_IO_MASK) ? "Write" : "Read ", + (UINT32) (Function >> 16), (UINT32) Address, (UINT32) BaseAddress, + Length, BitWidth, Buffer[1]); + } /* * Regardless of a READ or WRITE, this handler is passed a 66-byte @@ -950,9 +1060,16 @@ AeRegionHandler ( Buffer[0] = 0; /* Status byte */ Buffer[1] = 64; /* Return buffer data length */ Buffer[2] = 0; /* Completion code */ - Buffer[3] = 0x34; /* Power measurement */ - Buffer[4] = 0x12; /* Power measurement */ - Buffer[65] = 0xEE; /* last buffer byte */ + Buffer[3] = 0; /* Reserved */ + + /* + * Fill the 66-byte buffer with the return data. + * Note: ASLTS depends on these fill values. + */ + for (i = 4; i < 66; i++) + { + Buffer[i] = (UINT8) (i); + } return (AE_OK); default: @@ -1063,7 +1180,6 @@ AeRegionHandler ( ((UINT64) Address - (UINT64) RegionElement->Address)); DoFunction: - /* * Perform a read or write to the buffer space */ @@ -1087,6 +1203,37 @@ DoFunction: return (AE_BAD_PARAMETER); } + if (AcpiGbl_DisplayRegionAccess) + { + switch (SpaceId) + { + case ACPI_ADR_SPACE_SYSTEM_MEMORY: + + AcpiOsPrintf ("AcpiExec: SystemMemory " + "%s: Val %.8X Addr %.4X Width %X [REGION: BaseAddr %.4X Len %.2X]\n", + (Function & ACPI_IO_MASK) ? "Write" : "Read ", + (UINT32) *Value, (UINT32) Address, BitWidth, (UINT32) BaseAddress, Length); + break; + + case ACPI_ADR_SPACE_GPIO: /* ACPI 5.0 */ + + /* This space is required to always be ByteAcc */ + + Status = AcpiBufferToResource (MyContext->Connection, + MyContext->Length, &Resource); + + AcpiOsPrintf ("AcpiExec: GeneralPurposeIo " + "%s: Val %.8X Addr %.4X BaseAddr %.4X Len %.2X Width %X AccLen %.2X Conn %p\n", + (Function & ACPI_IO_MASK) ? "Write" : "Read ", (UINT32) *Value, + (UINT32) Address, (UINT32) BaseAddress, Length, BitWidth, + MyContext->AccessLength, MyContext->Connection); + break; + + default: + break; + } + } + return (AE_OK); } diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c index 2de367b54bfd..2c2f753cf538 100644 --- a/tools/acpiexec/aemain.c +++ b/tools/acpiexec/aemain.c @@ -55,6 +55,7 @@ UINT8 AcpiGbl_RegionFillValue = 0; BOOLEAN AcpiGbl_IgnoreErrors = FALSE; BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; BOOLEAN AcpiGbl_DebugTimeout = FALSE; +UINT8 AcpiGbl_UseHwReducedFadt = FALSE; static UINT8 AcpiGbl_BatchMode = 0; static char BatchBuffer[128]; @@ -64,7 +65,7 @@ static AE_TABLE_DESC *AeTableListHead = NULL; static char *FileList[ASL_MAX_FILES]; -#define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^ovx:" +#define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^orv:x:" /****************************************************************************** @@ -104,7 +105,9 @@ usage (void) printf ("\n"); ACPI_OPTION ("-f <Value>", "Operation Region initialization fill value"); - ACPI_OPTION ("-v", "Verbose initialization output"); + ACPI_OPTION ("-r", "Use hardware-reduced FADT V5"); + ACPI_OPTION ("-vi", "Verbose initialization output"); + ACPI_OPTION ("-vr", "Verbose region handler output"); ACPI_OPTION ("-x <DebugLevel>", "Debug output level"); } @@ -507,8 +510,26 @@ main ( AcpiGbl_DbOpt_stats = TRUE; break; + case 'r': + AcpiGbl_UseHwReducedFadt = TRUE; + printf ("Using ACPI 5.0 Hardware Reduced Mode and FADT\n"); + break; + case 'v': - AcpiDbgLevel |= ACPI_LV_INIT_NAMES; + switch (AcpiGbl_Optarg[0]) + { + case 'i': + AcpiDbgLevel |= ACPI_LV_INIT_NAMES; + break; + + case 'r': + AcpiGbl_DisplayRegionAccess = TRUE; + break; + + default: + printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); + return (-1); + } break; case 'x': diff --git a/tools/acpiexec/aetables.c b/tools/acpiexec/aetables.c index e846d54a3a30..b4b60f0c24d0 100644 --- a/tools/acpiexec/aetables.c +++ b/tools/acpiexec/aetables.c @@ -270,19 +270,37 @@ AeBuildLocalTables ( * as well as the checksum */ ExternalFadt->Dsdt = DsdtAddress; - ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + if (!AcpiGbl_ReducedHardware) + { + ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + } if (ExternalFadt->Header.Length > ACPI_PTR_DIFF (&ExternalFadt->XDsdt, ExternalFadt)) { ExternalFadt->XDsdt = DsdtAddress; - ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + + if (!AcpiGbl_ReducedHardware) + { + ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + } } + /* Complete the FADT with the checksum */ ExternalFadt->Header.Checksum = 0; ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum ( (void *) ExternalFadt, ExternalFadt->Header.Length); } + else if (AcpiGbl_UseHwReducedFadt) + { + ACPI_MEMCPY (&LocalFADT, HwReducedFadtCode, sizeof (ACPI_TABLE_FADT)); + LocalFADT.Dsdt = DsdtAddress; + LocalFADT.XDsdt = DsdtAddress; + + LocalFADT.Header.Checksum = 0; + LocalFADT.Header.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) &LocalFADT, LocalFADT.Header.Length); + } else { /* diff --git a/tools/acpiexec/aetables.h b/tools/acpiexec/aetables.h index 8226a6758537..7bf58e1e951c 100644 --- a/tools/acpiexec/aetables.h +++ b/tools/acpiexec/aetables.h @@ -101,6 +101,44 @@ unsigned char Ssdt3Code[] = /* Has method _T97 */ 0x39,0x37,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "97.p..`." */ }; +/* "Hardware-Reduced" ACPI 5.0 FADT (No FACS, no registers) */ + +unsigned char HwReducedFadtCode[] = +{ + 0x46,0x41,0x43,0x50,0x00,0x01,0x00,0x00, /* 00000000 "FACP...." */ + 0x05,0x8C,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x41,0x43,0x50,0x49,0x35,0x30,0x20,0x20, /* 00000010 "ACPI50 " */ + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x13,0x04,0x11,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00,0x78,0x00,0x01,0x08,0x00,0x01, /* 00000070 "..x....." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000088 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x02, /* 00000090 "..... .." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 000000A8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x00, /* 000000C0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ + 0x01,0x20,0x00,0x03,0x00,0x00,0x00,0x00, /* 000000D0 ". ......" */ + 0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x01, /* 000000D8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000F0 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 000000F8 "........" */ +}; + /* Example OEM table */ static unsigned char Oem1Code[] = diff --git a/tools/acpihelp/acpihelp.h b/tools/acpihelp/acpihelp.h index 928187348a9e..eb0a7574f1de 100644 --- a/tools/acpihelp/acpihelp.h +++ b/tools/acpihelp/acpihelp.h @@ -54,6 +54,7 @@ #include <sys/types.h> #include <fcntl.h> #include <ctype.h> +#include <string.h> #ifdef WIN32 #include <io.h> #include <direct.h> diff --git a/tools/acpihelp/ahaslkey.c b/tools/acpihelp/ahaslkey.c index 48d2110e9c49..186889835b71 100644 --- a/tools/acpihelp/ahaslkey.c +++ b/tools/acpihelp/ahaslkey.c @@ -49,11 +49,15 @@ */ const AH_ASL_KEYWORD AslKeywordInfo[] = { - {"AccessAttribKeyword", "SMBus Attributes", - ":= SMBQuick | SMBSendReceive | SMBByte | SMBWord | " - "SMBBlock | SMBProcessCall | SMBBlockProcessCall"}, + {"AccessAttribKeyword", "Serial Bus Attributes (with legacy SMBus aliases)", + ":= AttribQuick (SMBusQuick) | AttribSendReceive (SMBusSendReceive) | " + "AttribByte (SMBusByte) | AttribWord (SMBusWord) | " + "AttribBlock (SMBusBlock) | AttribProcessCall (SMBusProcessCall) | " + "AttribBlockProcessCall (SMBusProcessCall)"}, {"AccessTypeKeyword", "Field Access Types", ":= AnyAcc | ByteAcc | WordAcc | DWordAcc | QWordAcc | BufferAcc"}, + {"AddressingModeKeyword", "Mode - Resource Descriptors", + ":= AddressingMode7Bit | AddressingMode10Bit"}, {"AddressKeyword", "ACPI memory range types", ":= AddressRangeMemory | AddressRangeReserved | " "AddressRangeNVS | AddressRangeACPI"}, @@ -61,16 +65,32 @@ const AH_ASL_KEYWORD AslKeywordInfo[] = ":= RegionSpaceKeyword | FFixedHW"}, {"BusMasterKeyword", "DMA Bus Mastering", ":= BusMaster | NotBusMaster"}, + {"ByteLengthKeyword", "Bits per Byte - Resource Descriptors", + ":= DataBitsFive | DataBitsSix | DataBitsSeven | DataBitsEight | DataBitsNine"}, + {"ClockPhaseKeyword", "Resource Descriptors", + ":= ClockPhaseFirst | ClockPhaseSecond"}, + {"ClockPolarityKeyword", "Resource Descriptors", + ":= ClockPolarityLow | ClockPolarityHigh"}, {"DecodeKeyword", "Type of Memory Decoding - Resource Descriptors", ":= SubDecode | PosDecode"}, - {"DMATypeKeyword", "DMA Types - DMA Resource Descriptor", + {"DmaTypeKeyword", "DMA Types - DMA Resource Descriptor", ":= Compatibility | TypeA | TypeB | TypeF"}, + {"EndianKeyword", "Endian type - Resource Descriptor", + ":= BigEndian | LittleEndian"}, + {"ExtendedAttribKeyword", "Extended Bus Attributes", + ":= AttribBytes (AccessLength) | AttribRawBytes (AccessLength) | " + "AttribRawProcessBytes (AccessLength)"}, + {"FlowControlKeyword", "Resource Descriptor", + ":= FlowControlNone | FlowControlXon | FlowControlHardware"}, + {"InterruptLevelKeyword", "Interrupt Active Types", + ":= ActiveHigh | ActiveLow | ActiveBoth"}, {"InterruptTypeKeyword", "Interrupt Types", ":= Edge | Level"}, - {"InterruptLevel", "Interrupt Active Types", - ":= ActiveHigh | ActiveLow"}, - {"IODecodeKeyword", "I/O Decoding - IO Resource Descriptor", + {"IoDecodeKeyword", "I/O Decoding - IO Resource Descriptor", ":= Decode16 | Decode10"}, + {"IoRestrictionKeyword", "I/O Restriction - GPIO Resource Descriptors", + ":= IoRestrictionNone | IoRestrictionInputOnly | " + "IoRestrictionOutputOnly | IoRestrictionNoneAndPreserve"}, {"LockRuleKeyword", "Global Lock use for Field Operator", ":= Lock | NoLock"}, {"MatchOpKeyword", "Types for Match Operator", @@ -85,19 +105,34 @@ const AH_ASL_KEYWORD AslKeywordInfo[] = ":= UnknownObj | IntObj | StrObj | BuffObj | PkgObj | FieldUnitObj | " "DeviceObj | EventObj | MethodObj | MutexObj | OpRegionObj | PowerResObj | " "ProcessorObj | ThermalZoneObj | BuffFieldObj | DDBHandleObj"}, + {"ParityKeyword", "Resource Descriptors", + ":= ParityTypeNone | ParityTypeSpace | ParityTypeMark | " + "ParityTypeOdd | ParityTypeEven"}, + {"PinConfigKeyword", "Pin Configuration - GPIO Resource Descriptors", + ":= PullDefault | PullUp | PullDown | PullNone"}, + {"PolarityKeyword", "Resource Descriptors", + ":= PolarityHigh | PolarityLow"}, {"RangeTypeKeyword", "I/O Range Types - Resource Descriptors", ":= ISAOnlyRanges | NonISAOnlyRanges | EntireRange"}, {"ReadWriteKeyword", "Memory Access Types - Resource Descriptors", ":= ReadWrite | ReadOnly"}, {"RegionSpaceKeyword", "Operation Region Address Space Types", ":= UserDefRegionSpace | SystemIO | SystemMemory | PCI_Config | " - "EmbeddedControl | SMBus | SystemCMOS | PciBarTarget | IPMI"}, + "EmbeddedControl | SMBus | SystemCMOS | PciBarTarget | IPMI | " + "GeneralPurposeIo, GenericSerialBus"}, {"ResourceTypeKeyword", "Resource Usage - Resource Descriptors", ":= ResourceConsumer | ResourceProducer"}, {"SerializeRuleKeyword", "Control Method Serialization", ":= Serialized | NotSerialized"}, {"ShareTypeKeyword", "Interrupt Sharing - Resource Descriptors", - ":= Shared | Exclusive"}, + ":= Shared | Exclusive | SharedAndWake | ExclusiveAndWake"}, + {"SlaveModeKeyword", "Resource Descriptors", + ":= ControllerInitiated | DeviceInitiated"}, + {"StopBitsKeyword", "Resource Descriptors", + ":= StopBitsZero | StopBitsOne | StopBitsOnePlusHalf | StopBitsTwo"}, + {"TransferWidthKeyword", "DMA Widths - Fixed DMA Resource Descriptor", + ":= Width8bit | Width16bit | Width32bit | Width64bit | " + "Width128bit | Width256bit"}, {"TranslationKeyword", "Translation Density Types - Resource Descriptors", ":= SparseTranslation | DenseTranslation"}, {"TypeKeyword", "Translation Types - Resource Descriptors", @@ -106,6 +141,8 @@ const AH_ASL_KEYWORD AslKeywordInfo[] = ":= Preserve | WriteAsOnes | WriteAsZeros"}, {"UserDefRegionSpace", "User defined address spaces", ":= IntegerData => 0x80 - 0xFF"}, + {"WireModeKeyword", "SPI Wire Mode - Resource Descriptors", + ":= ThreeWireMode | FourWireMode"}, {"XferTypeKeyword", "DMA Transfer Types", ":= Transfer8 | Transfer16 | Transfer8_16"}, {NULL, NULL, NULL} diff --git a/tools/acpihelp/ahaslops.c b/tools/acpihelp/ahaslops.c index b1ad645e466e..1a18282fc5f0 100644 --- a/tools/acpihelp/ahaslops.c +++ b/tools/acpihelp/ahaslops.c @@ -50,7 +50,8 @@ */ const AH_ASL_OPERATOR AslOperatorInfo[] = { - {"AccessAs", "(AccessType, AccessAttibute)", + {"AccessAs", "(AccessType, AccessAttribKeyword | " + "ExtendedAttribKeyword (AccessLength))", "ChangeFieldUnitAccess"}, {"Acquire", "(SyncObject, TimeoutValue) => Boolean", "Acquire a mutex"}, @@ -62,11 +63,13 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Integer Bitwise And"}, {"Arg", "Arg0 - Arg6", "Method argument data objects"}, - {"BankField", "(RegionName, BankName, BankValue, AccessType, LockRule, UpdateRule) {FieldUnitList}", + {"BankField", "(RegionName, BankName, BankValue, " + "AccessTypeKeyword, LockRuleKeyword, " + "UpdateRuleKeyword) {FieldUnitList}", "Declare fields in a banked configuration object"}, - {"Break", NULL, + {"Break", "No parameters", "Continue following the innermost enclosing While"}, - {"BreakPoint", NULL, + {"BreakPoint", "No parameters", "Used for debugging, stops execution in the debugger"}, {"Buffer", "(BufferSize) {String or ByteList} => Buffer", "Declare Buffer object"}, @@ -78,7 +81,9 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Concatenate two resource templates"}, {"CondRefOf", "(Source, Result) => Boolean", "Conditional reference to an object"}, - {"Continue", NULL, + {"Connection", "(ResourceMacro)", + "Associate connection with FieldUnits within a Field object"}, + {"Continue", "No parameters", "Continue innermost enclosing While loop"}, {"CopyObject", "(Source, Destination) => DataRefObject", "Copy and existing object"}, @@ -96,13 +101,14 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Declare a Word field object of a buffer object"}, {"DataTableRegion", "(RegionName, SignatureString, OemIDString, OemTableIDString)", "Declare a Data Table Region"}, - {"Debug", NULL, + {"Debug", "No parameters", "Debugger output"}, {"Decrement", "(Minuend) => Integer", "Decrement an Integer"}, {"Default", "{TermList}", "Default execution path in Switch()"}, - {"DefinitionBlock", "(AMLFileName, TableSignature, ComplianceRevision, OEMID, TableID, OEMRevision) {TermList}", + {"DefinitionBlock", "(AMLFileName, TableSignature, ComplianceRevision, " + "OEMID, TableID, OEMRevision) {TermList}", "Declare a Definition Block"}, {"DerefOf", "(Source) => Object", "Dereference an object reference"}, @@ -110,19 +116,25 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Declare a bus/device object"}, {"Divide", "(Dividend, Divisor, Remainder, Result) => Integer", "Integer Divide"}, - {"DMA", "(DmaType, IsBusMaster, DmaTransferSize, DescriptorName) {DmaChannelList} => Buffer", + {"DMA", "(DmaTypeKeyword, BusMasterKeyword, XferTypeKeyword, " + "DescriptorName) {DmaChannelList} => Buffer", "DMA Resource Descriptor macro"}, - {"DWordIO", "(ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, AddressGranularity, " - "AddressMinimum, AddressMaximum, AddressTranslation, RangeLength, ResourceSourceIndex, " - "ResourceSource, DescriptorName, TranslationType, TranslationDensity)", + {"DWordIO", "(ResourceTypeKeyword, MinKeyword, MaxKeyword, " + "DecodeKeyword, RangeTypeKeyword, AddressGranularity, " + "AddressMinimum, AddressMaximum, AddressTranslation, " + "RangeLength, ResourceSourceIndex, " + "ResourceSource, DescriptorName, TypeKeyword, TranslationKeyword)", "DWord IO Resource Descriptor macro"}, - {"DWordMemory", "(ResourceUsage, Decode, IsMinFixed, IsMaxFixed, Cacheable, ReadAndWrite, " + {"DWordMemory", "(ResourceTypeKeyword, DecodeKeyword, MinKeyword, " + "MaxKeyword, MemTypeKeyword, ReadWriteKeyword, " "AddressGranularity, AddressMinimum, AddressMaximum, AddressTranslation, " - "RangeLength, ResourceSourceIndex, ResourceSource, DescriptorName, MemoryType, " - "TranslationType)", + "RangeLength, ResourceSourceIndex, ResourceSource, DescriptorName, AddressKeyword, " + "TypeKeyword)", "DWord Memory Resource Descriptor macro"}, - {"DWordSpace", "(ResourceType, ResourceUsage, Decode, IsMinFixed, IsMaxFixed, TypeSpecificFlags, " - "AddressGranularity, AddressMinimum, AddressMaximum, AddressTranslation, RangeLength, " + {"DWordSpace", "(ResourceType, ResourceTypeKeyword, DecodeKeyword, " + "MinKeyword, MaxKeyword, TypeSpecificFlags, " + "AddressGranularity, AddressMinimum, AddressMaximum, " + "AddressTranslation, RangeLength, " "ResourceSourceIndex, ResourceSource, DescriptorName)", "DWord Space Resource Descriptor macro"}, {"EISAID", "(EisaIdString) => DWordConst", @@ -135,34 +147,57 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "End Dependent Function Resource Descriptor macro"}, {"Event", "(EventName)", "Declare an event synchronization object"}, - {"ExtendedIO", "(ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, AddressGranularity, " + {"ExtendedIO", "(ResourceTypeKeyword, MinKeyword, MaxKeyword, " + "DecodeKeyword, RangeTypeKeyword, AddressGranularity, " "AddressMinimum, AddressMaximum, AddressTranslation, RangeLength, " - "TypeSpecificAttributes, DescriptorName, TranslationType, TranslationDensity)", + "TypeSpecificAttributes, DescriptorName, TypeKeyword, TranslationKeyword)", "Extended IO Resource Descriptor macro"}, - {"ExtendedMemory", "(ResourceUsage, Decode, IsMinFixed, IsMaxFixed, Cacheable, ReadAndWrite, " + {"ExtendedMemory", "(ResourceTypeKeyword, DecodeKeyword, MinKeyword, " + "MaxKeyword, MemTypeKeyword, ReadWriteKeyword, " "AddressGranularity, AddressMinimum, AddressMaximum, AddressTranslation, " - "RangeLength, TypeSpecificAttributes, DescriptorName, MemoryType, TranslationType)", + "RangeLength, TypeSpecificAttributes, DescriptorName, " + "AddressKeyword, TypeKeyword)", "Extended Memory Resource Descriptor macro"}, - {"ExtendedSpace", "(ResourceType, ResourceUsage, Decode, IsMinFixed, IsMaxFixed, TypeSpecificFlags, " + {"ExtendedSpace", "(ResourceType, ResourceTypeKeyword, DecodeKeyword, " + "MinKeyword, MaxKeyword, TypeSpecificFlags, " "AddressGranularity, AddressMinimum, AddressMaximum, AddressTranslation, " "RangeLength, TypeSpecificAttributes, DescriptorName)", "Extended Space Resource Descriptor macro"}, - {"External", "(ObjectName, ObjectType, ReturnType, ParameterTypes)", + {"External", "(ObjectName, ObjectTypeKeyword, ReturnType, ParameterTypes)", "Declare external objects"}, {"Fatal", "(Type, Code, Arg)", "Fatal error check"}, - {"Field", "(RegionName, AccessType, LockRule, UpdateRule) {FieldUnitList}", + {"Field", "(RegionName, AccessTypeKeyword, LockRuleKeyword, " + "UpdateRuleKeyword) {FieldUnitList}", "Declare fields of an operation region object"}, {"FindSetLeftBit", "(Source, Result) => Integer", "Index of first least significant bit set"}, {"FindSetRightBit", "(Source, Result) => Integer", "Index of first most significant bit set"}, + {"FixedDMA", "(DmaRequestLine, Channel, TransferWidthKeyword, DescriptorName) => Buffer", + "Fixed DMA Resource Descriptor macro"}, {"FixedIO", "(AddressBase, RangeLength, DescriptorName) => Buffer", "Fixed I/O Resource Descriptor macro"}, {"FromBCD", "(BCDValue, Result) => Integer", "Convert from BCD to numeric"}, {"Function", "(FunctionName, ReturnType, ParameterTypes) {TermList}", "Declare control method"}, + {"GpioInt", "(InterruptTypeKeyword, InterruptLevelKeyword, " + "ShareTypeKeyword, PinConfigKeyword, " + "DebounceTimeout, ResourceSource, " + "ResourceSourceIndex, ResourceTypeKeyword, DescriptorName, " + "RawDataBuffer() {VendorData}) {Pin}", + "GPIO Interrupt Connection Resource Descriptor Macro"}, + {"GpioIo", "(ShareTypeKeyword, PinConfigKeyword, DebounceTimeout, DriveStrength, " + "IoRestrictionKeyword, ResourceSource, " + "ResourceSourceIndex, ResourceTypeKeyword, DescriptorName, " + "RawDataBuffer() {VendorData}) {PinList}", + "GPIO I/O Connection Resource Descriptor Macro"}, + {"I2cSerialBus", "(SlaveAddress, SlaveModeKeyword, ConnectionSpeed, " + "AddressingModeKeyword, ResourceSource, " + "ResourceSourceIndex, ResourceTypeKeyword, DescriptorName, " + "RawDataBuffer() {VendorData})", + "I2C Serial Bus Connection Resource Descriptor Macro"}, {"If", "(Predicate) {TermList}", "Conditional execution"}, {"Include", "(FilePathName)", @@ -171,14 +206,18 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Increment a Integer"}, {"Index", "(Source, Index, Destination) => ObjectReference", "Indexed Reference to member object"}, - {"IndexField", "(IndexName, DataName, AccessType, LockRule, UpdateRule) {FieldUnitList}", + {"IndexField", "(IndexName, DataName, AccessTypeKeyword, LockRuleKeyword, " + "UpdateRuleKeyword) {FieldUnitList}", "Declare Index/Data Fields"}, - {"Interrupt", "(ResourceUsage, EdgeLevel, ActiveLevel, Shared, ResourceSourceIndex, " + {"Interrupt", "(ResourceTypeKeyword, InterruptTypeKeyword, InterruptLevelKeyword, " + "ShareTypeKeyword, ResourceSourceIndex, " "ResourceSource, DescriptorName) {InterruptList} => Buffer", "Interrupt Resource Descriptor macro"}, - {"IO", "(Decode, AddressMin, AddressMax, AddressAlignment, RangeLength, DescriptorName) => Buffer", + {"IO", "(IoDecodeKeyword, AddressMin, AddressMax, AddressAlignment, " + "RangeLength, DescriptorName) => Buffer", "IO Resource Descriptor macro"}, - {"IRQ", "(EdgeLevel, ActiveLevel, Shared, DescriptorName) {InterruptList} => Buffer", + {"IRQ", "(InterruptTypeKeyword, InterruptLevelKeyword, ShareTypeKeyword, " + "DescriptorName) {InterruptList} => Buffer", "Interrupt Resource Descriptor macro"}, {"IRQNoFlags", "(DescriptorName) {InterruptList} => Buffer", "Short Interrupt Resource Descriptor macro"}, @@ -207,17 +246,19 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Method local data objects"}, {"LOr", "(Source1, Source2) => Boolean", "Logical Or"}, - {"Match", "(SearchPackage, Op1, MatchObject1, Op2, MatchObject2, StartIndex) => Ones | Integer", + {"Match", "(SearchPackage, MatchOpKeyword, MatchObject1, MatchOpKeyword, " + "MatchObject2, StartIndex) => Ones | Integer", "Search for match in package array"}, - {"Memory24", "(ReadAndWrite, AddressMinimum, AddressMaximum, AddressAlignment, " + {"Memory24", "(ReadWriteKeyword, AddressMinimum, AddressMaximum, AddressAlignment, " "RangeLength, DescriptorName)", "Memory Resource Descriptor macro"}, - {"Memory32", "(ReadAndWrite, AddressMinimum, AddressMaximum, AddressAlignment, " + {"Memory32", "(ReadWriteKeyword, AddressMinimum, AddressMaximum, AddressAlignment, " "RangeLength, DescriptorName)", "Memory Resource Descriptor macro"}, - {"Memory32Fixed", "(ReadAndWrite, AddressBase, RangeLength, DescriptorName)", + {"Memory32Fixed", "(ReadWriteKeyword, AddressBase, RangeLength, DescriptorName)", "Memory Resource Descriptor macro"}, - {"Method", "(MethodName, NumArgs, SerializeRule, SyncLevel, ReturnType, ParameterTypes) " + {"Method", "(MethodName, NumArgs, SerializeRuleKeyword, " + "SyncLevel, ReturnType, ParameterTypes) " "{TermList}", "Declare a control method"}, {"Mid", "(Source, Index, Length, Result) => Buffer or String", @@ -232,7 +273,7 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Declare a Named object"}, {"NAnd", "(Source1, Source2, Result) => Integer", "Integer Bitwise Nand"}, - {"NoOp", NULL, + {"NoOp", "No parameters", "No operation"}, {"NOr", "(Source1, Source2, Result) => Integer", "Integer Bitwise Nor"}, @@ -248,7 +289,7 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Constant One Object (1)"}, {"Ones", "=> Integer", "Constant Ones Object (-1)"}, - {"OperationRegion", "(RegionName, RegionSpace, Offset, Length)", + {"OperationRegion", "(RegionName, RegionSpaceKeyword, Offset, Length)", "Declare an operational region"}, {"Or", "(Source1, Source2, Result) => Integer", "Integer Bitwise Or"}, @@ -258,23 +299,30 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Declare a power resource object"}, {"Processor", "(ProcessorName, ProcessorID, PBlockAddress, PblockLength) {ObjectList}", "Declare a processor package"}, - {"QWordIO", "(ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, AddressGranularity, " + {"QWordIO", "(ResourceTypeKeyword, MinKeyword, MaxKeyword, DecodeKeyword, " + "RangeTypeKeyword, AddressGranularity, " "AddressMinimum, AddressMaximum, AddressTranslation, RangeLength, " - "ResourceSourceIndex, ResourceSource, DescriptorName, TranslationType, " - "TranslationDensity)", + "ResourceSourceIndex, ResourceSource, DescriptorName, TypeKeyword, " + "TranslationKeyword)", "QWord IO Resource Descriptor macro"}, - {"QWordMemory", "(ResourceUsage, Decode, IsMinFixed, IsMaxFixed, Cacheable, ReadAndWrite, " + {"QWordMemory", "(ResourceTypeKeyword, DecodeKeyword, MinKeyword, MaxKeyword, " + "MemTypeKeyword, ReadWriteKeyword, " "AddressGranularity, AddressMinimum, AddressMaximum, AddressTranslation, " - "RangeLength, ResourceSourceIndex, ResourceSource, DescriptorName, MemoryType, " - "TranslationType)", + "RangeLength, ResourceSourceIndex, ResourceSource, " + "DescriptorName, AddressKeyword, " + "TypeKeyword)", "QWord Memory Resource Descriptor macro"}, - {"QWordSpace", "(ResourceType, ResourceUsage, Decode, IsMinFixed, IsMaxFixed, TypeSpecificFlags, " + {"QWordSpace", "(ResourceType, ResourceTypeKeyword, DecodeKeyword, " + "MinKeyword, MaxKeyword, TypeSpecificFlags, " "AddressGranularity, AddressMinimum, AddressMaximum, AddressTranslation, " "RangeLength, ResourceSourceIndex, ResourceSource, DescriptorName)", "Qword Space Resource Descriptor macro"}, + {"RawDataBuffer", "(BufferSize) {ByteList} => RawDataBuffer", + "Create a raw data buffer (does not use Buffer AML opcode)"}, {"RefOf", "(Object) => ObjectReference", "Create Reference to an object"}, - {"Register", "(AddressSpaceKeyword, RegisterBitWidth, RegisterBitOffset, RegisterAddress, " + {"Register", "(AddressSpaceKeyword, RegisterBitWidth, " + "RegisterBitOffset, RegisterAddress, " "AccessSize, DescriptorName)", "Generic register Resource Descriptor macro"}, {"Release", "(SyncObject)", @@ -299,6 +347,12 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Get the size of a buffer}, string}, or package"}, {"Sleep", "(MilliSeconds)", "Sleep n milliseconds (yields the processor)"}, + {"SpiSerialBus", "(DeviceSelection, PolarityKeyword, WireModeKeyword, " + "DataBitLength, SlaveModeKeyword, " + "ConnectionSpeed, ClockPolarityKeyword, ClockPhaseKeyword, " + "ResourceSource, ResourceSourceIndex, " + "ResourceTypeKeyword, DescriptorName, RawDataBuffer() {VendorData})", + "SPI Serial Bus Connection Resource Descriptor Macro"}, {"Stall", "(MicroSeconds)", "Delay n microseconds (does not yield the processor)"}, {"StartDependentFn", "(CompatibilityPriority, PerformancePriority) {ResourceList}", @@ -329,6 +383,12 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Copy ASCII string from buffer"}, {"ToUUID", "(AsciiString) => Buffer", "Convert Ascii string to UUID"}, + {"UartSerialBus", "(ConnectionSpeed, ByteLengthKeyword, StopBitsKeyword, " + "LinesInUse, EndianKeyword, ParityKeyword, " + "FlowControlKeyword, ReceiveBufferSize, TransmitBufferSize, ResourceSource, " + "ResourceSourceIndex, ResourceTypeKeyword, DescriptorName, " + "RawDataBuffer() {VendorData})", + "UART Serial Bus Connection Resource Descriptor Macro"}, {"Unicode", "(String) => Buffer", "String to Unicode conversion macro"}, {"Unload", "(Handle)", @@ -341,16 +401,19 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Wait on an Event"}, {"While", "(Predicate) {TermList}", "Conditional loop"}, - {"WordBusNumber", "(ResourceUsage, IsMinFixed, IsMaxFixed, Decode, AddressGranularity, AddressMinimum, " + {"WordBusNumber", "(ResourceTypeKeyword, MinKeyword, MaxKeyword, DecodeKeyword, " + "AddressGranularity, AddressMinimum, " "AddressMaximum, AddressTranslation, RangeLength, ResourceSourceIndex, " "ResourceSource, DescriptorName)", "Word Bus number Resource Descriptor macro"}, - {"WordIO", "(ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, AddressGranularity, " + {"WordIO", "(ResourceTypeKeyword, MinKeyword, MaxKeyword, DecodeKeyword, " + "RangeTypeKeyword, AddressGranularity, " "AddressMinimum, AddressMaximum, AddressTranslation, RangeLength, " - "ResourceSourceIndex, ResourceSource, DescriptorName, TranslationType, " - "TranslationDensity)", + "ResourceSourceIndex, ResourceSource, DescriptorName, TypeKeyword, " + "TranslationKeyword)", "Word IO Resource Descriptor macro"}, - {"WordSpace", "(ResourceType, ResourceUsage, Decode, IsMinFixed, IsMaxFixed, TypeSpecificFlags, " + {"WordSpace", "(ResourceType, ResourceTypeKeyword, DecodeKeyword, MinKeyword, " + "MaxKeyword, TypeSpecificFlags, " "AddressGranularity, AddressMinimum, AddressMaximum, AddressTranslation, " "RangeLength, ResourceSourceIndex, ResourceSource, DescriptorName)", "Word Space Resource Descriptor macro"}, diff --git a/tools/acpihelp/ahdecode.c b/tools/acpihelp/ahdecode.c index aaeae4a03160..34d816fc1d0e 100644 --- a/tools/acpihelp/ahdecode.c +++ b/tools/acpihelp/ahdecode.c @@ -46,7 +46,11 @@ #define ACPI_CREATE_PREDEFINED_TABLE #include "acpredef.h" -static char Gbl_Buffer[64]; +#define BUFFER_LENGTH 128 +#define LINE_BUFFER_LENGTH 512 + +static char Gbl_Buffer[BUFFER_LENGTH]; +static char Gbl_LineBuffer[LINE_BUFFER_LENGTH]; static const char *AcpiRtypeNames[] = { "/Integer", @@ -82,6 +86,10 @@ AhDisplayAslOperator ( const AH_ASL_OPERATOR *Op); static void +AhDisplayOperatorKeywords ( + const AH_ASL_OPERATOR *Op); + +static void AhDisplayAslKeyword ( const AH_ASL_KEYWORD *Op); @@ -386,7 +394,6 @@ AhDecodeAmlOpcode ( { const AH_AML_OPCODE *Op; UINT32 Opcode; - BOOLEAN Found = FALSE; UINT8 Prefix; @@ -421,7 +428,6 @@ AhDecodeAmlOpcode ( (Opcode <= Op->OpcodeRangeEnd)) { AhDisplayAmlOpcode (Op); - Found = TRUE; } } } @@ -561,7 +567,7 @@ AhDisplayAslKeyword ( /* ASL keyword name and description */ - printf ("%20s: %s\n", Op->Name, Op->Description); + printf ("%22s: %s\n", Op->Name, Op->Description); if (!Op->KeywordList) { return; @@ -569,7 +575,7 @@ AhDisplayAslKeyword ( /* List of actual keywords */ - AhPrintOneField (22, 0, AH_MAX_ASL_LINE_LENGTH, Op->KeywordList); + AhPrintOneField (24, 0, AH_MAX_ASL_LINE_LENGTH, Op->KeywordList); printf ("\n"); } @@ -658,6 +664,62 @@ AhDisplayAslOperator ( AhPrintOneField (18, 0, AH_MAX_ASL_LINE_LENGTH, Op->Syntax); printf ("\n"); + + AhDisplayOperatorKeywords (Op); + printf ("\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AhDisplayOperatorKeywords + * + * PARAMETERS: Op - Pointer to ASL keyword with syntax info + * + * RETURN: None + * + * DESCRIPTION: Display any/all keywords that are associated with the ASL + * operator. + * + ******************************************************************************/ + +static void +AhDisplayOperatorKeywords ( + const AH_ASL_OPERATOR *Op) +{ + char *Token; + char *Separators = "(){}, "; + BOOLEAN FirstKeyword = TRUE; + + + if (!Op || !Op->Syntax) + { + return; + } + + /* + * Find all parameters that have the word "keyword" within, and then + * display the info about that keyword + */ + strcpy (Gbl_LineBuffer, Op->Syntax); + Token = strtok (Gbl_LineBuffer, Separators); + while (Token) + { + if (strstr (Token, "Keyword")) + { + if (FirstKeyword) + { + printf ("\n"); + FirstKeyword = FALSE; + } + + /* Found a keyword, display keyword information */ + + AhFindAslKeywords (Token); + } + + Token = strtok (NULL, Separators); + } } diff --git a/tools/acpihelp/ahpredef.c b/tools/acpihelp/ahpredef.c index d56bea36f406..3836bcdc186a 100644 --- a/tools/acpihelp/ahpredef.c +++ b/tools/acpihelp/ahpredef.c @@ -51,6 +51,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = { {"_ACx", "Active Cooling", "Returns the active cooling policy threshold values"}, {"_ADR", "Address", "Returns the address of a device on its parent bus"}, + {"_AEI", "ACPI Event Interrupts", "Returns a list of GPIO events to be used as ACPI events"}, {"_ALC", "Ambient Light Chromaticity", "Returns the ambient light color chromaticity"}, {"_ALI", "Ambient Light Illuminance", "Returns the ambient light brightness"}, {"_ALN", "Alignment", "Base alignment, Resource Descriptor field"}, @@ -84,20 +85,28 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_CBA", "Configuration Base Address", "Sets the CBA for a PCI Express host bridge"}, {"_CDM", "Clock Domain", "Returns a logical processor's clock domain identifier"}, {"_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"}, + {"_CLS", "Class Code", "Returns PCI class code and subclass"}, + {"_CPC", "Continuous Performance Control", "Returns a list of performance control interfaces"}, {"_CRS", "Current Resource Settings", "Returns the current resource settings for a device"}, {"_CRT", "Critical Temperature", "Returns the shutdown critical temperature"}, {"_CSD", "C State Dependencies", "Returns a list of C-state dependencies"}, {"_CST", "C States", "Returns a list of supported C-states"}, + {"_CWS", "Clear Wake Alarm Status", "Clear the status of wake alarms"}, + {"_DBT", "Debounce Timeout", "Timeout value, Resource Descriptor field"}, {"_DCK", "Dock", "Sets docking isolation. Presence indicates device is a docking station"}, {"_DCS", "Display Current Status", "Returns status of the display output device"}, {"_DDC", "Display Data Current", "Returns the EDID for the display output device"}, {"_DDN", "Dos Device Name", "Returns a device logical name"}, {"_DEC", "Decode", "Device decoding type, Resource Descriptor field"}, + {"_DEP", "Dependencies", "Returns a list of operation region dependencies"}, {"_DGS", "Display Graphics State", "Return the current state of the output device"}, {"_DIS", "Disable", "Disables a device"}, + {"_DLM", "Device Lock Mutex", "Defines mutex for OS/AML sharing"}, {"_DMA", "Direct Memory Access", "Returns a device's current resources for DMA transactions"}, {"_DOD", "Display Output Devices", "Enumerate all devices attached to the display adapter"}, {"_DOS", "Disable Output Switching", "Sets the display output switching mode"}, + {"_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"}, + {"_DRS", "Drive Strength", "Drive Strength setting for GPIO connection, Resource Descriptor field"}, {"_DSM", "Device Specific Method", "Executes device-specific functions"}, {"_DSS", "Device Set State", "Sets the display device state"}, {"_DSW", "Device Sleep Wake", "Sets the sleep and wake transition states for a device"}, @@ -107,15 +116,19 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_EDL", "Eject Device List", "Returns a list of devices that are dependent on a device (docking)"}, {"_EJD", "Ejection Dependent Device", "Returns the name of dependent (parent) device (docking)"}, {"_EJx", "Eject", "Begin or cancel a device ejection request (docking)"}, + {"_END", "Endian-ness", "Endian orientation, Resource Descriptor field"}, + {"_EVT", "Event", "Event method for GPIO events"}, {"_FDE", "Floppy Disk Enumerate", "Returns floppy disk configuration information"}, {"_FDI", "Floppy Drive Information", "Returns a floppy drive information block"}, {"_FDM", "Floppy Drive Mode", "Sets a floppy drive speed"}, {"_FIF", "Fan Information", "Returns fan device information"}, {"_FIX", "Fixed Register Resource Provider", "Returns a list of devices that implement FADT register blocks"}, + {"_FLC", "Flow Control", "Flow control, Resource Descriptor field"}, {"_FPS", "Fan Performance States", "Returns a list of supported fan performance states"}, {"_FSL", "Fan Set Level", "Control method that sets the fan device's speed level (performance state)"}, {"_FST", "Fan Status", "Returns current status information for a fan device"}, {"_GAI", "Get Averaging Interval", "Returns the power meter averaging interval"}, + {"_GCP", "Get Capability", "Get device time capabilities"}, {"_GHL", "Get Hardware Limit", "Returns the hardware limit enforced by the power meter"}, {"_GL_", "Global Lock", "OS-defined Global Lock mutex object"}, {"_GLK", "Global Lock", "Returns a device's Global Lock requirement for device access"}, @@ -123,22 +136,27 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_GPE", "General Purpose Events", "(1) predefined Scope (\\_GPE.)"}, {"_GRA", "Granularity", "Address space granularity, Resource Descriptor field"}, {"_GSB", "Global System Interrupt Base", "Returns the GSB for a I/O APIC device"}, + {"_GRT", "Get Real Time", "Returns current time-of-day"}, {"_GTF", "Get Task File", "Returns a list of ATA commands to restore a drive to default state"}, {"_GTM", "Get Timing Mode", "Returns a list of IDE controller timing information"}, {"_GTS", "Going To Sleep", "Inform AML of pending sleep"}, + {"_GWS", "Get Wake Status", "Return status of wake alarms"}, {"_HE_", "High-Edge", "Interrupt triggering, Resource Descriptor field"}, {"_HID", "Hardware ID", "Returns a device's Plug and Play Hardware ID"}, {"_HOT", "Hot Temperature", "Returns the critical temperature for sleep (entry to S4)"}, {"_HPP", "Hot Plug Parameters", "Returns a list of hot-plug information for a PCI device"}, {"_HPX", "Hot Plug Parameter Extensions", "Returns a list of hot-plug information for a PCI device. Supersedes _HPP"}, + {"_HRV", "Hardware Revision", "Returns a hardware revision value"}, {"_IFT", "IPMI Interface Type", "See the Intelligent Platform Management Interface Specification"}, {"_INI", "Initialize", "Performs device specific initialization"}, {"_INT", "Interrupts", "Interrupt mask bits, Resource Descriptor field"}, + {"_IOR", "I/O Restriction", "Restriction type, Resource Descriptor field"}, {"_IRC", "Inrush Current", "Presence indicates that a device has a significant inrush current draw"}, {"_Lxx", "Level GPE", "Control method executed as a result of a general-purpose event"}, {"_LCK", "Lock", "Locks or unlocks a device (docking)"}, {"_LEN", "Length", "Range length, Resource Descriptor field"}, {"_LID", "Lid", "Returns the open/closed status of the lid on a mobile system"}, + {"_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"}, {"_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"}, {"_MAF", "Maximum Address Fixed", "Resource Descriptor field"}, {"_MAT", "Multiple Apic Table Entry", "Returns a list of MADT APIC structure entries"}, @@ -148,6 +166,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_MIF", "Minimum Address Fixed", "Resource Descriptor field"}, {"_MIN", "Minimum Base Address", "Resource Descriptor field"}, {"_MLS", "Multiple Language String", "Returns a device description in multiple languages"}, + {"_MOD", "Mode", "Interrupt mode, Resource Descriptor field"}, {"_MSG", "Message", "Sets the system message waiting status indicator"}, {"_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"}, {"_MTP", "Memory Type", "Resource Descriptor field"}, @@ -159,23 +178,29 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_OSI", "Operating System Interfaces", "Returns supported interfaces, behaviors, and features"}, {"_OST", "Ospm Status Indication", "Inform AML of event processing status"}, {"_PAI", "Power Averaging Interval", "Sets the averaging interval for a power meter"}, + {"_PAR", "Parity", "Parity bits, Resource Descriptor field"}, {"_PCL", "Power Consumer List", "Returns a list of devices powered by a power source"}, {"_PCT", "Performance Control", "Returns processor performance control and status registers"}, {"_PDC", "Processor Driver Capabilities", "Inform AML of processor driver capabilities"}, {"_PDL", "P-state Depth Limit", "Returns the lowest available performance P-state"}, + {"_PHA", "Phase", "Clock phase, Resource Descriptor field"}, {"_PIC", "PIC", "Inform AML of the interrupt model in use"}, {"_PIF", "Power Source Information", "Returns a Power Source information block"}, + {"_PIN", "Pins", "Pin list, Resource Descriptor field"}, {"_PLD", "Physical Device Location", "Returns a device's physical location information"}, {"_PMC", "Power Meter Capabilities", "Returns a list of Power Meter capabilities info"}, {"_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"}, {"_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"}, + {"_POL", "Polarity", "Interrupt polarity, Resource Descriptor field"}, {"_PPC", "Performance Present Capabilites", "Returns a list of the performance states currently supported by the platform"}, {"_PPE", "Polling for Platform Error", "Returns the polling interval to retrieve Corrected Platform Error information"}, + {"_PPI", "Pin Configuration", "Resource Descriptor field"}, {"_PR", "Processor", "Predefined scope for processor objects"}, {"_PR0", "Power Resources for D0", "Returns a list of dependent power resources to enter state D0 (fully on)"}, {"_PR1", "Power Resources for D1", "Returns a list of dependent power resources to enter state D1"}, {"_PR2", "Power Resources for D2", "Returns a list of dependent power resources to enter state D2"}, {"_PR3", "Power Resources for D3hot", "Returns a list of dependent power resources to enter state D3hot"}, + {"_PRE", "Power Resources for Enumeration", "Returns a list of dependent power resources to enumerate devices on a bus"}, {"_PRL", "Power Source Redundancy List", "Returns a list of power source devices in the same redundancy grouping"}, {"_PRS", "Possible Resource Settings", "Returns a list of a device's possible resource settings"}, {"_PRT", "Pci Routing Table", "Returns a list of PCI interrupt mappings"}, @@ -186,6 +211,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_PS3", "Power State 3", "Sets a device's power state to D3 (device off)"}, {"_PSC", "Power State Current", "Returns a device's current power state"}, {"_PSD", "Processor State Dependencies", "Returns processor P-State dependencies"}, + {"_PSE", "Power State for Enumeration", "Put a bus into enumeration power mode"}, {"_PSL", "Passive List", "Returns a list of passive cooling device objects"}, {"_PSR", "Power Source", "Returns the power source device currently in use"}, {"_PSS", "Performance Supported States", "Returns a list of supported processor performance states"}, @@ -207,6 +233,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_RT_", "Resource Type", "Resource Descriptor field"}, {"_RTV", "Relative Temperature Values", "Returns temperature value information"}, {"_RW_", "Read-Write Status", "Resource Descriptor field"}, + {"_RXL", "Receive Buffer Size", "Serial channel buffer, Resource Descriptor field"}, {"_S0_", "S0 System State", "Returns values to enter the system into the S0 state"}, {"_S1_", "S1 System State", "Returns values to enter the system into the S1 state"}, {"_S2_", "S2 System State", "Returns values to enter the system into the S2 state"}, @@ -232,15 +259,20 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_SI_", "System Indicators", "Predefined scope"}, {"_SIZ", "Size", "DMA transfer size, Resource Descriptor field"}, {"_SLI", "System Locality Information", "Returns a list of NUMA system localities"}, + {"_SLV", "Slave Mode", "Mode setting, Resource Descriptor field"}, {"_SPD", "Set Post Device", "Sets which video device will be posted at boot"}, + {"_SPE", "Speed", "Connection speed, Resource Descriptor field"}, {"_SRS", "Set Resource Settings", "Sets a device's resource allocation"}, + {"_SRT", "Set Real Time", "Interrupt triggering, Resource Descriptor field"}, {"_SRV", "IPMI Spec Revision", "See the Intelligent Platform Management Interface Specification"}, {"_SST", "System Status", "Sets the system status indicator"}, {"_STA", "Status", " (1) returns the current status of a device"}, + {"_STB", "Stop Bits", "Serial channel stop bits, Resource Descriptor field"}, {"_STM", "Set Timing Mode", "Sets an IDE controller transfer timings"}, {"_STP", "Set Expired Timer Wake Policy", "Sets expired timer policies of the wake alarm device"}, {"_STR", "String", "Returns a device's description string"}, {"_STV", "Set Timer Value", "Set timer values of the wake alarm device"}, + {"_SUB", "Subsystem ID", "Returns the subsystem ID for a device"}, {"_SUN", "Slot User Number", "Returns the slot unique ID number"}, {"_SWS", "System Wake Source", "Returns the source event that caused the system to wake"}, {"_T_x", "Temporary", "Reserved for use by ASL compilers"}, @@ -262,6 +294,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_TST", "Temperature Sensor Threshold", "Returns the minimum separation for a device's temperature trip points"}, {"_TTP", "Translation Type", "Translation/static flag, Resource Descriptor field"}, {"_TTS", "Transition To State", "Inform AML of an S-state transition"}, + {"_TXL", "Transmit Buffer Size", "Serial Channel buffer, Resource Descriptor field"}, {"_TYP", "Type", "DMA channel type (speed), Resource Descriptor field"}, {"_TZ_", "Thermal Zone", "Predefined scope: ACPI 1.0"}, {"_TZD", "Thermal Zone Devices", "Returns a list of device names associated with a Thermal Zone"}, @@ -271,6 +304,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_UPC", "USB Port Capabilities", "Returns a list of USB port capabilities"}, {"_UPD", "User Presence Detect", "Returns user detection information"}, {"_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"}, + {"_VEN", "Vendor Data", "Resource Descriptor field"}, {"_VPO", "Video Post Options", "Returns the implemented video post options"}, {"_WAK", "Wake", "Inform AML that the system has just awakened"}, {"_Wxx", "Wake Event", "Method executed as a result of a wake event"}, diff --git a/tools/acpisrc/asconvrt.c b/tools/acpisrc/asconvrt.c index 880acc6ce71f..e2a1d17510a9 100644 --- a/tools/acpisrc/asconvrt.c +++ b/tools/acpisrc/asconvrt.c @@ -577,7 +577,6 @@ void AsBracesOnSameLine ( char *Buffer) { - UINT32 Length; char *SubBuffer = Buffer; char *Beginning; char *StartOfThisLine; @@ -669,7 +668,6 @@ AsBracesOnSameLine ( { Beginning++; SubBuffer++; - Length = strlen (SubBuffer); Gbl_MadeChanges = TRUE; @@ -1243,7 +1241,6 @@ AsInsertPrefix ( char *SubString; char *SubBuffer; char *EndKeyword; - int StrLength; int InsertLength; char *InsertString; int TrailingSpaces; @@ -1279,7 +1276,6 @@ AsInsertPrefix ( /* Find an instance of the keyword */ SubString = strstr (SubBuffer, LowerKeyword); - if (!SubString) { return; @@ -1320,7 +1316,6 @@ AsInsertPrefix ( /* Prefix the keyword with the insert string */ Gbl_MadeChanges = TRUE; - StrLength = strlen (SubString); /* Is there room for insertion */ diff --git a/tools/acpisrc/astable.c b/tools/acpisrc/astable.c index b30f83ff3ae1..98468fd50c93 100644 --- a/tools/acpisrc/astable.c +++ b/tools/acpisrc/astable.c @@ -186,10 +186,12 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_BUFFER", SRC_TYPE_STRUCT}, {"ACPI_BUS_ATTRIBUTE", SRC_TYPE_STRUCT}, {"ACPI_CACHE_T", SRC_TYPE_SIMPLE}, + {"ACPI_CMTABLE_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_COMMON_FACS", SRC_TYPE_STRUCT}, {"ACPI_COMMON_STATE", SRC_TYPE_STRUCT}, {"ACPI_COMMON_DESCRIPTOR", SRC_TYPE_STRUCT}, {"ACPI_COMPATIBLE_ID", SRC_TYPE_STRUCT}, + {"ACPI_CONNECTION_INFO", SRC_TYPE_STRUCT}, {"ACPI_CONTROL_STATE", SRC_TYPE_STRUCT}, {"ACPI_CONVERSION_TABLE", SRC_TYPE_STRUCT}, {"ACPI_CPU_FLAGS", SRC_TYPE_SIMPLE}, @@ -212,6 +214,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_EVENT_TYPE", SRC_TYPE_SIMPLE}, {"ACPI_EXCEPTION_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_EXDUMP_INFO", SRC_TYPE_STRUCT}, + {"ACPI_EXECUTE_OP", SRC_TYPE_SIMPLE}, {"ACPI_EXECUTE_TYPE", SRC_TYPE_SIMPLE}, {"ACPI_EXECUTE_WALK", SRC_TYPE_STRUCT}, {"ACPI_EXTERNAL_LIST", SRC_TYPE_STRUCT}, @@ -222,6 +225,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_FIND_CONTEXT", SRC_TYPE_STRUCT}, {"ACPI_FIXED_EVENT_HANDLER", SRC_TYPE_STRUCT}, {"ACPI_FIXED_EVENT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GBL_EVENT_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_GENERIC_ADDRESS", SRC_TYPE_STRUCT}, {"ACPI_GENERIC_STATE", SRC_TYPE_UNION}, {"ACPI_GET_DEVICES_INFO", SRC_TYPE_STRUCT}, @@ -238,12 +242,14 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_HANDLE", SRC_TYPE_SIMPLE}, {"ACPI_HANDLER_INFO", SRC_TYPE_STRUCT}, {"ACPI_INIT_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_INTERFACE_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_IDENTIFIER_TABLE", SRC_TYPE_STRUCT}, {"ACPI_INIT_WALK_INFO", SRC_TYPE_STRUCT}, {"ACPI_INTEGER", SRC_TYPE_SIMPLE}, {"ACPI_INTEGER_OVERLAY", SRC_TYPE_STRUCT}, {"ACPI_INTEGRITY_INFO", SRC_TYPE_STRUCT}, {"ACPI_INTERFACE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_INTERNAL_METHOD", SRC_TYPE_SIMPLE}, {"ACPI_INTERPRETER_MODE", SRC_TYPE_SIMPLE}, {"ACPI_IO_ADDRESS", SRC_TYPE_SIMPLE}, {"ACPI_IO_ATTRIBUTE", SRC_TYPE_STRUCT}, @@ -318,6 +324,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_PKG_CALLBACK", SRC_TYPE_SIMPLE}, {"ACPI_PKG_INFO", SRC_TYPE_STRUCT}, {"ACPI_PKG_STATE", SRC_TYPE_STRUCT}, + {"ACPI_PMTT_HEADER", SRC_TYPE_STRUCT}, {"ACPI_POINTER", SRC_TYPE_STRUCT}, {"ACPI_POINTERS", SRC_TYPE_UNION}, {"ACPI_PORT_INFO", SRC_TYPE_STRUCT}, @@ -328,28 +335,35 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_REPAIR_FUNCTION", SRC_TYPE_SIMPLE}, {"ACPI_REPAIR_INFO", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_RESOURCE_ADDRESS", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_ADDRESS16", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_ADDRESS32", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_ADDRESS64", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_COMMON_SERIALBUS", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_EXTENDED_ADDRESS64", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_ATTRIBUTE", SRC_TYPE_UNION}, {"ACPI_RESOURCE_DATA", SRC_TYPE_UNION}, {"ACPI_RESOURCE_DMA", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_END_TAG", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_EXTENDED_IRQ", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_FIXED_DMA", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_FIXED_IO", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_FIXED_MEMORY32", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_GENERIC_REGISTER", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_GPIO", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_I2C_SERIALBUS", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_INFO", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_IO", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_IRQ", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_MEMORY24", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_MEMORY32", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_SOURCE", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_SPI_SERIALBUS", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_START_DEPENDENT", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_TAG", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_RESOURCE_UART_SERIALBUS", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_VENDOR", SRC_TYPE_STRUCT}, {"ACPI_RESOURCE_VENDOR_TYPED", SRC_TYPE_STRUCT}, {"ACPI_RESULT_VALUES", SRC_TYPE_STRUCT}, @@ -357,6 +371,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_RSCONVERT_INFO", SRC_TYPE_STRUCT}, {"ACPI_RSDUMP_INFO", SRC_TYPE_STRUCT}, {"ACPI_RW_LOCK", SRC_TYPE_STRUCT}, + {"ACPI_S3PT_HEADER", SRC_TYPE_STRUCT}, {"ACPI_SCOPE_STATE", SRC_TYPE_STRUCT}, {"ACPI_SEMAPHORE", SRC_TYPE_SIMPLE}, {"ACPI_SIGNAL_FATAL_INFO", SRC_TYPE_STRUCT}, @@ -399,23 +414,29 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"AML_RESOURCE_ADDRESS16", SRC_TYPE_STRUCT}, {"AML_RESOURCE_ADDRESS32", SRC_TYPE_STRUCT}, {"AML_RESOURCE_ADDRESS64", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_COMMON_SERIALBUS", SRC_TYPE_STRUCT}, {"AML_RESOURCE_DMA", SRC_TYPE_STRUCT}, {"AML_RESOURCE_END_DEPENDENT", SRC_TYPE_STRUCT}, {"AML_RESOURCE_END_TAG", SRC_TYPE_STRUCT}, {"AML_RESOURCE_EXTENDED_ADDRESS64", SRC_TYPE_STRUCT}, {"AML_RESOURCE_EXTENDED_IRQ", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_FIXED_DMA", SRC_TYPE_STRUCT}, {"AML_RESOURCE_FIXED_IO", SRC_TYPE_STRUCT}, {"AML_RESOURCE_FIXED_MEMORY32", SRC_TYPE_STRUCT}, {"AML_RESOURCE_GENERIC_REGISTER", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_GPIO", SRC_TYPE_STRUCT}, {"AML_RESOURCE_IO", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_I2C_SERIALBUS", SRC_TYPE_STRUCT}, {"AML_RESOURCE_IRQ", SRC_TYPE_STRUCT}, {"AML_RESOURCE_IRQ_NOFLAGS", SRC_TYPE_STRUCT}, {"AML_RESOURCE_LARGE_HEADER", SRC_TYPE_STRUCT}, {"AML_RESOURCE_MEMORY24", SRC_TYPE_STRUCT}, {"AML_RESOURCE_MEMORY32", SRC_TYPE_STRUCT}, {"AML_RESOURCE_SMALL_HEADER", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_SPI_SERIALBUS", SRC_TYPE_STRUCT}, {"AML_RESOURCE_START_DEPENDENT", SRC_TYPE_STRUCT}, {"AML_RESOURCE_START_DEPENDENT_NOPRIO", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_UART_SERIALBUS", SRC_TYPE_STRUCT}, {"AML_RESOURCE_VENDOR_LARGE", SRC_TYPE_STRUCT}, {"AML_RESOURCE_VENDOR_SMALL", SRC_TYPE_STRUCT}, @@ -423,11 +444,13 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ARGUMENT_INFO", SRC_TYPE_STRUCT}, {"AE_DEBUG_REGIONS", SRC_TYPE_STRUCT}, {"AE_REGION", SRC_TYPE_STRUCT}, + {"AE_TABLE_DESC", SRC_TYPE_STRUCT}, {"ASL_ANALYSIS_WALK_INFO", SRC_TYPE_STRUCT}, {"ASL_ERROR_MSG", SRC_TYPE_STRUCT}, {"ASL_EVENT_INFO", SRC_TYPE_STRUCT}, {"ASL_FILE_INFO", SRC_TYPE_STRUCT}, {"ASL_FILE_STATUS", SRC_TYPE_STRUCT}, + {"ASL_INCLUDE_DIR", SRC_TYPE_STRUCT}, {"ASL_LISTING_NODE", SRC_TYPE_STRUCT}, {"ASL_MAPPING_ENTRY", SRC_TYPE_STRUCT}, {"ASL_METHOD_INFO", SRC_TYPE_STRUCT}, @@ -443,15 +466,18 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { */ {"ACPI_TABLE_ASF", SRC_TYPE_STRUCT}, {"ACPI_TABLE_BERT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_BGRT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_BOOT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_CPEP", SRC_TYPE_STRUCT}, {"ACPI_TABLE_DBGP", SRC_TYPE_STRUCT}, {"ACPI_TABLE_DMAR", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_DRTM", SRC_TYPE_STRUCT}, {"ACPI_TABLE_ECDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_EINJ", SRC_TYPE_STRUCT}, {"ACPI_TABLE_ERST", SRC_TYPE_STRUCT}, {"ACPI_TABLE_FACS", SRC_TYPE_STRUCT}, {"ACPI_TABLE_FADT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_FPDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_HEST", SRC_TYPE_STRUCT}, {"ACPI_TABLE_HPET", SRC_TYPE_STRUCT}, {"ACPI_TABLE_IBFT", SRC_TYPE_STRUCT}, @@ -459,10 +485,15 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_MADT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_MCFG", SRC_TYPE_STRUCT}, {"ACPI_TABLE_MCHI", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_MPST", SRC_TYPE_STRUCT}, {"ACPI_TABLE_MSCT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_PCCT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_RSDP", SRC_TYPE_STRUCT}, {"ACPI_TABLE_RSDT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_MCHI", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_S3PT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_SBST", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_SLIC", SRC_TYPE_STRUCT}, {"ACPI_TABLE_SLIT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_SPCR", SRC_TYPE_STRUCT}, {"ACPI_TABLE_SPMI", SRC_TYPE_STRUCT}, @@ -471,6 +502,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_UEFI", SRC_TYPE_STRUCT}, {"ACPI_TABLE_WAET", SRC_TYPE_STRUCT}, {"ACPI_TABLE_WDAT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_WDDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_WDRT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_XSDT", SRC_TYPE_STRUCT}, @@ -492,6 +524,9 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_DMAR_RESERVED_MEMORY", SRC_TYPE_STRUCT}, {"ACPI_EINJ_ENTRY", SRC_TYPE_STRUCT}, {"ACPI_EINJ_TRIGGER", SRC_TYPE_STRUCT}, + {"ACPI_FPDT_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_FPDT_BOOT", SRC_TYPE_STRUCT}, + {"ACPI_FPDT_S3PT_PTR", SRC_TYPE_STRUCT}, {"ACPI_ERST_ENTRY", SRC_TYPE_STRUCT}, {"ACPI_ERST_INFO", SRC_TYPE_STRUCT}, {"ACPI_HEST_AER_COMMON", SRC_TYPE_STRUCT}, @@ -530,14 +565,27 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_MADT_LOCAL_SAPIC", SRC_TYPE_STRUCT}, {"ACPI_MADT_LOCAL_X2APIC", SRC_TYPE_STRUCT}, {"ACPI_MADT_LOCAL_X2APIC_NMI", SRC_TYPE_STRUCT}, + {"ACPI_MADT_GENERIC_DISTRIBUTOR", SRC_TYPE_STRUCT}, + {"ACPI_MADT_GENERIC_INTERRUPT", SRC_TYPE_STRUCT}, {"ACPI_MADT_INTERRUPT_OVERRIDE", SRC_TYPE_STRUCT}, {"ACPI_MADT_INTERRUPT_SOURCE", SRC_TYPE_STRUCT}, {"ACPI_MADT_NMI_SOURCE", SRC_TYPE_STRUCT}, {"ACPI_MADT_PROCESSOR_APIC", SRC_TYPE_STRUCT}, + {"ACPI_MPST_COMPONENT", SRC_TYPE_STRUCT}, + {"ACPI_MPST_DATA_HDR", SRC_TYPE_STRUCT}, + {"ACPI_MPST_POWER_DATA", SRC_TYPE_STRUCT}, + {"ACPI_MPST_POWER_NODE", SRC_TYPE_STRUCT}, + {"ACPI_MPST_POWER_STATE", SRC_TYPE_STRUCT}, {"ACPI_MCFG_ALLOCATION", SRC_TYPE_STRUCT}, {"ACPI_MSCT_PROXIMITY", SRC_TYPE_STRUCT}, + {"ACPI_PCCT_SUBSPACE", SRC_TYPE_STRUCT}, {"ACPI_RSDP_COMMON", SRC_TYPE_STRUCT}, {"ACPI_RSDP_EXTENSION", SRC_TYPE_STRUCT}, + {"ACPI_S3PT_RESUME", SRC_TYPE_STRUCT}, + {"ACPI_S3PT_SUSPEND", SRC_TYPE_STRUCT}, + {"ACPI_SLIC_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_SLIC_KEY", SRC_TYPE_STRUCT}, + {"ACPI_SLIC_MARKER", SRC_TYPE_STRUCT}, {"ACPI_SRAT_CPU_AFFINITY", SRC_TYPE_STRUCT}, {"ACPI_SRAT_HEADER", SRC_TYPE_STRUCT}, {"ACPI_SRAT_MEM_AFFINITY", SRC_TYPE_STRUCT}, @@ -548,6 +596,18 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"DT_FIELD", SRC_TYPE_STRUCT}, {"DT_SUBTABLE", SRC_TYPE_STRUCT}, + {"DT_WALK_CALLBACK", SRC_TYPE_SIMPLE}, + + /* AcpiHelp utility */ + + {"AH_AML_OPCODE", SRC_TYPE_STRUCT}, + {"AH_ASL_OPERATOR", SRC_TYPE_STRUCT}, + {"AH_ASL_KEYWORD", SRC_TYPE_STRUCT}, + {"AH_PREDEFINED_NAME", SRC_TYPE_STRUCT}, + + /* AcpiXtract utility */ + + {"AX_TABLE_INFO", SRC_TYPE_STRUCT}, {NULL, 0} }; diff --git a/utilities/utdecode.c b/utilities/utdecode.c index feca6c725c93..85a122b26125 100644 --- a/utilities/utdecode.c +++ b/utilities/utdecode.c @@ -187,7 +187,9 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = "SMBus", "SystemCMOS", "PCIBARTarget", - "IPMI" + "IPMI", + "GeneralPurposeIo", + "GenericSerialBus" }; diff --git a/utilities/utmutex.c b/utilities/utmutex.c index f7af803de1e3..8b2f2f70d851 100644 --- a/utilities/utmutex.c +++ b/utilities/utmutex.c @@ -335,15 +335,10 @@ ACPI_STATUS AcpiUtReleaseMutex ( ACPI_MUTEX_HANDLE MutexId) { - ACPI_THREAD_ID ThisThreadId; - - ACPI_FUNCTION_NAME (UtReleaseMutex); - - ThisThreadId = AcpiOsGetThreadId (); ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", - (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); + (UINT32) AcpiOsGetThreadId (), AcpiUtGetMutexName (MutexId))); if (MutexId > ACPI_MAX_MUTEX) { @@ -374,7 +369,7 @@ AcpiUtReleaseMutex ( */ for (i = MutexId; i < ACPI_NUM_MUTEX; i++) { - if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId) + if (AcpiGbl_MutexInfo[i].ThreadId == AcpiOsGetThreadId ()) { if (i == MutexId) { diff --git a/utilities/utresrc.c b/utilities/utresrc.c index 468ffd6a1a1c..8e9b3707f848 100644 --- a/utilities/utresrc.c +++ b/utilities/utresrc.c @@ -46,7 +46,7 @@ #include "acpi.h" #include "accommon.h" -#include "amlresrc.h" +#include "acresrc.h" #define _COMPONENT ACPI_UTILITIES @@ -179,6 +179,154 @@ const char *AcpiGbl_TypDecode[] = "TypeF" }; +const char *AcpiGbl_PpcDecode[] = +{ + "PullDefault", + "PullUp", + "PullDown", + "PullNone" +}; + +const char *AcpiGbl_IorDecode[] = +{ + "IoRestrictionNone", + "IoRestrictionInputOnly", + "IoRestrictionOutputOnly", + "IoRestrictionNoneAndPreserve" +}; + +const char *AcpiGbl_DtsDecode[] = +{ + "Width8bit", + "Width16bit", + "Width32bit", + "Width64bit", + "Width128bit", + "Width256bit", +}; + +/* GPIO connection type */ + +const char *AcpiGbl_CtDecode[] = +{ + "Interrupt", + "I/O" +}; + +/* Serial bus type */ + +const char *AcpiGbl_SbtDecode[] = +{ + "/* UNKNOWN serial bus type */", + "I2C", + "SPI", + "UART" +}; + +/* I2C serial bus access mode */ + +const char *AcpiGbl_AmDecode[] = +{ + "AddressingMode7Bit", + "AddressingMode10Bit" +}; + +/* I2C serial bus slave mode */ + +const char *AcpiGbl_SmDecode[] = +{ + "ControllerInitiated", + "DeviceInitiated" +}; + +/* SPI serial bus wire mode */ + +const char *AcpiGbl_WmDecode[] = +{ + "FourWireMode", + "ThreeWireMode" +}; + +/* SPI serial clock phase */ + +const char *AcpiGbl_CphDecode[] = +{ + "ClockPhaseFirst", + "ClockPhaseSecond" +}; + +/* SPI serial bus clock polarity */ + +const char *AcpiGbl_CpoDecode[] = +{ + "ClockPolarityLow", + "ClockPolarityHigh" +}; + +/* SPI serial bus device polarity */ + +const char *AcpiGbl_DpDecode[] = +{ + "PolarityLow", + "PolarityHigh" +}; + +/* UART serial bus endian */ + +const char *AcpiGbl_EdDecode[] = +{ + "LittleEndian", + "BigEndian" +}; + +/* UART serial bus bits per byte */ + +const char *AcpiGbl_BpbDecode[] = +{ + "DataBitsFive", + "DataBitsSix", + "DataBitsSeven", + "DataBitsEight", + "DataBitsNine", + "/* UNKNOWN Bits per byte */", + "/* UNKNOWN Bits per byte */", + "/* UNKNOWN Bits per byte */" +}; + +/* UART serial bus stop bits */ + +const char *AcpiGbl_SbDecode[] = +{ + "StopBitsNone", + "StopBitsOne", + "StopBitsOnePlusHalf", + "StopBitsTwo" +}; + +/* UART serial bus flow control */ + +const char *AcpiGbl_FcDecode[] = +{ + "FlowControlNone", + "FlowControlHardware", + "FlowControlXON", + "/* UNKNOWN flow control keyword */" +}; + +/* UART serial bus parity type */ + +const char *AcpiGbl_PtDecode[] = +{ + "ParityTypeNone", + "ParityTypeEven", + "ParityTypeOdd", + "ParityTypeMark", + "ParityTypeSpace", + "/* UNKNOWN parity keyword */", + "/* UNKNOWN parity keyword */", + "/* UNKNOWN parity keyword */" +}; + #endif @@ -200,7 +348,7 @@ const UINT8 AcpiGbl_ResourceAmlSizes[] = ACPI_AML_SIZE_SMALL (AML_RESOURCE_END_DEPENDENT), ACPI_AML_SIZE_SMALL (AML_RESOURCE_IO), ACPI_AML_SIZE_SMALL (AML_RESOURCE_FIXED_IO), - 0, + ACPI_AML_SIZE_SMALL (AML_RESOURCE_FIXED_DMA), 0, 0, 0, @@ -220,7 +368,18 @@ const UINT8 AcpiGbl_ResourceAmlSizes[] = ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS16), ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_IRQ), ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS64), - ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64) + ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO), + 0, + ACPI_AML_SIZE_LARGE (AML_RESOURCE_COMMON_SERIALBUS), +}; + +const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[] = +{ + 0, + ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS), }; @@ -238,35 +397,49 @@ static const UINT8 AcpiGbl_ResourceTypes[] = 0, 0, 0, - ACPI_SMALL_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_SMALL_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, - 0, + ACPI_SMALL_VARIABLE_LENGTH, /* 04 IRQ */ + ACPI_FIXED_LENGTH, /* 05 DMA */ + ACPI_SMALL_VARIABLE_LENGTH, /* 06 StartDependentFunctions */ + ACPI_FIXED_LENGTH, /* 07 EndDependentFunctions */ + ACPI_FIXED_LENGTH, /* 08 IO */ + ACPI_FIXED_LENGTH, /* 09 FixedIO */ + ACPI_FIXED_LENGTH, /* 0A FixedDMA */ 0, 0, 0, - ACPI_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, + ACPI_VARIABLE_LENGTH, /* 0E VendorShort */ + ACPI_FIXED_LENGTH, /* 0F EndTag */ /* Large descriptors */ 0, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, + ACPI_FIXED_LENGTH, /* 01 Memory24 */ + ACPI_FIXED_LENGTH, /* 02 GenericRegister */ + 0, + ACPI_VARIABLE_LENGTH, /* 04 VendorLong */ + ACPI_FIXED_LENGTH, /* 05 Memory32 */ + ACPI_FIXED_LENGTH, /* 06 Memory32Fixed */ + ACPI_VARIABLE_LENGTH, /* 07 Dword* address */ + ACPI_VARIABLE_LENGTH, /* 08 Word* address */ + ACPI_VARIABLE_LENGTH, /* 09 ExtendedIRQ */ + ACPI_VARIABLE_LENGTH, /* 0A Qword* address */ + ACPI_FIXED_LENGTH, /* 0B Extended* address */ + ACPI_VARIABLE_LENGTH, /* 0C Gpio* */ 0, - ACPI_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH + ACPI_VARIABLE_LENGTH /* 0E *SerialBus */ }; +/* + * For the iASL compiler/disassembler, we don't want any error messages + * because the disassembler uses the resource validation code to determine + * if Buffer objects are actually Resource Templates. + */ +#ifdef ACPI_ASL_COMPILER +#define ACPI_RESOURCE_ERROR(plist) +#else +#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist) +#endif + /******************************************************************************* * @@ -297,6 +470,7 @@ AcpiUtWalkAmlResources ( UINT8 ResourceIndex; UINT32 Length; UINT32 Offset = 0; + UINT8 EndTag[2] = {0x79, 0x00}; ACPI_FUNCTION_TRACE (UtWalkAmlResources); @@ -322,6 +496,10 @@ AcpiUtWalkAmlResources ( Status = AcpiUtValidateResource (Aml, &ResourceIndex); if (ACPI_FAILURE (Status)) { + /* + * Exit on failure. Cannot continue because the descriptor length + * may be bogus also. + */ return_ACPI_STATUS (Status); } @@ -336,7 +514,7 @@ AcpiUtWalkAmlResources ( Status = UserFunction (Aml, Length, Offset, ResourceIndex, Context); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } @@ -371,7 +549,19 @@ AcpiUtWalkAmlResources ( /* Did not find an EndTag descriptor */ - return (AE_AML_NO_RESOURCE_END_TAG); + if (UserFunction) + { + /* Insert an EndTag anyway. AcpiRsGetListLength always leaves room */ + + (void) AcpiUtValidateResource (EndTag, &ResourceIndex); + Status = UserFunction (EndTag, 2, Offset, ResourceIndex, Context); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } @@ -396,6 +586,7 @@ AcpiUtValidateResource ( void *Aml, UINT8 *ReturnIndex) { + AML_RESOURCE *AmlResource; UINT8 ResourceType; UINT8 ResourceIndex; ACPI_RS_LENGTH ResourceLength; @@ -420,7 +611,7 @@ AcpiUtValidateResource ( if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX) { - return (AE_AML_INVALID_RESOURCE_TYPE); + goto InvalidResource; } /* @@ -439,17 +630,18 @@ AcpiUtValidateResource ( ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); } - /* Check validity of the resource type, zero indicates name is invalid */ - + /* + * Check validity of the resource type, via AcpiGbl_ResourceTypes. Zero + * indicates an invalid resource. + */ if (!AcpiGbl_ResourceTypes[ResourceIndex]) { - return (AE_AML_INVALID_RESOURCE_TYPE); + goto InvalidResource; } - /* - * 2) Validate the ResourceLength field. This ensures that the length - * is at least reasonable, and guarantees that it is non-zero. + * Validate the ResourceLength field. This ensures that the length + * is at least reasonable, and guarantees that it is non-zero. */ ResourceLength = AcpiUtGetResourceLength (Aml); MinimumResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex]; @@ -464,7 +656,7 @@ AcpiUtValidateResource ( if (ResourceLength != MinimumResourceLength) { - return (AE_AML_BAD_RESOURCE_LENGTH); + goto BadResourceLength; } break; @@ -474,7 +666,7 @@ AcpiUtValidateResource ( if (ResourceLength < MinimumResourceLength) { - return (AE_AML_BAD_RESOURCE_LENGTH); + goto BadResourceLength; } break; @@ -485,7 +677,7 @@ AcpiUtValidateResource ( if ((ResourceLength > MinimumResourceLength) || (ResourceLength < (MinimumResourceLength - 1))) { - return (AE_AML_BAD_RESOURCE_LENGTH); + goto BadResourceLength; } break; @@ -493,7 +685,22 @@ AcpiUtValidateResource ( /* Shouldn't happen (because of validation earlier), but be sure */ - return (AE_AML_INVALID_RESOURCE_TYPE); + goto InvalidResource; + } + + AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml); + if (ResourceType == ACPI_RESOURCE_NAME_SERIAL_BUS) + { + /* Validate the BusType field */ + + if ((AmlResource->CommonSerialBus.Type == 0) || + (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)) + { + ACPI_RESOURCE_ERROR ((AE_INFO, + "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", + AmlResource->CommonSerialBus.Type)); + return (AE_AML_INVALID_RESOURCE_TYPE); + } } /* Optionally return the resource table index */ @@ -504,6 +711,22 @@ AcpiUtValidateResource ( } return (AE_OK); + + +InvalidResource: + + ACPI_RESOURCE_ERROR ((AE_INFO, + "Invalid/unsupported resource descriptor: Type 0x%2.2X", + ResourceType)); + return (AE_AML_INVALID_RESOURCE_TYPE); + +BadResourceLength: + + ACPI_RESOURCE_ERROR ((AE_INFO, + "Invalid resource descriptor length: Type " + "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", + ResourceType, ResourceLength, MinimumResourceLength)); + return (AE_AML_BAD_RESOURCE_LENGTH); } diff --git a/utilities/utxfmutex.c b/utilities/utxfmutex.c new file mode 100644 index 000000000000..ef962b1874cc --- /dev/null +++ b/utilities/utxfmutex.c @@ -0,0 +1,213 @@ +/******************************************************************************* + * + * Module Name: utxfmutex - external AML mutex access functions + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#define __UTXFMUTEX_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utxfmutex") + + +/* Local prototypes */ + +static ACPI_STATUS +AcpiUtGetMutexObject ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname, + ACPI_OPERAND_OBJECT **RetObj); + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetMutexObject + * + * PARAMETERS: Handle - Mutex or prefix handle (optional) + * Pathname - Mutex pathname (optional) + * RetObj - Where the mutex object is returned + * + * RETURN: Status + * + * DESCRIPTION: Get an AML mutex object. The mutex node is pointed to by + * Handle:Pathname. Either Handle or Pathname can be NULL, but + * not both. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtGetMutexObject ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname, + ACPI_OPERAND_OBJECT **RetObj) +{ + ACPI_NAMESPACE_NODE *MutexNode; + ACPI_OPERAND_OBJECT *MutexObj; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!RetObj || (!Handle && !Pathname)) + { + return (AE_BAD_PARAMETER); + } + + /* Get a the namespace node for the mutex */ + + MutexNode = Handle; + if (Pathname != NULL) + { + Status = AcpiGetHandle (Handle, Pathname, + ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode)); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* Ensure that we actually have a Mutex object */ + + if (!MutexNode || + (MutexNode->Type != ACPI_TYPE_MUTEX)) + { + return (AE_TYPE); + } + + /* Get the low-level mutex object */ + + MutexObj = AcpiNsGetAttachedObject (MutexNode); + if (!MutexObj) + { + return (AE_NULL_OBJECT); + } + + *RetObj = MutexObj; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiAcquireMutex + * + * PARAMETERS: Handle - Mutex or prefix handle (optional) + * Pathname - Mutex pathname (optional) + * Timeout - Max time to wait for the lock (millisec) + * + * RETURN: Status + * + * DESCRIPTION: Acquire an AML mutex. This is a device driver interface to + * AML mutex objects, and allows for transaction locking between + * drivers and AML code. The mutex node is pointed to by + * Handle:Pathname. Either Handle or Pathname can be NULL, but + * not both. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiAcquireMutex ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname, + UINT16 Timeout) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *MutexObj; + + + /* Get the low-level mutex associated with Handle:Pathname */ + + Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Acquire the OS mutex */ + + Status = AcpiOsAcquireMutex (MutexObj->Mutex.OsMutex, Timeout); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiReleaseMutex + * + * PARAMETERS: Handle - Mutex or prefix handle (optional) + * Pathname - Mutex pathname (optional) + * + * RETURN: Status + * + * DESCRIPTION: Release an AML mutex. This is a device driver interface to + * AML mutex objects, and allows for transaction locking between + * drivers and AML code. The mutex node is pointed to by + * Handle:Pathname. Either Handle or Pathname can be NULL, but + * not both. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiReleaseMutex ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *MutexObj; + + + /* Get the low-level mutex associated with Handle:Pathname */ + + Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Release the OS mutex */ + + AcpiOsReleaseMutex (MutexObj->Mutex.OsMutex); + return (AE_OK); +} |