From 4a5720e5f30ea6a8d31e75f94046c76ace845126 Mon Sep 17 00:00:00 2001 From: jkim Date: Mon, 29 Sep 2014 19:53:38 +0000 Subject: Import ACPICA 20140926. --- changes.txt | 73 ++- generate/unix/acpiexamples/Makefile | 2 +- generate/unix/acpiexec/Makefile | 1 + generate/unix/iasl/Makefile | 6 +- source/common/adisasm.c | 11 +- source/common/ahids.c | 22 + source/compiler/aslcompile.c | 4 + source/compiler/aslcompiler.h | 113 ++-- source/compiler/asldefine.h | 1 + source/compiler/aslglobal.h | 9 +- source/compiler/aslload.c | 30 +- source/compiler/aslmain.c | 2 +- source/compiler/aslmapenter.c | 346 +++++++++++ source/compiler/aslmapoutput.c | 661 ++++++++++++++++++++ source/compiler/aslmaputils.c | 402 ++++++++++++ source/compiler/aslopcodes.c | 5 +- source/compiler/asloptions.c | 7 + source/compiler/aslparser.y | 8 +- source/compiler/aslresource.c | 145 ++--- source/compiler/aslrestype1.c | 102 ++- source/compiler/aslrestype1i.c | 80 ++- source/compiler/aslrestype2.c | 41 +- source/compiler/aslrestype2d.c | 51 +- source/compiler/aslrestype2e.c | 54 +- source/compiler/aslrestype2q.c | 51 +- source/compiler/aslrestype2s.c | 79 +-- source/compiler/aslrestype2w.c | 51 +- source/compiler/aslsupport.y | 19 +- source/compiler/asltree.c | 1 - source/compiler/asltypes.h | 36 +- source/compiler/aslxref.c | 27 +- source/compiler/dtcompile.c | 5 +- source/compiler/dtsubtable.c | 4 +- source/components/disassembler/dmbuffer.c | 4 + source/components/disassembler/dmopcode.c | 2 + source/components/disassembler/dmresrc.c | 9 +- source/components/disassembler/dmresrcl.c | 40 +- source/components/disassembler/dmresrcl2.c | 80 ++- source/components/disassembler/dmresrcs.c | 32 +- source/components/dispatcher/dsfield.c | 2 + source/components/events/evgpeinit.c | 4 + source/components/events/evregion.c | 46 +- source/components/events/evxface.c | 3 +- source/components/events/evxfevnt.c | 41 +- source/components/executer/exfield.c | 68 ++ source/components/executer/exprep.c | 2 + source/components/hardware/hwgpe.c | 8 + source/components/tables/tbxfroot.c | 37 ++ source/include/acdisasm.h | 22 + source/include/aclocal.h | 1 + source/include/acnames.h | 1 + source/include/acobject.h | 1 + source/include/acpixf.h | 2 +- source/include/actables.h | 4 + source/include/actypes.h | 18 +- source/include/amlresrc.h | 54 ++ source/os_specific/service_layers/osunixxf.c | 9 + source/tools/acpidump/apdump.c | 2 +- source/tools/acpiexec/aecommon.h | 17 + source/tools/acpiexec/aehandlers.c | 803 +----------------------- source/tools/acpiexec/aemain.c | 21 + source/tools/acpiexec/aeregion.c | 894 +++++++++++++++++++++++++++ source/tools/acpisrc/astable.c | 3 + 63 files changed, 3355 insertions(+), 1324 deletions(-) create mode 100644 source/compiler/aslmapenter.c create mode 100644 source/compiler/aslmapoutput.c create mode 100644 source/compiler/aslmaputils.c create mode 100644 source/tools/acpiexec/aeregion.c diff --git a/changes.txt b/changes.txt index 89d2628..1c2b1ed 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,71 @@ ---------------------------------------- +26 September 2014. Summary of changes for version 20140926: + +1) ACPICA kernel-resident subsystem: + +Updated the GPIO operation region handler interface (GeneralPurposeIo). +In order to support GPIO Connection objects with multiple pins, along +with the related Field objects, the following changes to the interface +have been made: The Address is now defined to be the offset in bits of +the field unit from the previous invocation of a Connection. It can be +viewed as a "Pin Number Index" into the connection resource descriptor. +The BitWidth is the exact bit width of the field. It is usually one bit, +but not always. See the ACPICA reference guide (section 8.8.6.2.1) for +additional information and examples. + +GPE support: During ACPICA/GPE initialization, ensure that all GPEs with +corresponding _Lxx/_Exx methods are disabled (they may have been enabled +by the firmware), so that they cannot fire until they are enabled via +AcpiUpdateAllGpes. Rafael J. Wysocki. + +Added a new return flag for the Event/GPE status interfaces -- +AcpiGetEventStatus and AcpiGetGpeStatus. The new +ACPI_EVENT_FLAGS_HAS_HANDLER flag is used to indicate that the event or +GPE currently has a handler associated with it, and can thus actually +affect the system. Lv Zheng. + +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. + + Current Release: + Non-Debug Version: 99.1K Code, 27.3K Data, 126.4K Total + Debug Version: 192.8K Code, 79.9K Data, 272.7K Total + Previous Release: + Non-Debug Version: 98.8K Code, 27.3K Data, 126.1K Total + Debug Version: 192.1K Code, 79.8K Data, 271.9K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a memory allocation/free regression introduced in 20140828 +that could cause the compiler to crash. This was introduced inadvertently +during the effort to eliminate compiler memory leaks. ACPICA BZ 1111, +1113. + +iASL: Removed two error messages that have been found to create false +positives, until they can be fixed and fully validated (ACPICA BZ 1112): +1) Illegal forward reference within a method +2) Illegal reference across two methods + +iASL: Implemented a new option (-lm) to create a hardware mapping file +that summarizes all GPIO, I2C, SPI, and UART connections. This option +works for both the compiler and disassembler. See the iASL compiler user +guide for additional information and examples (section 6.4.6). + +AcpiDump: Added support for the version 1 (ACPI 1.0) RSDP in addition to +version 2. This corrects the AE_BAD_HEADER exception seen on systems with +a version 1 RSDP. Lv Zheng ACPICA BZ 1097. + +AcpiExec: For Unix versions, don't attempt to put STDIN into raw mode +unless STDIN is actually a terminal. Assists with batch-mode processing. +ACPICA BZ 1114. + +Disassembler/AcpiHelp: Added another large group of recognized _HID +values. + + +---------------------------------------- 28 August 2014. Summary of changes for version 20140828: 1) ACPICA kernel-resident subsystem: @@ -37,8 +104,10 @@ Memory24 resource descriptor. There was a boundary condition when the range was equal to the (length -1) caused by the fact that these values are defined in 256-byte blocks, not bytes. ACPICA BZ 1098 -Disassembler: Fixed a problem with the GpioInt descriptor interrupt polarity -flags. The flags are actually 2 bits, not 1, and the "ActiveBoth" keyword is +Disassembler: Fixed a problem with the GpioInt descriptor interrupt +polarity +flags. The flags are actually 2 bits, not 1, and the "ActiveBoth" keyword +is now supported properly. ACPI 5.1: Added the GICC affinity subtable to the SRAT table. Supported diff --git a/generate/unix/acpiexamples/Makefile b/generate/unix/acpiexamples/Makefile index 4583143..b404b54 100644 --- a/generate/unix/acpiexamples/Makefile +++ b/generate/unix/acpiexamples/Makefile @@ -162,7 +162,7 @@ OBJECTS = \ # CFLAGS += \ -DACPI_EXAMPLE_APP\ - -I$(EXAMPLES) + -I$(ACPIEXAMPLES) # # Common Rules diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 8d7facf..1054d29 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -43,6 +43,7 @@ OBJECTS = \ $(OBJDIR)/aeexec.o\ $(OBJDIR)/aehandlers.o\ $(OBJDIR)/aemain.o\ + $(OBJDIR)/aeregion.o\ $(OBJDIR)/aetables.o\ $(OBJDIR)/ahids.o\ $(OBJDIR)/ahuuids.o\ diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index f4b6ef3..59d5f52 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -66,6 +66,9 @@ OBJECTS = \ $(OBJDIR)/asllookup.o\ $(OBJDIR)/aslmain.o\ $(OBJDIR)/aslmap.o\ + $(OBJDIR)/aslmapenter.o\ + $(OBJDIR)/aslmapoutput.o\ + $(OBJDIR)/aslmaputils.o\ $(OBJDIR)/aslmessages.o\ $(OBJDIR)/aslmethod.o\ $(OBJDIR)/aslnamesp.o\ @@ -228,6 +231,7 @@ MISC = \ ASL_PARSER = \ $(ASL_COMPILER)/aslparser.y\ + $(ASL_COMPILER)/aslsupport.y\ $(ASL_COMPILER)/asltokens.y\ $(ASL_COMPILER)/asltypes.y\ $(ASL_COMPILER)/aslrules.y @@ -254,7 +258,7 @@ include ../Makefile.rules # # Macro processing for iASL .y files # -$(OBJDIR)/aslcompiler.y : $(ASL_PARSER) +$(OBJDIR)/aslcompiler.y : $(ASL_PARSER) $(MACROPROC) $(MFLAGS) $(ASL_COMPILER)/aslparser.y > $(OBJDIR)/aslcompiler.y # diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 8deaee7e..3a742b1 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -128,7 +128,7 @@ AcpiDsMethodDataInitArgs ( static ACPI_TABLE_DESC LocalTables[1]; -static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; +ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; /******************************************************************************* @@ -489,6 +489,14 @@ AdAmlDisassemble ( fprintf (stderr, "Disassembly completed\n"); fprintf (stderr, "ASL Output: %s - %u bytes\n", DisasmFilename, CmGetFileSize (File)); + + if (Gbl_MapfileFlag) + { + fprintf (stderr, "%14s %s - %u bytes\n", + Gbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, + Gbl_Files[ASL_FILE_MAP_OUTPUT].Filename, + FlGetFileSize (ASL_FILE_MAP_OUTPUT)); + } } } @@ -688,6 +696,7 @@ AdDisplayTables ( } AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX); + MpEmitMappingInfo (); if (AcpiGbl_DbOpt_verbose) { diff --git a/source/common/ahids.c b/source/common/ahids.c index 13cd100..dc15f35 100644 --- a/source/common/ahids.c +++ b/source/common/ahids.c @@ -54,7 +54,9 @@ const AH_DEVICE_ID AslDeviceIds[] = { {"10EC5640", "Realtek I2S Audio Codec"}, + {"80860F09", "Intel PWM Controller"}, {"80860F0A", "Intel Atom UART Controller"}, + {"80860F0E", "Intel SPI Controller"}, {"80860F14", "Intel Baytrail SDIO/MMC Host Controller"}, {"80860F28", "Intel SST Audio DSP"}, {"80860F41", "Intel Baytrail I2C Host Controller"}, @@ -73,12 +75,20 @@ const AH_DEVICE_ID AslDeviceIds[] = {"ACPI000D", "Power Meter Device"}, {"ACPI000E", "Time and Alarm Device"}, {"ACPI000F", "User Presence Detection Device"}, + {"ADMA0F28", "Intel Audio DMA"}, + {"AMCR0F28", "Intel Audio Machine Driver"}, {"ATK4001", "Asus Radio Control Button"}, {"ATML1000", "Atmel Touchscreen Controller"}, + {"AUTH2750", "AuthenTec AES2750"}, {"BCM2E39", "Broadcom BT Serial Bus Driver over UART Bus Enumerator"}, + {"BCM4752E", "Broadcom GPS Controller"}, + {"BMG0160", "Bosch Gyro Sensor"}, {"CPLM3218", "Capella Micro CM3218x Ambient Light Sensor"}, {"DELLABCE", "Dell Airplane Mode Switch Driver"}, {"DLAC3002", "Qualcomm Atheros Bluetooth UART Transport"}, + {"FTTH5506", "FocalTech 5506 Touch Controller"}, + {"HAD0F28", "Intel HDMI Audio Driver"}, + {"INBC0000", "GPIO Expander"}, {"INT0002", "Virtual GPIO Controller"}, {"INT0800", "Intel 82802 Firmware Hub Device"}, {"INT3394", "ACPI System Fan"}, @@ -87,6 +97,7 @@ const AH_DEVICE_ID AslDeviceIds[] = {"INT33A1", "Intel Power Engine"}, {"INT33BB", "Intel Baytrail SD Host Controller"}, {"INT33BD", "Intel Baytrail Mailbox Device"}, + {"INT33BE", "Camera Sensor OV5693"}, {"INT33C0", "Intel Serial I/O SPI Host Controller"}, {"INT33C1", "Intel Serial I/O SPI Host Controller"}, {"INT33C2", "Intel Serial I/O I2C Host Controller"}, @@ -105,9 +116,12 @@ const AH_DEVICE_ID AslDeviceIds[] = {"INT33D4", "Intel GPIO Buttons"}, {"INT33D6", "Intel Virtual Buttons Device"}, {"INT33F0", "Camera Sensor MT9M114"}, + {"INT33F4", "XPOWER PMIC Controller"}, + {"INT33F5", "TI PMIC Controller"}, {"INT33FB", "MIPI-CSI Camera Sensor OV2722"}, {"INT33FC", "Intel Baytrail GPIO Controller"}, {"INT33FD", "Intel Baytrail Power Management IC"}, + {"INT33FE", "XPOWER Battery Device"}, {"INT3400", "Intel Dynamic Power Performance Management"}, {"INT3401", "Intel Extended Thermal Model CPU"}, {"INT3403", "DPTF Temperature Sensor"}, @@ -127,8 +141,10 @@ const AH_DEVICE_ID AslDeviceIds[] = {"LNXSYSTM", "ACPI Root Node"}, {"LNXTHERM", "ACPI Thermal Zone"}, {"LNXVIDEO", "ACPI Video Controller"}, + {"MAX17047", "Fuel Gauge Controller"}, {"MSFT0101", "TPM 2.0 Security Device"}, {"NXP5442", "NXP 5442 Near Field Communications Controller"}, + {"NXP5472", "NXP NFC"}, {"PNP0000", "8259-compatible Programmable Interrupt Controller"}, {"PNP0001", "EISA Interrupt Controller"}, {"PNP0002", "MCA Interrupt Controller"}, @@ -181,7 +197,13 @@ const AH_DEVICE_ID AslDeviceIds[] = {"PNP0D40", "SDA Standard Compliant SD Host Controller"}, {"PNP0D80", "Windows-compatible System Power Management Controller"}, {"PNP0F03", "Microsoft PS/2-style Mouse"}, + {"PNP0F13", "PS/2 Mouse"}, + {"RTL8723", "Realtek Wireless Controller"}, + {"SMB0349", "Charger"}, {"SMO91D0", "Sensor Hub"}, + {"SMSC3750", "SMSC 3750 USB MUX"}, + {"SSPX0000", "Intel SSP Device"}, + {"TBQ24296", "Charger"}, {NULL, NULL} }; diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 060380a..62d7d87 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -540,6 +540,10 @@ CmDoOutputFiles ( /* Dump the namespace to the .nsp file if requested */ (void) NsDisplayNamespace (); + + /* Dump the device mapping file */ + + MpEmitMappingInfo (); } diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 1001f68..fdf19c1 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -808,6 +808,13 @@ ACPI_STATUS FlOpenMiscOutputFiles ( char *InputFilename); +/* + * aslhwmap - hardware map summary + */ +void +MpEmitMappingInfo ( + void); + /* * asload - load namespace in prep for cross reference @@ -1045,8 +1052,7 @@ RsCheckListForDuplicates ( ASL_RESOURCE_NODE * RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, + ASL_RESOURCE_INFO *Info, UINT8 *State); /* Values for State above */ @@ -1070,43 +1076,35 @@ RsDoResourceTemplate ( */ ASL_RESOURCE_NODE * RsDoEndTagDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); /* @@ -1114,33 +1112,27 @@ RsDoVendorSmallDescriptor ( */ ASL_RESOURCE_NODE * RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoFixedDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); /* @@ -1148,61 +1140,50 @@ RsDoIrqNoFlagsDescriptor ( */ ASL_RESOURCE_NODE * RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoGpioIntDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoGpioIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoI2cSerialBusDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoSpiSerialBusDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoUartSerialBusDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); /* * aslrestype2d - DWord address descriptors */ ASL_RESOURCE_NODE * RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoDwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); /* @@ -1210,18 +1191,15 @@ RsDoDwordSpaceDescriptor ( */ ASL_RESOURCE_NODE * RsDoExtendedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoExtendedMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoExtendedSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); /* @@ -1229,18 +1207,15 @@ RsDoExtendedSpaceDescriptor ( */ ASL_RESOURCE_NODE * RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoQwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); /* @@ -1248,18 +1223,16 @@ RsDoQwordSpaceDescriptor ( */ ASL_RESOURCE_NODE * RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoWordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); ASL_RESOURCE_NODE * RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); + ASL_RESOURCE_INFO *Info); + /* * Entry to data table compiler subsystem diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index c76b4a0..9400281 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -108,6 +108,7 @@ #define FILE_SUFFIX_PREPROCESSOR "i" #define FILE_SUFFIX_AML_CODE "aml" +#define FILE_SUFFIX_MAP "map" #define FILE_SUFFIX_LISTING "lst" #define FILE_SUFFIX_HEX_DUMP "hex" #define FILE_SUFFIX_DEBUG "txt" diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index e347e69..8106824 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -81,7 +81,8 @@ ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = {NULL, NULL, "C Source: ", "C Code Output"}, {NULL, NULL, "ASM Include: ", "Assembly Header Output"}, {NULL, NULL, "C Include: ", "C Header Output"}, - {NULL, NULL, "Offset Table: ", "C Offset Table Output"} + {NULL, NULL, "Offset Table: ", "C Offset Table Output"}, + {NULL, NULL, "Device Map: ", "Device Map Output"} }; #else @@ -141,6 +142,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_MapfileFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); @@ -221,6 +223,11 @@ ASL_EXTERN ASL_CACHE_INFO ASL_INIT_GLOBAL (*Gbl_StringCacheList, NULL) ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL); +/* Map file */ + +ASL_EXTERN ACPI_GPIO_INFO ASL_INIT_GLOBAL (*Gbl_GpioList, NULL); +ASL_EXTERN ACPI_SERIAL_INFO ASL_INIT_GLOBAL (*Gbl_SerialList, NULL); + /* Misc */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index ff02d53..1207f43 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -360,7 +360,6 @@ LdNamespace1Begin ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", Op, Op->Asl.ParseOpName)); - /* * We are only interested in opcodes that have an associated name * (or multiple names) @@ -374,6 +373,34 @@ LdNamespace1Begin ( Status = LdLoadFieldElements (Op, WalkState); return (Status); + case AML_INT_CONNECTION_OP: + + + if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP) + { + break; + } + Arg = Op->Asl.Child; + + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &Node); + if (ACPI_FAILURE (Status)) + { + break; + } + + if (Node->Type == ACPI_TYPE_BUFFER) + { + Arg->Asl.Node = Node; + + Arg = Node->Op->Asl.Child; /* Get namepath */ + Arg = Arg->Asl.Next; /* Get actual buffer */ + Arg = Arg->Asl.Child; /* Buffer length */ + Arg = Arg->Asl.Next; /* RAW_DATA buffer */ + } + break; + default: /* All other opcodes go below */ @@ -467,7 +494,6 @@ LdNamespace1Begin ( ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); break; - case PARSEOP_SCOPE: /* * The name referenced by Scope(Name) must already exist at this point. diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 25dca94..1ef7b1c 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -172,6 +172,7 @@ Usage ( printf ("\nOptional Listing Files:\n"); ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)"); + ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)"); ACPI_OPTION ("-ln", "Create namespace file (*.nsp)"); ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)"); @@ -404,7 +405,6 @@ main ( CleanupAndExit: UtFreeLineBuffers (); - AslParserCleanup (); if (AcpiGbl_ExternalFileList) diff --git a/source/compiler/aslmapenter.c b/source/compiler/aslmapenter.c new file mode 100644 index 0000000..a97c555 --- /dev/null +++ b/source/compiler/aslmapenter.c @@ -0,0 +1,346 @@ +/****************************************************************************** + * + * Module Name: aslmapenter - Build resource descriptor/device maps + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, 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 "acapps.h" +#include "aslcompiler.h" + +/* This module used for application-level code only */ + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslmapenter") + +/* Local prototypes */ + +static ACPI_GPIO_INFO * +MpCreateGpioInfo ( + UINT16 PinNumber, + char *DeviceName); + +static ACPI_SERIAL_INFO * +MpCreateSerialInfo ( + char *DeviceName, + UINT16 Address); + + +/******************************************************************************* + * + * FUNCTION: MpSaveGpioInfo + * + * PARAMETERS: Resource - GPIO resource descriptor + * PinCount - From GPIO descriptor + * PinList - From GPIO descriptor + * DeviceName - The "ResourceSource" name + * + * RETURN: None + * + * DESCRIPTION: External Interface. + * Save GPIO resource descriptor information. + * Creates new GPIO info blocks, one for each pin defined by the + * GPIO descriptor. + * + ******************************************************************************/ + +void +MpSaveGpioInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + UINT32 PinCount, + UINT16 *PinList, + char *DeviceName) +{ + ACPI_GPIO_INFO *Info; + UINT32 i; + + + /* Mapfile option enabled? */ + + if (!Gbl_MapfileFlag) + { + return; + } + + /* Create an info block for each pin defined in the descriptor */ + + for (i = 0; i < PinCount; i++) + { + Info = MpCreateGpioInfo (PinList[i], DeviceName); + + Info->Op = Op; + Info->DeviceName = DeviceName; + Info->PinCount = PinCount; + Info->PinIndex = i; + Info->PinNumber = PinList[i]; + Info->Type = Resource->Gpio.ConnectionType; + Info->Direction = (UINT8) (Resource->Gpio.IntFlags & 0x0003); /* _IOR, for IO descriptor */ + Info->Polarity = (UINT8) ((Resource->Gpio.IntFlags >> 1) & 0x0003); /* _POL, for INT descriptor */ + } +} + + +/******************************************************************************* + * + * FUNCTION: MpSaveSerialInfo + * + * PARAMETERS: Resource - A Serial resource descriptor + * DeviceName - The "ResourceSource" name. + * + * RETURN: None + * + * DESCRIPTION: External Interface. + * Save serial resource descriptor information. + * Creates a new serial info block. + * + ******************************************************************************/ + +void +MpSaveSerialInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + char *DeviceName) +{ + ACPI_SERIAL_INFO *Info; + UINT16 Address; + UINT32 Speed; + + + /* Mapfile option enabled? */ + + if (!Gbl_MapfileFlag) + { + return; + } + + if (Resource->DescriptorType != ACPI_RESOURCE_NAME_SERIAL_BUS) + { + return; + } + + /* Extract address and speed from the resource descriptor */ + + switch (Resource->CommonSerialBus.Type) + { + case AML_RESOURCE_I2C_SERIALBUSTYPE: + + Address = Resource->I2cSerialBus.SlaveAddress; + Speed = Resource->I2cSerialBus.ConnectionSpeed; + break; + + case AML_RESOURCE_SPI_SERIALBUSTYPE: + + Address = Resource->SpiSerialBus.DeviceSelection; + Speed = Resource->SpiSerialBus.ConnectionSpeed; + break; + + case AML_RESOURCE_UART_SERIALBUSTYPE: + + Address = 0; + Speed = Resource->UartSerialBus.DefaultBaudRate; + break; + + default: /* Invalid bus subtype */ + return; + } + + Info = MpCreateSerialInfo (DeviceName, Address); + + Info->Op = Op; + Info->DeviceName = DeviceName; + Info->Resource = Resource; + Info->Address = Address; + Info->Speed = Speed; +} + + +/******************************************************************************* + * + * FUNCTION: MpCreateGpioInfo + * + * PARAMETERS: PinNumber - GPIO pin number + * DeviceName - The "ResourceSource" name + * + * RETURN: New GPIO info block. + * + * DESCRIPTION: Create a new GPIO info block and place it on the global list. + * The list is sorted by GPIO device names first, and pin numbers + * secondarily. + * + ******************************************************************************/ + +static ACPI_GPIO_INFO * +MpCreateGpioInfo ( + UINT16 PinNumber, + char *DeviceName) +{ + ACPI_GPIO_INFO *Info; + ACPI_GPIO_INFO *NextGpio; + ACPI_GPIO_INFO *PrevGpio; + + + /* + * Allocate a new info block and insert it into the global GPIO list + * sorted by both source device name and then the pin number. There is + * one block per pin. + */ + Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, + UtStringCacheCalloc (sizeof (ACPI_GPIO_INFO))); + + NextGpio = Gbl_GpioList; + PrevGpio = NULL; + if (!Gbl_GpioList) + { + Gbl_GpioList = Info; + Info->Next = NULL; + return (Info); + } + + /* Sort on source DeviceName first */ + + while (NextGpio && + (ACPI_STRCMP (DeviceName, NextGpio->DeviceName) > 0)) + { + PrevGpio = NextGpio; + NextGpio = NextGpio->Next; + } + + /* Now sort on the PinNumber */ + + while (NextGpio && + (NextGpio->PinNumber < PinNumber) && + !ACPI_STRCMP (DeviceName, NextGpio->DeviceName)) + { + PrevGpio = NextGpio; + NextGpio = NextGpio->Next; + } + + /* Finish the list insertion */ + + if (PrevGpio) + { + PrevGpio->Next = Info; + } + else + { + Gbl_GpioList = Info; + } + + Info->Next = NextGpio; + return (Info); +} + + +/******************************************************************************* + * + * FUNCTION: MpCreateSerialInfo + * + * PARAMETERS: DeviceName - The "ResourceSource" name. + * Address - Physical address for the device + * + * RETURN: New Serial info block. + * + * DESCRIPTION: Create a new Serial info block and place it on the global list. + * The list is sorted by Serial device names first, and addresses + * secondarily. + * + ******************************************************************************/ + +static ACPI_SERIAL_INFO * +MpCreateSerialInfo ( + char *DeviceName, + UINT16 Address) +{ + ACPI_SERIAL_INFO *Info; + ACPI_SERIAL_INFO *NextSerial; + ACPI_SERIAL_INFO *PrevSerial; + + + /* + * Allocate a new info block and insert it into the global Serial list + * sorted by both source device name and then the address. + */ + Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, + UtStringCacheCalloc (sizeof (ACPI_SERIAL_INFO))); + + NextSerial = Gbl_SerialList; + PrevSerial = NULL; + if (!Gbl_SerialList) + { + Gbl_SerialList = Info; + Info->Next = NULL; + return (Info); + } + + /* Sort on source DeviceName */ + + while (NextSerial && + (ACPI_STRCMP (DeviceName, NextSerial->DeviceName) > 0)) + { + PrevSerial = NextSerial; + NextSerial = NextSerial->Next; + } + + /* Now sort on the Address */ + + while (NextSerial && + (NextSerial->Address < Address) && + !ACPI_STRCMP (DeviceName, NextSerial->DeviceName)) + { + PrevSerial = NextSerial; + NextSerial = NextSerial->Next; + } + + /* Finish the list insertion */ + + if (PrevSerial) + { + PrevSerial->Next = Info; + } + else + { + Gbl_SerialList = Info; + } + + Info->Next = NextSerial; + return (Info); +} diff --git a/source/compiler/aslmapoutput.c b/source/compiler/aslmapoutput.c new file mode 100644 index 0000000..404c843 --- /dev/null +++ b/source/compiler/aslmapoutput.c @@ -0,0 +1,661 @@ +/****************************************************************************** + * + * Module Name: aslmapoutput - Output/emit the resource descriptor/device maps + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, 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 "acapps.h" +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "acinterp.h" +#include "acparser.h" +#include "acnamesp.h" +#include "amlcode.h" + +/* This module used for application-level code only */ + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslmapoutput") + +/* Local prototypes */ + +static void +MpEmitGpioInfo ( + void); + +static void +MpEmitSerialInfo ( + void); + +static void +MpEmitDeviceTree ( + void); + +static ACPI_STATUS +MpEmitOneDevice ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +static void +MpXrefDevices ( + ACPI_GPIO_INFO *Info); + +static ACPI_STATUS +MpNamespaceXrefBegin ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + + +/* Strings used to decode flag bits */ + +const char *DirectionDecode[] = +{ + "Both I/O ", + "InputOnly ", + "OutputOnly ", + "Preserve " +}; + +const char *PolarityDecode[] = +{ + "ActiveHigh", + "ActiveLow ", + "ActiveBoth", + "Reserved " +}; + + +/******************************************************************************* + * + * FUNCTION: MpEmitMappingInfo + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: External interface. + * Create and open the mapfile and emit all of the collected + * hardware mapping information. Includes: GPIO information, + * Serial information, and a dump of the entire ACPI device tree. + * + ******************************************************************************/ + +void +MpEmitMappingInfo ( + void) +{ + char *NewFilename; + + + /* Mapfile option enabled? */ + + if (!Gbl_MapfileFlag) + { + return; + } + + /* Create/Open a map file */ + + NewFilename = FlGenerateFilename (Gbl_OutputFilenamePrefix, + FILE_SUFFIX_MAP); + if (!NewFilename) + { + AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, + 0, 0, 0, 0, NULL, NULL); + } + + /* Open the hex file, text mode (closed at compiler exit) */ + + FlOpenFile (ASL_FILE_MAP_OUTPUT, NewFilename, "w+t"); + AslCompilerSignon (ASL_FILE_MAP_OUTPUT); + AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT); + + if (!Gbl_GpioList) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, + "\nNo GPIO devices found\n"); + } + + if (!Gbl_SerialList) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, + "\nNo Serial devices found (I2C/SPI/UART)\n"); + } + + if (!Gbl_GpioList && !Gbl_SerialList) + { + return; + } + + /* Headers */ + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "\nResource Descriptor Connectivity Map\n"); + FlPrintFile (ASL_FILE_MAP_OUTPUT, "------------------------------------\n"); + + /* Emit GPIO and Serial descriptors, then entire ACPI device tree */ + + MpEmitGpioInfo (); + MpEmitSerialInfo (); + MpEmitDeviceTree (); + + /* Clear the lists - no need to free memory here */ + + Gbl_SerialList = NULL; + Gbl_GpioList = NULL; +} + + +/******************************************************************************* + * + * FUNCTION: MpEmitGpioInfo + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Emit the info about all GPIO devices found during the + * compile or disassembly. + * + ******************************************************************************/ + +static void +MpEmitGpioInfo ( + void) +{ + ACPI_GPIO_INFO *Info; + char *Type; + char *PrevDeviceName = NULL; + const char *Direction; + const char *Polarity; + char *ParentPathname; + const char *Description; + char *HidString; + const AH_DEVICE_ID *HidInfo; + + + /* Walk the GPIO descriptor list */ + + Info = Gbl_GpioList; + while (Info) + { + HidString = MpGetHidViaNamestring (Info->DeviceName); + + /* Print header info for the controller itself */ + + if (!PrevDeviceName || + ACPI_STRCMP (PrevDeviceName, Info->DeviceName)) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, + "\n\nGPIO Controller: %-8s %-28s", + HidString, Info->DeviceName); + + HidInfo = AcpiAhMatchHardwareId (HidString); + if (HidInfo) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", + HidInfo->Description); + } + + FlPrintFile (ASL_FILE_MAP_OUTPUT, + "\n\nPin Type Direction Polarity" + " Dest _HID Destination\n"); + } + + PrevDeviceName = Info->DeviceName; + + /* Setup various strings based upon the type (GpioInt or GpioIo) */ + + switch (Info->Type) + { + case AML_RESOURCE_GPIO_TYPE_INT: + + Type = "GpioInt"; + Direction = "-Interrupt-"; + Polarity = PolarityDecode[Info->Polarity]; + break; + + case AML_RESOURCE_GPIO_TYPE_IO: + + Type = "GpioIo "; + Direction = DirectionDecode[Info->Direction]; + Polarity = " "; + break; + + default: + continue; + } + + /* Emit the GPIO info */ + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%4.4X %s %s %s ", + Info->PinNumber, Type, Direction, Polarity); + + ParentPathname = NULL; + HidString = MpGetConnectionInfo (Info->Op, Info->PinIndex, + &Info->TargetNode, &ParentPathname); + if (HidString) + { + /* + * This is a Connection() field + * Attempt to find all references to the field. + */ + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", + HidString, ParentPathname); + + MpXrefDevices (Info); + } + else + { + /* + * For Devices, attempt to get the _HID description string. + * Failing that (many _HIDs are not recognized), attempt to + * get the _DDN description string. + */ + HidString = MpGetParentDeviceHid (Info->Op, &Info->TargetNode, + &ParentPathname); + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", + HidString, ParentPathname); + + /* Get the _HID description or _DDN string */ + + HidInfo = AcpiAhMatchHardwareId (HidString); + if (HidInfo) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", + HidInfo->Description); + } + else if ((Description = MpGetDdnValue (ParentPathname))) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s (_DDN)", + Description); + } + } + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n"); + ACPI_FREE (ParentPathname); + Info = Info->Next; + } +} + + +/******************************************************************************* + * + * FUNCTION: MpEmitSerialInfo + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Emit the info about all Serial devices found during the + * compile or disassembly. + * + ******************************************************************************/ + +static void +MpEmitSerialInfo ( + void) +{ + ACPI_SERIAL_INFO *Info; + char *Type; + char *ParentPathname; + char *PrevDeviceName = NULL; + char *HidString; + const AH_DEVICE_ID *HidInfo; + const char *Description; + AML_RESOURCE *Resource; + + + /* Walk the constructed serial descriptor list */ + + Info = Gbl_SerialList; + while (Info) + { + Resource = Info->Resource; + switch (Resource->CommonSerialBus.Type) + { + case AML_RESOURCE_I2C_SERIALBUSTYPE: + Type = "I2C "; + break; + + case AML_RESOURCE_SPI_SERIALBUSTYPE: + Type = "SPI "; + break; + + case AML_RESOURCE_UART_SERIALBUSTYPE: + Type = "UART"; + break; + + default: + Type = "UNKN"; + break; + } + + HidString = MpGetHidViaNamestring (Info->DeviceName); + + /* Print header info for the controller itself */ + + if (!PrevDeviceName || + ACPI_STRCMP (PrevDeviceName, Info->DeviceName)) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n\n%s Controller: ", + Type); + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%-8s %-28s", + HidString, Info->DeviceName); + + HidInfo = AcpiAhMatchHardwareId (HidString); + if (HidInfo) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", + HidInfo->Description); + } + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n\n"); + FlPrintFile (ASL_FILE_MAP_OUTPUT, + "Type Address Speed Dest _HID Destination\n"); + } + + PrevDeviceName = Info->DeviceName; + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%s %4.4X %8.8X ", + Type, Info->Address, Info->Speed); + + ParentPathname = NULL; + HidString = MpGetConnectionInfo (Info->Op, 0, &Info->TargetNode, + &ParentPathname); + if (HidString) + { + /* + * This is a Connection() field + * Attempt to find all references to the field. + */ + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", + HidString, ParentPathname); + } + else + { + /* Normal resource template */ + + HidString = MpGetParentDeviceHid (Info->Op, &Info->TargetNode, + &ParentPathname); + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s %-28s", + HidString, ParentPathname); + + /* Get the _HID description or _DDN string */ + + HidInfo = AcpiAhMatchHardwareId (HidString); + if (HidInfo) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", + HidInfo->Description); + } + else if ((Description = MpGetDdnValue (ParentPathname))) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s (_DDN)", + Description); + } + } + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n"); + ACPI_FREE (ParentPathname); + Info = Info->Next; + } +} + + +/******************************************************************************* + * + * FUNCTION: MpEmitDeviceTree + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Emit information about all devices within the ACPI namespace. + * + ******************************************************************************/ + +static void +MpEmitDeviceTree ( + void) +{ + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n\nACPI Device Tree\n"); + FlPrintFile (ASL_FILE_MAP_OUTPUT, "----------------\n\n"); + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "Device Pathname " + "_HID Description\n\n"); + + /* Walk the namespace from the root */ + + (void) AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL); +} + + +/******************************************************************************* + * + * FUNCTION: MpEmitOneDevice + * + * PARAMETERS: ACPI_NAMESPACE_WALK callback + * + * RETURN: Status + * + * DESCRIPTION: Emit information about one ACPI device in the namespace. Used + * during dump of all device objects within the namespace. + * + ******************************************************************************/ + +static ACPI_STATUS +MpEmitOneDevice ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + char *DevicePathname; + char *DdnString; + char *HidString; + const AH_DEVICE_ID *HidInfo; + + + /* Device pathname */ + + DevicePathname = AcpiNsGetExternalPathname ( + ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle)); + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%-32s", DevicePathname); + + /* _HID or _DDN */ + + HidString = MpGetHidValue ( + ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle)); + FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s", HidString); + + HidInfo = AcpiAhMatchHardwareId (HidString); + if (HidInfo) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s", + HidInfo->Description); + } + else if ((DdnString = MpGetDdnValue (DevicePathname))) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // %s (_DDN)", DdnString); + } + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n"); + ACPI_FREE (DevicePathname); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: MpXrefDevices + * + * PARAMETERS: Info - A GPIO Info block + * + * RETURN: None + * + * DESCRIPTION: Cross-reference the parse tree and find all references to the + * specified GPIO device. + * + ******************************************************************************/ + +static void +MpXrefDevices ( + ACPI_GPIO_INFO *Info) +{ + + /* Walk the entire parse tree */ + + TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + MpNamespaceXrefBegin, NULL, Info); + + if (!Info->References) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // **** No references in table"); + } +} + + +/******************************************************************************* + * + * FUNCTION: MpNamespaceXrefBegin + * + * PARAMETERS: WALK_PARSE_TREE callback + * + * RETURN: Status + * + * DESCRIPTION: Walk parse tree callback used to cross-reference GPIO pins. + * + ******************************************************************************/ + +static ACPI_STATUS +MpNamespaceXrefBegin ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ACPI_GPIO_INFO *Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Context); + const ACPI_OPCODE_INFO *OpInfo; + char *DevicePathname; + ACPI_PARSE_OBJECT *ParentOp; + char *HidString; + + + ACPI_FUNCTION_TRACE_PTR (MpNamespaceXrefBegin, Op); + + /* + * If this node is the actual declaration of a name + * [such as the XXXX name in "Method (XXXX)"], + * we are not interested in it here. We only care about names that + * are references to other objects within the namespace and the + * parent objects of name declarations + */ + if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) + { + return (AE_OK); + } + + /* We are only interested in opcodes that have an associated name */ + + OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); + + if ((OpInfo->Flags & AML_NAMED) || + (OpInfo->Flags & AML_CREATE)) + { + return (AE_OK); + } + + if ((Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && + (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && + (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) + { + return (AE_OK); + } + + if (!Op->Asl.Node) + { + return (AE_OK); + } + + ParentOp = Op->Asl.Parent; + if (ParentOp->Asl.ParseOpcode == PARSEOP_FIELD) + { + return (AE_OK); + } + + if (Op->Asl.Node == Info->TargetNode) + { + DevicePathname = AcpiNsGetExternalPathname ( + Info->TargetNode); + + while (ParentOp && (!ParentOp->Asl.Node)) + { + ParentOp = ParentOp->Asl.Parent; + } + + if (ParentOp) + { + DevicePathname = AcpiNsGetExternalPathname ( + ParentOp->Asl.Node); + + if (!Info->References) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " // References:"); + } + + HidString = MpGetHidViaNamestring (DevicePathname); + + FlPrintFile (ASL_FILE_MAP_OUTPUT, " %s [%s]", + DevicePathname, HidString); + + Info->References++; + } + } + + return (AE_OK); +} diff --git a/source/compiler/aslmaputils.c b/source/compiler/aslmaputils.c new file mode 100644 index 0000000..10a6aea --- /dev/null +++ b/source/compiler/aslmaputils.c @@ -0,0 +1,402 @@ +/****************************************************************************** + * + * Module Name: aslmaputils - Utilities for the resource descriptor/device maps + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, 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 "acapps.h" +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "amlcode.h" + +/* This module used for application-level code only */ + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslmaputils") + + +/******************************************************************************* + * + * FUNCTION: MpGetHidFromParseTree + * + * PARAMETERS: HidNode - Node for a _HID object + * + * RETURN: An _HID string value. Automatically converts _HID integers + * to strings. Never NULL. + * + * DESCRIPTION: Extract a _HID value from the parse tree, not the namespace. + * Used when a fully initialized namespace is not available. + * + ******************************************************************************/ + +char * +MpGetHidFromParseTree ( + ACPI_NAMESPACE_NODE *HidNode) +{ + ACPI_PARSE_OBJECT *Op; + ACPI_PARSE_OBJECT *Arg; + char *HidString; + + + Op = HidNode->Op; + + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_NAME: + + Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */ + Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */ + + switch (Arg->Asl.ParseOpcode) + { + case PARSEOP_STRING_LITERAL: + + return (Arg->Asl.Value.String); + + case PARSEOP_INTEGER: + + /* Convert EISAID to a string */ + + HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE); + AcpiExEisaIdToString (HidString, Arg->Asl.Value.Integer); + return (HidString); + + default: + + return ("UNKNOWN"); + } + + default: + return ("-No HID-"); + } +} + + +/******************************************************************************* + * + * FUNCTION: MpGetHidValue + * + * PARAMETERS: DeviceNode - Node for parent device + * + * RETURN: An _HID string value. Automatically converts _HID integers + * to strings. Never NULL. + * + * DESCRIPTION: Extract _HID value from within a device scope. Does not + * actually execute a method, just gets the string or integer + * value for the _HID. + * + ******************************************************************************/ + +char * +MpGetHidValue ( + ACPI_NAMESPACE_NODE *DeviceNode) +{ + ACPI_NAMESPACE_NODE *HidNode; + char *HidString; + ACPI_STATUS Status; + + + Status = AcpiNsGetNode (DeviceNode, METHOD_NAME__HID, + ACPI_NS_NO_UPSEARCH, &HidNode); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + /* If only partial namespace, get the _HID from the parse tree */ + + if (!HidNode->Object) + { + return (MpGetHidFromParseTree (HidNode)); + } + + /* Handle the different _HID flavors */ + + switch (HidNode->Type) + { + case ACPI_TYPE_STRING: + + return (HidNode->Object->String.Pointer); + + case ACPI_TYPE_INTEGER: + + /* Convert EISAID to a string */ + + HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE); + AcpiExEisaIdToString (HidString, HidNode->Object->Integer.Value); + return (HidString); + + case ACPI_TYPE_METHOD: + + return ("-Method-"); + + default: + + FlPrintFile (ASL_FILE_MAP_OUTPUT, "BAD HID TYPE: %u", HidNode->Type); + break; + } + + +ErrorExit: + return ("-No HID-"); +} + + +/******************************************************************************* + * + * FUNCTION: MpGetHidViaNamestring + * + * PARAMETERS: DeviceName - Namepath for parent device + * + * RETURN: _HID string. Never NULL. + * + * DESCRIPTION: Get a _HID value via a device pathname (instead of just simply + * a device node.) + * + ******************************************************************************/ + +char * +MpGetHidViaNamestring ( + char *DeviceName) +{ + ACPI_NAMESPACE_NODE *DeviceNode; + ACPI_STATUS Status; + + + Status = AcpiNsGetNode (NULL, DeviceName, ACPI_NS_NO_UPSEARCH, + &DeviceNode); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + return (MpGetHidValue (DeviceNode)); + + +ErrorExit: + return ("-No HID-"); +} + + +/******************************************************************************* + * + * FUNCTION: MpGetParentDeviceHid + * + * PARAMETERS: Op - Parse Op to be examined + * TargetNode - Where the field node is returned + * ParentDeviceName - Where the node path is returned + * + * RETURN: _HID string. Never NULL. + * + * DESCRIPTION: Find the parent Device or Scope Op, get the full pathname to + * the parent, and get the _HID associated with the parent. + * + ******************************************************************************/ + +char * +MpGetParentDeviceHid ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE **TargetNode, + char **ParentDeviceName) +{ + ACPI_NAMESPACE_NODE *DeviceNode; + + + /* Find parent Device() or Scope() Op */ + + while (Op && + (Op->Asl.AmlOpcode != AML_DEVICE_OP) && + (Op->Asl.AmlOpcode != AML_SCOPE_OP)) + { + Op = Op->Asl.Parent; + } + + if (!Op) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " No_Parent_Device "); + goto ErrorExit; + } + + /* Get the full pathname to the device and the _HID */ + + DeviceNode = Op->Asl.Node; + if (!DeviceNode) + { + FlPrintFile (ASL_FILE_MAP_OUTPUT, " No_Device_Node "); + goto ErrorExit; + } + + *ParentDeviceName = AcpiNsGetExternalPathname (DeviceNode); + return (MpGetHidValue (DeviceNode)); + + +ErrorExit: + return ("-No HID-"); +} + + +/******************************************************************************* + * + * FUNCTION: MpGetDdnValue + * + * PARAMETERS: DeviceName - Namepath for parent device + * + * RETURN: _DDN description string. NULL on failure. + * + * DESCRIPTION: Execute the _DDN method for the device. + * + ******************************************************************************/ + +char * +MpGetDdnValue ( + char *DeviceName) +{ + ACPI_NAMESPACE_NODE *DeviceNode; + ACPI_NAMESPACE_NODE *DdnNode; + ACPI_STATUS Status; + + + Status = AcpiNsGetNode (NULL, DeviceName, ACPI_NS_NO_UPSEARCH, + &DeviceNode); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + Status = AcpiNsGetNode (DeviceNode, METHOD_NAME__DDN, ACPI_NS_NO_UPSEARCH, + &DdnNode); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + if ((DdnNode->Type != ACPI_TYPE_STRING) || + !DdnNode->Object) + { + goto ErrorExit; + } + + return (DdnNode->Object->String.Pointer); + + +ErrorExit: + return (NULL); +} + + +/******************************************************************************* + * + * FUNCTION: MpGetConnectionInfo + * + * PARAMETERS: Op - Parse Op to be examined + * PinIndex - Index into GPIO PinList + * TargetNode - Where the field node is returned + * TargetName - Where the node path is returned + * + * RETURN: A substitute _HID string, indicating that the name is actually + * a field. NULL if the Op does not refer to a Connection. + * + * DESCRIPTION: Get the Field Unit that corresponds to the PinIndex after + * a Connection() invocation. + * + ******************************************************************************/ + +char * +MpGetConnectionInfo ( + ACPI_PARSE_OBJECT *Op, + UINT32 PinIndex, + ACPI_NAMESPACE_NODE **TargetNode, + char **TargetName) +{ + ACPI_PARSE_OBJECT *NextOp; + UINT32 i; + + + /* + * Handle Connection() here. Find the next named FieldUnit. + * Note: we look at the ParseOpcode for the compiler, look + * at the AmlOpcode for the disassembler. + */ + if ((Op->Asl.AmlOpcode == AML_INT_CONNECTION_OP) || + (Op->Asl.ParseOpcode == PARSEOP_CONNECTION)) + { + /* Find the correct field unit definition */ + + NextOp = Op; + for (i = 0; i <= PinIndex;) + { + NextOp = NextOp->Asl.Next; + while (NextOp && + (NextOp->Asl.ParseOpcode != PARSEOP_NAMESEG) && + (NextOp->Asl.AmlOpcode != AML_INT_NAMEDFIELD_OP)) + { + NextOp = NextOp->Asl.Next; + } + + if (!NextOp) + { + return ("UNKNOWN"); + } + + /* Add length of this field to the current pin index */ + + if (NextOp->Asl.ParseOpcode == PARSEOP_NAMESEG) + { + i += (UINT32) NextOp->Asl.Child->Asl.Value.Integer; + } + else /* AML_INT_NAMEDFIELD_OP */ + { + i += (UINT32) NextOp->Asl.Value.Integer; + } + } + + /* Return the node and pathname for the field unit */ + + *TargetNode = NextOp->Asl.Node; + *TargetName = AcpiNsGetExternalPathname (*TargetNode); + return ("-Field-"); + } + + return (NULL); +} diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index 1ad4753..8030c95 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -402,6 +402,7 @@ OpcDoConnection ( ACPI_PARSE_OBJECT *BufferOp; ACPI_PARSE_OBJECT *BufferLengthOp; ACPI_PARSE_OBJECT *BufferDataOp; + ASL_RESOURCE_INFO Info; UINT8 State; @@ -416,8 +417,10 @@ OpcDoConnection ( BufferLengthOp = BufferOp->Asl.Child; BufferDataOp = BufferLengthOp->Asl.Next; + Info.DescriptorTypeOp = BufferDataOp->Asl.Next; + Info.CurrentByteOffset = 0; State = ACPI_RSTATE_NORMAL; - Rnode = RsDoOneResourceDescriptor (BufferDataOp->Asl.Next, 0, &State); + Rnode = RsDoOneResourceDescriptor (&Info, &State); if (!Rnode) { return; /* error */ diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 039fc7d..63abcf4 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -413,6 +413,13 @@ AslDoOptions ( Gbl_PreprocessorOutputFlag = TRUE; break; + case 'm': + + /* Produce hardware map summary file */ + + Gbl_MapfileFlag = TRUE; + break; + case 'n': /* Produce namespace file */ diff --git a/source/compiler/aslparser.y b/source/compiler/aslparser.y index bf4a8a7..5d21ce6 100644 --- a/source/compiler/aslparser.y +++ b/source/compiler/aslparser.y @@ -62,7 +62,9 @@ * ResourceMacroList, and FieldUnitList */ -void * AslLocalAllocate (unsigned int Size); +void * +AslLocalAllocate ( + unsigned int Size); /* Bison/yacc configuration */ @@ -80,8 +82,8 @@ void * AslLocalAllocate (unsigned int Size); /* Define YYMALLOC/YYFREE to prevent redefinition errors */ -#define YYMALLOC malloc -#define YYFREE free +#define YYMALLOC AslLocalAllocate +#define YYFREE ACPI_FREE %} /* diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index f123990..7b31e13 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -645,8 +645,7 @@ RsCheckListForDuplicates ( ASL_RESOURCE_NODE * RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, + ASL_RESOURCE_INFO *Info, UINT8 *State) { ASL_RESOURCE_NODE *Rnode = NULL; @@ -654,36 +653,31 @@ RsDoOneResourceDescriptor ( /* Construct the resource */ - switch (DescriptorTypeOp->Asl.ParseOpcode) + switch (Info->DescriptorTypeOp->Asl.ParseOpcode) { case PARSEOP_DMA: - Rnode = RsDoDmaDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoDmaDescriptor (Info); break; case PARSEOP_FIXEDDMA: - Rnode = RsDoFixedDmaDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoFixedDmaDescriptor (Info); break; case PARSEOP_DWORDIO: - Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoDwordIoDescriptor (Info); break; case PARSEOP_DWORDMEMORY: - Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoDwordMemoryDescriptor (Info); break; case PARSEOP_DWORDSPACE: - Rnode = RsDoDwordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoDwordSpaceDescriptor (Info); break; case PARSEOP_ENDDEPENDENTFN: @@ -693,13 +687,13 @@ RsDoOneResourceDescriptor ( case ACPI_RSTATE_NORMAL: AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT, - DescriptorTypeOp, NULL); + Info->DescriptorTypeOp, NULL); break; case ACPI_RSTATE_START_DEPENDENT: AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); + Info->DescriptorTypeOp, NULL); break; case ACPI_RSTATE_DEPENDENT_LIST: @@ -709,104 +703,87 @@ RsDoOneResourceDescriptor ( } *State = ACPI_RSTATE_NORMAL; - Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoEndDependentDescriptor (Info); break; case PARSEOP_ENDTAG: - Rnode = RsDoEndTagDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoEndTagDescriptor (Info); break; case PARSEOP_EXTENDEDIO: - Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoExtendedIoDescriptor (Info); break; case PARSEOP_EXTENDEDMEMORY: - Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoExtendedMemoryDescriptor (Info); break; case PARSEOP_EXTENDEDSPACE: - Rnode = RsDoExtendedSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoExtendedSpaceDescriptor (Info); break; case PARSEOP_FIXEDIO: - Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoFixedIoDescriptor (Info); break; case PARSEOP_INTERRUPT: - Rnode = RsDoInterruptDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoInterruptDescriptor (Info); break; case PARSEOP_IO: - Rnode = RsDoIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoIoDescriptor (Info); break; case PARSEOP_IRQ: - Rnode = RsDoIrqDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoIrqDescriptor (Info); break; case PARSEOP_IRQNOFLAGS: - Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoIrqNoFlagsDescriptor (Info); break; case PARSEOP_MEMORY24: - Rnode = RsDoMemory24Descriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoMemory24Descriptor (Info); break; case PARSEOP_MEMORY32: - Rnode = RsDoMemory32Descriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoMemory32Descriptor (Info); break; case PARSEOP_MEMORY32FIXED: - Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoMemory32FixedDescriptor (Info); break; case PARSEOP_QWORDIO: - Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoQwordIoDescriptor (Info); break; case PARSEOP_QWORDMEMORY: - Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoQwordMemoryDescriptor (Info); break; case PARSEOP_QWORDSPACE: - Rnode = RsDoQwordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoQwordSpaceDescriptor (Info); break; case PARSEOP_REGISTER: - Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoGeneralRegisterDescriptor (Info); break; case PARSEOP_STARTDEPENDENTFN: @@ -816,7 +793,7 @@ RsDoOneResourceDescriptor ( case ACPI_RSTATE_START_DEPENDENT: AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); + Info->DescriptorTypeOp, NULL); break; case ACPI_RSTATE_NORMAL: @@ -827,8 +804,7 @@ RsDoOneResourceDescriptor ( } *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoStartDependentDescriptor (Info); *State = ACPI_RSTATE_DEPENDENT_LIST; break; @@ -839,7 +815,7 @@ RsDoOneResourceDescriptor ( case ACPI_RSTATE_START_DEPENDENT: AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, - DescriptorTypeOp, NULL); + Info->DescriptorTypeOp, NULL); break; case ACPI_RSTATE_NORMAL: @@ -850,69 +826,58 @@ RsDoOneResourceDescriptor ( } *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoStartDependentNoPriDescriptor (Info); *State = ACPI_RSTATE_DEPENDENT_LIST; break; case PARSEOP_VENDORLONG: - Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoVendorLargeDescriptor (Info); break; case PARSEOP_VENDORSHORT: - Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoVendorSmallDescriptor (Info); break; case PARSEOP_WORDBUSNUMBER: - Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoWordBusNumberDescriptor (Info); break; case PARSEOP_WORDIO: - Rnode = RsDoWordIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoWordIoDescriptor (Info); break; case PARSEOP_WORDSPACE: - Rnode = RsDoWordSpaceDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoWordSpaceDescriptor (Info); break; case PARSEOP_GPIO_INT: - Rnode = RsDoGpioIntDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoGpioIntDescriptor (Info); break; case PARSEOP_GPIO_IO: - Rnode = RsDoGpioIoDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoGpioIoDescriptor (Info); break; case PARSEOP_I2C_SERIALBUS: - Rnode = RsDoI2cSerialBusDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoI2cSerialBusDescriptor (Info); break; case PARSEOP_SPI_SERIALBUS: - Rnode = RsDoSpiSerialBusDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoSpiSerialBusDescriptor (Info); break; case PARSEOP_UART_SERIALBUS: - Rnode = RsDoUartSerialBusDescriptor (DescriptorTypeOp, - CurrentByteOffset); + Rnode = RsDoUartSerialBusDescriptor (Info); break; case PARSEOP_DEFAULT_ARG: @@ -923,7 +888,7 @@ RsDoOneResourceDescriptor ( default: printf ("Unknown resource descriptor type [%s]\n", - DescriptorTypeOp->Asl.ParseOpName); + Info->DescriptorTypeOp->Asl.ParseOpName); break; } @@ -932,14 +897,14 @@ RsDoOneResourceDescriptor ( * This allows the resource to be installed in the namespace so that * references to the descriptor can be resolved. */ - DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; - DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset; + Info->DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + Info->DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; + Info->DescriptorTypeOp->Asl.Value.Integer = Info->CurrentByteOffset; if (Rnode) { - DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; - DescriptorTypeOp->Asl.Extra = ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType; + Info->DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength; + Info->DescriptorTypeOp->Asl.Extra = ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType; } return (Rnode); @@ -1023,6 +988,7 @@ RsDoResourceTemplate ( ASL_RESOURCE_NODE HeadRnode; ASL_RESOURCE_NODE *PreviousRnode; ASL_RESOURCE_NODE *Rnode; + ASL_RESOURCE_INFO Info; UINT8 State; @@ -1055,9 +1021,22 @@ RsDoResourceTemplate ( PreviousRnode = &HeadRnode; while (DescriptorTypeOp) { + /* Save information for optional mapfile */ + + if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONNECTION) + { + Info.MappingOp = Op->Asl.Parent; + } + else + { + Info.MappingOp = DescriptorTypeOp; + } + + Info.DescriptorTypeOp = DescriptorTypeOp; + Info.CurrentByteOffset = CurrentByteOffset; + DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC; - Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, - &State); + Rnode = RsDoOneResourceDescriptor (&Info, &State); /* * Update current byte offset to indicate the number of bytes from the diff --git a/source/compiler/aslrestype1.c b/source/compiler/aslrestype1.c index 73f3efe..3731442 100644 --- a/source/compiler/aslrestype1.c +++ b/source/compiler/aslrestype1.c @@ -64,9 +64,7 @@ * * FUNCTION: RsDoEndTagDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -76,8 +74,7 @@ ASL_RESOURCE_NODE * RsDoEndTagDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ASL_RESOURCE_NODE *Rnode; @@ -98,9 +95,7 @@ RsDoEndTagDescriptor ( * * FUNCTION: RsDoEndDependentDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -110,8 +105,7 @@ RsDoEndTagDescriptor ( ASL_RESOURCE_NODE * RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ASL_RESOURCE_NODE *Rnode; @@ -130,9 +124,7 @@ RsDoEndDependentDescriptor ( * * FUNCTION: RsDoMemory24Descriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -142,8 +134,7 @@ RsDoEndDependentDescriptor ( ASL_RESOURCE_NODE * RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -151,10 +142,12 @@ RsDoMemory24Descriptor ( ACPI_PARSE_OBJECT *MaxOp = NULL; ACPI_PARSE_OBJECT *LengthOp = NULL; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24)); Descriptor = Rnode->Buffer; @@ -207,7 +200,7 @@ RsDoMemory24Descriptor ( case 5: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -226,7 +219,7 @@ RsDoMemory24Descriptor ( Descriptor->Memory24.Maximum, Descriptor->Memory24.AddressLength, Descriptor->Memory24.Alignment, - MinOp, MaxOp, LengthOp, NULL, Op); + MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp); return (Rnode); } @@ -236,9 +229,7 @@ RsDoMemory24Descriptor ( * * FUNCTION: RsDoMemory32Descriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -248,8 +239,7 @@ RsDoMemory24Descriptor ( ASL_RESOURCE_NODE * RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -258,10 +248,12 @@ RsDoMemory32Descriptor ( ACPI_PARSE_OBJECT *LengthOp = NULL; ACPI_PARSE_OBJECT *AlignOp = NULL; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32)); Descriptor = Rnode->Buffer; @@ -315,7 +307,7 @@ RsDoMemory32Descriptor ( case 5: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -334,7 +326,7 @@ RsDoMemory32Descriptor ( Descriptor->Memory32.Maximum, Descriptor->Memory32.AddressLength, Descriptor->Memory32.Alignment, - MinOp, MaxOp, LengthOp, AlignOp, Op); + MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp); return (Rnode); } @@ -344,9 +336,7 @@ RsDoMemory32Descriptor ( * * FUNCTION: RsDoMemory32FixedDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -356,16 +346,17 @@ RsDoMemory32Descriptor ( ASL_RESOURCE_NODE * RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32)); Descriptor = Rnode->Buffer; @@ -401,7 +392,7 @@ RsDoMemory32FixedDescriptor ( case 3: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -421,9 +412,7 @@ RsDoMemory32FixedDescriptor ( * * FUNCTION: RsDoStartDependentDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -433,19 +422,21 @@ RsDoMemory32FixedDescriptor ( ASL_RESOURCE_NODE * RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; ASL_RESOURCE_NODE *PreviousRnode; ASL_RESOURCE_NODE *NextRnode; + ASL_RESOURCE_INFO NextInfo; + UINT32 CurrentByteOffset; UINT32 i; UINT8 State; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT)); PreviousRnode = Rnode; @@ -491,8 +482,10 @@ RsDoStartDependentDescriptor ( default: - NextRnode = RsDoOneResourceDescriptor (InitializerOp, - CurrentByteOffset, &State); + NextInfo.CurrentByteOffset = CurrentByteOffset; + NextInfo.DescriptorTypeOp = InitializerOp; + + NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State); /* * Update current byte offset to indicate the number of bytes from the @@ -516,9 +509,7 @@ RsDoStartDependentDescriptor ( * * FUNCTION: RsDoStartDependentNoPriDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -528,18 +519,20 @@ RsDoStartDependentDescriptor ( ASL_RESOURCE_NODE * RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; ASL_RESOURCE_NODE *PreviousRnode; ASL_RESOURCE_NODE *NextRnode; + ASL_RESOURCE_INFO NextInfo; + UINT32 CurrentByteOffset; UINT8 State; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)); Descriptor = Rnode->Buffer; @@ -556,8 +549,10 @@ RsDoStartDependentNoPriDescriptor ( State = ACPI_RSTATE_START_DEPENDENT; while (InitializerOp) { - NextRnode = RsDoOneResourceDescriptor (InitializerOp, - CurrentByteOffset, &State); + NextInfo.CurrentByteOffset = CurrentByteOffset; + NextInfo.DescriptorTypeOp = InitializerOp; + + NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State); /* * Update current byte offset to indicate the number of bytes from the @@ -578,9 +573,7 @@ RsDoStartDependentNoPriDescriptor ( * * FUNCTION: RsDoVendorSmallDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -590,8 +583,7 @@ RsDoStartDependentNoPriDescriptor ( ASL_RESOURCE_NODE * RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -600,7 +592,7 @@ RsDoVendorSmallDescriptor ( UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; /* Allocate worst case - 7 vendor bytes */ diff --git a/source/compiler/aslrestype1i.c b/source/compiler/aslrestype1i.c index bc16d72..ca4771e 100644 --- a/source/compiler/aslrestype1i.c +++ b/source/compiler/aslrestype1i.c @@ -62,9 +62,7 @@ * * FUNCTION: RsDoDmaDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -74,18 +72,19 @@ ASL_RESOURCE_NODE * RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; UINT8 DmaChannelMask = 0; UINT8 DmaChannels = 0; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA)); Descriptor = Rnode->Buffer; @@ -121,7 +120,7 @@ RsDoDmaDescriptor ( case 3: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -183,9 +182,7 @@ RsDoDmaDescriptor ( * * FUNCTION: RsDoFixedDmaDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -195,16 +192,17 @@ RsDoDmaDescriptor ( ASL_RESOURCE_NODE * RsDoFixedDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_DMA)); Descriptor = Rnode->Buffer; @@ -240,7 +238,7 @@ RsDoFixedDmaDescriptor ( case 3: /* Descriptor Name (optional) */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: /* Ignore any extra nodes */ @@ -259,9 +257,7 @@ RsDoFixedDmaDescriptor ( * * FUNCTION: RsDoFixedIoDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -271,17 +267,18 @@ RsDoFixedDmaDescriptor ( ASL_RESOURCE_NODE * RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ACPI_PARSE_OBJECT *AddressOp = NULL; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO)); Descriptor = Rnode->Buffer; @@ -313,7 +310,7 @@ RsDoFixedIoDescriptor ( case 2: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -340,9 +337,7 @@ RsDoFixedIoDescriptor ( * * FUNCTION: RsDoIoDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -352,8 +347,7 @@ RsDoFixedIoDescriptor ( ASL_RESOURCE_NODE * RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -362,10 +356,12 @@ RsDoIoDescriptor ( ACPI_PARSE_OBJECT *LengthOp = NULL; ACPI_PARSE_OBJECT *AlignOp = NULL; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO)); Descriptor = Rnode->Buffer; @@ -423,7 +419,7 @@ RsDoIoDescriptor ( case 5: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -442,7 +438,7 @@ RsDoIoDescriptor ( Descriptor->Io.Maximum, Descriptor->Io.AddressLength, Descriptor->Io.Alignment, - MinOp, MaxOp, LengthOp, AlignOp, Op); + MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp); return (Rnode); } @@ -452,9 +448,7 @@ RsDoIoDescriptor ( * * FUNCTION: RsDoIrqDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -464,18 +458,19 @@ RsDoIoDescriptor ( ASL_RESOURCE_NODE * RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; UINT32 Interrupts = 0; UINT16 IrqMask = 0; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ)); /* Length = 3 (with flag byte) */ @@ -513,7 +508,7 @@ RsDoIrqDescriptor ( case 3: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -575,9 +570,7 @@ RsDoIrqDescriptor ( * * FUNCTION: RsDoIrqNoFlagsDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -587,18 +580,19 @@ RsDoIrqDescriptor ( ASL_RESOURCE_NODE * RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; UINT16 IrqMask = 0; UINT32 Interrupts = 0; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS)); Descriptor = Rnode->Buffer; @@ -613,7 +607,7 @@ RsDoIrqNoFlagsDescriptor ( { case 0: /* Name */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: diff --git a/source/compiler/aslrestype2.c b/source/compiler/aslrestype2.c index 9579fe4..ed848c6 100644 --- a/source/compiler/aslrestype2.c +++ b/source/compiler/aslrestype2.c @@ -60,9 +60,7 @@ * * FUNCTION: RsDoGeneralRegisterDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -72,16 +70,17 @@ ASL_RESOURCE_NODE * RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; ASL_RESOURCE_NODE *Rnode; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GENERIC_REGISTER)); Descriptor = Rnode->Buffer; @@ -137,7 +136,7 @@ RsDoGeneralRegisterDescriptor ( case 5: /* ResourceTag (ACPI 3.0b) */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -156,9 +155,7 @@ RsDoGeneralRegisterDescriptor ( * * FUNCTION: RsDoInterruptDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -168,8 +165,7 @@ RsDoGeneralRegisterDescriptor ( ASL_RESOURCE_NODE * RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; AML_RESOURCE *Rover = NULL; @@ -177,13 +173,15 @@ RsDoInterruptDescriptor ( ASL_RESOURCE_NODE *Rnode; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN HasResSourceIndex = FALSE; UINT8 ResSourceIndex = 0; UINT8 *ResSourceString = NULL; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; StringLength = RsGetStringDataLength (InitializerOp); /* Count the interrupt numbers */ @@ -210,9 +208,9 @@ RsDoInterruptDescriptor ( OptionIndex += 4; } - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_EXTENDED_IRQ) + - 1 + OptionIndex + StringLength); + 1 + OptionIndex + StringLength); Descriptor = Rnode->Buffer; Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ; @@ -302,7 +300,7 @@ RsDoInterruptDescriptor ( case 6: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -395,9 +393,7 @@ RsDoInterruptDescriptor ( * * FUNCTION: RsDoVendorLargeDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -407,8 +403,7 @@ RsDoInterruptDescriptor ( ASL_RESOURCE_NODE * RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -419,7 +414,7 @@ RsDoVendorLargeDescriptor ( /* Count the number of data bytes */ - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); for (i = 0; InitializerOp; i++) @@ -431,7 +426,7 @@ RsDoVendorLargeDescriptor ( InitializerOp = InitializerOp->Asl.Next; } - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_LARGE) + i); diff --git a/source/compiler/aslrestype2d.c b/source/compiler/aslrestype2d.c index 297f99a..edce9c8 100644 --- a/source/compiler/aslrestype2d.c +++ b/source/compiler/aslrestype2d.c @@ -59,9 +59,7 @@ * * FUNCTION: RsDoDwordIoDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -71,8 +69,7 @@ ASL_RESOURCE_NODE * RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -84,12 +81,14 @@ RsDoDwordIoDescriptor ( UINT16 StringLength = 0; UINT32 OptionIndex = 0; UINT8 *OptionalFields; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); @@ -244,7 +243,7 @@ RsDoDwordIoDescriptor ( case 12: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 13: /* Type */ @@ -278,10 +277,10 @@ RsDoDwordIoDescriptor ( (UINT64) Descriptor->Address32.AddressLength, (UINT64) Descriptor->Address32.Granularity, Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } @@ -290,9 +289,7 @@ RsDoDwordIoDescriptor ( * * FUNCTION: RsDoDwordMemoryDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -302,8 +299,7 @@ RsDoDwordIoDescriptor ( ASL_RESOURCE_NODE * RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -315,12 +311,14 @@ RsDoDwordMemoryDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); @@ -479,7 +477,7 @@ RsDoDwordMemoryDescriptor ( case 13: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; @@ -514,10 +512,10 @@ RsDoDwordMemoryDescriptor ( (UINT64) Descriptor->Address32.AddressLength, (UINT64) Descriptor->Address32.Granularity, Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } @@ -526,9 +524,7 @@ RsDoDwordMemoryDescriptor ( * * FUNCTION: RsDoDwordSpaceDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -538,8 +534,7 @@ RsDoDwordMemoryDescriptor ( ASL_RESOURCE_NODE * RsDoDwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -551,12 +546,14 @@ RsDoDwordSpaceDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength); @@ -711,7 +708,7 @@ RsDoDwordSpaceDescriptor ( case 13: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -732,9 +729,9 @@ RsDoDwordSpaceDescriptor ( (UINT64) Descriptor->Address32.AddressLength, (UINT64) Descriptor->Address32.Granularity, Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } diff --git a/source/compiler/aslrestype2e.c b/source/compiler/aslrestype2e.c index 08590cc..94fb2344 100644 --- a/source/compiler/aslrestype2e.c +++ b/source/compiler/aslrestype2e.c @@ -58,9 +58,7 @@ * * FUNCTION: RsDoExtendedIoDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -70,8 +68,7 @@ ASL_RESOURCE_NODE * RsDoExtendedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -81,11 +78,13 @@ RsDoExtendedIoDescriptor ( ACPI_PARSE_OBJECT *GranOp = NULL; ASL_RESOURCE_NODE *Rnode; UINT16 StringLength = 0; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); @@ -186,7 +185,7 @@ RsDoExtendedIoDescriptor ( case 11: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 12: /* Type */ @@ -220,9 +219,10 @@ RsDoExtendedIoDescriptor ( Descriptor->ExtAddress64.AddressLength, Descriptor->ExtAddress64.Granularity, Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; + Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + + StringLength; return (Rnode); } @@ -231,9 +231,7 @@ RsDoExtendedIoDescriptor ( * * FUNCTION: RsDoExtendedMemoryDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -243,8 +241,7 @@ RsDoExtendedIoDescriptor ( ASL_RESOURCE_NODE * RsDoExtendedMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -254,11 +251,13 @@ RsDoExtendedMemoryDescriptor ( ACPI_PARSE_OBJECT *GranOp = NULL; ASL_RESOURCE_NODE *Rnode; UINT16 StringLength = 0; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); @@ -366,7 +365,7 @@ RsDoExtendedMemoryDescriptor ( case 12: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; @@ -401,9 +400,10 @@ RsDoExtendedMemoryDescriptor ( Descriptor->ExtAddress64.AddressLength, Descriptor->ExtAddress64.Granularity, Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; + Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + + StringLength; return (Rnode); } @@ -412,9 +412,7 @@ RsDoExtendedMemoryDescriptor ( * * FUNCTION: RsDoExtendedSpaceDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -424,8 +422,7 @@ RsDoExtendedMemoryDescriptor ( ASL_RESOURCE_NODE * RsDoExtendedSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -435,11 +432,13 @@ RsDoExtendedSpaceDescriptor ( ACPI_PARSE_OBJECT *GranOp = NULL; ASL_RESOURCE_NODE *Rnode; UINT16 StringLength = 0; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength); @@ -544,7 +543,7 @@ RsDoExtendedSpaceDescriptor ( case 12: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -564,8 +563,9 @@ RsDoExtendedSpaceDescriptor ( Descriptor->ExtAddress64.AddressLength, Descriptor->ExtAddress64.Granularity, Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); - Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; + Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + + StringLength; return (Rnode); } diff --git a/source/compiler/aslrestype2q.c b/source/compiler/aslrestype2q.c index 0bd32e7..2e548e8 100644 --- a/source/compiler/aslrestype2q.c +++ b/source/compiler/aslrestype2q.c @@ -59,9 +59,7 @@ * * FUNCTION: RsDoQwordIoDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -71,8 +69,7 @@ ASL_RESOURCE_NODE * RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -84,12 +81,14 @@ RsDoQwordIoDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); @@ -235,7 +234,7 @@ RsDoQwordIoDescriptor ( case 12: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 13: /* Type */ @@ -269,10 +268,10 @@ RsDoQwordIoDescriptor ( Descriptor->Address64.AddressLength, Descriptor->Address64.Granularity, Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } @@ -281,9 +280,7 @@ RsDoQwordIoDescriptor ( * * FUNCTION: RsDoQwordMemoryDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -293,8 +290,7 @@ RsDoQwordIoDescriptor ( ASL_RESOURCE_NODE * RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -306,12 +302,14 @@ RsDoQwordMemoryDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); @@ -464,7 +462,7 @@ RsDoQwordMemoryDescriptor ( case 13: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; @@ -499,10 +497,10 @@ RsDoQwordMemoryDescriptor ( Descriptor->Address64.AddressLength, Descriptor->Address64.Granularity, Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } @@ -511,9 +509,7 @@ RsDoQwordMemoryDescriptor ( * * FUNCTION: RsDoQwordSpaceDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -523,8 +519,7 @@ RsDoQwordMemoryDescriptor ( ASL_RESOURCE_NODE * RsDoQwordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -536,12 +531,14 @@ RsDoQwordSpaceDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength); @@ -691,7 +688,7 @@ RsDoQwordSpaceDescriptor ( case 13: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -711,9 +708,9 @@ RsDoQwordSpaceDescriptor ( Descriptor->Address64.AddressLength, Descriptor->Address64.Granularity, Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c index c607899..7e4884b 100644 --- a/source/compiler/aslrestype2s.c +++ b/source/compiler/aslrestype2s.c @@ -267,9 +267,7 @@ RsGetVendorData ( * * FUNCTION: RsDoGpioIntDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -279,8 +277,7 @@ RsGetVendorData ( ASL_RESOURCE_NODE * RsDoGpioIntDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -288,14 +285,18 @@ RsDoGpioIntDescriptor ( char *ResourceSource = NULL; UINT8 *VendorData = NULL; UINT16 *InterruptList = NULL; + UINT16 *PinList = NULL; UINT16 ResSourceLength; UINT16 VendorLength; UINT16 InterruptLength; UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; /* * Calculate lengths for fields that have variable length: @@ -323,6 +324,7 @@ RsDoGpioIntDescriptor ( /* Build pointers to optional areas */ InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO)); + PinList = InterruptList; ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength); VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); @@ -406,7 +408,7 @@ RsDoGpioIntDescriptor ( case 8: /* Resource Tag (Descriptor Name) */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ @@ -437,6 +439,7 @@ RsDoGpioIntDescriptor ( */ *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; InterruptList++; + PinCount++; /* Case 10: First interrupt number in list */ @@ -465,6 +468,7 @@ RsDoGpioIntDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } + MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource); return (Rnode); } @@ -473,9 +477,7 @@ RsDoGpioIntDescriptor ( * * FUNCTION: RsDoGpioIoDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -485,8 +487,7 @@ RsDoGpioIntDescriptor ( ASL_RESOURCE_NODE * RsDoGpioIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -494,14 +495,18 @@ RsDoGpioIoDescriptor ( char *ResourceSource = NULL; UINT8 *VendorData = NULL; UINT16 *InterruptList = NULL; + UINT16 *PinList = NULL; UINT16 ResSourceLength; UINT16 VendorLength; UINT16 InterruptLength; UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; /* * Calculate lengths for fields that have variable length: @@ -512,6 +517,7 @@ RsDoGpioIoDescriptor ( ResSourceLength = RsGetStringDataLength (InitializerOp); VendorLength = RsGetBufferDataLength (InitializerOp); InterruptLength = RsGetInterruptDataLength (InitializerOp); + PinList = InterruptList; DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + ResSourceLength + VendorLength + InterruptLength; @@ -529,6 +535,7 @@ RsDoGpioIoDescriptor ( /* Build pointers to optional areas */ InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO)); + PinList = InterruptList; ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength); VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); @@ -612,7 +619,7 @@ RsDoGpioIoDescriptor ( case 8: /* Resource Tag (Descriptor Name) */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ @@ -642,6 +649,7 @@ RsDoGpioIoDescriptor ( */ *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; InterruptList++; + PinCount++; /* Case 10: First interrupt number in list */ @@ -670,6 +678,7 @@ RsDoGpioIoDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } + MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource); return (Rnode); } @@ -678,9 +687,7 @@ RsDoGpioIoDescriptor ( * * FUNCTION: RsDoI2cSerialBusDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -690,8 +697,7 @@ RsDoGpioIoDescriptor ( ASL_RESOURCE_NODE * RsDoI2cSerialBusDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -701,10 +707,12 @@ RsDoI2cSerialBusDescriptor ( UINT16 ResSourceLength; UINT16 VendorLength; UINT16 DescriptorSize; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; /* * Calculate lengths for fields that have variable length: @@ -800,7 +808,7 @@ RsDoI2cSerialBusDescriptor ( case 7: /* Resource Tag (Descriptor Name) */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ @@ -817,6 +825,7 @@ RsDoI2cSerialBusDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } + MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); return (Rnode); } @@ -825,9 +834,7 @@ RsDoI2cSerialBusDescriptor ( * * FUNCTION: RsDoSpiSerialBusDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -837,8 +844,7 @@ RsDoI2cSerialBusDescriptor ( ASL_RESOURCE_NODE * RsDoSpiSerialBusDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -848,10 +854,12 @@ RsDoSpiSerialBusDescriptor ( UINT16 ResSourceLength; UINT16 VendorLength; UINT16 DescriptorSize; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; /* * Calculate lengths for fields that have variable length: @@ -975,7 +983,7 @@ RsDoSpiSerialBusDescriptor ( case 11: /* Resource Tag (Descriptor Name) */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 12: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ @@ -992,6 +1000,7 @@ RsDoSpiSerialBusDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } + MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); return (Rnode); } @@ -1000,9 +1009,7 @@ RsDoSpiSerialBusDescriptor ( * * FUNCTION: RsDoUartSerialBusDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -1012,8 +1019,7 @@ RsDoSpiSerialBusDescriptor ( ASL_RESOURCE_NODE * RsDoUartSerialBusDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -1023,10 +1029,12 @@ RsDoUartSerialBusDescriptor ( UINT16 ResSourceLength; UINT16 VendorLength; UINT16 DescriptorSize; + UINT32 CurrentByteOffset; UINT32 i; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; /* * Calculate lengths for fields that have variable length: @@ -1167,7 +1175,7 @@ RsDoUartSerialBusDescriptor ( case 12: /* Resource Tag (Descriptor Name) */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ @@ -1184,5 +1192,6 @@ RsDoUartSerialBusDescriptor ( InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); } + MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); return (Rnode); } diff --git a/source/compiler/aslrestype2w.c b/source/compiler/aslrestype2w.c index 7f58bab..33372d8 100644 --- a/source/compiler/aslrestype2w.c +++ b/source/compiler/aslrestype2w.c @@ -59,9 +59,7 @@ * * FUNCTION: RsDoWordIoDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -71,8 +69,7 @@ ASL_RESOURCE_NODE * RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -84,12 +81,14 @@ RsDoWordIoDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); @@ -235,7 +234,7 @@ RsDoWordIoDescriptor ( case 12: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; case 13: /* Type */ @@ -269,10 +268,10 @@ RsDoWordIoDescriptor ( (UINT64) Descriptor->Address16.AddressLength, (UINT64) Descriptor->Address16.Granularity, Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } @@ -281,9 +280,7 @@ RsDoWordIoDescriptor ( * * FUNCTION: RsDoWordBusNumberDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -293,8 +290,7 @@ RsDoWordIoDescriptor ( ASL_RESOURCE_NODE * RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -306,12 +302,14 @@ RsDoWordBusNumberDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); @@ -455,7 +453,7 @@ RsDoWordBusNumberDescriptor ( case 11: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -475,10 +473,10 @@ RsDoWordBusNumberDescriptor ( (UINT64) Descriptor->Address16.AddressLength, (UINT64) Descriptor->Address16.Granularity, Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } @@ -487,9 +485,7 @@ RsDoWordBusNumberDescriptor ( * * FUNCTION: RsDoWordSpaceDescriptor * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) + * PARAMETERS: Info - Parse Op and resource template offset * * RETURN: Completed resource node * @@ -499,8 +495,7 @@ RsDoWordBusNumberDescriptor ( ASL_RESOURCE_NODE * RsDoWordSpaceDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) + ASL_RESOURCE_INFO *Info) { AML_RESOURCE *Descriptor; ACPI_PARSE_OBJECT *InitializerOp; @@ -512,12 +507,14 @@ RsDoWordSpaceDescriptor ( UINT8 *OptionalFields; UINT16 StringLength = 0; UINT32 OptionIndex = 0; + UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; - InitializerOp = Op->Asl.Child; + InitializerOp = Info->DescriptorTypeOp->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); + CurrentByteOffset = Info->CurrentByteOffset; Rnode = RsAllocateResourceNode ( sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength); @@ -672,7 +669,7 @@ RsDoWordSpaceDescriptor ( case 13: /* ResourceTag */ - UtAttachNamepathToOwner (Op, InitializerOp); + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); break; default: @@ -692,9 +689,9 @@ RsDoWordSpaceDescriptor ( (UINT64) Descriptor->Address16.AddressLength, (UINT64) Descriptor->Address16.Granularity, Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp, Op); + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + - OptionIndex + StringLength; + OptionIndex + StringLength; return (Rnode); } diff --git a/source/compiler/aslsupport.y b/source/compiler/aslsupport.y index a1fdec34..dfeca6e 100644 --- a/source/compiler/aslsupport.y +++ b/source/compiler/aslsupport.y @@ -60,20 +60,22 @@ AslCompilerwrap(void) void * -AslLocalAllocate (unsigned int Size) +AslLocalAllocate ( + unsigned int Size) { void *Mem; - DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size); + DbgPrint (ASL_PARSE_OUTPUT, + "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size); - Mem = UtStringCacheCalloc (Size); + Mem = ACPI_ALLOCATE_ZEROED (Size); if (!Mem) { AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_InputByteCount, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); exit (1); } @@ -81,12 +83,11 @@ AslLocalAllocate (unsigned int Size) } ACPI_PARSE_OBJECT * -AslDoError (void) +AslDoError ( + void) { - return (TrCreateLeafNode (PARSEOP_ERRORNODE)); - } diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index cd84d8b..38644e8 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -530,7 +530,6 @@ TrCreateConstantLeafNode ( /* Get the simple filename from the full path */ FlSplitInputPathname (Op->Asl.Filename, &Path, &Filename); - ACPI_FREE (Path); Op->Asl.Value.String = Filename; break; diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index 44c937f..5f01c80 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -165,12 +165,13 @@ typedef enum ASL_FILE_C_SOURCE_OUTPUT, ASL_FILE_ASM_INCLUDE_OUTPUT, ASL_FILE_C_INCLUDE_OUTPUT, - ASL_FILE_C_OFFSET_OUTPUT + ASL_FILE_C_OFFSET_OUTPUT, + ASL_FILE_MAP_OUTPUT } ASL_FILE_TYPES; -#define ASL_MAX_FILE_TYPE 14 +#define ASL_MAX_FILE_TYPE 15 #define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) @@ -247,4 +248,35 @@ typedef struct asl_event_info } ASL_EVENT_INFO; +/* Hardware mapping file structures */ + +typedef struct acpi_gpio_info +{ + struct acpi_gpio_info *Next; + ACPI_PARSE_OBJECT *Op; + char *DeviceName; + ACPI_NAMESPACE_NODE *TargetNode; + UINT32 References; + UINT32 PinCount; + UINT32 PinIndex; + UINT16 PinNumber; + UINT8 Type; + UINT8 Direction; + UINT8 Polarity; + +} ACPI_GPIO_INFO; + +typedef struct acpi_serial_info +{ + struct acpi_serial_info *Next; + ACPI_PARSE_OBJECT *Op; + char *DeviceName; + ACPI_NAMESPACE_NODE *TargetNode; + AML_RESOURCE *Resource; + UINT32 Speed; + UINT16 Address; + +} ACPI_SERIAL_INFO; + + #endif /* __ASLTYPES_H */ diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index 1cbd6e0..f26cfdd 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -85,11 +85,7 @@ XfCheckFieldRange ( UINT32 FieldBitLength, UINT32 AccessBitWidth); -static BOOLEAN -XfIsObjectParental ( - ACPI_PARSE_OBJECT *MethodOp1, - ACPI_PARSE_OBJECT *MethodOp2); - +#ifdef __UNDER_DEVELOPMENT static ACPI_PARSE_OBJECT * XfGetParentMethod ( ACPI_PARSE_OBJECT *Op); @@ -99,6 +95,12 @@ XfCheckIllegalReference ( ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *Node); +static BOOLEAN +XfIsObjectParental ( + ACPI_PARSE_OBJECT *MethodOp1, + ACPI_PARSE_OBJECT *MethodOp2); +#endif + /******************************************************************************* * @@ -278,6 +280,7 @@ XfCheckFieldRange ( } +#ifdef __UNDER_DEVELOPMENT /******************************************************************************* * * FUNCTION: XfIsObjectParental @@ -368,6 +371,7 @@ XfGetParentMethod ( return (NULL); } + /******************************************************************************* * * FUNCTION: XfCheckIllegalReference @@ -446,7 +450,9 @@ XfCheckIllegalReference ( AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, Op->Asl.ExternalName); } + } +#endif /******************************************************************************* @@ -659,9 +665,12 @@ XfNamespaceLocateBegin ( Node->Flags |= ANOBJ_IS_REFERENCED; +#ifdef __UNDER_DEVELOPMENT + /* Check for an illegal reference */ XfCheckIllegalReference (Op, Node); +#endif } /* Attempt to optimize the NamePath */ @@ -1013,6 +1022,14 @@ XfNamespaceLocateBegin ( } } + /* 5) Check for a connection object */ +#if 0 + else if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONNECTION) + { + return_ACPI_STATUS (Status); + } +#endif + Op->Asl.Node = Node; return_ACPI_STATUS (Status); } diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index 5c8fea3..e7dfabf 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -437,6 +437,7 @@ DtCompileTable ( UINT8 FieldType; UINT8 *Buffer; UINT8 *FlagBuffer = NULL; + char *String; UINT32 CurrentFlagByteOffset = 0; ACPI_STATUS Status; @@ -465,8 +466,10 @@ DtCompileTable ( if (Length > 0) { - Subtable->Buffer = ACPI_CAST_PTR (UINT8, UtStringCacheCalloc (Length)); + String = UtStringCacheCalloc (Length); + Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); } + Subtable->Length = Length; Subtable->TotalLength = Length; Buffer = Subtable->Buffer; diff --git a/source/compiler/dtsubtable.c b/source/compiler/dtsubtable.c index a87198d..d4394e3 100644 --- a/source/compiler/dtsubtable.c +++ b/source/compiler/dtsubtable.c @@ -73,13 +73,15 @@ DtCreateSubtable ( DT_SUBTABLE **RetSubtable) { DT_SUBTABLE *Subtable; + char *String; Subtable = UtSubtableCacheCalloc (); /* Create a new buffer for the subtable data */ - Subtable->Buffer = ACPI_CAST_PTR (UINT8, UtStringCacheCalloc (Length)); + String = UtStringCacheCalloc (Length); + Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); ACPI_MEMCPY (Subtable->Buffer, Buffer, Length); Subtable->Length = Length; diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 2231ce1..973e269 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -840,6 +840,10 @@ AcpiDmCheckForHardwareId ( /* _CID with Package: get the package length, check all elements */ NextOp = AcpiPsGetDepthNext (NULL, NextOp); + if (!NextOp) + { + return; + } /* Don't need to use the length, just walk the peer list */ diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index 52e01a9..e3d9e69 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -933,7 +933,9 @@ AcpiDmDisassembleOneOp ( Length = (UINT32) Child->Common.Value.Integer; Info->Level += 1; + Info->MappingOp = Op; Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; + AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length); Info->Level -= 1; diff --git a/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c index ff6278b..3fcfa41 100644 --- a/source/components/disassembler/dmresrc.c +++ b/source/components/disassembler/dmresrc.c @@ -259,6 +259,11 @@ AcpiDmResourceTemplate ( ACPI_NAMESPACE_NODE *Node; + if (Op->Asl.AmlOpcode != AML_FIELD_OP) + { + Info->MappingOp = Op; + } + Level = Info->Level; ResourceName = ACPI_DEFAULT_RESNAME; Node = Op->Common.Node; @@ -327,7 +332,7 @@ AcpiDmResourceTemplate ( /* Go ahead and insert EndDependentFn() */ - AcpiDmEndDependentDescriptor (Aml, ResourceLength, Level); + AcpiDmEndDependentDescriptor (Info, Aml, ResourceLength, Level); AcpiDmIndent (Level); AcpiOsPrintf ( @@ -349,7 +354,7 @@ AcpiDmResourceTemplate ( } AcpiGbl_DmResourceDispatch [ResourceIndex] ( - Aml, ResourceLength, Level); + Info, Aml, ResourceLength, Level); /* Descriptor post-processing */ diff --git a/source/components/disassembler/dmresrcl.c b/source/components/disassembler/dmresrcl.c index d6707d3..a7db21f 100644 --- a/source/components/disassembler/dmresrcl.c +++ b/source/components/disassembler/dmresrcl.c @@ -575,7 +575,8 @@ AcpiDmResourceSource ( * * FUNCTION: AcpiDmWordDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -587,6 +588,7 @@ AcpiDmResourceSource ( void AcpiDmWordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -620,7 +622,8 @@ AcpiDmWordDescriptor ( * * FUNCTION: AcpiDmDwordDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -632,6 +635,7 @@ AcpiDmWordDescriptor ( void AcpiDmDwordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -665,7 +669,8 @@ AcpiDmDwordDescriptor ( * * FUNCTION: AcpiDmQwordDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -677,6 +682,7 @@ AcpiDmDwordDescriptor ( void AcpiDmQwordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -710,7 +716,8 @@ AcpiDmQwordDescriptor ( * * FUNCTION: AcpiDmExtendedDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -722,6 +729,7 @@ AcpiDmQwordDescriptor ( void AcpiDmExtendedDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -757,7 +765,8 @@ AcpiDmExtendedDescriptor ( * * FUNCTION: AcpiDmMemory24Descriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -769,6 +778,7 @@ AcpiDmExtendedDescriptor ( void AcpiDmMemory24Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -796,7 +806,8 @@ AcpiDmMemory24Descriptor ( * * FUNCTION: AcpiDmMemory32Descriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -808,6 +819,7 @@ AcpiDmMemory24Descriptor ( void AcpiDmMemory32Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -835,7 +847,8 @@ AcpiDmMemory32Descriptor ( * * FUNCTION: AcpiDmFixedMemory32Descriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -847,6 +860,7 @@ AcpiDmMemory32Descriptor ( void AcpiDmFixedMemory32Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -876,7 +890,8 @@ AcpiDmFixedMemory32Descriptor ( * * FUNCTION: AcpiDmGenericRegisterDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -888,6 +903,7 @@ AcpiDmFixedMemory32Descriptor ( void AcpiDmGenericRegisterDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -932,7 +948,8 @@ AcpiDmGenericRegisterDescriptor ( * * FUNCTION: AcpiDmInterruptDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -944,6 +961,7 @@ AcpiDmGenericRegisterDescriptor ( void AcpiDmInterruptDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -1038,7 +1056,8 @@ AcpiDmVendorCommon ( * * FUNCTION: AcpiDmVendorLargeDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -1050,6 +1069,7 @@ AcpiDmVendorCommon ( void AcpiDmVendorLargeDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index dd9039e..cb6dd68 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/components/disassembler/dmresrcl2.c @@ -55,24 +55,28 @@ static void AcpiDmI2cSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); static void AcpiDmSpiSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); static void AcpiDmUartSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); static void AcpiDmGpioCommon ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Level); @@ -167,7 +171,8 @@ Finish: * * FUNCTION: AcpiDmGpioCommon * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Level - Current source code indentation level * * RETURN: None @@ -178,12 +183,14 @@ Finish: static void AcpiDmGpioCommon ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Level) { - UINT32 PinCount; UINT16 *PinList; UINT8 *VendorData; + char *DeviceName = NULL; + UINT32 PinCount; UINT32 i; @@ -192,9 +199,8 @@ AcpiDmGpioCommon ( AcpiDmIndent (Level + 1); if (Resource->Gpio.ResSourceOffset) { - AcpiUtPrintString ( - ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset), - ACPI_UINT16_MAX); + DeviceName = ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); } AcpiOsPrintf (", "); @@ -242,6 +248,8 @@ AcpiDmGpioCommon ( AcpiDmIndent (Level + 1); AcpiOsPrintf ("}\n"); + + MpSaveGpioInfo (Info->MappingOp, Resource, PinCount, PinList, DeviceName); } @@ -249,7 +257,8 @@ AcpiDmGpioCommon ( * * FUNCTION: AcpiDmGpioIntDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -261,6 +270,7 @@ AcpiDmGpioCommon ( static void AcpiDmGpioIntDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -291,7 +301,7 @@ AcpiDmGpioIntDescriptor ( /* Dump the GpioInt/GpioIo common portion of the descriptor */ - AcpiDmGpioCommon (Resource, Level); + AcpiDmGpioCommon (Info, Resource, Level); } @@ -299,7 +309,8 @@ AcpiDmGpioIntDescriptor ( * * FUNCTION: AcpiDmGpioIoDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -311,6 +322,7 @@ AcpiDmGpioIntDescriptor ( static void AcpiDmGpioIoDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -343,7 +355,7 @@ AcpiDmGpioIoDescriptor ( /* Dump the GpioInt/GpioIo common portion of the descriptor */ - AcpiDmGpioCommon (Resource, Level); + AcpiDmGpioCommon (Info, Resource, Level); } @@ -351,7 +363,8 @@ AcpiDmGpioIoDescriptor ( * * FUNCTION: AcpiDmGpioDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -363,6 +376,7 @@ AcpiDmGpioIoDescriptor ( void AcpiDmGpioDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -376,12 +390,12 @@ AcpiDmGpioDescriptor ( { case AML_RESOURCE_GPIO_TYPE_INT: - AcpiDmGpioIntDescriptor (Resource, Length, Level); + AcpiDmGpioIntDescriptor (Info, Resource, Length, Level); break; case AML_RESOURCE_GPIO_TYPE_IO: - AcpiDmGpioIoDescriptor (Resource, Length, Level); + AcpiDmGpioIoDescriptor (Info, Resource, Length, Level); break; default: @@ -459,7 +473,8 @@ AcpiDmDumpSerialBusVendorData ( * * FUNCTION: AcpiDmI2cSerialBusDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -471,11 +486,13 @@ AcpiDmDumpSerialBusVendorData ( static void AcpiDmI2cSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { UINT32 ResourceSourceOffset; + char *DeviceName; /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */ @@ -495,9 +512,8 @@ AcpiDmI2cSerialBusDescriptor ( ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Resource->CommonSerialBus.TypeDataLength; - AcpiUtPrintString ( - ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), - ACPI_UINT16_MAX); + DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ @@ -518,6 +534,8 @@ AcpiDmI2cSerialBusDescriptor ( AcpiDmIndent (Level + 1); AcpiDmDumpSerialBusVendorData (Resource, Level); AcpiOsPrintf (")\n"); + + MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); } @@ -525,7 +543,8 @@ AcpiDmI2cSerialBusDescriptor ( * * FUNCTION: AcpiDmSpiSerialBusDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -537,11 +556,13 @@ AcpiDmI2cSerialBusDescriptor ( static void AcpiDmSpiSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { UINT32 ResourceSourceOffset; + char *DeviceName; /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */ @@ -570,9 +591,8 @@ AcpiDmSpiSerialBusDescriptor ( ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Resource->CommonSerialBus.TypeDataLength; - AcpiUtPrintString ( - ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), - ACPI_UINT16_MAX); + DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ @@ -593,6 +613,8 @@ AcpiDmSpiSerialBusDescriptor ( AcpiDmIndent (Level + 1); AcpiDmDumpSerialBusVendorData (Resource, Level); AcpiOsPrintf (")\n"); + + MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); } @@ -600,7 +622,8 @@ AcpiDmSpiSerialBusDescriptor ( * * FUNCTION: AcpiDmUartSerialBusDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -612,11 +635,13 @@ AcpiDmSpiSerialBusDescriptor ( static void AcpiDmUartSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { UINT32 ResourceSourceOffset; + char *DeviceName; /* ConnectionSpeed, BitsPerByte, StopBits */ @@ -648,9 +673,8 @@ AcpiDmUartSerialBusDescriptor ( ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Resource->CommonSerialBus.TypeDataLength; - AcpiUtPrintString ( - ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), - ACPI_UINT16_MAX); + DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); /* ResourceSourceIndex, ResourceUsage */ @@ -671,6 +695,8 @@ AcpiDmUartSerialBusDescriptor ( AcpiDmIndent (Level + 1); AcpiDmDumpSerialBusVendorData (Resource, Level); AcpiOsPrintf (")\n"); + + MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); } @@ -678,7 +704,8 @@ AcpiDmUartSerialBusDescriptor ( * * FUNCTION: AcpiDmSerialBusDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -690,13 +717,14 @@ AcpiDmUartSerialBusDescriptor ( void AcpiDmSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { SerialBusResourceDispatch [Resource->CommonSerialBus.Type] ( - Resource, Length, Level); + Info, Resource, Length, Level); } #endif diff --git a/source/components/disassembler/dmresrcs.c b/source/components/disassembler/dmresrcs.c index cbbdc71..3710166 100644 --- a/source/components/disassembler/dmresrcs.c +++ b/source/components/disassembler/dmresrcs.c @@ -56,7 +56,8 @@ * * FUNCTION: AcpiDmIrqDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -68,6 +69,7 @@ void AcpiDmIrqDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -101,7 +103,8 @@ AcpiDmIrqDescriptor ( * * FUNCTION: AcpiDmDmaDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -113,6 +116,7 @@ AcpiDmIrqDescriptor ( void AcpiDmDmaDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -138,7 +142,8 @@ AcpiDmDmaDescriptor ( * * FUNCTION: AcpiDmFixedDmaDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -150,6 +155,7 @@ AcpiDmDmaDescriptor ( void AcpiDmFixedDmaDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -181,7 +187,8 @@ AcpiDmFixedDmaDescriptor ( * * FUNCTION: AcpiDmIoDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -193,6 +200,7 @@ AcpiDmFixedDmaDescriptor ( void AcpiDmIoDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -226,7 +234,8 @@ AcpiDmIoDescriptor ( * * FUNCTION: AcpiDmFixedIoDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -238,6 +247,7 @@ AcpiDmIoDescriptor ( void AcpiDmFixedIoDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -264,7 +274,8 @@ AcpiDmFixedIoDescriptor ( * * FUNCTION: AcpiDmStartDependentDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -276,6 +287,7 @@ AcpiDmFixedIoDescriptor ( void AcpiDmStartDependentDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -303,7 +315,8 @@ AcpiDmStartDependentDescriptor ( * * FUNCTION: AcpiDmEndDependentDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -315,6 +328,7 @@ AcpiDmStartDependentDescriptor ( void AcpiDmEndDependentDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) @@ -331,7 +345,8 @@ AcpiDmEndDependentDescriptor ( * * FUNCTION: AcpiDmVendorSmallDescriptor * - * PARAMETERS: Resource - Pointer to the resource descriptor + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor * Length - Length of the descriptor in bytes * Level - Current source code indentation level * @@ -343,6 +358,7 @@ AcpiDmEndDependentDescriptor ( void AcpiDmVendorSmallDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index f3d5cfa..a067116 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -391,6 +391,7 @@ AcpiDsGetFieldNames ( */ Info->ResourceBuffer = NULL; Info->ConnectionNode = NULL; + Info->PinNumberIndex = 0; /* * A Connection() is either an actual resource descriptor (buffer) @@ -466,6 +467,7 @@ AcpiDsGetFieldNames ( } Info->FieldBitPosition += Info->FieldBitLength; + Info->PinNumberIndex++; /* Index relative to previous Connection() */ break; default: diff --git a/source/components/events/evgpeinit.c b/source/components/events/evgpeinit.c index a8aea02..ac54f00 100644 --- a/source/components/events/evgpeinit.c +++ b/source/components/events/evgpeinit.c @@ -443,6 +443,10 @@ AcpiEvMatchGpeMethod ( return_ACPI_STATUS (AE_OK); } + /* Disable the GPE in case it's been enabled already. */ + + (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + /* * Add the GPE information from above to the GpeEventInfo block for * use during dispatch of this GPE. diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index 8531b5a..2acafab 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -158,6 +158,7 @@ AcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; ACPI_CONNECTION_INFO *Context; + ACPI_PHYSICAL_ADDRESS Address; ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch); @@ -247,23 +248,33 @@ AcpiEvAddressSpaceDispatch ( /* We have everything we need, we can invoke the address space handler */ Handler = HandlerDesc->AddressSpace.Handler; - - ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", - &RegionObj->Region.Handler->AddressSpace, Handler, - ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset), - AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + Address = (RegionObj->Region.Address + RegionOffset); /* * 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. + * 1) Connection buffer, a resource template from Connection() op + * 2) Length of the above buffer + * 3) Actual access length from the AccessAs() op + * + * In addition, for GeneralPurposeIo, the Address and BitWidth fields + * are defined as follows: + * 1) Address is the pin number index of the field (bit offset from + * the previous Connection) + * 2) BitWidth is the actual bit length of the field (number of pins) */ - if (((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) || - (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) && + if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) && + Context && + FieldObj) + { + /* Get the Connection (ResourceTemplate) buffer */ + + Context->Connection = FieldObj->Field.ResourceBuffer; + Context->Length = FieldObj->Field.ResourceLength; + Context->AccessLength = FieldObj->Field.AccessLength; + } + if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO) && Context && FieldObj) { @@ -272,8 +283,16 @@ AcpiEvAddressSpaceDispatch ( Context->Connection = FieldObj->Field.ResourceBuffer; Context->Length = FieldObj->Field.ResourceLength; Context->AccessLength = FieldObj->Field.AccessLength; + Address = FieldObj->Field.PinNumberIndex; + BitWidth = FieldObj->Field.BitLength; } + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, + "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", + &RegionObj->Region.Handler->AddressSpace, Handler, + ACPI_FORMAT_NATIVE_UINT (Address), + AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + if (!(HandlerDesc->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { @@ -287,9 +306,8 @@ AcpiEvAddressSpaceDispatch ( /* Call the handler */ - Status = Handler (Function, - (RegionObj->Region.Address + RegionOffset), BitWidth, Value, - Context, RegionObj2->Extra.RegionContext); + Status = Handler (Function, Address, BitWidth, Value, Context, + RegionObj2->Extra.RegionContext); if (ACPI_FAILURE (Status)) { diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index bbd88dc..327fd9b 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -1036,7 +1036,8 @@ AcpiRemoveGpeHandler ( * enabled, it should be enabled at this point to restore the * post-initialization configuration. */ - if ((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) && + if (((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) || + (Handler->OriginalFlags & ACPI_GPE_DISPATCH_NOTIFY)) && Handler->OriginallyEnabled) { (void) AcpiEvAddGpeReference (GpeEventInfo); diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c index 683c73b..3a3cf84 100644 --- a/source/components/events/evxfevnt.c +++ b/source/components/events/evxfevnt.c @@ -364,7 +364,9 @@ AcpiGetEventStatus ( UINT32 Event, ACPI_EVENT_STATUS *EventStatus) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; + ACPI_EVENT_STATUS LocalEventStatus = 0; + UINT32 InByte; ACPI_FUNCTION_TRACE (AcpiGetEventStatus); @@ -382,12 +384,43 @@ AcpiGetEventStatus ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get the status of the requested fixed event */ + /* Fixed event currently can be dispatched? */ + + if (AcpiGbl_FixedEventHandlers[Event].Handler) + { + LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; + } + + /* Fixed event currently enabled? */ Status = AcpiReadBitRegister ( - AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus); + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &InByte); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - return_ACPI_STATUS (Status); + if (InByte) + { + LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED; + } + + /* Fixed event currently active? */ + + Status = AcpiReadBitRegister ( + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, &InByte); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (InByte) + { + LocalEventStatus |= ACPI_EVENT_FLAG_SET; + } + + (*EventStatus) = LocalEventStatus; + return_ACPI_STATUS (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiGetEventStatus) diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index 49d3b66..65520b6 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -273,6 +273,39 @@ AcpiExReadDataFromField ( Buffer = &BufferDesc->Integer.Value; } + if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) + { + /* + * For GPIO (GeneralPurposeIo), the Address will be the bit offset + * from the previous Connection() operator, making it effectively a + * pin number index. The BitLength is the length of the field, which + * is thus the number of pins. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "GPIO FieldRead [FROM]: Pin %u Bits %u\n", + ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* Perform the write */ + + Status = AcpiExAccessRegion (ObjDesc, 0, + (UINT64 *) Buffer, ACPI_READ); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + if (ACPI_FAILURE (Status)) + { + AcpiUtRemoveReference (BufferDesc); + } + else + { + *RetBufferDesc = BufferDesc; + } + return_ACPI_STATUS (Status); + } + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length)); @@ -446,6 +479,41 @@ AcpiExWriteDataToField ( *ResultDesc = BufferDesc; return_ACPI_STATUS (Status); } + else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) + { + /* + * For GPIO (GeneralPurposeIo), we will bypass the entire field + * mechanism and handoff the bit address and bit width directly to + * the handler. The Address will be the bit offset + * from the previous Connection() operator, making it effectively a + * pin number index. The BitLength is the length of the field, which + * is thus the number of pins. + */ + if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) + { + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", + AcpiUtGetTypeName (SourceDesc->Common.Type), + SourceDesc->Common.Type, (UINT32) SourceDesc->Integer.Value, + ObjDesc->Field.PinNumberIndex, ObjDesc->Field.BitLength)); + + Buffer = &SourceDesc->Integer.Value; + + /* Lock entire transaction if requested */ + + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + + /* Perform the write */ + + Status = AcpiExAccessRegion (ObjDesc, 0, + (UINT64 *) Buffer, ACPI_WRITE); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); + return_ACPI_STATUS (Status); + } /* Get a pointer to the data to be written */ diff --git a/source/components/executer/exprep.c b/source/components/executer/exprep.c index 77ccb87..89dcd04 100644 --- a/source/components/executer/exprep.c +++ b/source/components/executer/exprep.c @@ -515,6 +515,8 @@ AcpiExPrepFieldValue ( ObjDesc->Field.ResourceLength = Info->ResourceLength; } + ObjDesc->Field.PinNumberIndex = Info->PinNumberIndex; + /* Allow full data read from EC address space */ if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index b786ca3..701fa78 100644 --- a/source/components/hardware/hwgpe.c +++ b/source/components/hardware/hwgpe.c @@ -241,6 +241,14 @@ AcpiHwGetGpeStatus ( return (AE_BAD_PARAMETER); } + /* GPE currently handled? */ + + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + ACPI_GPE_DISPATCH_NONE) + { + LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; + } + /* Get the info block for the entire GPE register */ GpeRegisterInfo = GpeEventInfo->RegisterInfo; diff --git a/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c index b3b3ed6..04500aa 100644 --- a/source/components/tables/tbxfroot.c +++ b/source/components/tables/tbxfroot.c @@ -54,6 +54,43 @@ /******************************************************************************* * + * FUNCTION: AcpiTbGetRsdpLength + * + * PARAMETERS: Rsdp - Pointer to RSDP + * + * RETURN: Table length + * + * DESCRIPTION: Get the length of the RSDP + * + ******************************************************************************/ + +UINT32 +AcpiTbGetRsdpLength ( + ACPI_TABLE_RSDP *Rsdp) +{ + + if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature)) + { + /* BAD Signature */ + + return (0); + } + + /* "Length" field is available if table version >= 2 */ + + if (Rsdp->Revision >= 2) + { + return (Rsdp->Length); + } + else + { + return (ACPI_RSDP_CHECKSUM_LENGTH); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiTbValidateRsdp * * PARAMETERS: Rsdp - Pointer to unvalidated RSDP diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index a732d17..e3f1eb9 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -190,6 +190,7 @@ typedef struct acpi_op_walk_info UINT32 BitOffset; UINT32 Flags; ACPI_WALK_STATE *WalkState; + ACPI_PARSE_OBJECT *MappingOp; } ACPI_OP_WALK_INFO; @@ -207,6 +208,7 @@ ACPI_STATUS (*ASL_WALK_CALLBACK) ( typedef void (*ACPI_RESOURCE_HANDLER) ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -793,72 +795,84 @@ AcpiDmDescriptorName ( */ void AcpiDmWordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmDwordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmExtendedDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmQwordDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmMemory24Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmMemory32Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmFixedMemory32Descriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmGenericRegisterDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmInterruptDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmVendorLargeDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmGpioDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmSerialBusDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -876,48 +890,56 @@ AcpiDmVendorCommon ( */ void AcpiDmIrqDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmDmaDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmFixedDmaDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmIoDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmFixedIoDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmStartDependentDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmEndDependentDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmVendorSmallDescriptor ( + ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 7b9e83d..d911985 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -291,6 +291,7 @@ typedef struct acpi_create_field_info UINT32 FieldBitPosition; UINT32 FieldBitLength; UINT16 ResourceLength; + UINT16 PinNumberIndex; UINT8 FieldFlags; UINT8 Attribute; UINT8 FieldType; diff --git a/source/include/acnames.h b/source/include/acnames.h index bd2a168..3297a73 100644 --- a/source/include/acnames.h +++ b/source/include/acnames.h @@ -52,6 +52,7 @@ #define METHOD_NAME__CBA "_CBA" #define METHOD_NAME__CID "_CID" #define METHOD_NAME__CRS "_CRS" +#define METHOD_NAME__DDN "_DDN" #define METHOD_NAME__HID "_HID" #define METHOD_NAME__INI "_INI" #define METHOD_NAME__PLD "_PLD" diff --git a/source/include/acobject.h b/source/include/acobject.h index 3670049..c08c827 100644 --- a/source/include/acobject.h +++ b/source/include/acobject.h @@ -338,6 +338,7 @@ typedef struct acpi_object_region_field UINT16 ResourceLength; union acpi_operand_object *RegionObj; /* Containing OpRegion object */ UINT8 *ResourceBuffer; /* ResourceTemplate for serial regions/fields */ + UINT16 PinNumberIndex; /* Index relative to previous Connection/Template */ } ACPI_OBJECT_REGION_FIELD; diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 40037b1..1fe8e65 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20140828 +#define ACPI_CA_VERSION 0x20140926 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/actables.h b/source/include/actables.h index e266924..2e30658 100644 --- a/source/include/actables.h +++ b/source/include/actables.h @@ -52,6 +52,10 @@ AcpiAllocateRootTable ( /* * tbxfroot - Root pointer utilities */ +UINT32 +AcpiTbGetRsdpLength ( + ACPI_TABLE_RSDP *Rsdp); + ACPI_STATUS AcpiTbValidateRsdp ( ACPI_TABLE_RSDP *Rsdp); diff --git a/source/include/actypes.h b/source/include/actypes.h index 8171923..0444f5e 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -720,14 +720,15 @@ typedef UINT32 ACPI_EVENT_TYPE; * The encoding of ACPI_EVENT_STATUS is illustrated below. * Note that a set bit (1) indicates the property is TRUE * (e.g. if bit 0 is set then the event is enabled). - * +-------------+-+-+-+ - * | Bits 31:3 |2|1|0| - * +-------------+-+-+-+ - * | | | | - * | | | +- Enabled? - * | | +--- Enabled for wake? - * | +----- Set? - * +----------- + * +-------------+-+-+-+-+ + * | Bits 31:4 |3|2|1|0| + * +-------------+-+-+-+-+ + * | | | | | + * | | | | +- Enabled? + * | | | +--- Enabled for wake? + * | | +----- Set? + * | +------- Has a handler? + * +------------- */ typedef UINT32 ACPI_EVENT_STATUS; @@ -735,6 +736,7 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 +#define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x08 /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */ diff --git a/source/include/amlresrc.h b/source/include/amlresrc.h index 23c4400..cd8b3b6 100644 --- a/source/include/amlresrc.h +++ b/source/include/amlresrc.h @@ -122,6 +122,14 @@ typedef struct asl_resource_node } ASL_RESOURCE_NODE; +typedef struct asl_resource_info +{ + ACPI_PARSE_OBJECT *DescriptorTypeOp; /* Resource descriptor parse node */ + ACPI_PARSE_OBJECT *MappingOp; /* Used for mapfile support */ + UINT32 CurrentByteOffset; /* Offset in resource template */ + +} ASL_RESOURCE_INFO; + /* Macros used to generate AML resource length fields */ @@ -574,4 +582,50 @@ typedef union aml_resource } AML_RESOURCE; + +/* Interfaces used by both the disassembler and compiler */ + +void +MpSaveGpioInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + UINT32 PinCount, + UINT16 *PinList, + char *DeviceName); + +void +MpSaveSerialInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + char *DeviceName); + +char * +MpGetHidFromParseTree ( + ACPI_NAMESPACE_NODE *HidNode); + +char * +MpGetHidViaNamestring ( + char *DeviceName); + +char * +MpGetConnectionInfo ( + ACPI_PARSE_OBJECT *Op, + UINT32 PinIndex, + ACPI_NAMESPACE_NODE **TargetNode, + char **TargetName); + +char * +MpGetParentDeviceHid ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE **TargetNode, + char **ParentDeviceName); + +char * +MpGetDdnValue ( + char *DeviceName); + +char * +MpGetHidValue ( + ACPI_NAMESPACE_NODE *DeviceNode); + #endif diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index b656de9..ca06206 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -137,6 +137,15 @@ OsEnterLineEditMode ( struct termios LocalTermAttributes; + TermAttributesWereSet = 0; + + /* STDIN must be a terminal */ + + if (!isatty (STDIN_FILENO)) + { + return; + } + /* Get and keep the original attributes */ if (tcgetattr (STDIN_FILENO, &OriginalTermAttributes)) diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c index ab5c32c..6248a61 100644 --- a/source/tools/acpidump/apdump.c +++ b/source/tools/acpidump/apdump.c @@ -168,7 +168,7 @@ ApGetTableLength ( if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) { Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table); - return (Rsdp->Length); + return (AcpiTbGetRsdpLength (Rsdp)); } /* Normal ACPI table */ diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index c27338d..a14ae64 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -56,6 +56,7 @@ #include "acdebug.h" #include "actables.h" #include "acinterp.h" +#include "amlresrc.h" #include "acapps.h" #include @@ -69,6 +70,7 @@ extern UINT8 AcpiGbl_UseHwReducedFadt; extern BOOLEAN AcpiGbl_DisplayRegionAccess; extern BOOLEAN AcpiGbl_DoInterfaceTests; extern BOOLEAN AcpiGbl_LoadTestTables; +extern ACPI_CONNECTION_INFO AeMyContext; /* Check for unexpected exceptions */ @@ -196,4 +198,19 @@ AeGlobalEventHandler ( UINT32 EventNumber, void *Context); +/* aeregion */ + +ACPI_STATUS +AeInstallDeviceHandlers ( + void); + +void +AeInstallRegionHandlers ( + void); + +void +AeOverrideRegionHandlers ( + void); + + #endif /* _AECOMMON */ diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 9f32ae7..8ea9efa 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -46,6 +46,7 @@ #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("aehandlers") + /* Local prototypes */ static void @@ -86,13 +87,6 @@ AeTableHandler ( void *Table, void *Context); -static ACPI_STATUS -AeRegionInit ( - ACPI_HANDLE RegionHandle, - UINT32 Function, - void *HandlerContext, - void **RegionContext); - static void AeAttachedDataHandler ( ACPI_HANDLE Object, @@ -108,24 +102,6 @@ AeInterfaceHandler ( ACPI_STRING InterfaceName, UINT32 Supported); -static ACPI_STATUS -AeInstallEcHandler ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AeInstallPciHandler ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AeInstallDeviceHandlers ( - void); - #if (!ACPI_REDUCED_HARDWARE) static UINT32 AeEventHandler ( @@ -146,48 +122,6 @@ static char *TableEvents[] = static UINT32 SigintCount = 0; static AE_DEBUG_REGIONS AeRegions; -BOOLEAN AcpiGbl_DisplayRegionAccess = FALSE; - -/* - * We will override some of the default region handlers, especially - * the SystemMemory handler, which must be implemented locally. - * These handlers are installed "early" - before any _REG methods - * are executed - since they are special in the sense that the ACPI spec - * declares that they must "always be available". Cannot override the - * DataTable region handler either -- needed for test execution. - * - * NOTE: The local region handler will simulate access to these address - * spaces by creating a memory buffer behind each operation region. - */ -static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] = -{ - ACPI_ADR_SPACE_SYSTEM_MEMORY, - ACPI_ADR_SPACE_SYSTEM_IO, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_ADR_SPACE_EC -}; - -/* - * 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_DEFINED1 0x80 -#define ACPI_ADR_SPACE_USER_DEFINED2 0xE4 - -static ACPI_ADR_SPACE_TYPE SpaceIdList[] = -{ - ACPI_ADR_SPACE_SMBUS, - 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_FIXED_HARDWARE, - ACPI_ADR_SPACE_USER_DEFINED1, - ACPI_ADR_SPACE_USER_DEFINED2 -}; - -static ACPI_CONNECTION_INFO AeMyContext; /****************************************************************************** @@ -695,39 +629,6 @@ AeSciHandler ( #endif /* !ACPI_REDUCED_HARDWARE */ -/****************************************************************************** - * - * FUNCTION: AeRegionInit - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Opregion init function. - * - *****************************************************************************/ - -static ACPI_STATUS -AeRegionInit ( - ACPI_HANDLE RegionHandle, - UINT32 Function, - void *HandlerContext, - void **RegionContext) -{ - - if (Function == ACPI_REGION_DEACTIVATE) - { - *RegionContext = NULL; - } - else - { - *RegionContext = RegionHandle; - } - - return (AE_OK); -} - - /******************************************************************************* * * FUNCTION: AeInstallSciHandler @@ -773,93 +674,6 @@ AeInstallSciHandler ( } -/******************************************************************************* - * - * FUNCTION: AeInstallDeviceHandlers, AeInstallEcHandler, - * AeInstallPciHandler - * - * PARAMETERS: ACPI_WALK_NAMESPACE callback - * - * RETURN: Status - * - * DESCRIPTION: Walk entire namespace, install a handler for every EC - * and PCI device found. - * - ******************************************************************************/ - -static ACPI_STATUS -AeInstallEcHandler ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - - - /* Install the handler for this EC device */ - - Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_EC, - AeRegionHandler, AeRegionInit, &AeMyContext); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install an OpRegion handler for EC device (%p)", - ObjHandle)); - } - - return (Status); -} - -static ACPI_STATUS -AeInstallPciHandler ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_STATUS Status; - - - /* Install memory and I/O handlers for the PCI device */ - - Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_IO, - AeRegionHandler, AeRegionInit, &AeMyContext); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install an OpRegion handler for PCI device (%p)", - ObjHandle)); - } - - Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_MEMORY, - AeRegionHandler, AeRegionInit, &AeMyContext); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install an OpRegion handler for PCI device (%p)", - ObjHandle)); - } - - return (AE_CTRL_TERMINATE); -} - -static ACPI_STATUS -AeInstallDeviceHandlers ( - void) -{ - - /* Find all Embedded Controller devices */ - - AcpiGetDevices ("PNP0C09", AeInstallEcHandler, NULL, NULL); - - /* Install a PCI handler */ - - AcpiGetDevices ("PNP0A08", AeInstallPciHandler, NULL, NULL); - return (AE_OK); -} - - /****************************************************************************** * * FUNCTION: AeInstallLateHandlers @@ -877,7 +691,6 @@ AeInstallLateHandlers ( void) { ACPI_STATUS Status; - UINT32 i; #if (!ACPI_REDUCED_HARDWARE) @@ -913,22 +726,7 @@ AeInstallLateHandlers ( * Install handlers for some of the "device driver" address spaces * such as SMBus, etc. */ - for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++) - { - /* Install handler at the root object */ - - Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, - SpaceIdList[i], AeRegionHandler, - AeRegionInit, &AeMyContext); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install an OpRegion handler for %s space(%u)", - AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i])); - return (Status); - } - } - + AeInstallRegionHandlers (); return (AE_OK); } @@ -953,7 +751,6 @@ AeInstallEarlyHandlers ( void) { ACPI_STATUS Status; - UINT32 i; ACPI_HANDLE Handle; @@ -1114,22 +911,7 @@ AeInstallEarlyHandlers ( * Install handlers that will override the default handlers for some of * the space IDs. */ - for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++) - { - /* Install handler at the root object */ - - Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, - DefaultSpaceIdList[i], AeRegionHandler, - AeRegionInit, &AeMyContext); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install a default OpRegion handler for %s space(%u)", - AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]), - DefaultSpaceIdList[i])); - return (Status); - } - } + AeOverrideRegionHandlers (); /* * Initialize the global Region Handler space @@ -1137,584 +919,5 @@ AeInstallEarlyHandlers ( */ AeRegions.NumberOfRegions = 0; AeRegions.RegionList = NULL; - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AeRegionHandler - * - * PARAMETERS: Standard region handler parameters - * - * RETURN: Status - * - * DESCRIPTION: Test handler - Handles some dummy regions via memory that can - * be manipulated in Ring 3. Simulates actual reads and writes. - * - *****************************************************************************/ - -ACPI_STATUS -AeRegionHandler ( - UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, - UINT32 BitWidth, - UINT64 *Value, - void *HandlerContext, - void *RegionContext) -{ - - ACPI_OPERAND_OBJECT *RegionObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, RegionContext); - UINT8 *Buffer = ACPI_CAST_PTR (UINT8, Value); - UINT8 *OldBuffer; - UINT8 *NewBuffer; - ACPI_PHYSICAL_ADDRESS BaseAddress; - ACPI_PHYSICAL_ADDRESS BaseAddressEnd; - ACPI_PHYSICAL_ADDRESS RegionAddress; - ACPI_PHYSICAL_ADDRESS RegionAddressEnd; - ACPI_SIZE Length; - BOOLEAN BufferExists; - BOOLEAN BufferResize; - AE_REGION *RegionElement; - void *BufferValue; - ACPI_STATUS Status; - UINT32 ByteWidth; - UINT32 RegionLength; - UINT32 i; - UINT8 SpaceId; - ACPI_CONNECTION_INFO *MyContext; - UINT32 Value1; - UINT32 Value2; - ACPI_RESOURCE *Resource; - - - ACPI_FUNCTION_NAME (AeRegionHandler); - - /* - * If the object is not a region, simply return - */ - if (RegionObject->Region.Type != ACPI_TYPE_REGION) - { - 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 -do option. - * We use this to support dynamically loaded tables where we pass a valid - * address to the AML. - */ - if (AcpiGbl_DbOpt_NoRegionSupport) - { - BufferValue = ACPI_TO_POINTER (Address); - ByteWidth = (BitWidth / 8); - - if (BitWidth % 8) - { - ByteWidth += 1; - } - goto DoFunction; - } - - 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: - - 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: - - 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: - - Status = AE_BAD_PARAMETER; - break; - } - - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* 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; - - switch (Function & ACPI_IO_MASK) - { - case ACPI_READ: - - switch (Function >> 16) - { - case AML_FIELD_ATTRIB_QUICK: - - Length = 0; - break; - - case AML_FIELD_ATTRIB_SEND_RCV: - case AML_FIELD_ATTRIB_BYTE: - - Length = 1; - break; - - case AML_FIELD_ATTRIB_WORD: - case AML_FIELD_ATTRIB_WORD_CALL: - - Length = 2; - break; - - 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: - - Length = MyContext->AccessLength; - break; - - default: - - break; - } - break; - - case ACPI_WRITE: - - switch (Function >> 16) - { - 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_WORD_CALL: - Length = 2; - break; - - 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: - - Length = MyContext->AccessLength; - break; - - default: - - break; - } - break; - - default: - - 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); - } - - Buffer[0] = 0x7A; - Buffer[1] = (UINT8) Length; - return (AE_OK); - - - case ACPI_ADR_SPACE_IPMI: /* ACPI 4.0 */ - - 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 - * buffer in which to return the IPMI status/length/data. - * - * Return some example data to show use of the bidirectional buffer - */ - Buffer[0] = 0; /* Status byte */ - Buffer[1] = 64; /* Return buffer data length */ - Buffer[2] = 0; /* Completion code */ - 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: - break; - } - - /* - * Search through the linked list for this region's buffer - */ - BufferExists = FALSE; - BufferResize = FALSE; - RegionElement = AeRegions.RegionList; - - if (AeRegions.NumberOfRegions) - { - BaseAddressEnd = BaseAddress + Length - 1; - while (!BufferExists && RegionElement) - { - RegionAddress = RegionElement->Address; - RegionAddressEnd = RegionElement->Address + RegionElement->Length - 1; - RegionLength = RegionElement->Length; - - /* - * Overlapping Region Support - * - * While searching through the region buffer list, determine if an - * overlap exists between the requested buffer space and the current - * RegionElement space. If there is an overlap then replace the old - * buffer with a new buffer of increased size before continuing to - * do the read or write - */ - if (RegionElement->SpaceId != SpaceId || - BaseAddressEnd < RegionAddress || - BaseAddress > RegionAddressEnd) - { - /* - * Requested buffer is outside of the current RegionElement - * bounds - */ - RegionElement = RegionElement->NextRegion; - } - else - { - /* - * Some amount of buffer space sharing exists. There are 4 cases - * to consider: - * - * 1. Right overlap - * 2. Left overlap - * 3. Left and right overlap - * 4. Fully contained - no resizing required - */ - BufferExists = TRUE; - - if ((BaseAddress >= RegionAddress) && - (BaseAddress <= RegionAddressEnd) && - (BaseAddressEnd > RegionAddressEnd)) - { - /* Right overlap */ - - RegionElement->Length = BaseAddress - - RegionAddress + Length; - BufferResize = TRUE; - } - - else if ((BaseAddressEnd >= RegionAddress) && - (BaseAddressEnd <= RegionAddressEnd) && - (BaseAddress < RegionAddress)) - { - /* Left overlap */ - - RegionElement->Address = BaseAddress; - RegionElement->Length = RegionAddress - - BaseAddress + RegionElement->Length; - BufferResize = TRUE; - } - - else if ((BaseAddress < RegionAddress) && - (BaseAddressEnd > RegionAddressEnd)) - { - /* Left and right overlap */ - - RegionElement->Address = BaseAddress; - RegionElement->Length = Length; - BufferResize = TRUE; - } - - /* - * only remaining case is fully contained for which we don't - * need to do anything - */ - if (BufferResize) - { - NewBuffer = AcpiOsAllocate (RegionElement->Length); - if (!NewBuffer) - { - return (AE_NO_MEMORY); - } - - OldBuffer = RegionElement->Buffer; - RegionElement->Buffer = NewBuffer; - NewBuffer = NULL; - - /* Initialize the region with the default fill value */ - - ACPI_MEMSET (RegionElement->Buffer, - AcpiGbl_RegionFillValue, RegionElement->Length); - - /* - * Get BufferValue to point (within the new buffer) to the - * base address of the old buffer - */ - BufferValue = (UINT8 *) RegionElement->Buffer + - (UINT64) RegionAddress - - (UINT64) RegionElement->Address; - - /* - * Copy the old buffer to its same location within the new - * buffer - */ - ACPI_MEMCPY (BufferValue, OldBuffer, RegionLength); - AcpiOsFree (OldBuffer); - } - } - } - } - - /* - * If the Region buffer does not exist, create it now - */ - if (!BufferExists) - { - /* Do the memory allocations first */ - - RegionElement = AcpiOsAllocate (sizeof (AE_REGION)); - if (!RegionElement) - { - return (AE_NO_MEMORY); - } - - RegionElement->Buffer = AcpiOsAllocate (Length); - if (!RegionElement->Buffer) - { - AcpiOsFree (RegionElement); - return (AE_NO_MEMORY); - } - - /* Initialize the region with the default fill value */ - - ACPI_MEMSET (RegionElement->Buffer, AcpiGbl_RegionFillValue, Length); - - RegionElement->Address = BaseAddress; - RegionElement->Length = Length; - RegionElement->SpaceId = SpaceId; - RegionElement->NextRegion = NULL; - - /* - * Increment the number of regions and put this one - * at the head of the list as it will probably get accessed - * more often anyway. - */ - AeRegions.NumberOfRegions += 1; - - if (AeRegions.RegionList) - { - RegionElement->NextRegion = AeRegions.RegionList; - } - - AeRegions.RegionList = RegionElement; - } - - /* Calculate the size of the memory copy */ - - ByteWidth = (BitWidth / 8); - - if (BitWidth % 8) - { - ByteWidth += 1; - } - - /* - * The buffer exists and is pointed to by RegionElement. - * We now need to verify the request is valid and perform the operation. - * - * NOTE: RegionElement->Length is in bytes, therefore it we compare against - * ByteWidth (see above) - */ - if (((UINT64) Address + ByteWidth) > - ((UINT64)(RegionElement->Address) + RegionElement->Length)) - { - ACPI_WARNING ((AE_INFO, - "Request on [%4.4s] is beyond region limit Req-0x%X+0x%X, Base=0x%X, Len-0x%X", - (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address, - ByteWidth, (UINT32)(RegionElement->Address), - RegionElement->Length)); - - return (AE_AML_REGION_LIMIT); - } - - /* - * Get BufferValue to point to the "address" in the buffer - */ - BufferValue = ((UINT8 *) RegionElement->Buffer + - ((UINT64) Address - (UINT64) RegionElement->Address)); - -DoFunction: - /* - * Perform a read or write to the buffer space - */ - switch (Function) - { - case ACPI_READ: - /* - * Set the pointer Value to whatever is in the buffer - */ - ACPI_MEMCPY (Value, BufferValue, ByteWidth); - break; - - case ACPI_WRITE: - /* - * Write the contents of Value to the buffer - */ - ACPI_MEMCPY (BufferValue, Value, ByteWidth); - break; - - default: - - 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/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index c771509..5381b4e 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -98,6 +98,27 @@ static AE_TABLE_DESC *AeTableListHead = NULL; #define AE_SUPPORTED_OPTIONS "?b:d:e:f:ghm^orv^:x:" +/* Stubs for the disassembler */ + +void +MpSaveGpioInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + UINT32 PinCount, + UINT16 *PinList, + char *DeviceName) +{ +} + +void +MpSaveSerialInfo ( + ACPI_PARSE_OBJECT *Op, + AML_RESOURCE *Resource, + char *DeviceName) +{ +} + + /****************************************************************************** * * FUNCTION: usage diff --git a/source/tools/acpiexec/aeregion.c b/source/tools/acpiexec/aeregion.c new file mode 100644 index 0000000..0cd893c --- /dev/null +++ b/source/tools/acpiexec/aeregion.c @@ -0,0 +1,894 @@ +/****************************************************************************** + * + * Module Name: aeregion - Operation region support for acpiexec + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, 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 "aecommon.h" + +#define _COMPONENT ACPI_TOOLS + ACPI_MODULE_NAME ("aeregion") + + +/* Local prototypes */ + +static ACPI_STATUS +AeRegionInit ( + ACPI_HANDLE RegionHandle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +static ACPI_STATUS +AeInstallEcHandler ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +static ACPI_STATUS +AeInstallPciHandler ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + + +static AE_DEBUG_REGIONS AeRegions; +BOOLEAN AcpiGbl_DisplayRegionAccess = FALSE; +ACPI_CONNECTION_INFO AeMyContext; + + +/* + * We will override some of the default region handlers, especially + * the SystemMemory handler, which must be implemented locally. + * These handlers are installed "early" - before any _REG methods + * are executed - since they are special in the sense that the ACPI spec + * declares that they must "always be available". Cannot override the + * DataTable region handler either -- needed for test execution. + * + * NOTE: The local region handler will simulate access to these address + * spaces by creating a memory buffer behind each operation region. + */ +static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] = +{ + ACPI_ADR_SPACE_SYSTEM_MEMORY, + ACPI_ADR_SPACE_SYSTEM_IO, + ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_ADR_SPACE_EC +}; + +/* + * 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_DEFINED1 0x80 +#define ACPI_ADR_SPACE_USER_DEFINED2 0xE4 + +static ACPI_ADR_SPACE_TYPE SpaceIdList[] = +{ + ACPI_ADR_SPACE_SMBUS, + 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_FIXED_HARDWARE, + ACPI_ADR_SPACE_USER_DEFINED1, + ACPI_ADR_SPACE_USER_DEFINED2 +}; + + +/****************************************************************************** + * + * FUNCTION: AeRegionInit + * + * PARAMETERS: Region init handler + * + * RETURN: Status + * + * DESCRIPTION: Opregion init function. + * + *****************************************************************************/ + +static ACPI_STATUS +AeRegionInit ( + ACPI_HANDLE RegionHandle, + UINT32 Function, + void *HandlerContext, + void **RegionContext) +{ + + if (Function == ACPI_REGION_DEACTIVATE) + { + *RegionContext = NULL; + } + else + { + *RegionContext = RegionHandle; + } + + return (AE_OK); +} + + +void +AeInstallRegionHandlers ( + void) +{ + UINT32 i; + ACPI_STATUS Status; + + /* + * Install handlers for some of the "device driver" address spaces + * such as SMBus, etc. + */ + for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++) + { + /* Install handler at the root object */ + + Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, + SpaceIdList[i], AeRegionHandler, + AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not install an OpRegion handler for %s space(%u)", + AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i])); + return; + } + } +} + + +void +AeOverrideRegionHandlers ( + void) +{ + UINT32 i; + ACPI_STATUS Status; + + /* + * Install handlers that will override the default handlers for some of + * the space IDs. + */ + for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++) + { + /* Install handler at the root object */ + + Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, + DefaultSpaceIdList[i], AeRegionHandler, + AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not install a default OpRegion handler for %s space(%u)", + AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]), + DefaultSpaceIdList[i])); + return; + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AeInstallDeviceHandlers, + * AeInstallEcHandler, + * AeInstallPciHandler + * + * PARAMETERS: ACPI_WALK_NAMESPACE callback + * + * RETURN: Status + * + * DESCRIPTION: Walk entire namespace, install a handler for every EC + * and PCI device found. + * + ******************************************************************************/ + +static ACPI_STATUS +AeInstallEcHandler ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + ACPI_STATUS Status; + + + /* Install the handler for this EC device */ + + Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_EC, + AeRegionHandler, AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not install an OpRegion handler for EC device (%p)", + ObjHandle)); + } + + return (Status); +} + + +static ACPI_STATUS +AeInstallPciHandler ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + ACPI_STATUS Status; + + + /* Install memory and I/O handlers for the PCI device */ + + Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_IO, + AeRegionHandler, AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not install an OpRegion handler for PCI device (%p)", + ObjHandle)); + } + + Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_MEMORY, + AeRegionHandler, AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not install an OpRegion handler for PCI device (%p)", + ObjHandle)); + } + + return (AE_CTRL_TERMINATE); +} + + +ACPI_STATUS +AeInstallDeviceHandlers ( + void) +{ + + /* Find all Embedded Controller devices */ + + AcpiGetDevices ("PNP0C09", AeInstallEcHandler, NULL, NULL); + + /* Install a PCI handler */ + + AcpiGetDevices ("PNP0A08", AeInstallPciHandler, NULL, NULL); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AeRegionHandler + * + * PARAMETERS: Standard region handler parameters + * + * RETURN: Status + * + * DESCRIPTION: Test handler - Handles some dummy regions via memory that can + * be manipulated in Ring 3. Simulates actual reads and writes. + * + *****************************************************************************/ + +ACPI_STATUS +AeRegionHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + UINT64 *Value, + void *HandlerContext, + void *RegionContext) +{ + + ACPI_OPERAND_OBJECT *RegionObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, RegionContext); + UINT8 *Buffer = ACPI_CAST_PTR (UINT8, Value); + UINT8 *OldBuffer; + UINT8 *NewBuffer; + ACPI_PHYSICAL_ADDRESS BaseAddress; + ACPI_PHYSICAL_ADDRESS BaseAddressEnd; + ACPI_PHYSICAL_ADDRESS RegionAddress; + ACPI_PHYSICAL_ADDRESS RegionAddressEnd; + ACPI_SIZE Length; + BOOLEAN BufferExists; + BOOLEAN BufferResize; + AE_REGION *RegionElement; + void *BufferValue; + ACPI_STATUS Status; + UINT32 ByteWidth; + UINT32 RegionLength; + UINT32 i; + UINT8 SpaceId; + ACPI_CONNECTION_INFO *MyContext; + UINT32 Value1; + UINT32 Value2; + ACPI_RESOURCE *Resource; + + + ACPI_FUNCTION_NAME (AeRegionHandler); + + /* + * If the object is not a region, simply return + */ + if (RegionObject->Region.Type != ACPI_TYPE_REGION) + { + 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 -do option. + * We use this to support dynamically loaded tables where we pass a valid + * address to the AML. + */ + if (AcpiGbl_DbOpt_NoRegionSupport) + { + BufferValue = ACPI_TO_POINTER (Address); + ByteWidth = (BitWidth / 8); + + if (BitWidth % 8) + { + ByteWidth += 1; + } + goto DoFunction; + } + + 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: + + 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: + + 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: + + Status = AE_BAD_PARAMETER; + break; + } + + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* 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; + + switch (Function & ACPI_IO_MASK) + { + case ACPI_READ: + + switch (Function >> 16) + { + case AML_FIELD_ATTRIB_QUICK: + + Length = 0; + break; + + case AML_FIELD_ATTRIB_SEND_RCV: + case AML_FIELD_ATTRIB_BYTE: + + Length = 1; + break; + + case AML_FIELD_ATTRIB_WORD: + case AML_FIELD_ATTRIB_WORD_CALL: + + Length = 2; + break; + + 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: + + Length = MyContext->AccessLength; + break; + + default: + + break; + } + break; + + case ACPI_WRITE: + + switch (Function >> 16) + { + 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_WORD_CALL: + Length = 2; + break; + + 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: + + Length = MyContext->AccessLength; + break; + + default: + + break; + } + break; + + default: + + 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); + } + + Buffer[0] = 0x7A; + Buffer[1] = (UINT8) Length; + return (AE_OK); + + + case ACPI_ADR_SPACE_IPMI: /* ACPI 4.0 */ + + 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 + * buffer in which to return the IPMI status/length/data. + * + * Return some example data to show use of the bidirectional buffer + */ + Buffer[0] = 0; /* Status byte */ + Buffer[1] = 64; /* Return buffer data length */ + Buffer[2] = 0; /* Completion code */ + 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); + + /* + * GPIO has some special semantics: + * 1) Address is the pin number index into the Connection() pin list + * 2) BitWidth is the actual number of bits (pins) defined by the field + */ + case ACPI_ADR_SPACE_GPIO: /* ACPI 5.0 */ + + if (AcpiGbl_DisplayRegionAccess) + { + AcpiOsPrintf ("AcpiExec: GPIO " + "%s: Addr %.4X Width %X Conn %p\n", + (Function & ACPI_IO_MASK) ? "Write" : "Read ", + (UINT32) Address, BitWidth, MyContext->Connection); + } + return (AE_OK); + + default: + break; + } + + /* + * Search through the linked list for this region's buffer + */ + BufferExists = FALSE; + BufferResize = FALSE; + RegionElement = AeRegions.RegionList; + + if (AeRegions.NumberOfRegions) + { + BaseAddressEnd = BaseAddress + Length - 1; + while (!BufferExists && RegionElement) + { + RegionAddress = RegionElement->Address; + RegionAddressEnd = RegionElement->Address + RegionElement->Length - 1; + RegionLength = RegionElement->Length; + + /* + * Overlapping Region Support + * + * While searching through the region buffer list, determine if an + * overlap exists between the requested buffer space and the current + * RegionElement space. If there is an overlap then replace the old + * buffer with a new buffer of increased size before continuing to + * do the read or write + */ + if (RegionElement->SpaceId != SpaceId || + BaseAddressEnd < RegionAddress || + BaseAddress > RegionAddressEnd) + { + /* + * Requested buffer is outside of the current RegionElement + * bounds + */ + RegionElement = RegionElement->NextRegion; + } + else + { + /* + * Some amount of buffer space sharing exists. There are 4 cases + * to consider: + * + * 1. Right overlap + * 2. Left overlap + * 3. Left and right overlap + * 4. Fully contained - no resizing required + */ + BufferExists = TRUE; + + if ((BaseAddress >= RegionAddress) && + (BaseAddress <= RegionAddressEnd) && + (BaseAddressEnd > RegionAddressEnd)) + { + /* Right overlap */ + + RegionElement->Length = BaseAddress - + RegionAddress + Length; + BufferResize = TRUE; + } + + else if ((BaseAddressEnd >= RegionAddress) && + (BaseAddressEnd <= RegionAddressEnd) && + (BaseAddress < RegionAddress)) + { + /* Left overlap */ + + RegionElement->Address = BaseAddress; + RegionElement->Length = RegionAddress - + BaseAddress + RegionElement->Length; + BufferResize = TRUE; + } + + else if ((BaseAddress < RegionAddress) && + (BaseAddressEnd > RegionAddressEnd)) + { + /* Left and right overlap */ + + RegionElement->Address = BaseAddress; + RegionElement->Length = Length; + BufferResize = TRUE; + } + + /* + * only remaining case is fully contained for which we don't + * need to do anything + */ + if (BufferResize) + { + NewBuffer = AcpiOsAllocate (RegionElement->Length); + if (!NewBuffer) + { + return (AE_NO_MEMORY); + } + + OldBuffer = RegionElement->Buffer; + RegionElement->Buffer = NewBuffer; + NewBuffer = NULL; + + /* Initialize the region with the default fill value */ + + ACPI_MEMSET (RegionElement->Buffer, + AcpiGbl_RegionFillValue, RegionElement->Length); + + /* + * Get BufferValue to point (within the new buffer) to the + * base address of the old buffer + */ + BufferValue = (UINT8 *) RegionElement->Buffer + + (UINT64) RegionAddress - + (UINT64) RegionElement->Address; + + /* + * Copy the old buffer to its same location within the new + * buffer + */ + ACPI_MEMCPY (BufferValue, OldBuffer, RegionLength); + AcpiOsFree (OldBuffer); + } + } + } + } + + /* + * If the Region buffer does not exist, create it now + */ + if (!BufferExists) + { + /* Do the memory allocations first */ + + RegionElement = AcpiOsAllocate (sizeof (AE_REGION)); + if (!RegionElement) + { + return (AE_NO_MEMORY); + } + + RegionElement->Buffer = AcpiOsAllocate (Length); + if (!RegionElement->Buffer) + { + AcpiOsFree (RegionElement); + return (AE_NO_MEMORY); + } + + /* Initialize the region with the default fill value */ + + ACPI_MEMSET (RegionElement->Buffer, AcpiGbl_RegionFillValue, Length); + + RegionElement->Address = BaseAddress; + RegionElement->Length = Length; + RegionElement->SpaceId = SpaceId; + RegionElement->NextRegion = NULL; + + /* + * Increment the number of regions and put this one + * at the head of the list as it will probably get accessed + * more often anyway. + */ + AeRegions.NumberOfRegions += 1; + + if (AeRegions.RegionList) + { + RegionElement->NextRegion = AeRegions.RegionList; + } + + AeRegions.RegionList = RegionElement; + } + + /* Calculate the size of the memory copy */ + + ByteWidth = (BitWidth / 8); + + if (BitWidth % 8) + { + ByteWidth += 1; + } + + /* + * The buffer exists and is pointed to by RegionElement. + * We now need to verify the request is valid and perform the operation. + * + * NOTE: RegionElement->Length is in bytes, therefore it we compare against + * ByteWidth (see above) + */ + if ((RegionObject->Region.SpaceId != ACPI_ADR_SPACE_GPIO) && + ((UINT64) Address + ByteWidth) > + ((UINT64)(RegionElement->Address) + RegionElement->Length)) + { + ACPI_WARNING ((AE_INFO, + "Request on [%4.4s] is beyond region limit Req-0x%X+0x%X, Base=0x%X, Len-0x%X", + (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address, + ByteWidth, (UINT32)(RegionElement->Address), + RegionElement->Length)); + + return (AE_AML_REGION_LIMIT); + } + + /* + * Get BufferValue to point to the "address" in the buffer + */ + BufferValue = ((UINT8 *) RegionElement->Buffer + + ((UINT64) Address - (UINT64) RegionElement->Address)); + +DoFunction: + /* + * Perform a read or write to the buffer space + */ + switch (Function) + { + case ACPI_READ: + /* + * Set the pointer Value to whatever is in the buffer + */ + ACPI_MEMCPY (Value, BufferValue, ByteWidth); + break; + + case ACPI_WRITE: + /* + * Write the contents of Value to the buffer + */ + ACPI_MEMCPY (BufferValue, Value, ByteWidth); + break; + + default: + + 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/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 818bba6..758720e 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -238,6 +238,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_GPE_REGISTER_INFO", SRC_TYPE_STRUCT}, {"ACPI_GPE_WALK_INFO", SRC_TYPE_STRUCT}, {"ACPI_GPE_XRUPT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPIO_INFO", SRC_TYPE_STRUCT}, {"ACPI_HANDLE", SRC_TYPE_SIMPLE}, {"ACPI_HANDLER_INFO", SRC_TYPE_STRUCT}, {"ACPI_INIT_HANDLER", SRC_TYPE_SIMPLE}, @@ -385,6 +386,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_SCI_HANDLER_INFO", SRC_TYPE_STRUCT}, {"ACPI_SCOPE_STATE", SRC_TYPE_STRUCT}, {"ACPI_SEMAPHORE", SRC_TYPE_SIMPLE}, + {"ACPI_SERIAL_INFO", SRC_TYPE_STRUCT}, {"ACPI_SIGNAL_FATAL_INFO", SRC_TYPE_STRUCT}, {"ACPI_SIMPLE_REPAIR_INFO", SRC_TYPE_STRUCT}, {"ACPI_SIZE", SRC_TYPE_SIMPLE}, @@ -484,6 +486,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ASL_MAPPING_ENTRY", SRC_TYPE_STRUCT}, {"ASL_METHOD_INFO", SRC_TYPE_STRUCT}, {"ASL_RESERVED_INFO", SRC_TYPE_STRUCT}, + {"ASL_RESOURCE_INFO", SRC_TYPE_STRUCT}, {"ASL_RESOURCE_NODE", SRC_TYPE_STRUCT}, {"ASL_WALK_CALLBACK", SRC_TYPE_SIMPLE}, {"UINT64_OVERLAY", SRC_TYPE_UNION}, -- cgit v1.1