diff options
Diffstat (limited to 'source/compiler')
27 files changed, 1890 insertions, 444 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 060380a4341b0..62d7d87043295 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 1001f68966ec7..fdf19c1840d72 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 c76b4a070b27a..94002816ebcca 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 e347e694f86c1..8106824fd8efb 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 ff02d5362f051..1207f43a3d825 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 25dca949054af..1ef7b1cafc8f7 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 0000000000000..a97c555a8881d --- /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 0000000000000..404c8436c3405 --- /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 0000000000000..10a6aeab48dad --- /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 1ad47532bc3b7..8030c950fa055 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 039fc7d3d48d0..63abcf4667a44 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 bf4a8a74991c8..5d21ce66a3c0a 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 f123990cc233c..7b31e13e6bb1d 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 73f3efe6cabf9..3731442ea3e87 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 bc16d728200cc..ca4771e8fe7df 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 9579fe4423ce3..ed848c63cd32c 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 297f99a2cb3b8..edce9c8e4ed88 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 08590cc573175..94fb2344c9dc6 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 0bd32e79b3bc6..2e548e86cbf05 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 c607899b5fbed..7e4884b503796 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 7f58babf21086..33372d8175079 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 a1fdec3437d2f..dfeca6e9b309a 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 cd84d8bf5667c..38644e8412521 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 44c937f2f63e9..5f01c80785b53 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 1cbd6e092c703..f26cfdd084014 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 5c8fea3092a19..e7dfabff15146 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 a87198d39a65d..d4394e38c366d 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; |