diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2009-06-25 23:20:50 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2009-06-25 23:20:50 +0000 |
commit | 22724f14194b3fe80a6a7848da104f7916536a52 (patch) | |
tree | 90ff140546ac1c8f9223f343715887361e86492a | |
parent | e83ee77d7b009e11006d75946be388f7b99f9990 (diff) |
Import ACPICA 20090625vendor/acpica/20090625
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=195013
svn path=/vendor-sys/acpica/20090625/; revision=195014; tag=vendor/acpica/20090625
48 files changed, 2135 insertions, 1002 deletions
diff --git a/changes.txt b/changes.txt index 89f62326145a..6c3851547356 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,82 @@ ---------------------------------------- +25 June 2009. Summary of changes for version 20090625: + +This release is available at www.acpica.org/downloads + +The ACPI 4.0 Specification was released on June 16 and is available at +www.acpi.info. ACPICA implementation of ACPI 4.0 is underway and will +continue for the next few releases. + +1) ACPI CA Core Subsystem: + +ACPI 4.0: Implemented interpreter support for the IPMI operation region +address space. Includes support for bi-directional data buffers and an IPMI +address space handler (to be installed by an IPMI device driver.) ACPICA BZ +773. Lin Ming. + +ACPI 4.0: Added changes for existing ACPI tables - FACS and SRAT. Includes +support in both the header files and the disassembler. + +Completed a major update for the AcpiGetObjectInfo external interface. +Changes include: + - Support for variable, unlimited length HID, UID, and CID strings. + - Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, etc.) + - Call the _SxW power methods on behalf of a device object. + - Determine if a device is a PCI root bridge. + - Change the ACPI_BUFFER parameter to ACPI_DEVICE_INFO. +These changes will require an update to all callers of this interface. See +the updated ACPICA Programmer Reference for details. One new source file has +been added - utilities/utids.c. ACPICA BZ 368, 780. + +Updated the AcpiRead and AcpiWrite external interfaces to support 64-bit +transfers. The Value parameter has been extended from 32 bits to 64 bits in +order to support new ACPI 4.0 tables. These changes will require an update to +all callers of these interfaces. See the ACPICA Programmer Reference for +details. ACPICA BZ 768. + +Fixed several problems with AcpiAttachData. The handler was not invoked when +the host node was deleted. The data sub-object was not automatically deleted +when the host node was deleted. The interface to the handler had an unused +parameter, this was removed. ACPICA BZ 778. + +Enhanced the function that dumps ACPI table headers. All non-printable +characters in the string fields are now replaced with '?' (Signature, OemId, +OemTableId, and CompilerId.) ACPI tables with non-printable characters in +these fields are occasionally seen in the field. ACPICA BZ 788. + +Fixed a problem with predefined method repair code where the code that +attempts to repair/convert an object of incorrect type is only executed on +the first time the predefined method is called. The mechanism that disables +warnings on subsequent calls was interfering with the repair mechanism. +ACPICA BZ 781. + +Fixed a possible memory leak in the predefined validation/repair code when a +buffer is automatically converted to an expected string object. + +Removed obsolete 16-bit files from the distribution and from the current git +tree head. ACPICA BZ 776. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and has a +much larger code and data size. + + Previous Release: + Non-Debug Version: 83.4K Code, 17.5K Data, 100.9K Total + Debug Version: 158.9K Code, 50.0K Data, 208.9K Total + Current Release: + Non-Debug Version: 84.7K Code, 17.8K Data, 102.5K Total + Debug Version: 160.5K Code, 50.6K Data, 211.1K Total + +2) iASL Compiler/Disassembler and Tools: + +ACPI 4.0: iASL and Disassembler - implemented support for the new IPMI +operation region keyword. ACPICA BZ 771, 772. Lin Ming. + +ACPI 4.0: iASL - implemented compile-time validation support for all new +predefined names and control methods (31 total). ACPICA BZ 769. + +---------------------------------------- 21 May 2009. Summary of changes for version 20090521: This release is available at www.acpica.org/downloads diff --git a/common/dmtbinfo.c b/common/dmtbinfo.c index 3574a2a71131..a57ca40574c9 100644 --- a/common/dmtbinfo.c +++ b/common/dmtbinfo.c @@ -299,12 +299,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "Firmware Waking Vector(32)"}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "32 Firmware Waking Vector"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)"}, {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present"}, - {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "Firmware Waking Vector(64)"}, + {ACPI_DMT_FLAG1, ACPI_FACS_FLAG_OFFSET (Flags,0), "64-bit Wake Supported (V2)"}, + {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "64 Firmware Waking Vector"}, {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version"}, + {ACPI_DMT_UINT24, ACPI_FACS_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (OspmFlags), "OspmFlags (decoded below)"}, + {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (OspmFlags,0), "64-bit Wake Env Required (V2)"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -1074,7 +1078,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* 9: Processor Local X2_APIC (07/2008) */ +/* 9: Processor Local X2_APIC (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = { @@ -1086,7 +1090,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* 10: Local X2_APIC NMI (07/2008) */ +/* 10: Local X2_APIC NMI (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = { @@ -1275,7 +1279,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* 2: Processor Local X2_APIC Affinity (07/2008) */ +/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = { @@ -1284,6 +1288,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID"}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)"}, {ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled"}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain"}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved"}, {ACPI_DMT_EXIT, 0, NULL} }; diff --git a/compiler/aslcompiler.l b/compiler/aslcompiler.l index 3a52348c49f6..d64dbf6a0a96 100644 --- a/compiler/aslcompiler.l +++ b/compiler/aslcompiler.l @@ -386,6 +386,7 @@ NamePathTail [.]{NameSeg} "SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); } "SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); } "PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); } +"IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } "FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); } diff --git a/compiler/aslcompiler.y b/compiler/aslcompiler.y index 053574f21b4a..1d89f2c508a6 100644 --- a/compiler/aslcompiler.y +++ b/compiler/aslcompiler.y @@ -400,6 +400,7 @@ AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_REGIONSPACE_CMOS %token <i> PARSEOP_REGIONSPACE_EC %token <i> PARSEOP_REGIONSPACE_IO +%token <i> PARSEOP_REGIONSPACE_IPMI %token <i> PARSEOP_REGIONSPACE_MEM %token <i> PARSEOP_REGIONSPACE_PCI %token <i> PARSEOP_REGIONSPACE_PCIBAR @@ -2175,6 +2176,7 @@ RegionSpaceKeyword | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} + | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} ; AddressSpaceKeyword diff --git a/compiler/asllookup.c b/compiler/asllookup.c index 06113f07845d..51c036967c8d 100644 --- a/compiler/asllookup.c +++ b/compiler/asllookup.c @@ -1337,6 +1337,7 @@ LkNamespaceLocateBegin ( break; case REGION_SMBUS: + case REGION_IPMI: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) { diff --git a/compiler/aslmap.c b/compiler/aslmap.c index f96e78c14126..4c1fdf0c6f2d 100644 --- a/compiler/aslmap.c +++ b/compiler/aslmap.c @@ -232,7 +232,8 @@ MpDisplayReservedNames ( * * Name - The ACPI reserved name * Args - Number of arguments to the method - * Flags - Whether this method must return a value or not + * Flags - Whether this method must return a value or not. Or if the + * name is a resource descriptor label. * ******************************************************************************/ @@ -264,24 +265,30 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_ALP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_ALR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_ALT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_ART", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_ASI", 0, ASL_RSVD_RESOURCE_NAME}, {"_ASZ", 0, ASL_RSVD_RESOURCE_NAME}, {"_BAS", 0, ASL_RSVD_RESOURCE_NAME}, {"_BBN", 0, ASL_RSVD_RETURN_VALUE}, {"_BCL", 0, ASL_RSVD_RETURN_VALUE}, {"_BCM", 1, 0}, + {"_BCT", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BDN", 0, ASL_RSVD_RETURN_VALUE}, {"_BFS", 1, 0}, {"_BIF", 0, ASL_RSVD_RETURN_VALUE}, + {"_BIX", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BLT", 3, 0}, /* Acpi 3.0 */ {"_BM_", 0, ASL_RSVD_RESOURCE_NAME}, + {"_BMA", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BMC", 1, 0}, /* Acpi 3.0 */ {"_BMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_BMS", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BQC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_BST", 0, ASL_RSVD_RETURN_VALUE}, {"_BTM", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_BTP", 1, 0}, {"_CBA", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_CDM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_CID", 0, ASL_RSVD_RETURN_VALUE}, {"_CRS", 0, ASL_RSVD_RETURN_VALUE}, {"_CRT", 0, ASL_RSVD_RETURN_VALUE}, @@ -300,6 +307,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_DSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_DSS", 1, 0}, {"_DSW", 3, 0}, /* Acpi 3.0 */ + {"_DTI", 1, 0}, /* Acpi 4.0 */ {"_EC_", 0, ASL_RSVD_RETURN_VALUE}, {"_EDL", 0, ASL_RSVD_RETURN_VALUE}, {"_EJ0", 1, 0}, @@ -312,7 +320,13 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_FDE", 0, ASL_RSVD_RETURN_VALUE}, {"_FDI", 0, ASL_RSVD_RETURN_VALUE}, {"_FDM", 1, 0}, + {"_FIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_FIX", 0, ASL_RSVD_RETURN_VALUE}, + {"_FPS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_FSL", 1, 0}, /* Acpi 4.0 */ + {"_FST", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_GAI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_GHL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_GL_", 0, ASL_RSVD_RETURN_VALUE}, {"_GLK", 0, ASL_RSVD_RETURN_VALUE}, {"_GPD", 0, ASL_RSVD_RETURN_VALUE}, @@ -338,28 +352,39 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_MAF", 0, ASL_RSVD_RESOURCE_NAME}, {"_MAT", 0, ASL_RSVD_RETURN_VALUE}, {"_MAX", 0, ASL_RSVD_RESOURCE_NAME}, + {"_MBM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_MEM", 0, ASL_RSVD_RESOURCE_NAME}, {"_MIF", 0, ASL_RSVD_RESOURCE_NAME}, {"_MIN", 0, ASL_RSVD_RESOURCE_NAME}, {"_MLS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_MSG", 1, 0}, + {"_MSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_MTP", 0, ASL_RSVD_RESOURCE_NAME}, + {"_NTT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_OFF", 0, 0}, {"_ON_", 0, 0}, {"_OS_", 0, ASL_RSVD_RETURN_VALUE}, {"_OSC", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_OSI", 1, ASL_RSVD_RETURN_VALUE}, {"_OST", 3, 0}, /* Acpi 3.0 */ + {"_PAI", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PCL", 0, ASL_RSVD_RETURN_VALUE}, {"_PCT", 0, ASL_RSVD_RETURN_VALUE}, {"_PDC", 1, 0}, + {"_PDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PIC", 1, 0}, + {"_PIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PLD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_PMC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_PMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_PMM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PPC", 0, ASL_RSVD_RETURN_VALUE}, {"_PPE", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_PR0", 0, ASL_RSVD_RETURN_VALUE}, {"_PR1", 0, ASL_RSVD_RETURN_VALUE}, {"_PR2", 0, ASL_RSVD_RETURN_VALUE}, + {"_PR3", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_PRL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PRS", 0, ASL_RSVD_RETURN_VALUE}, {"_PRT", 0, ASL_RSVD_RETURN_VALUE}, {"_PRW", 0, ASL_RSVD_RETURN_VALUE}, @@ -375,7 +400,9 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_PSV", 0, ASL_RSVD_RETURN_VALUE}, {"_PSW", 1, 0}, {"_PTC", 0, ASL_RSVD_RETURN_VALUE}, + {"_PTP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PTS", 1, 0}, + {"_PUR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PXM", 0, ASL_RSVD_RETURN_VALUE}, {"_RBO", 0, ASL_RSVD_RESOURCE_NAME}, {"_RBW", 0, ASL_RSVD_RESOURCE_NAME}, @@ -407,6 +434,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_SCP", 0x13, 0}, /* Acpi 1.0 - one arg; Acpi 3.0 - three args */ {"_SDD", 1, 0}, /* Acpi 3.0 */ {"_SEG", 0, ASL_RSVD_RETURN_VALUE}, + {"_SHL", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_SHR", 0, ASL_RSVD_RESOURCE_NAME}, {"_SI_", 0, ASL_RSVD_SCOPE}, {"_SIZ", 0, ASL_RSVD_RESOURCE_NAME}, @@ -417,12 +445,16 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_SST", 1, 0}, {"_STA", 0, ASL_RSVD_RETURN_VALUE}, {"_STM", 3, 0}, + {"_STP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_STR", 0, ASL_RSVD_RETURN_VALUE}, + {"_STV", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_SUN", 0, ASL_RSVD_RETURN_VALUE}, {"_SWS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_TC1", 0, ASL_RSVD_RETURN_VALUE}, {"_TC2", 0, ASL_RSVD_RETURN_VALUE}, {"_TDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0b */ + {"_TIP", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_TIV", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_TMP", 0, ASL_RSVD_RETURN_VALUE}, {"_TPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_TPT", 1, 0}, /* Acpi 3.0 */ @@ -681,6 +713,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0), /* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0), /* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0), +/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IPMI, 0, 0), /* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0), /* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0), /* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0), diff --git a/debugger/dbcmds.c b/debugger/dbcmds.c index a316b4292c27..5504535af3ca 100644 --- a/debugger/dbcmds.c +++ b/debugger/dbcmds.c @@ -500,17 +500,16 @@ AcpiDbWalkForExecute ( void *Context, void **ReturnValue) { - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - UINT32 *Count = (UINT32 *) Context; - const ACPI_PREDEFINED_INFO *Predefined; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - char *Pathname; - ACPI_BUFFER Buffer; + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + UINT32 *Count = (UINT32 *) Context; + ACPI_BUFFER ReturnObj; + ACPI_STATUS Status; + char *Pathname; UINT32 i; ACPI_DEVICE_INFO *ObjInfo; ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; + const ACPI_PREDEFINED_INFO *Predefined; Predefined = AcpiNsCheckForPredefinedName (Node); @@ -532,8 +531,7 @@ AcpiDbWalkForExecute ( /* Get the object info for number of method parameters */ - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiGetObjectInfo (ObjHandle, &Buffer); + Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo); if (ACPI_FAILURE (Status)) { return (Status); @@ -542,7 +540,6 @@ AcpiDbWalkForExecute ( ParamObjects.Pointer = NULL; ParamObjects.Count = 0; - ObjInfo = Buffer.Pointer; if (ObjInfo->Type == ACPI_TYPE_METHOD) { @@ -558,7 +555,7 @@ AcpiDbWalkForExecute ( ParamObjects.Count = ObjInfo->ParamCount; } - ACPI_FREE (Buffer.Pointer); + ACPI_FREE (ObjInfo); ReturnObj.Pointer = NULL; ReturnObj.Length = ACPI_ALLOCATE_BUFFER; @@ -1993,11 +1990,16 @@ AcpiDbBusWalk ( ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_STATUS Status; ACPI_BUFFER Buffer; - ACPI_INTEGER ADR; - ACPI_DEVICE_ID Id; - ACPI_COMPATIBLE_ID_LIST *Cid; ACPI_NAMESPACE_NODE *TempNode; + ACPI_DEVICE_INFO *Info; + UINT32 i; + + if ((Node->Type != ACPI_TYPE_DEVICE) && + (Node->Type != ACPI_TYPE_PROCESSOR)) + { + return (AE_OK); + } /* Exit if there is no _PRT under this device */ @@ -2018,57 +2020,70 @@ AcpiDbBusWalk ( return (AE_OK); } + Status = AcpiGetObjectInfo (ObjHandle, &Info); + if (ACPI_FAILURE (Status)) + { + return (AE_OK); + } + /* Display the full path */ - AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer); + AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type); ACPI_FREE (Buffer.Pointer); + if (Info->Flags & ACPI_PCI_ROOT_BRIDGE) + { + AcpiOsPrintf (" - Is PCI Root Bridge"); + } + AcpiOsPrintf ("\n"); + /* _PRT info */ - AcpiOsPrintf ("_PRT=%p", TempNode); + AcpiOsPrintf ("_PRT: %p\n", TempNode); - /* Get the _ADR value */ + /* Dump _ADR, _HID, _UID, _CID */ - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &ADR); - if (ACPI_FAILURE (Status)) + if (Info->Valid & ACPI_VALID_ADR) { - AcpiOsPrintf (" No _ADR "); + AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address)); } else { - AcpiOsPrintf (" _ADR=%8.8X", (UINT32) ADR); + AcpiOsPrintf ("_ADR: <Not Present>\n"); } - /* Get the _HID if present */ - - Status = AcpiUtExecute_HID (Node, &Id); - if (ACPI_SUCCESS (Status)) + if (Info->Valid & ACPI_VALID_HID) { - AcpiOsPrintf (" _HID=%s", Id.Value); + AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String); } else { - AcpiOsPrintf (" "); + AcpiOsPrintf ("_HID: <Not Present>\n"); } - /* Get the _UID if present */ - - Status = AcpiUtExecute_UID (Node, &Id); - if (ACPI_SUCCESS (Status)) + if (Info->Valid & ACPI_VALID_UID) { - AcpiOsPrintf (" _UID=%s", Id.Value); + AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String); + } + else + { + AcpiOsPrintf ("_UID: <Not Present>\n"); } - /* Get the _CID if present */ - - Status = AcpiUtExecute_CID (Node, &Cid); - if (ACPI_SUCCESS (Status)) + if (Info->Valid & ACPI_VALID_CID) { - AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value); - ACPI_FREE (Cid); + for (i = 0; i < Info->CompatibleIdList.Count; i++) + { + AcpiOsPrintf ("_CID: %s\n", + Info->CompatibleIdList.Ids[i].String); + } + } + else + { + AcpiOsPrintf ("_CID: <Not Present>\n"); } - AcpiOsPrintf ("\n"); + ACPI_FREE (Info); return (AE_OK); } @@ -2091,7 +2106,7 @@ AcpiDbGetBusInfo ( { /* Search all nodes in namespace */ - (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbBusWalk, NULL, NULL); } diff --git a/debugger/dbdisply.c b/debugger/dbdisply.c index 28b0f8f8aef3..fbcb8f10d39a 100644 --- a/debugger/dbdisply.c +++ b/debugger/dbdisply.c @@ -682,42 +682,52 @@ AcpiDbDisplayObjectType ( char *ObjectArg) { ACPI_HANDLE Handle; - ACPI_BUFFER Buffer; ACPI_DEVICE_INFO *Info; ACPI_STATUS Status; UINT32 i; Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiGetObjectInfo (Handle, &Buffer); - if (ACPI_SUCCESS (Status)) + Status = AcpiGetObjectInfo (Handle, &Info); + if (ACPI_FAILURE (Status)) { - Info = Buffer.Pointer; - AcpiOsPrintf ( - "S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n", - Info->HighestDstates[0], Info->HighestDstates[1], - Info->HighestDstates[2], Info->HighestDstates[3], - Info->HardwareId.Value, - ACPI_FORMAT_UINT64 (Info->Address), - Info->CurrentStatus); - - if (Info->Valid & ACPI_VALID_CID) - { - for (i = 0; i < Info->CompatibilityId.Count; i++) - { - AcpiOsPrintf ("CID #%d: %s\n", i, - Info->CompatibilityId.Id[i].Value); - } - } + AcpiOsPrintf ("Could not get object info, %s\n", + AcpiFormatException (Status)); + return; + } + + AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", + ACPI_FORMAT_UINT64 (Info->Address), + Info->CurrentStatus, Info->Flags); + + AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", + Info->HighestDstates[0], Info->HighestDstates[1], + Info->HighestDstates[2], Info->HighestDstates[3]); - ACPI_FREE (Info); + AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", + Info->LowestDstates[0], Info->LowestDstates[1], + Info->LowestDstates[2], Info->LowestDstates[3], + Info->LowestDstates[4]); + + if (Info->Valid & ACPI_VALID_HID) + { + AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); } - else + if (Info->Valid & ACPI_VALID_UID) + { + AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); + } + if (Info->Valid & ACPI_VALID_CID) { - AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); + for (i = 0; i < Info->CompatibleIdList.Count; i++) + { + AcpiOsPrintf ("CID %d: %s\n", i, + Info->CompatibleIdList.Ids[i].String); + } } + + ACPI_FREE (Info); } diff --git a/debugger/dbexec.c b/debugger/dbexec.c index eb39b3749eb4..f6e20ce55c79 100644 --- a/debugger/dbexec.c +++ b/debugger/dbexec.c @@ -176,7 +176,6 @@ AcpiDbExecuteMethod ( ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; ACPI_HANDLE Handle; - ACPI_BUFFER Buffer; UINT32 i; ACPI_DEVICE_INFO *ObjInfo; @@ -196,8 +195,7 @@ AcpiDbExecuteMethod ( /* Get the object info for number of method parameters */ - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiGetObjectInfo (Handle, &Buffer); + Status = AcpiGetObjectInfo (Handle, &ObjInfo); if (ACPI_FAILURE (Status)) { return (Status); @@ -206,7 +204,6 @@ AcpiDbExecuteMethod ( ParamObjects.Pointer = NULL; ParamObjects.Count = 0; - ObjInfo = Buffer.Pointer; if (ObjInfo->Type == ACPI_TYPE_METHOD) { /* Are there arguments to the method? */ @@ -256,7 +253,7 @@ AcpiDbExecuteMethod ( } } - ACPI_FREE (Buffer.Pointer); + ACPI_FREE (ObjInfo); /* Prepare for a return object of arbitrary size */ diff --git a/events/evgpe.c b/events/evgpe.c index 95cb9fa7ea8c..17738b384040 100644 --- a/events/evgpe.c +++ b/events/evgpe.c @@ -543,7 +543,7 @@ AcpiEvGpeDetect ( /* Read the Status Register */ - Status = AcpiRead (&StatusReg, &GpeRegisterInfo->StatusAddress); + Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -551,7 +551,7 @@ AcpiEvGpeDetect ( /* Read the Enable Register */ - Status = AcpiRead (&EnableReg, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; diff --git a/events/evgpeblk.c b/events/evgpeblk.c index 418d0d50644a..343a31d28efd 100644 --- a/events/evgpeblk.c +++ b/events/evgpeblk.c @@ -995,7 +995,7 @@ AcpiEvCreateGpeInfoBlocks ( /* Disable all GPEs within this register */ - Status = AcpiWrite (0x00, &ThisRegister->EnableAddress); + Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -1003,7 +1003,7 @@ AcpiEvCreateGpeInfoBlocks ( /* Clear any pending GPE events within this register */ - Status = AcpiWrite (0xFF, &ThisRegister->StatusAddress); + Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; diff --git a/events/evrgnini.c b/events/evrgnini.c index 187aebe58fe3..9c45ee84f028 100644 --- a/events/evrgnini.c +++ b/events/evrgnini.c @@ -127,10 +127,6 @@ /* Local prototypes */ static BOOLEAN -AcpiEvMatchPciRootBridge ( - char *Id); - -static BOOLEAN AcpiEvIsPciRootBridge ( ACPI_NAMESPACE_NODE *Node); @@ -444,42 +440,6 @@ AcpiEvPciConfigRegionSetup ( /******************************************************************************* * - * FUNCTION: AcpiEvMatchPciRootBridge - * - * PARAMETERS: Id - The HID/CID in string format - * - * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge - * - * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. - * - ******************************************************************************/ - -static BOOLEAN -AcpiEvMatchPciRootBridge ( - char *Id) -{ - - /* - * Check if this is a PCI root. - * ACPI 3.0+: check for a PCI Express root also. - */ - if (!(ACPI_STRNCMP (Id, - PCI_ROOT_HID_STRING, - sizeof (PCI_ROOT_HID_STRING))) || - - !(ACPI_STRNCMP (Id, - PCI_EXPRESS_ROOT_HID_STRING, - sizeof (PCI_EXPRESS_ROOT_HID_STRING)))) - { - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * * FUNCTION: AcpiEvIsPciRootBridge * * PARAMETERS: Node - Device node being examined @@ -496,9 +456,10 @@ AcpiEvIsPciRootBridge ( ACPI_NAMESPACE_NODE *Node) { ACPI_STATUS Status; - ACPI_DEVICE_ID Hid; - ACPI_COMPATIBLE_ID_LIST *Cid; + ACPI_DEVICE_ID *Hid; + ACPI_DEVICE_ID_LIST *Cid; UINT32 i; + BOOLEAN Match; /* Get the _HID and check for a PCI Root Bridge */ @@ -509,7 +470,10 @@ AcpiEvIsPciRootBridge ( return (FALSE); } - if (AcpiEvMatchPciRootBridge (Hid.Value)) + Match = AcpiUtIsPciRootBridge (Hid->String); + ACPI_FREE (Hid); + + if (Match) { return (TRUE); } @@ -526,7 +490,7 @@ AcpiEvIsPciRootBridge ( for (i = 0; i < Cid->Count; i++) { - if (AcpiEvMatchPciRootBridge (Cid->Id[i].Value)) + if (AcpiUtIsPciRootBridge (Cid->Ids[i].String)) { ACPI_FREE (Cid); return (TRUE); diff --git a/executer/exfield.c b/executer/exfield.c index 0065bb51840f..0ee522c572a4 100644 --- a/executer/exfield.c +++ b/executer/exfield.c @@ -151,6 +151,7 @@ AcpiExReadDataFromField ( ACPI_OPERAND_OBJECT *BufferDesc; ACPI_SIZE Length; void *Buffer; + UINT32 Function; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -183,13 +184,27 @@ AcpiExReadDataFromField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus read. We must create a buffer to hold the data - * and directly access the region handler. + * This is an SMBus or IPMI read. We must create a buffer to hold + * the data and then directly access the region handler. + * + * Note: Smbus protocol value is passed in upper 16-bits of Function */ - BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE); + if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + { + Length = ACPI_SMBUS_BUFFER_SIZE; + Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); + } + else /* IPMI */ + { + Length = ACPI_IPMI_BUFFER_SIZE; + Function = ACPI_READ; + } + + BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -199,13 +214,11 @@ AcpiExReadDataFromField ( AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - /* - * Perform the read. - * Note: Smbus protocol value is passed in upper 16-bits of Function - */ + /* Call the region handler for the read */ + Status = AcpiExAccessRegion (ObjDesc, 0, ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer), - ACPI_READ | (ObjDesc->Field.Attribute << 16)); + Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); goto Exit; } @@ -304,6 +317,7 @@ AcpiExWriteDataToField ( UINT32 Length; void *Buffer; ACPI_OPERAND_OBJECT *BufferDesc; + UINT32 Function; ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); @@ -332,40 +346,59 @@ AcpiExWriteDataToField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus write. We will bypass the entire field mechanism - * and handoff the buffer directly to the handler. + * This is an SMBus or IPMI write. We will bypass the entire field + * mechanism and handoff the buffer directly to the handler. For + * these address spaces, the buffer is bi-directional; on a write, + * return data is returned in the same buffer. + * + * Source must be a buffer of sufficient size: + * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE. * - * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). + * Note: SMBus protocol type is passed in upper 16-bits of Function */ if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { - ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s", + ACPI_ERROR ((AE_INFO, + "SMBus or IPMI write requires Buffer, found type %s", AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - if (SourceDesc->Buffer.Length < ACPI_SMBUS_BUFFER_SIZE) + if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + { + Length = ACPI_SMBUS_BUFFER_SIZE; + Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); + } + else /* IPMI */ + { + Length = ACPI_IPMI_BUFFER_SIZE; + Function = ACPI_WRITE; + } + + if (SourceDesc->Buffer.Length < Length) { ACPI_ERROR ((AE_INFO, - "SMBus write requires Buffer of length %X, found length %X", - ACPI_SMBUS_BUFFER_SIZE, SourceDesc->Buffer.Length)); + "SMBus or IPMI write requires Buffer of length %X, found length %X", + Length, SourceDesc->Buffer.Length)); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); } - BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE); + /* Create the bi-directional buffer */ + + BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } Buffer = BufferDesc->Buffer.Pointer; - ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, - ACPI_SMBUS_BUFFER_SIZE); + ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, Length); /* Lock entire transaction if requested */ @@ -374,11 +407,9 @@ AcpiExWriteDataToField ( /* * Perform the write (returns status and perhaps data in the * same buffer) - * Note: SMBus protocol type is passed in upper 16-bits of Function. */ Status = AcpiExAccessRegion (ObjDesc, 0, - (ACPI_INTEGER *) Buffer, - ACPI_WRITE | (ObjDesc->Field.Attribute << 16)); + (ACPI_INTEGER *) Buffer, Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); *ResultDesc = BufferDesc; diff --git a/executer/exfldio.c b/executer/exfldio.c index cfb02213aa9c..37a678655172 100644 --- a/executer/exfldio.c +++ b/executer/exfldio.c @@ -202,12 +202,13 @@ AcpiExSetupRegion ( } /* - * Exit now for SMBus address space, it has a non-linear address space + * Exit now for SMBus or IPMI address space, it has a non-linear address space * and the request cannot be directly validated */ - if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI) { - /* SMBus has a non-linear address space */ + /* SMBus or IPMI has a non-linear address space */ return_ACPI_STATUS (AE_OK); } diff --git a/executer/exutils.c b/executer/exutils.c index 45b35a0c2571..1f5e861b68cb 100644 --- a/executer/exutils.c +++ b/executer/exutils.c @@ -482,59 +482,76 @@ AcpiExDigitsNeeded ( * * FUNCTION: AcpiExEisaIdToString * - * PARAMETERS: NumericId - EISA ID to be converted + * PARAMETERS: CompressedId - EISAID to be converted * OutString - Where to put the converted string (8 bytes) * * RETURN: None * - * DESCRIPTION: Convert a numeric EISA ID to string representation + * DESCRIPTION: Convert a numeric EISAID to string representation. Return + * buffer must be large enough to hold the string. The string + * returned is always exactly of length ACPI_EISAID_STRING_SIZE + * (includes null terminator). The EISAID is always 32 bits. * ******************************************************************************/ void AcpiExEisaIdToString ( - UINT32 NumericId, - char *OutString) + char *OutString, + ACPI_INTEGER CompressedId) { - UINT32 EisaId; + UINT32 SwappedId; ACPI_FUNCTION_ENTRY (); + /* The EISAID should be a 32-bit integer */ + + if (CompressedId > ACPI_UINT32_MAX) + { + ACPI_WARNING ((AE_INFO, + "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", + ACPI_FORMAT_UINT64 (CompressedId))); + } + /* Swap ID to big-endian to get contiguous bits */ - EisaId = AcpiUtDwordByteSwap (NumericId); + SwappedId = AcpiUtDwordByteSwap ((UINT32) CompressedId); - OutString[0] = (char) ('@' + (((unsigned long) EisaId >> 26) & 0x1f)); - OutString[1] = (char) ('@' + ((EisaId >> 21) & 0x1f)); - OutString[2] = (char) ('@' + ((EisaId >> 16) & 0x1f)); - OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12); - OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8); - OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4); - OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0); + /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */ + + OutString[0] = (char) (0x40 + (((unsigned long) SwappedId >> 26) & 0x1F)); + OutString[1] = (char) (0x40 + ((SwappedId >> 21) & 0x1F)); + OutString[2] = (char) (0x40 + ((SwappedId >> 16) & 0x1F)); + OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 12); + OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 8); + OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 4); + OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 0); OutString[7] = 0; } /******************************************************************************* * - * FUNCTION: AcpiExUnsignedIntegerToString + * FUNCTION: AcpiExIntegerToString * - * PARAMETERS: Value - Value to be converted - * OutString - Where to put the converted string (8 bytes) + * PARAMETERS: OutString - Where to put the converted string. At least + * 21 bytes are needed to hold the largest + * possible 64-bit integer. + * Value - Value to be converted * * RETURN: None, string * - * DESCRIPTION: Convert a number to string representation. Assumes string - * buffer is large enough to hold the string. + * DESCRIPTION: Convert a 64-bit integer to decimal string representation. + * Assumes string buffer is large enough to hold the string. The + * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1). * ******************************************************************************/ void -AcpiExUnsignedIntegerToString ( - ACPI_INTEGER Value, - char *OutString) +AcpiExIntegerToString ( + char *OutString, + ACPI_INTEGER Value) { UINT32 Count; UINT32 DigitsNeeded; diff --git a/generate/lint/options.lnt b/generate/lint/options.lnt index ca4f90beec08..1dfd97b02e4d 100644 --- a/generate/lint/options.lnt +++ b/generate/lint/options.lnt @@ -33,6 +33,8 @@ -emacro( (413), ACPI_PTR_DIFF ) // use of NULL pointer creates a stir -emacro( (413), ACPI_FADT_OFFSET ) // use of NULL pointer creates a stir -emacro( (413), ASL_RESDESC_OFFSET ) // use of NULL pointer creates a stir +-emacro( (662), ACPI_ADD_PTR ) // allow pointer overrun for dynamic structs +-emacro( (797), ACPI_ADD_PTR ) // allow pointer overrun for dynamic structs -emacro( 826, ACPI_NEXT_RESOURCE) // Pointer cast -emacro( 826, ACPI_MOVE_UNALIGNED16_TO_16) // Pointer cast @@ -76,4 +78,5 @@ -e834 // - followed by + is "confusing" NOT. -e820 // Allow Boolean test of a parenthesized assignment -e778 // Allow constant expressions to evaluate to zero +-e662 // Allow "pointer overrun" for dynamic structures -e831
\ No newline at end of file diff --git a/hardware/hwgpe.c b/hardware/hwgpe.c index b7bb0b47f5d3..a45603d9d5fb 100644 --- a/hardware/hwgpe.c +++ b/hardware/hwgpe.c @@ -161,7 +161,7 @@ AcpiHwLowDisableGpe ( /* Get current value of the enable register that contains this GPE */ - Status = AcpiRead (&EnableMask, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -175,7 +175,7 @@ AcpiHwLowDisableGpe ( /* Write the updated enable mask */ - Status = AcpiWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); return (Status); } @@ -215,7 +215,7 @@ AcpiHwWriteGpeEnableReg ( /* Write the entire GPE (runtime) enable register */ - Status = AcpiWrite (GpeRegisterInfo->EnableForRun, + Status = AcpiHwWrite (GpeRegisterInfo->EnableForRun, &GpeRegisterInfo->EnableAddress); return (Status); @@ -252,7 +252,7 @@ AcpiHwClearGpe ( * Write a one to the appropriate bit in the status register to * clear this GPE. */ - Status = AcpiWrite (RegisterBit, + Status = AcpiHwWrite (RegisterBit, &GpeEventInfo->RegisterInfo->StatusAddress); return (Status); @@ -317,7 +317,7 @@ AcpiHwGetGpeStatus ( /* GPE currently active (status bit == 1)? */ - Status = AcpiRead (&InByte, &GpeRegisterInfo->StatusAddress); + Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -367,7 +367,7 @@ AcpiHwDisableGpeBlock ( { /* Disable all GPEs in this register */ - Status = AcpiWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress); + Status = AcpiHwWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -407,7 +407,7 @@ AcpiHwClearGpeBlock ( { /* Clear status on all GPEs in this register */ - Status = AcpiWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress); + Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -455,7 +455,7 @@ AcpiHwEnableRuntimeGpeBlock ( /* Enable all "runtime" GPEs in this register */ - Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForRun, + Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForRun, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { @@ -502,7 +502,7 @@ AcpiHwEnableWakeupGpeBlock ( /* Enable all "wake" GPEs in this register */ - Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForWake, + Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForWake, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { diff --git a/hardware/hwregs.c b/hardware/hwregs.c index cfb83f22e642..163840d7f4ad 100644 --- a/hardware/hwregs.c +++ b/hardware/hwregs.c @@ -140,6 +140,209 @@ AcpiHwWriteMultiple ( ACPI_GENERIC_ADDRESS *RegisterB); +/****************************************************************************** + * + * FUNCTION: AcpiHwValidateRegister + * + * PARAMETERS: Reg - GAS register structure + * MaxBitWidth - Max BitWidth supported (32 or 64) + * Address - Pointer to where the gas->address + * is returned + * + * RETURN: Status + * + * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS + * pointer, Address, SpaceId, BitWidth, and BitOffset. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwValidateRegister ( + ACPI_GENERIC_ADDRESS *Reg, + UINT8 MaxBitWidth, + UINT64 *Address) +{ + + /* Must have a valid pointer to a GAS structure */ + + if (!Reg) + { + return (AE_BAD_PARAMETER); + } + + /* + * Copy the target address. This handles possible alignment issues. + * Address must not be null. A null address also indicates an optional + * ACPI register that is not supported, so no error message. + */ + ACPI_MOVE_64_TO_64 (Address, &Reg->Address); + if (!(*Address)) + { + return (AE_BAD_ADDRESS); + } + + /* Validate the SpaceID */ + + if ((Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && + (Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) + { + ACPI_ERROR ((AE_INFO, + "Unsupported address space: 0x%X", Reg->SpaceId)); + return (AE_SUPPORT); + } + + /* Validate the BitWidth */ + + if ((Reg->BitWidth != 8) && + (Reg->BitWidth != 16) && + (Reg->BitWidth != 32) && + (Reg->BitWidth != MaxBitWidth)) + { + ACPI_ERROR ((AE_INFO, + "Unsupported register bit width: 0x%X", Reg->BitWidth)); + return (AE_SUPPORT); + } + + /* Validate the BitOffset. Just a warning for now. */ + + if (Reg->BitOffset != 0) + { + ACPI_WARNING ((AE_INFO, + "Unsupported register bit offset: 0x%X", Reg->BitOffset)); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwRead + * + * PARAMETERS: Value - Where the value is returned + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Read from either memory or IO space. This is a 32-bit max + * version of AcpiRead, used internally since the overhead of + * 64-bit values is not needed. + * + * LIMITATIONS: <These limitations also apply to AcpiHwWrite> + * BitWidth must be exactly 8, 16, or 32. + * SpaceID must be SystemMemory or SystemIO. + * BitOffset and AccessWidth are currently ignored, as there has + * not been a need to implement these. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwRead ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *Reg) +{ + UINT64 Address; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME (HwRead); + + + /* Validate contents of the GAS register */ + + Status = AcpiHwValidateRegister (Reg, 32, &Address); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Initialize entire 32-bit return value to zero */ + + *Value = 0; + + /* + * Two address spaces supported: Memory or IO. PCI_Config is + * not supported here because the GAS structure is insufficient + */ + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) + { + Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) + Address, Value, Reg->BitWidth); + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) + Address, Value, Reg->BitWidth); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address), + AcpiUtGetRegionName (Reg->SpaceId))); + + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwWrite + * + * PARAMETERS: Value - Value to be written + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max + * version of AcpiWrite, used internally since the overhead of + * 64-bit values is not needed. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwWrite ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *Reg) +{ + UINT64 Address; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME (HwWrite); + + + /* Validate contents of the GAS register */ + + Status = AcpiHwValidateRegister (Reg, 32, &Address); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * Two address spaces supported: Memory or IO. PCI_Config is + * not supported here because the GAS structure is insufficient + */ + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) + { + Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) + Address, Value, Reg->BitWidth); + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) + Address, Value, Reg->BitWidth); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address), + AcpiUtGetRegionName (Reg->SpaceId))); + + return (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiHwClearAcpiStatus @@ -245,7 +448,7 @@ AcpiHwWritePm1Control ( ACPI_FUNCTION_TRACE (HwWritePm1Control); - Status = AcpiWrite (Pm1aControl, &AcpiGbl_FADT.XPm1aControlBlock); + Status = AcpiHwWrite (Pm1aControl, &AcpiGbl_FADT.XPm1aControlBlock); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -253,7 +456,7 @@ AcpiHwWritePm1Control ( if (AcpiGbl_FADT.XPm1bControlBlock.Address) { - Status = AcpiWrite (Pm1bControl, &AcpiGbl_FADT.XPm1bControlBlock); + Status = AcpiHwWrite (Pm1bControl, &AcpiGbl_FADT.XPm1bControlBlock); } return_ACPI_STATUS (Status); } @@ -319,13 +522,13 @@ AcpiHwRegisterRead ( case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - Status = AcpiRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock); break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - Status = AcpiRead (&Value, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPmTimerBlock); break; @@ -450,7 +653,7 @@ AcpiHwRegisterWrite ( * For control registers, all reserved bits must be preserved, * as per the ACPI spec. */ - Status = AcpiRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock); if (ACPI_FAILURE (Status)) { goto Exit; @@ -460,13 +663,13 @@ AcpiHwRegisterWrite ( ACPI_INSERT_BITS (Value, ACPI_PM2_CONTROL_PRESERVED_BITS, ReadValue); - Status = AcpiWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock); break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - Status = AcpiWrite (Value, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPmTimerBlock); break; @@ -517,7 +720,7 @@ AcpiHwReadMultiple ( /* The first register is always required */ - Status = AcpiRead (&ValueA, RegisterA); + Status = AcpiHwRead (&ValueA, RegisterA); if (ACPI_FAILURE (Status)) { return (Status); @@ -527,7 +730,7 @@ AcpiHwReadMultiple ( if (RegisterB->Address) { - Status = AcpiRead (&ValueB, RegisterB); + Status = AcpiHwRead (&ValueB, RegisterB); if (ACPI_FAILURE (Status)) { return (Status); @@ -574,7 +777,7 @@ AcpiHwWriteMultiple ( /* The first register is always required */ - Status = AcpiWrite (Value, RegisterA); + Status = AcpiHwWrite (Value, RegisterA); if (ACPI_FAILURE (Status)) { return (Status); @@ -594,7 +797,7 @@ AcpiHwWriteMultiple ( */ if (RegisterB->Address) { - Status = AcpiWrite (Value, RegisterB); + Status = AcpiHwWrite (Value, RegisterB); } return (Status); diff --git a/hardware/hwtimer.c b/hardware/hwtimer.c index ad9934cdaaf9..f86fb7f865e1 100644 --- a/hardware/hwtimer.c +++ b/hardware/hwtimer.c @@ -187,7 +187,7 @@ AcpiGetTimer ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - Status = AcpiRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock); return_ACPI_STATUS (Status); } diff --git a/hardware/hwxface.c b/hardware/hwxface.c index 63641d38935a..901b178fa579 100644 --- a/hardware/hwxface.c +++ b/hardware/hwxface.c @@ -159,7 +159,7 @@ AcpiReset ( /* Write the reset value to the reset register */ - Status = AcpiWrite (AcpiGbl_FADT.ResetValue, ResetReg); + Status = AcpiHwWrite (AcpiGbl_FADT.ResetValue, ResetReg); return_ACPI_STATUS (Status); } @@ -177,13 +177,20 @@ ACPI_EXPORT_SYMBOL (AcpiReset) * * DESCRIPTION: Read from either memory or IO space. * + * LIMITATIONS: <These limitations also apply to AcpiWrite> + * BitWidth must be exactly 8, 16, 32, or 64. + * SpaceID must be SystemMemory or SystemIO. + * BitOffset and AccessWidth are currently ignored, as there has + * not been a need to implement these. + * ******************************************************************************/ ACPI_STATUS AcpiRead ( - UINT32 *Value, + UINT64 *ReturnValue, ACPI_GENERIC_ADDRESS *Reg) { + UINT32 Value; UINT32 Width; UINT64 Address; ACPI_STATUS Status; @@ -192,63 +199,85 @@ AcpiRead ( ACPI_FUNCTION_NAME (AcpiRead); - /* - * Must have a valid pointer to a GAS structure, and a non-zero address - * within. - */ - if (!Reg) + if (!ReturnValue) { return (AE_BAD_PARAMETER); } - /* Get a local copy of the address. Handles possible alignment issues */ + /* Validate contents of the GAS register. Allow 64-bit transfers */ - ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!Address) + Status = AcpiHwValidateRegister (Reg, 64, &Address); + if (ACPI_FAILURE (Status)) { - return (AE_BAD_ADDRESS); + return (Status); } - /* Supported widths are 8/16/32 */ - Width = Reg->BitWidth; - if ((Width != 8) && (Width != 16) && (Width != 32)) + if (Width == 64) { - return (AE_SUPPORT); + Width = 32; /* Break into two 32-bit transfers */ } - /* Initialize entire 32-bit return value to zero */ + /* Initialize entire 64-bit return value to zero */ - *Value = 0; + *ReturnValue = 0; + Value = 0; /* * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient */ - switch (Reg->SpaceId) + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - Status = AcpiOsReadMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); - break; - - - case ACPI_ADR_SPACE_SYSTEM_IO: - - Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, Value, Width); - break; + Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) + Address, &Value, Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue = Value; + if (Reg->BitWidth == 64) + { + /* Read the top 32 bits */ + + Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) + (Address + 4), &Value, 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue |= ((UINT64) Value << 32); + } + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) + Address, &Value, Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue = Value; - default: - ACPI_ERROR ((AE_INFO, - "Unsupported address space: %X", Reg->SpaceId)); - return (AE_BAD_PARAMETER); + if (Reg->BitWidth == 64) + { + /* Read the top 32 bits */ + + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) + (Address + 4), &Value, 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue |= ((UINT64) Value << 32); + } } ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *Value, Width, ACPI_FORMAT_UINT64 (Address), + "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n", + ACPI_FORMAT_UINT64 (*ReturnValue), Reg->BitWidth, + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); @@ -261,7 +290,7 @@ ACPI_EXPORT_SYMBOL (AcpiRead) * * FUNCTION: AcpiWrite * - * PARAMETERS: Value - To be written + * PARAMETERS: Value - Value to be written * Reg - GAS register structure * * RETURN: Status @@ -272,7 +301,7 @@ ACPI_EXPORT_SYMBOL (AcpiRead) ACPI_STATUS AcpiWrite ( - UINT32 Value, + UINT64 Value, ACPI_GENERIC_ADDRESS *Reg) { UINT32 Width; @@ -283,60 +312,67 @@ AcpiWrite ( ACPI_FUNCTION_NAME (AcpiWrite); - /* - * Must have a valid pointer to a GAS structure, and a non-zero address - * within. - */ - if (!Reg) - { - return (AE_BAD_PARAMETER); - } - - /* Get a local copy of the address. Handles possible alignment issues */ + /* Validate contents of the GAS register. Allow 64-bit transfers */ - ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!Address) + Status = AcpiHwValidateRegister (Reg, 64, &Address); + if (ACPI_FAILURE (Status)) { - return (AE_BAD_ADDRESS); + return (Status); } - /* Supported widths are 8/16/32 */ - Width = Reg->BitWidth; - if ((Width != 8) && (Width != 16) && (Width != 32)) + if (Width == 64) { - return (AE_SUPPORT); + Width = 32; /* Break into two 32-bit transfers */ } /* - * Two address spaces supported: Memory or IO. - * PCI_Config is not supported here because the GAS struct is insufficient + * Two address spaces supported: Memory or IO. PCI_Config is + * not supported here because the GAS structure is insufficient */ - switch (Reg->SpaceId) + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - Status = AcpiOsWriteMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); - break; - - - case ACPI_ADR_SPACE_SYSTEM_IO: - - Status = AcpiHwWritePort ( - (ACPI_IO_ADDRESS) Address, Value, Width); - break; + Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) + Address, ACPI_LODWORD (Value), Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Reg->BitWidth == 64) + { + Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) + (Address + 4), ACPI_HIDWORD (Value), 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) + Address, ACPI_LODWORD (Value), Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } - default: - ACPI_ERROR ((AE_INFO, - "Unsupported address space: %X", Reg->SpaceId)); - return (AE_BAD_PARAMETER); + if (Reg->BitWidth == 64) + { + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) + (Address + 4), ACPI_HIDWORD (Value), 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } } ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - Value, Width, ACPI_FORMAT_UINT64 (Address), + "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n", + ACPI_FORMAT_UINT64 (Value), Reg->BitWidth, + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); diff --git a/include/acconfig.h b/include/acconfig.h index 7b458cc457fd..1fcc45a364a8 100644 --- a/include/acconfig.h +++ b/include/acconfig.h @@ -236,7 +236,7 @@ /* Operation regions */ -#define ACPI_NUM_PREDEFINED_REGIONS 8 +#define ACPI_NUM_PREDEFINED_REGIONS 9 #define ACPI_USER_REGION_BEGIN 0x80 /* Maximum SpaceIds for Operation Regions */ @@ -252,9 +252,15 @@ #define ACPI_RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_XCHECKSUM_LENGTH 36 -/* SMBus bidirectional buffer size */ +/* SMBus and IPMI bidirectional buffer size */ #define ACPI_SMBUS_BUFFER_SIZE 34 +#define ACPI_IPMI_BUFFER_SIZE 66 + +/* _SxD and _SxW control methods */ + +#define ACPI_NUM_SxD_METHODS 4 +#define ACPI_NUM_SxW_METHODS 5 /****************************************************************************** diff --git a/include/acdebug.h b/include/acdebug.h index 6a9d51fe473a..dedaa649eae1 100644 --- a/include/acdebug.h +++ b/include/acdebug.h @@ -313,13 +313,6 @@ AcpiDbDisplayArgumentObject ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); -void -AcpiDbCheckPredefinedNames ( - void); - -void -AcpiDbBatchExecute ( - void); /* * dbexec - debugger control method execution diff --git a/include/acglobal.h b/include/acglobal.h index 42b7b158c4b3..8588843df934 100644 --- a/include/acglobal.h +++ b/include/acglobal.h @@ -324,7 +324,8 @@ extern char const *AcpiGbl_ExceptionNames_Ctrl[]; extern BOOLEAN AcpiGbl_Shutdown; extern UINT32 AcpiGbl_StartupFlags; extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; -extern const char *AcpiGbl_HighestDstateNames[4]; +extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS]; +extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS]; extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; #endif diff --git a/include/achware.h b/include/achware.h index 05da01b44db2..c171a5fc1df8 100644 --- a/include/achware.h +++ b/include/achware.h @@ -141,6 +141,22 @@ AcpiHwGetMode ( /* * hwregs - ACPI Register I/O */ +ACPI_STATUS +AcpiHwValidateRegister ( + ACPI_GENERIC_ADDRESS *Reg, + UINT8 MaxBitWidth, + UINT64 *Address); + +ACPI_STATUS +AcpiHwRead ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *Reg); + +ACPI_STATUS +AcpiHwWrite ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *Reg); + ACPI_BIT_REGISTER_INFO * AcpiHwGetBitRegisterInfo ( UINT32 RegisterId); diff --git a/include/acinterp.h b/include/acinterp.h index b0f4b921854b..74c5f0b4ebae 100644 --- a/include/acinterp.h +++ b/include/acinterp.h @@ -696,13 +696,13 @@ AcpiExReleaseGlobalLock ( void AcpiExEisaIdToString ( - UINT32 NumericId, - char *OutString); + char *Dest, + ACPI_INTEGER CompressedId); void -AcpiExUnsignedIntegerToString ( - ACPI_INTEGER Value, - char *OutString); +AcpiExIntegerToString ( + char *Dest, + ACPI_INTEGER Value); /* diff --git a/include/aclocal.h b/include/aclocal.h index 99955c31bf1a..2a0689244544 100644 --- a/include/aclocal.h +++ b/include/aclocal.h @@ -493,6 +493,23 @@ typedef union acpi_predefined_info } ACPI_PREDEFINED_INFO; + +/* Data block used during object validation */ + +typedef struct acpi_predefined_data +{ + char *Pathname; + const ACPI_PREDEFINED_INFO *Predefined; + UINT32 Flags; + UINT8 NodeFlags; + +} ACPI_PREDEFINED_DATA; + +/* Defines for Flags field above */ + +#define ACPI_OBJECT_REPAIRED 1 + + /* * Bitmapped return value types * Note: the actual data types must be contiguous, a loop in nspredef.c diff --git a/include/acmacros.h b/include/acmacros.h index b9c323ebd7de..28c934deb996 100644 --- a/include/acmacros.h +++ b/include/acmacros.h @@ -402,6 +402,7 @@ */ #define ACPI_ERROR_NAMESPACE(s, e) AcpiNsReportError (AE_INFO, s, e); #define ACPI_ERROR_METHOD(s, n, p, e) AcpiNsReportMethodError (AE_INFO, s, n, p, e); +#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist #else @@ -409,6 +410,7 @@ #define ACPI_ERROR_NAMESPACE(s, e) #define ACPI_ERROR_METHOD(s, n, p, e) +#define ACPI_WARN_PREDEFINED(plist) #endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/include/acnamesp.h b/include/acnamesp.h index 3f9a6ce6faf8..ee9c26caba5a 100644 --- a/include/acnamesp.h +++ b/include/acnamesp.h @@ -241,6 +241,10 @@ AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node); void +AcpiNsRemoveNode ( + ACPI_NAMESPACE_NODE *Node); + +void AcpiNsDeleteNamespaceSubtree ( ACPI_NAMESPACE_NODE *ParentHandle); diff --git a/include/acpixf.h b/include/acpixf.h index 84e4a4f56f2d..7c0a89f34510 100644 --- a/include/acpixf.h +++ b/include/acpixf.h @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20090521 +#define ACPI_CA_VERSION 0x20090625 #include "actypes.h" #include "actbl.h" @@ -336,7 +336,7 @@ AcpiEvaluateObjectTyped ( ACPI_STATUS AcpiGetObjectInfo ( ACPI_HANDLE Handle, - ACPI_BUFFER *ReturnBuffer); + ACPI_DEVICE_INFO **ReturnBuffer); ACPI_STATUS AcpiInstallMethod ( @@ -573,12 +573,12 @@ AcpiReset ( ACPI_STATUS AcpiRead ( - UINT32 *Value, + UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS AcpiWrite ( - UINT32 Value, + UINT64 Value, ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS diff --git a/include/actbl.h b/include/actbl.h index 9d53404d605a..084d210657d4 100644 --- a/include/actbl.h +++ b/include/actbl.h @@ -250,18 +250,25 @@ typedef struct acpi_table_facs UINT32 Flags; UINT64 XFirmwareWakingVector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ UINT8 Version; /* Version of this table (ACPI 2.0+) */ - UINT8 Reserved[31]; /* Reserved, must be zero */ + UINT8 Reserved[3]; /* Reserved, must be zero */ + UINT32 OspmFlags; /* Flags to be set by OSPM (ACPI 4.0) */ + UINT8 Reserved1[24]; /* Reserved, must be zero */ } ACPI_TABLE_FACS; -/* Flag macros */ +/* GlobalLock flags */ -#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ +#define ACPI_GLOCK_PENDING (1) /* 00: Pending global lock ownership */ +#define ACPI_GLOCK_OWNED (1<<1) /* 01: Global lock is owned */ -/* Global lock flags */ +/* Flags */ -#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ -#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ +#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ +#define ACPI_FACS_64BIT_WAKE (1<<1) /* 01: 64-bit wake vector supported (ACPI 4.0) */ + +/* OspmFlags */ + +#define ACPI_FACS_64BIT_ENVIRONMENT (1) /* 00: 64-bit wake environment is required (ACPI 4.0) */ /******************************************************************************* diff --git a/include/actbl1.h b/include/actbl1.h index dc5519b62263..a0ff06b2af81 100644 --- a/include/actbl1.h +++ b/include/actbl1.h @@ -1262,7 +1262,7 @@ typedef struct acpi_madt_interrupt_source #define ACPI_MADT_CPEI_OVERRIDE (1) -/* 9: Processor Local X2APIC (07/2008) */ +/* 9: Processor Local X2APIC (ACPI 4.0) */ typedef struct acpi_madt_local_x2apic { @@ -1274,7 +1274,7 @@ typedef struct acpi_madt_local_x2apic } ACPI_MADT_LOCAL_X2APIC; -/* 10: Local X2APIC NMI (07/2008) */ +/* 10: Local X2APIC NMI (ACPI 4.0) */ typedef struct acpi_madt_local_x2apic_nmi { @@ -1493,7 +1493,7 @@ typedef struct acpi_srat_mem_affinity #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ #define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ -/* 2: Processor Local X2_APIC Affinity (07/2008) */ +/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ typedef struct acpi_srat_x2apic_cpu_affinity { @@ -1502,6 +1502,8 @@ typedef struct acpi_srat_x2apic_cpu_affinity UINT32 ProximityDomain; UINT32 ApicId; UINT32 Flags; + UINT32 ClockDomain; + UINT32 Reserved2; } ACPI_SRAT_X2APIC_CPU_AFFINITY; diff --git a/include/actypes.h b/include/actypes.h index 8f970d972960..0e01b97bbe06 100644 --- a/include/actypes.h +++ b/include/actypes.h @@ -415,7 +415,7 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; /* PM Timer ticks per second (HZ) */ -#define PM_TIMER_FREQUENCY 3579545 +#define PM_TIMER_FREQUENCY 3579545 /******************************************************************************* @@ -816,7 +816,8 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 -#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7 +#define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 +#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 8 #define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127 @@ -1056,7 +1057,6 @@ void (*ACPI_NOTIFY_HANDLER) ( typedef void (*ACPI_OBJECT_HANDLER) ( ACPI_HANDLE Object, - UINT32 Function, void *Data); typedef @@ -1123,46 +1123,67 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) ( #define ACPI_INTERRUPT_NOT_HANDLED 0x00 #define ACPI_INTERRUPT_HANDLED 0x01 +/* Length of 32-bit EISAID values when converted back to a string */ + +#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ -/* Length of _HID, _UID, _CID, and UUID values */ +/* Length of UUID (string) values */ -#define ACPI_DEVICE_ID_LENGTH 0x09 -#define ACPI_MAX_CID_LENGTH 48 #define ACPI_UUID_LENGTH 16 -/* Common string version of device HIDs and UIDs */ + +/* Structures used for device/processor HID, UID, CID */ typedef struct acpi_device_id { - char Value[ACPI_DEVICE_ID_LENGTH]; + UINT32 Length; /* Length of string + null */ + char *String; } ACPI_DEVICE_ID; -/* Common string version of device CIDs */ - -typedef struct acpi_compatible_id +typedef struct acpi_device_id_list { - char Value[ACPI_MAX_CID_LENGTH]; + UINT32 Count; /* Number of IDs in Ids array */ + UINT32 ListSize; /* Size of list, including ID strings */ + ACPI_DEVICE_ID Ids[1]; /* ID array */ -} ACPI_COMPATIBLE_ID; +} ACPI_DEVICE_ID_LIST; -typedef struct acpi_compatible_id_list +/* + * Structure returned from AcpiGetObjectInfo. + * Optimized for both 32- and 64-bit builds + */ +typedef struct acpi_device_info { - UINT32 Count; - UINT32 Size; - ACPI_COMPATIBLE_ID Id[1]; + UINT32 InfoSize; /* Size of info, including ID strings */ + UINT32 Name; /* ACPI object Name */ + ACPI_OBJECT_TYPE Type; /* ACPI object Type */ + UINT8 ParamCount; /* If a method, required parameter count */ + UINT8 Valid; /* Indicates which optional fields are valid */ + UINT8 Flags; /* Miscellaneous info */ + UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ + UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */ + UINT32 CurrentStatus; /* _STA value */ + ACPI_INTEGER Address; /* _ADR value */ + ACPI_DEVICE_ID HardwareId; /* _HID value */ + ACPI_DEVICE_ID UniqueId; /* _UID value */ + ACPI_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */ + +} ACPI_DEVICE_INFO; -} ACPI_COMPATIBLE_ID_LIST; +/* Values for Flags field above (AcpiGetObjectInfo) */ +#define ACPI_PCI_ROOT_BRIDGE 0x01 -/* Structure and flags for AcpiGetObjectInfo */ +/* Flags for Valid field above (AcpiGetObjectInfo) */ -#define ACPI_VALID_STA 0x0001 -#define ACPI_VALID_ADR 0x0002 -#define ACPI_VALID_HID 0x0004 -#define ACPI_VALID_UID 0x0008 -#define ACPI_VALID_CID 0x0010 -#define ACPI_VALID_SXDS 0x0020 +#define ACPI_VALID_STA 0x01 +#define ACPI_VALID_ADR 0x02 +#define ACPI_VALID_HID 0x04 +#define ACPI_VALID_UID 0x08 +#define ACPI_VALID_CID 0x10 +#define ACPI_VALID_SXDS 0x20 +#define ACPI_VALID_SXWS 0x40 /* Flags for _STA method */ @@ -1174,36 +1195,6 @@ typedef struct acpi_compatible_id_list #define ACPI_STA_BATTERY_PRESENT 0x10 -#define ACPI_COMMON_OBJ_INFO \ - ACPI_OBJECT_TYPE Type; /* ACPI object type */ \ - ACPI_NAME Name /* ACPI object Name */ - - -typedef struct acpi_obj_info_header -{ - ACPI_COMMON_OBJ_INFO; - -} ACPI_OBJ_INFO_HEADER; - - -/* Structure returned from Get Object Info */ - -typedef struct acpi_device_info -{ - ACPI_COMMON_OBJ_INFO; - - UINT32 ParamCount; /* If a method, required parameter count */ - UINT32 Valid; /* Indicates which fields below are valid */ - UINT32 CurrentStatus; /* _STA value */ - ACPI_INTEGER Address; /* _ADR value if any */ - ACPI_DEVICE_ID HardwareId; /* _HID value if any */ - ACPI_DEVICE_ID UniqueId; /* _UID value if any */ - UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ - ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */ - -} ACPI_DEVICE_INFO; - - /* Context structs for address space handlers */ typedef struct acpi_pci_id @@ -1215,7 +1206,6 @@ typedef struct acpi_pci_id } ACPI_PCI_ID; - typedef struct acpi_mem_space_context { UINT32 Length; diff --git a/include/acutils.h b/include/acutils.h index 5573754e89fd..33d33c2f4787 100644 --- a/include/acutils.h +++ b/include/acutils.h @@ -550,32 +550,39 @@ ACPI_STATUS AcpiUtEvaluateNumericObject ( char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_INTEGER *Address); + ACPI_INTEGER *Value); ACPI_STATUS -AcpiUtExecute_HID ( +AcpiUtExecute_STA ( ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Hid); + UINT32 *StatusFlags); ACPI_STATUS -AcpiUtExecute_CID ( +AcpiUtExecutePowerMethods ( ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_COMPATIBLE_ID_LIST **ReturnCidList); + const char **MethodNames, + UINT8 MethodCount, + UINT8 *OutValues); + +/* + * utids - device ID support + */ ACPI_STATUS -AcpiUtExecute_STA ( +AcpiUtExecute_HID ( ACPI_NAMESPACE_NODE *DeviceNode, - UINT32 *StatusFlags); + ACPI_DEVICE_ID **ReturnId); ACPI_STATUS AcpiUtExecute_UID ( ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Uid); + ACPI_DEVICE_ID **ReturnId); ACPI_STATUS -AcpiUtExecute_Sxds ( +AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, - UINT8 *Highest); + ACPI_DEVICE_ID_LIST **ReturnCidList); + /* * utlock - reader/writer locks @@ -729,6 +736,10 @@ AcpiUtValidateException ( ACPI_STATUS Status); BOOLEAN +AcpiUtIsPciRootBridge ( + char *Id); + +BOOLEAN AcpiUtIsAmlTable ( ACPI_TABLE_HEADER *Table); @@ -775,6 +786,15 @@ AcpiUtStrtoul64 ( UINT32 Base, ACPI_INTEGER *RetInteger); +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedWarning ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...); + /* Values for Base above (16=Hex, 10=Decimal) */ #define ACPI_ANY_BASE 0 diff --git a/include/amlcode.h b/include/amlcode.h index 7694acc14cf4..19740d9083c2 100644 --- a/include/amlcode.h +++ b/include/amlcode.h @@ -485,6 +485,7 @@ typedef enum REGION_SMBUS, REGION_CMOS, REGION_PCI_BAR, + REGION_IPMI, REGION_DATA_TABLE, /* Internal use only */ REGION_FIXED_HW = 0x7F diff --git a/namespace/nsalloc.c b/namespace/nsalloc.c index c3113b6cb3d4..9693cb7835a1 100644 --- a/namespace/nsalloc.c +++ b/namespace/nsalloc.c @@ -181,7 +181,10 @@ AcpiNsCreateNode ( * * RETURN: None * - * DESCRIPTION: Delete a namespace node + * DESCRIPTION: Delete a namespace node. All node deletions must come through + * here. Detaches any attached objects, including any attached + * data. If a handler is associated with attached data, it is + * invoked before the node is deleted. * ******************************************************************************/ @@ -189,12 +192,67 @@ void AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { + ACPI_OPERAND_OBJECT *ObjDesc; + + + ACPI_FUNCTION_NAME (NsDeleteNode); + + + /* Detach an object if there is one */ + + AcpiNsDetachObject (Node); + + /* + * Delete an attached data object if present (an object that was created + * and attached via AcpiAttachData). Note: After any normal object is + * detached above, the only possible remaining object is a data object. + */ + ObjDesc = Node->Object; + if (ObjDesc && + (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) + { + /* Invoke the attached data deletion handler if present */ + + if (ObjDesc->Data.Handler) + { + ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); + } + + AcpiUtRemoveReference (ObjDesc); + } + + /* Now we can delete the node */ + + (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); + + ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n", + Node, AcpiGbl_CurrentNodeCount)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsRemoveNode + * + * PARAMETERS: Node - Node to be removed/deleted + * + * RETURN: None + * + * DESCRIPTION: Remove (unlink) and delete a namespace node + * + ******************************************************************************/ + +void +AcpiNsRemoveNode ( + ACPI_NAMESPACE_NODE *Node) +{ ACPI_NAMESPACE_NODE *ParentNode; ACPI_NAMESPACE_NODE *PrevNode; ACPI_NAMESPACE_NODE *NextNode; - ACPI_FUNCTION_TRACE_PTR (NsDeleteNode, Node); + ACPI_FUNCTION_TRACE_PTR (NsRemoveNode, Node); ParentNode = AcpiNsGetParentNode (Node); @@ -237,12 +295,9 @@ AcpiNsDeleteNode ( } } - ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); - - /* Detach an object if there is one, then delete the node */ + /* Delete the node and any attached objects */ - AcpiNsDetachObject (Node); - (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); + AcpiNsDeleteNode (Node); return_VOID; } @@ -385,23 +440,11 @@ AcpiNsDeleteChildren ( ParentNode, ChildNode)); } - /* Now we can free this child object */ - - ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n", - ChildNode, AcpiGbl_CurrentNodeCount)); - - /* Detach an object if there is one, then free the child node */ - - AcpiNsDetachObject (ChildNode); - - /* Now we can delete the node */ - - (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, ChildNode); - - /* And move on to the next child in the list */ - + /* + * Delete this child node and move on to the next child in the list. + * No need to unlink the node since we are deleting the entire branch. + */ + AcpiNsDeleteNode (ChildNode); ChildNode = NextNode; } while (!(Flags & ANOBJ_END_OF_PEER_LIST)); @@ -561,7 +604,7 @@ AcpiNsDeleteNamespaceByOwner ( if (DeletionNode) { AcpiNsDeleteChildren (DeletionNode); - AcpiNsDeleteNode (DeletionNode); + AcpiNsRemoveNode (DeletionNode); DeletionNode = NULL; } diff --git a/namespace/nsload.c b/namespace/nsload.c index 10eff45cb36f..a9f3824718bc 100644 --- a/namespace/nsload.c +++ b/namespace/nsload.c @@ -376,8 +376,7 @@ AcpiNsDeleteSubtree ( /* Now delete the starting object, and we are done */ - AcpiNsDeleteNode (ChildHandle); - + AcpiNsRemoveNode (ChildHandle); return_ACPI_STATUS (AE_OK); } diff --git a/namespace/nspredef.c b/namespace/nspredef.c index bfd6d7b4fc3b..0dc75247fbc8 100644 --- a/namespace/nspredef.c +++ b/namespace/nspredef.c @@ -146,17 +146,17 @@ * ******************************************************************************/ + /* Local prototypes */ static ACPI_STATUS AcpiNsCheckPackage ( - char *Pathname, - ACPI_OPERAND_OBJECT **ReturnObjectPtr, - const ACPI_PREDEFINED_INFO *Predefined); + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); static ACPI_STATUS AcpiNsCheckPackageElements ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, @@ -166,22 +166,28 @@ AcpiNsCheckPackageElements ( static ACPI_STATUS AcpiNsCheckObjectType ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex); static ACPI_STATUS AcpiNsCheckReference ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT *ReturnObject); static ACPI_STATUS AcpiNsRepairObject ( + ACPI_PREDEFINED_DATA *Data, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr); +static void +AcpiNsGetExpectedTypes ( + char *Buffer, + UINT32 ExpectedBtypes); + /* * Names for the types that can be returned by the predefined objects. * Used for warning messages. Must be in the same order as the ACPI_RTYPEs @@ -195,7 +201,13 @@ static const char *AcpiRtypeNames[] = "/Reference", }; -#define ACPI_NOT_PACKAGE ACPI_UINT32_MAX +/* Object is not a package element */ + +#define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX + +/* Always emit warning message, not dependent on node flags */ + +#define ACPI_WARN_ALWAYS 0 /******************************************************************************* @@ -203,6 +215,8 @@ static const char *AcpiRtypeNames[] = * FUNCTION: AcpiNsCheckPredefinedNames * * PARAMETERS: Node - Namespace node for the method/object + * UserParamCount - Number of parameters actually passed + * ReturnStatus - Status from the object evaluation * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -223,13 +237,14 @@ AcpiNsCheckPredefinedNames ( ACPI_STATUS Status = AE_OK; const ACPI_PREDEFINED_INFO *Predefined; char *Pathname; + ACPI_PREDEFINED_DATA *Data; /* Match the name for this method/object against the predefined list */ Predefined = AcpiNsCheckForPredefinedName (Node); - /* Get the full pathname to the object, for use in error messages */ + /* Get the full pathname to the object, for use in warning messages */ Pathname = AcpiNsGetExternalPathname (Node); if (!Pathname) @@ -248,30 +263,18 @@ AcpiNsCheckPredefinedNames ( if (!Predefined) { - goto Exit; - } - - /* If the method failed, we cannot validate the return object */ - - if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) - { - goto Exit; + goto Cleanup; } /* - * Only validate the return value on the first successful evaluation of - * the method. This ensures that any warnings will only be emitted during - * the very first evaluation of the method/object. + * If the method failed or did not actually return an object, we cannot + * validate the return object */ - if (Node->Flags & ANOBJ_EVALUATED) + if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) { - goto Exit; + goto Cleanup; } - /* Mark the node as having been successfully evaluated */ - - Node->Flags |= ANOBJ_EVALUATED; - /* * If there is no return value, check if we require a return value for * this predefined name. Either one return value is expected, or none, @@ -284,45 +287,68 @@ AcpiNsCheckPredefinedNames ( if ((Predefined->Info.ExpectedBtypes) && (!(Predefined->Info.ExpectedBtypes & ACPI_RTYPE_NONE))) { - ACPI_ERROR ((AE_INFO, - "%s: Missing expected return value", Pathname)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Missing expected return value")); Status = AE_AML_NO_RETURN_VALUE; } - goto Exit; + goto Cleanup; } /* * We have a return value, but if one wasn't expected, just exit, this is - * not a problem - * - * For example, if the "Implicit Return" feature is enabled, methods will - * always return a value + * not a problem. For example, if the "Implicit Return" feature is + * enabled, methods will always return a value. */ if (!Predefined->Info.ExpectedBtypes) { - goto Exit; + goto Cleanup; + } + + /* Create the parameter data block for object validation */ + + Data = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PREDEFINED_DATA)); + if (!Data) + { + goto Cleanup; } + Data->Predefined = Predefined; + Data->NodeFlags = Node->Flags; + Data->Pathname = Pathname; /* * Check that the type of the return object is what is expected for * this predefined name */ - Status = AcpiNsCheckObjectType (Pathname, ReturnObjectPtr, - Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE); + Status = AcpiNsCheckObjectType (Data, ReturnObjectPtr, + Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); if (ACPI_FAILURE (Status)) { - goto Exit; + goto CheckValidationStatus; } /* For returned Package objects, check the type of all sub-objects */ if (ReturnObject->Common.Type == ACPI_TYPE_PACKAGE) { - Status = AcpiNsCheckPackage (Pathname, ReturnObjectPtr, Predefined); + Status = AcpiNsCheckPackage (Data, ReturnObjectPtr); } -Exit: + +CheckValidationStatus: + /* + * If the object validation failed or if we successfully repaired one + * or more objects, mark the parent node to suppress further warning + * messages during the next evaluation of the same method/object. + */ + if (ACPI_FAILURE (Status) || (Data->Flags & ACPI_OBJECT_REPAIRED)) + { + Node->Flags |= ANOBJ_EVALUATED; + } + ACPI_FREE (Data); + + +Cleanup: ACPI_FREE (Pathname); return (Status); } @@ -365,11 +391,11 @@ AcpiNsCheckParameterCount ( ParamCount = Node->Object->Method.ParamCount; } - /* Argument count check for non-predefined methods/objects */ - if (!Predefined) { /* + * Check the parameter count for non-predefined methods/objects. + * * Warning if too few or too many arguments have been passed by the * caller. An incorrect number of arguments may not cause the method * to fail. However, the method will fail if there are too few @@ -377,58 +403,49 @@ AcpiNsCheckParameterCount ( */ if (UserParamCount < ParamCount) { - ACPI_WARNING ((AE_INFO, - "%s: Insufficient arguments - needs %d, found %d", - Pathname, ParamCount, UserParamCount)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Insufficient arguments - needs %u, found %u", + ParamCount, UserParamCount)); } else if (UserParamCount > ParamCount) { - ACPI_WARNING ((AE_INFO, - "%s: Excess arguments - needs %d, found %d", - Pathname, ParamCount, UserParamCount)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Excess arguments - needs %u, found %u", + ParamCount, UserParamCount)); } return; } - /* Allow two different legal argument counts (_SCP, etc.) */ - + /* + * Validate the user-supplied parameter count. + * Allow two different legal argument counts (_SCP, etc.) + */ RequiredParamsCurrent = Predefined->Info.ParamCount & 0x0F; RequiredParamsOld = Predefined->Info.ParamCount >> 4; if (UserParamCount != ACPI_UINT32_MAX) { - /* Validate the user-supplied parameter count */ - if ((UserParamCount != RequiredParamsCurrent) && (UserParamCount != RequiredParamsOld)) { - ACPI_WARNING ((AE_INFO, - "%s: Parameter count mismatch - " - "caller passed %d, ACPI requires %d", - Pathname, UserParamCount, RequiredParamsCurrent)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Parameter count mismatch - " + "caller passed %u, ACPI requires %u", + UserParamCount, RequiredParamsCurrent)); } } /* - * Only validate the argument count on the first successful evaluation of - * the method. This ensures that any warnings will only be emitted during - * the very first evaluation of the method/object. - */ - if (Node->Flags & ANOBJ_EVALUATED) - { - return; - } - - /* * Check that the ASL-defined parameter count is what is expected for - * this predefined name. + * this predefined name (parameter count as defined by the ACPI + * specification) */ if ((ParamCount != RequiredParamsCurrent) && (ParamCount != RequiredParamsOld)) { - ACPI_WARNING ((AE_INFO, - "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d", - Pathname, ParamCount, RequiredParamsCurrent)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, Node->Flags, + "Parameter count mismatch - ASL declared %u, ACPI requires %u", + ParamCount, RequiredParamsCurrent)); } } @@ -466,8 +483,6 @@ AcpiNsCheckForPredefinedName ( { if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Info.Name)) { - /* Return pointer to this table entry */ - return (ThisName); } @@ -483,7 +498,7 @@ AcpiNsCheckForPredefinedName ( ThisName++; } - return (NULL); + return (NULL); /* Not found */ } @@ -491,10 +506,9 @@ AcpiNsCheckForPredefinedName ( * * FUNCTION: AcpiNsCheckPackage * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object - * Predefined - Pointer to entry in predefined name table * * RETURN: Status * @@ -505,9 +519,8 @@ AcpiNsCheckForPredefinedName ( static ACPI_STATUS AcpiNsCheckPackage ( - char *Pathname, - ACPI_OPERAND_OBJECT **ReturnObjectPtr, - const ACPI_PREDEFINED_INFO *Predefined) + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; const ACPI_PREDEFINED_INFO *Package; @@ -526,11 +539,11 @@ AcpiNsCheckPackage ( /* The package info for this name is in the next table entry */ - Package = Predefined + 1; + Package = Data->Predefined + 1; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s Validating return Package of Type %X, Count %X\n", - Pathname, Package->RetInfo.Type, ReturnObject->Package.Count)); + Data->Pathname, Package->RetInfo.Type, ReturnObject->Package.Count)); /* Extract package count and elements array */ @@ -541,8 +554,8 @@ AcpiNsCheckPackage ( if (!Count) { - ACPI_WARNING ((AE_INFO, - "%s: Return Package has no elements (empty)", Pathname)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Package has no elements (empty)")); return (AE_AML_OPERAND_VALUE); } @@ -570,14 +583,14 @@ AcpiNsCheckPackage ( } else if (Count > ExpectedCount) { - ACPI_WARNING ((AE_INFO, - "%s: Return Package is larger than needed - " - "found %u, expected %u", Pathname, Count, ExpectedCount)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Package is larger than needed - " + "found %u, expected %u", Count, ExpectedCount)); } /* Validate all elements of the returned package */ - Status = AcpiNsCheckPackageElements (Pathname, Elements, + Status = AcpiNsCheckPackageElements (Data, Elements, Package->RetInfo.ObjectType1, Package->RetInfo.Count1, Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); if (ACPI_FAILURE (Status)) @@ -595,7 +608,7 @@ AcpiNsCheckPackage ( */ for (i = 0; i < Count; i++) { - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { @@ -629,7 +642,7 @@ AcpiNsCheckPackage ( { /* These are the required package elements (0, 1, or 2) */ - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { @@ -640,7 +653,7 @@ AcpiNsCheckPackage ( { /* These are the optional package elements */ - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { @@ -656,7 +669,7 @@ AcpiNsCheckPackage ( /* First element is the (Integer) count of sub-packages to follow */ - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { @@ -697,7 +710,7 @@ AcpiNsCheckPackage ( /* Each sub-object must be of type Package */ - Status = AcpiNsCheckObjectType (Pathname, &SubPackage, + Status = AcpiNsCheckObjectType (Data, &SubPackage, ACPI_RTYPE_PACKAGE, i); if (ACPI_FAILURE (Status)) { @@ -721,7 +734,7 @@ AcpiNsCheckPackage ( goto PackageTooSmall; } - Status = AcpiNsCheckPackageElements (Pathname, SubElements, + Status = AcpiNsCheckPackageElements (Data, SubElements, Package->RetInfo.ObjectType1, Package->RetInfo.Count1, Package->RetInfo.ObjectType2, @@ -747,7 +760,7 @@ AcpiNsCheckPackage ( for (j = 0; j < ExpectedCount; j++) { - Status = AcpiNsCheckObjectType (Pathname, &SubElements[j], + Status = AcpiNsCheckObjectType (Data, &SubElements[j], Package->RetInfo2.ObjectType[j], j); if (ACPI_FAILURE (Status)) { @@ -769,7 +782,7 @@ AcpiNsCheckPackage ( /* Check the type of each sub-package element */ - Status = AcpiNsCheckPackageElements (Pathname, SubElements, + Status = AcpiNsCheckPackageElements (Data, SubElements, Package->RetInfo.ObjectType1, SubPackage->Package.Count, 0, 0, 0); if (ACPI_FAILURE (Status)) @@ -782,7 +795,7 @@ AcpiNsCheckPackage ( /* First element is the (Integer) count of elements to follow */ - Status = AcpiNsCheckObjectType (Pathname, SubElements, + Status = AcpiNsCheckObjectType (Data, SubElements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { @@ -800,8 +813,7 @@ AcpiNsCheckPackage ( /* Check the type of each sub-package element */ - Status = AcpiNsCheckPackageElements (Pathname, - (SubElements + 1), + Status = AcpiNsCheckPackageElements (Data, (SubElements + 1), Package->RetInfo.ObjectType1, (ExpectedCount - 1), 0, 0, 1); if (ACPI_FAILURE (Status)) @@ -823,9 +835,9 @@ AcpiNsCheckPackage ( /* Should not get here if predefined info table is correct */ - ACPI_WARNING ((AE_INFO, - "%s: Invalid internal return type in table entry: %X", - Pathname, Package->RetInfo.Type)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Invalid internal return type in table entry: %X", + Package->RetInfo.Type)); return (AE_AML_INTERNAL); } @@ -837,8 +849,9 @@ PackageTooSmall: /* Error exit for the case with an incorrect package count */ - ACPI_WARNING ((AE_INFO, "%s: Return Package is too small - " - "found %u, expected %u", Pathname, Count, ExpectedCount)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Package is too small - found %u, expected %u", + Count, ExpectedCount)); return (AE_AML_OPERAND_VALUE); } @@ -848,7 +861,7 @@ PackageTooSmall: * * FUNCTION: AcpiNsCheckPackageElements * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * Elements - Pointer to the package elements array * Type1 - Object type for first group * Count1 - Count for first group @@ -865,7 +878,7 @@ PackageTooSmall: static ACPI_STATUS AcpiNsCheckPackageElements ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, @@ -885,7 +898,7 @@ AcpiNsCheckPackageElements ( */ for (i = 0; i < Count1; i++) { - Status = AcpiNsCheckObjectType (Pathname, ThisElement, + Status = AcpiNsCheckObjectType (Data, ThisElement, Type1, i + StartIndex); if (ACPI_FAILURE (Status)) { @@ -896,7 +909,7 @@ AcpiNsCheckPackageElements ( for (i = 0; i < Count2; i++) { - Status = AcpiNsCheckObjectType (Pathname, ThisElement, + Status = AcpiNsCheckObjectType (Data, ThisElement, Type2, (i + Count1 + StartIndex)); if (ACPI_FAILURE (Status)) { @@ -913,12 +926,13 @@ AcpiNsCheckPackageElements ( * * FUNCTION: AcpiNsCheckObjectType * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * ExpectedBtypes - Bitmap of expected return type(s) * PackageIndex - Index of object within parent package (if - * applicable - ACPI_NOT_PACKAGE otherwise) + * applicable - ACPI_NOT_PACKAGE_ELEMENT + * otherwise) * * RETURN: Status * @@ -929,7 +943,7 @@ AcpiNsCheckPackageElements ( static ACPI_STATUS AcpiNsCheckObjectType ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex) @@ -938,9 +952,6 @@ AcpiNsCheckObjectType ( ACPI_STATUS Status = AE_OK; UINT32 ReturnBtype; char TypeBuffer[48]; /* Room for 5 types */ - UINT32 ThisRtype; - UINT32 i; - UINT32 j; /* @@ -956,9 +967,9 @@ AcpiNsCheckObjectType ( if (ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED) { - ACPI_WARNING ((AE_INFO, - "%s: Invalid return type - Found a Namespace node [%4.4s] type %s", - Pathname, ReturnObject->Node.Name.Ascii, + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Invalid return type - Found a Namespace node [%4.4s] type %s", + ReturnObject->Node.Name.Ascii, AcpiUtGetTypeName (ReturnObject->Node.Type))); return (AE_AML_OPERAND_TYPE); } @@ -1005,11 +1016,11 @@ AcpiNsCheckObjectType ( { /* Type mismatch -- attempt repair of the returned object */ - Status = AcpiNsRepairObject (ExpectedBtypes, PackageIndex, - ReturnObjectPtr); + Status = AcpiNsRepairObject (Data, ExpectedBtypes, + PackageIndex, ReturnObjectPtr); if (ACPI_SUCCESS (Status)) { - return (Status); + return (AE_OK); /* Repair was successful */ } goto TypeErrorExit; } @@ -1018,7 +1029,7 @@ AcpiNsCheckObjectType ( if (ReturnObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) { - Status = AcpiNsCheckReference (Pathname, ReturnObject); + Status = AcpiNsCheckReference (Data, ReturnObject); } return (Status); @@ -1028,33 +1039,19 @@ TypeErrorExit: /* Create a string with all expected types for this predefined object */ - j = 1; - TypeBuffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; + AcpiNsGetExpectedTypes (TypeBuffer, ExpectedBtypes); - for (i = 0; i < ACPI_NUM_RTYPES; i++) + if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - ACPI_STRCAT (TypeBuffer, &AcpiRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - ThisRtype <<= 1; /* Next Rtype */ - } - - if (PackageIndex == ACPI_NOT_PACKAGE) - { - ACPI_WARNING ((AE_INFO, - "%s: Return type mismatch - found %s, expected %s", - Pathname, AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return type mismatch - found %s, expected %s", + AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); } else { - ACPI_WARNING ((AE_INFO, - "%s: Return Package type mismatch at index %u - " - "found %s, expected %s", Pathname, PackageIndex, + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Package type mismatch at index %u - " + "found %s, expected %s", PackageIndex, AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); } @@ -1066,7 +1063,7 @@ TypeErrorExit: * * FUNCTION: AcpiNsCheckReference * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * ReturnObject - Object returned from the evaluation of a * method or object * @@ -1080,7 +1077,7 @@ TypeErrorExit: static ACPI_STATUS AcpiNsCheckReference ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT *ReturnObject) { @@ -1094,10 +1091,9 @@ AcpiNsCheckReference ( return (AE_OK); } - ACPI_WARNING ((AE_INFO, - "%s: Return type mismatch - " - "unexpected reference object type [%s] %2.2X", - Pathname, AcpiUtGetReferenceName (ReturnObject), + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return type mismatch - unexpected reference object type [%s] %2.2X", + AcpiUtGetReferenceName (ReturnObject), ReturnObject->Reference.Class)); return (AE_AML_OPERAND_TYPE); @@ -1108,8 +1104,11 @@ AcpiNsCheckReference ( * * FUNCTION: AcpiNsRepairObject * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * PackageIndex - Used to determine if target is in a package + * PARAMETERS: Data - Pointer to validation data structure + * ExpectedBtypes - Object types expected + * PackageIndex - Index of object within parent package (if + * applicable - ACPI_NOT_PACKAGE_ELEMENT + * otherwise) * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -1122,6 +1121,7 @@ AcpiNsCheckReference ( static ACPI_STATUS AcpiNsRepairObject ( + ACPI_PREDEFINED_DATA *Data, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr) @@ -1135,6 +1135,8 @@ AcpiNsRepairObject ( { case ACPI_TYPE_BUFFER: + /* Does the method/object legally return a string? */ + if (!(ExpectedBtypes & ACPI_RTYPE_STRING)) { return (AE_AML_OPERAND_TYPE); @@ -1168,23 +1170,37 @@ AcpiNsRepairObject ( ACPI_MEMCPY (NewObject->String.Pointer, ReturnObject->Buffer.Pointer, Length); - /* Install the new return object */ - - AcpiUtRemoveReference (ReturnObject); - *ReturnObjectPtr = NewObject; - /* - * If the object is a package element, we need to: - * 1. Decrement the reference count of the orignal object, it was - * incremented when building the package - * 2. Increment the reference count of the new object, it will be - * decremented when releasing the package + * If the original object is a package element, we need to: + * 1. Set the reference count of the new object to match the + * reference count of the old object. + * 2. Decrement the reference count of the original object. */ - if (PackageIndex != ACPI_NOT_PACKAGE) + if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT) { - AcpiUtRemoveReference (ReturnObject); - AcpiUtAddReference (NewObject); + NewObject->Common.ReferenceCount = + ReturnObject->Common.ReferenceCount; + + if (ReturnObject->Common.ReferenceCount > 1) + { + ReturnObject->Common.ReferenceCount--; + } + + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Converted Buffer to expected String at index %u", + PackageIndex)); + } + else + { + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Converted Buffer to expected String")); } + + /* Delete old object, install the new return object */ + + AcpiUtRemoveReference (ReturnObject); + *ReturnObjectPtr = NewObject; + Data->Flags |= ACPI_OBJECT_REPAIRED; return (AE_OK); default: @@ -1194,3 +1210,44 @@ AcpiNsRepairObject ( return (AE_AML_OPERAND_TYPE); } + +/******************************************************************************* + * + * FUNCTION: AcpiNsGetExpectedTypes + * + * PARAMETERS: Buffer - Pointer to where the string is returned + * ExpectedBtypes - Bitmap of expected return type(s) + * + * RETURN: Buffer is populated with type names. + * + * DESCRIPTION: Translate the expected types bitmap into a string of ascii + * names of expected types, for use in warning messages. + * + ******************************************************************************/ + +static void +AcpiNsGetExpectedTypes ( + char *Buffer, + UINT32 ExpectedBtypes) +{ + UINT32 ThisRtype; + UINT32 i; + UINT32 j; + + + j = 1; + Buffer[0] = 0; + ThisRtype = ACPI_RTYPE_INTEGER; + + for (i = 0; i < ACPI_NUM_RTYPES; i++) + { + /* If one of the expected types, concatenate the name of this type */ + + if (ExpectedBtypes & ThisRtype) + { + ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); + j = 0; /* Use name separator from now on */ + } + ThisRtype <<= 1; /* Next Rtype */ + } +} diff --git a/namespace/nsxfeval.c b/namespace/nsxfeval.c index c0d877839c3e..c2a5dbb6f175 100644 --- a/namespace/nsxfeval.c +++ b/namespace/nsxfeval.c @@ -658,10 +658,11 @@ AcpiNsGetDeviceCallback ( ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; UINT32 Flags; - ACPI_DEVICE_ID Hid; - ACPI_COMPATIBLE_ID_LIST *Cid; + ACPI_DEVICE_ID *Hid; + ACPI_DEVICE_ID_LIST *Cid; UINT32 i; BOOLEAN Found; + int Match; Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); @@ -715,7 +716,10 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - if (ACPI_STRNCMP (Hid.Value, Info->Hid, sizeof (Hid.Value)) != 0) + Match = ACPI_STRCMP (Hid->String, Info->Hid); + ACPI_FREE (Hid); + + if (!Match) { /* * HID does not match, attempt match within the @@ -736,8 +740,7 @@ AcpiNsGetDeviceCallback ( Found = FALSE; for (i = 0; i < Cid->Count; i++) { - if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid, - sizeof (ACPI_COMPATIBLE_ID)) == 0) + if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0) { /* Found a matching CID */ diff --git a/namespace/nsxfname.c b/namespace/nsxfname.c index 49ccb58092fa..166862bc2a9c 100644 --- a/namespace/nsxfname.c +++ b/namespace/nsxfname.c @@ -126,6 +126,14 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsxfname") +/* Local prototypes */ + +static char * +AcpiNsCopyDeviceId ( + ACPI_DEVICE_ID *Dest, + ACPI_DEVICE_ID *Source, + char *StringArea); + /****************************************************************************** * @@ -308,10 +316,42 @@ ACPI_EXPORT_SYMBOL (AcpiGetName) /****************************************************************************** * + * FUNCTION: AcpiNsCopyDeviceId + * + * PARAMETERS: Dest - Pointer to the destination DEVICE_ID + * Source - Pointer to the source DEVICE_ID + * StringArea - Pointer to where to copy the dest string + * + * RETURN: Pointer to the next string area + * + * DESCRIPTION: Copy a single DEVICE_ID, including the string data. + * + ******************************************************************************/ + +static char * +AcpiNsCopyDeviceId ( + ACPI_DEVICE_ID *Dest, + ACPI_DEVICE_ID *Source, + char *StringArea) +{ + /* Create the destination DEVICE_ID */ + + Dest->String = StringArea; + Dest->Length = Source->Length; + + /* Copy actual string and return a pointer to the next string area */ + + ACPI_MEMCPY (StringArea, Source->String, Source->Length); + return (StringArea + Source->Length); +} + + +/****************************************************************************** + * * FUNCTION: AcpiGetObjectInfo * - * PARAMETERS: Handle - Object Handle - * Buffer - Where the info is returned + * PARAMETERS: Handle - Object Handle + * ReturnBuffer - Where the info is returned * * RETURN: Status * @@ -319,40 +359,40 @@ ACPI_EXPORT_SYMBOL (AcpiGetName) * namespace node and possibly by running several standard * control methods (Such as in the case of a device.) * + * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, + * _ADR, _SxW, and _SxD methods. + * + * Note: Allocates the return buffer, must be freed by the caller. + * ******************************************************************************/ ACPI_STATUS AcpiGetObjectInfo ( ACPI_HANDLE Handle, - ACPI_BUFFER *Buffer) + ACPI_DEVICE_INFO **ReturnBuffer) { - ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; ACPI_DEVICE_INFO *Info; - ACPI_DEVICE_INFO *ReturnInfo; - ACPI_COMPATIBLE_ID_LIST *CidList = NULL; - ACPI_SIZE Size; + ACPI_DEVICE_ID_LIST *CidList = NULL; + ACPI_DEVICE_ID *Hid = NULL; + ACPI_DEVICE_ID *Uid = NULL; + char *NextIdString; + ACPI_OBJECT_TYPE Type; + ACPI_NAME Name; + UINT8 ParamCount= 0; + UINT8 Valid = 0; + UINT32 InfoSize; + UINT32 i; + ACPI_STATUS Status; /* Parameter validation */ - if (!Handle || !Buffer) + if (!Handle || !ReturnBuffer) { return (AE_BAD_PARAMETER); } - Status = AcpiUtValidateBuffer (Buffer); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_INFO)); - if (!Info) - { - return (AE_NO_MEMORY); - } - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { @@ -363,56 +403,54 @@ AcpiGetObjectInfo ( if (!Node) { (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - Status = AE_BAD_PARAMETER; - goto Cleanup; + return (AE_BAD_PARAMETER); } - /* Init return structure */ - - Size = sizeof (ACPI_DEVICE_INFO); + /* Get the namespace node data while the namespace is locked */ - Info->Type = Node->Type; - Info->Name = Node->Name.Integer; - Info->Valid = 0; + InfoSize = sizeof (ACPI_DEVICE_INFO); + Type = Node->Type; + Name = Node->Name.Integer; if (Node->Type == ACPI_TYPE_METHOD) { - Info->ParamCount = Node->Object->Method.ParamCount; + ParamCount = Node->Object->Method.ParamCount; } Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - goto Cleanup; + return (Status); } - /* If not a device, we are all done */ - - if (Info->Type == ACPI_TYPE_DEVICE) + if ((Type == ACPI_TYPE_DEVICE) || + (Type == ACPI_TYPE_PROCESSOR)) { /* - * Get extra info for ACPI Devices objects only: - * Run the Device _HID, _UID, _CID, _STA, _ADR and _SxD methods. + * Get extra info for ACPI Device/Processor objects only: + * Run the Device _HID, _UID, and _CID methods. * * Note: none of these methods are required, so they may or may - * not be present for this device. The Info->Valid bitfield is used - * to indicate which methods were found and ran successfully. + * not be present for this device. The Info->Valid bitfield is used + * to indicate which methods were found and run successfully. */ /* Execute the Device._HID method */ - Status = AcpiUtExecute_HID (Node, &Info->HardwareId); + Status = AcpiUtExecute_HID (Node, &Hid); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_HID; + InfoSize += Hid->Length; + Valid |= ACPI_VALID_HID; } /* Execute the Device._UID method */ - Status = AcpiUtExecute_UID (Node, &Info->UniqueId); + Status = AcpiUtExecute_UID (Node, &Uid); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_UID; + InfoSize += Uid->Length; + Valid |= ACPI_VALID_UID; } /* Execute the Device._CID method */ @@ -420,57 +458,151 @@ AcpiGetObjectInfo ( Status = AcpiUtExecute_CID (Node, &CidList); if (ACPI_SUCCESS (Status)) { - Size += CidList->Size; - Info->Valid |= ACPI_VALID_CID; + /* Add size of CID strings and CID pointer array */ + + InfoSize += (CidList->ListSize - sizeof (ACPI_DEVICE_ID_LIST)); + Valid |= ACPI_VALID_CID; } + } + + /* + * Now that we have the variable-length data, we can allocate the + * return buffer + */ + Info = ACPI_ALLOCATE_ZEROED (InfoSize); + if (!Info) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Get the fixed-length data */ + + if ((Type == ACPI_TYPE_DEVICE) || + (Type == ACPI_TYPE_PROCESSOR)) + { + /* + * Get extra info for ACPI Device/Processor objects only: + * Run the _STA, _ADR and, SxW, and _SxD methods. + * + * Note: none of these methods are required, so they may or may + * not be present for this device. The Info->Valid bitfield is used + * to indicate which methods were found and run successfully. + */ /* Execute the Device._STA method */ Status = AcpiUtExecute_STA (Node, &Info->CurrentStatus); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_STA; + Valid |= ACPI_VALID_STA; } /* Execute the Device._ADR method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, - &Info->Address); + &Info->Address); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_ADR; + Valid |= ACPI_VALID_ADR; + } + + /* Execute the Device._SxW methods */ + + Status = AcpiUtExecutePowerMethods (Node, + AcpiGbl_LowestDstateNames, ACPI_NUM_SxW_METHODS, + Info->LowestDstates); + if (ACPI_SUCCESS (Status)) + { + Valid |= ACPI_VALID_SXWS; } /* Execute the Device._SxD methods */ - Status = AcpiUtExecute_Sxds (Node, Info->HighestDstates); + Status = AcpiUtExecutePowerMethods (Node, + AcpiGbl_HighestDstateNames, ACPI_NUM_SxD_METHODS, + Info->HighestDstates); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_SXDS; + Valid |= ACPI_VALID_SXDS; } } - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (Buffer, Size); - if (ACPI_FAILURE (Status)) + /* + * Create a pointer to the string area of the return buffer. + * Point to the end of the base ACPI_DEVICE_INFO structure. + */ + NextIdString = ACPI_CAST_PTR (char, Info->CompatibleIdList.Ids); + if (CidList) { - goto Cleanup; + /* Point past the CID DEVICE_ID array */ + + NextIdString += ((ACPI_SIZE) CidList->Count * sizeof (ACPI_DEVICE_ID)); } - /* Populate the return buffer */ + /* + * Copy the HID, UID, and CIDs to the return buffer. The variable-length + * strings are copied to the reserved area at the end of the buffer. + * + * For HID and CID, check if the ID is a PCI Root Bridge. + */ + if (Hid) + { + NextIdString = AcpiNsCopyDeviceId (&Info->HardwareId, + Hid, NextIdString); + + if (AcpiUtIsPciRootBridge (Hid->String)) + { + Info->Flags |= ACPI_PCI_ROOT_BRIDGE; + } + } - ReturnInfo = Buffer->Pointer; - ACPI_MEMCPY (ReturnInfo, Info, sizeof (ACPI_DEVICE_INFO)); + if (Uid) + { + NextIdString = AcpiNsCopyDeviceId (&Info->UniqueId, + Uid, NextIdString); + } if (CidList) { - ACPI_MEMCPY (&ReturnInfo->CompatibilityId, CidList, CidList->Size); + Info->CompatibleIdList.Count = CidList->Count; + Info->CompatibleIdList.ListSize = CidList->ListSize; + + /* Copy each CID */ + + for (i = 0; i < CidList->Count; i++) + { + NextIdString = AcpiNsCopyDeviceId (&Info->CompatibleIdList.Ids[i], + &CidList->Ids[i], NextIdString); + + if (AcpiUtIsPciRootBridge (CidList->Ids[i].String)) + { + Info->Flags |= ACPI_PCI_ROOT_BRIDGE; + } + } } + /* Copy the fixed-length data */ + + Info->InfoSize = InfoSize; + Info->Type = Type; + Info->Name = Name; + Info->ParamCount = ParamCount; + Info->Valid = Valid; + + *ReturnBuffer = Info; + Status = AE_OK; + Cleanup: - ACPI_FREE (Info); + if (Hid) + { + ACPI_FREE (Hid); + } + if (Uid) + { + ACPI_FREE (Uid); + } if (CidList) { ACPI_FREE (CidList); diff --git a/tables/tbutils.c b/tables/tbutils.c index f4803a2e7627..ec2a88e283d3 100644 --- a/tables/tbutils.c +++ b/tables/tbutils.c @@ -124,6 +124,16 @@ /* Local prototypes */ +static void +AcpiTbFixString ( + char *String, + ACPI_SIZE Length); + +static void +AcpiTbCleanupTableHeader ( + ACPI_TABLE_HEADER *OutHeader, + ACPI_TABLE_HEADER *Header); + static ACPI_PHYSICAL_ADDRESS AcpiTbGetRootTableEntry ( UINT8 *TableEntry, @@ -185,6 +195,67 @@ AcpiTbTablesLoaded ( /******************************************************************************* * + * FUNCTION: AcpiTbFixString + * + * PARAMETERS: String - String to be repaired + * Length - Maximum length + * + * RETURN: None + * + * DESCRIPTION: Replace every non-printable or non-ascii byte in the string + * with a question mark '?'. + * + ******************************************************************************/ + +static void +AcpiTbFixString ( + char *String, + ACPI_SIZE Length) +{ + + while (Length && *String) + { + if (!ACPI_IS_PRINT (*String)) + { + *String = '?'; + } + String++; + Length--; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbCleanupTableHeader + * + * PARAMETERS: OutHeader - Where the cleaned header is returned + * Header - Input ACPI table header + * + * RETURN: Returns the cleaned header in OutHeader + * + * DESCRIPTION: Copy the table header and ensure that all "string" fields in + * the header consist of printable characters. + * + ******************************************************************************/ + +static void +AcpiTbCleanupTableHeader ( + ACPI_TABLE_HEADER *OutHeader, + ACPI_TABLE_HEADER *Header) +{ + + ACPI_MEMCPY (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); + + AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE); + AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE); + AcpiTbFixString (OutHeader->OemTableId, ACPI_OEM_TABLE_ID_SIZE); + AcpiTbFixString (OutHeader->AslCompilerId, ACPI_NAME_SIZE); +} + + +/******************************************************************************* + * * FUNCTION: AcpiTbPrintTableHeader * * PARAMETERS: Address - Table physical address @@ -201,6 +272,8 @@ AcpiTbPrintTableHeader ( ACPI_PHYSICAL_ADDRESS Address, ACPI_TABLE_HEADER *Header) { + ACPI_TABLE_HEADER LocalHeader; + /* * The reason that the Address is cast to a void pointer is so that we @@ -218,23 +291,29 @@ AcpiTbPrintTableHeader ( { /* RSDP has no common fields */ + ACPI_MEMCPY (LocalHeader.OemId, + ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE); + AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); + ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", ACPI_CAST_PTR (void, Address), (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ? ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20, ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision, - ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId)); + LocalHeader.OemId)); } else { /* Standard ACPI table with full common header */ + AcpiTbCleanupTableHeader (&LocalHeader, Header); + ACPI_INFO ((AE_INFO, "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", - Header->Signature, ACPI_CAST_PTR (void, Address), - Header->Length, Header->Revision, Header->OemId, - Header->OemTableId, Header->OemRevision, Header->AslCompilerId, - Header->AslCompilerRevision)); + LocalHeader.Signature, ACPI_CAST_PTR (void, Address), + LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId, + LocalHeader.OemTableId, LocalHeader.OemRevision, + LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); } } diff --git a/tools/acpiexec/Makefile b/tools/acpiexec/Makefile index a8ec4d00f43f..515c9d3b831a 100644 --- a/tools/acpiexec/Makefile +++ b/tools/acpiexec/Makefile @@ -120,6 +120,7 @@ SRCS= aetables.c aehandlers.c aeexec.c aemain.c \ ../../utilities/utdelete.c \ ../../utilities/uteval.c \ ../../utilities/utglobal.c \ + ../../utilities/utids.c \ ../../utilities/utinit.c \ ../../utilities/utlock.c \ ../../utilities/utmath.c \ diff --git a/tools/acpiexec/aeexec.c b/tools/acpiexec/aeexec.c index 798e841689af..d945cc359fa4 100644 --- a/tools/acpiexec/aeexec.c +++ b/tools/acpiexec/aeexec.c @@ -152,6 +152,10 @@ void AeHardwareInterfaces ( void); +void +AeGenericRegisters ( + void); + extern unsigned char Ssdt3Code[]; @@ -437,6 +441,41 @@ ExecuteOSI ( /****************************************************************************** * + * FUNCTION: AeGenericRegisters + * + * DESCRIPTION: Call the AcpiRead/Write interfaces. + * + *****************************************************************************/ + +ACPI_GENERIC_ADDRESS GenericRegister; + +void +AeGenericRegisters ( + void) +{ + ACPI_STATUS Status; + UINT64 Value; + + + GenericRegister.Address = 0x1234; + GenericRegister.BitWidth = 64; + GenericRegister.BitOffset = 0; + GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; + + Status = AcpiRead (&Value, &GenericRegister); + Status = AcpiWrite (Value, &GenericRegister); + + GenericRegister.Address = 0x12345678; + GenericRegister.BitOffset = 0; + GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY; + + Status = AcpiRead (&Value, &GenericRegister); + Status = AcpiWrite (Value, &GenericRegister); +} + + +/****************************************************************************** + * * FUNCTION: AeHardwareInterfaces * * DESCRIPTION: Call various hardware support interfaces @@ -487,6 +526,7 @@ AeMiscellaneousTests ( AeHardwareInterfaces (); + AeGenericRegisters (); AeSetupConfiguration (Ssdt3Code); AeTestBufferArgument(); diff --git a/tools/acpiexec/aehandlers.c b/tools/acpiexec/aehandlers.c index 47c95abae91d..a108fde02e06 100644 --- a/tools/acpiexec/aehandlers.c +++ b/tools/acpiexec/aehandlers.c @@ -153,6 +153,10 @@ AeRegionInit ( void *HandlerContext, void **RegionContext); +void +AeAttachedDataHandler ( + ACPI_HANDLE Object, + void *Data); UINT32 SigintCount = 0; AE_DEBUG_REGIONS AeRegions; @@ -446,8 +450,6 @@ UINT32 AeGpeHandler ( void *Context) { - - AcpiOsPrintf ("Received a GPE at handler\n"); return (0); } @@ -455,6 +457,28 @@ AeGpeHandler ( /****************************************************************************** * + * FUNCTION: AeAttachedDataHandler + * + * DESCRIPTION: Handler for deletion of nodes with attached data (attached via + * AcpiAttachData) + * + *****************************************************************************/ + +void +AeAttachedDataHandler ( + ACPI_HANDLE Object, + void *Data) +{ + ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); + + + AcpiOsPrintf ("Received an attached data deletion on %4.4s\n", + Node->Name.Ascii); +} + + +/****************************************************************************** + * * FUNCTION: AeRegionInit * * PARAMETERS: None @@ -493,8 +517,8 @@ AeRegionInit ( * *****************************************************************************/ -ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 4, 5, 6, 0x80}; -#define AEXEC_NUM_REGIONS 8 +ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 4, 5, 6, 7, 0x80}; +#define AEXEC_NUM_REGIONS 9 ACPI_STATUS AeInstallHandlers (void) @@ -569,6 +593,10 @@ AeInstallHandlers (void) printf ("Could not install a notify handler, %s\n", AcpiFormatException (Status)); } + + Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); + Status = AcpiDetachData (Handle, AeAttachedDataHandler); + Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); } else { @@ -630,7 +658,8 @@ AeRegionHandler ( void *RegionContext) { - ACPI_OPERAND_OBJECT *RegionObject = (ACPI_OPERAND_OBJECT*) RegionContext; + ACPI_OPERAND_OBJECT *RegionObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, RegionContext); + UINT8 *Buffer = ACPI_CAST_PTR (UINT8, Value); ACPI_PHYSICAL_ADDRESS BaseAddress; ACPI_SIZE Length; BOOLEAN BufferExists; @@ -681,8 +710,9 @@ AeRegionHandler ( AcpiUtGetRegionName (RegionObject->Region.SpaceId), (UINT32) Address)); - if (SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) + switch (SpaceId) { + case ACPI_ADR_SPACE_SYSTEM_IO: /* * For I/O space, exercise the port validation */ @@ -707,10 +737,11 @@ AeRegionHandler ( } /* Now go ahead and simulate the hardware */ - } + break; + + + case ACPI_ADR_SPACE_SMBUS: - else if (SpaceId == ACPI_ADR_SPACE_SMBUS) - { Length = 0; switch (Function & ACPI_IO_MASK) @@ -769,13 +800,37 @@ AeRegionHandler ( for (i = 0; i < Length; i++) { - ((UINT8 *) Value)[i+2] = (UINT8) (0xA0 + i); + Buffer[i+2] = (UINT8) (0xA0 + i); } - ((UINT8 *) Value)[0] = 0x7A; - ((UINT8 *) Value)[1] = (UINT8) Length; + Buffer[0] = 0x7A; + Buffer[1] = (UINT8) Length; + return (AE_OK); - return AE_OK; + + case ACPI_ADR_SPACE_IPMI: /* ACPI 4.0 */ + + AcpiOsPrintf ("AcpiExec: Received IPMI request: " + "Address %X BaseAddress %X Length %X Width %X BufferLength %u\n", + (UINT32) Address, (UINT32) BaseAddress, + Length, BitWidth, Buffer[1]); + + /* + * Regardless of a READ or WRITE, this handler is passed a 66-byte + * buffer in which to return the IPMI status/length/data. + * + * Return some example data to show use of the bidirectional buffer + */ + Buffer[0] = 0; /* Status byte */ + Buffer[1] = 64; /* Return buffer data length */ + Buffer[2] = 0; /* Completion code */ + Buffer[3] = 0x34; /* Power measurement */ + Buffer[4] = 0x12; /* Power measurement */ + Buffer[65] = 0xEE; /* last buffer byte */ + return (AE_OK); + + default: + break; } /* diff --git a/tools/acpisrc/astable.c b/tools/acpisrc/astable.c index b8135514694c..c5154093f00d 100644 --- a/tools/acpisrc/astable.c +++ b/tools/acpisrc/astable.c @@ -258,7 +258,6 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_COMMON_STATE", SRC_TYPE_STRUCT}, {"ACPI_COMMON_DESCRIPTOR", SRC_TYPE_STRUCT}, {"ACPI_COMPATIBLE_ID", SRC_TYPE_STRUCT}, - {"ACPI_COMPATIBLE_ID_LIST", SRC_TYPE_STRUCT}, {"ACPI_CONTROL_STATE", SRC_TYPE_STRUCT}, {"ACPI_CONVERSION_TABLE", SRC_TYPE_STRUCT}, {"ACPI_CPU_FLAGS", SRC_TYPE_SIMPLE}, @@ -269,6 +268,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_DEBUG_PRINT_INFO", SRC_TYPE_STRUCT}, {"ACPI_DESCRIPTOR", SRC_TYPE_UNION}, {"ACPI_DEVICE_ID", SRC_TYPE_STRUCT}, + {"ACPI_DEVICE_ID_LIST", SRC_TYPE_STRUCT}, {"ACPI_DEVICE_INFO", SRC_TYPE_STRUCT}, {"ACPI_DEVICE_WALK_INFO", SRC_TYPE_STRUCT}, {"ACPI_DMTABLE_DATA", SRC_TYPE_STRUCT}, @@ -386,6 +386,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_POINTER", SRC_TYPE_STRUCT}, {"ACPI_POINTERS", SRC_TYPE_UNION}, {"ACPI_PORT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_PREDEFINED_DATA", SRC_TYPE_STRUCT}, {"ACPI_PREDEFINED_INFO", SRC_TYPE_UNION}, {"ACPI_PREDEFINED_NAMES", SRC_TYPE_STRUCT}, {"ACPI_PSCOPE_STATE", SRC_TYPE_STRUCT}, diff --git a/utilities/uteval.c b/utilities/uteval.c index a75ef3caf6e0..b25cfe12ac81 100644 --- a/utilities/uteval.c +++ b/utilities/uteval.c @@ -118,32 +118,18 @@ #include "acpi.h" #include "accommon.h" #include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("uteval") -/* Local prototypes */ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source, - ACPI_SIZE MaxLength); - -static ACPI_STATUS -AcpiUtTranslateOneCid ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_COMPATIBLE_ID *OneCid); - /* * Strings supported by the _OSI predefined (internal) method. * * March 2009: Removed "Linux" as this host no longer wants to respond true * for this string. Basically, the only safe OS strings are windows-related - * and in many or most cases represent the only test path within the + * and in many or most cases represent the only test path within the * BIOS-provided ASL code. * * The second element of each entry is used to track the newest version of @@ -280,7 +266,7 @@ Exit: * RETURN: Status * * DESCRIPTION: Evaluates a namespace object and verifies the type of the - * return object. Common code that simplifies accessing objects + * return object. Common code that simplifies accessing objects * that have required return objects of fixed types. * * NOTE: Internal function, no parameter validation @@ -376,7 +362,7 @@ AcpiUtEvaluateObject ( (!ExpectedReturnBtypes)) { /* - * We received a return object, but one was not expected. This can + * We received a return object, but one was not expected. This can * happen frequently if the "implicit return" feature is enabled. * Just delete the return object and return AE_OK. */ @@ -419,12 +405,12 @@ Cleanup: * * PARAMETERS: ObjectName - Object name to be evaluated * DeviceNode - Node for the device - * Address - Where the value is returned + * Value - Where the value is returned * * RETURN: Status * * DESCRIPTION: Evaluates a numeric namespace object for a selected device - * and stores result in *Address. + * and stores result in *Value. * * NOTE: Internal function, no parameter validation * @@ -434,7 +420,7 @@ ACPI_STATUS AcpiUtEvaluateNumericObject ( char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_INTEGER *Address) + ACPI_INTEGER *Value) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -452,326 +438,7 @@ AcpiUtEvaluateNumericObject ( /* Get the returned Integer */ - *Address = ObjDesc->Integer.Value; - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIdString - * - * PARAMETERS: Destination - Where to copy the string - * Source - Source string - * MaxLength - Length of the destination buffer - * - * RETURN: None - * - * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. - * Performs removal of a leading asterisk if present -- workaround - * for a known issue on a bunch of machines. - * - ******************************************************************************/ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source, - ACPI_SIZE MaxLength) -{ - - /* - * Workaround for ID strings that have a leading asterisk. This construct - * is not allowed by the ACPI specification (ID strings must be - * alphanumeric), but enough existing machines have this embedded in their - * ID strings that the following code is useful. - */ - if (*Source == '*') - { - Source++; - } - - /* Do the actual copy */ - - ACPI_STRNCPY (Destination, Source, MaxLength); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_HID - * - * PARAMETERS: DeviceNode - Node for the device - * Hid - Where the HID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _HID control method that returns the hardware - * ID of the device. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_HID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Hid) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_HID); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric HID to string */ - - AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value); - } - else - { - /* Copy the String HID from the returned object */ - - AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer, - sizeof (Hid->Value)); - } - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTranslateOneCid - * - * PARAMETERS: ObjDesc - _CID object, must be integer or string - * OneCid - Where the CID string is returned - * - * RETURN: Status - * - * DESCRIPTION: Return a numeric or string _CID value as a string. - * (Compatible ID) - * - * NOTE: Assumes a maximum _CID string length of - * ACPI_MAX_CID_LENGTH. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtTranslateOneCid ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_COMPATIBLE_ID *OneCid) -{ - - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - /* Convert the Numeric CID to string */ - - AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value); - return (AE_OK); - - case ACPI_TYPE_STRING: - - if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH) - { - return (AE_AML_STRING_LIMIT); - } - - /* Copy the String CID from the returned object */ - - AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer, - ACPI_MAX_CID_LENGTH); - return (AE_OK); - - default: - - return (AE_TYPE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_CID - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnCidList - Where the CID list is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _CID control method that returns one or more - * compatible hardware IDs for the device. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_CID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_COMPATIBLE_ID_LIST **ReturnCidList) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - UINT32 Count; - UINT32 Size; - ACPI_COMPATIBLE_ID_LIST *CidList; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtExecute_CID); - - - /* Evaluate the _CID method for this device */ - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, - &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the number of _CIDs returned */ - - Count = 1; - if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - Count = ObjDesc->Package.Count; - } - - /* Allocate a worst-case buffer for the _CIDs */ - - Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) + - sizeof (ACPI_COMPATIBLE_ID_LIST)); - - CidList = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Size); - if (!CidList) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Init CID list */ - - CidList->Count = Count; - CidList->Size = Size; - - /* - * A _CID can return either a single compatible ID or a package of - * compatible IDs. Each compatible ID can be one of the following: - * 1) Integer (32 bit compressed EISA ID) or - * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") - */ - - /* The _CID object can be either a single CID or a package (list) of CIDs */ - - if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - /* Translate each package element */ - - for (i = 0; i < Count; i++) - { - Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i], - &CidList->Id[i]); - if (ACPI_FAILURE (Status)) - { - break; - } - } - } - else - { - /* Only one CID, translate to a string */ - - Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id); - } - - /* Cleanup on error */ - - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (CidList); - } - else - { - *ReturnCidList = CidList; - } - - /* On exit, we must delete the _CID return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_UID - * - * PARAMETERS: DeviceNode - Node for the device - * Uid - Where the UID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _UID control method that returns the hardware - * ID of the device. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_UID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Uid) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_UID); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric UID to string */ - - AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value); - } - else - { - /* Copy the String UID from the returned object */ - - AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer, - sizeof (Uid->Value)); - } + *Value = ObjDesc->Integer.Value; /* On exit, we must delete the return object */ @@ -838,63 +505,68 @@ AcpiUtExecute_STA ( /******************************************************************************* * - * FUNCTION: AcpiUtExecute_Sxds + * FUNCTION: AcpiUtExecutePowerMethods * * PARAMETERS: DeviceNode - Node for the device - * Flags - Where the status flags are returned + * MethodNames - Array of power method names + * MethodCount - Number of methods to execute + * OutValues - Where the power method values are returned * - * RETURN: Status + * RETURN: Status, OutValues * - * DESCRIPTION: Executes _STA for selected device and stores results in - * *Flags. + * DESCRIPTION: Executes the specified power methods for the device and returns + * the result(s). * * NOTE: Internal function, no parameter validation * ******************************************************************************/ ACPI_STATUS -AcpiUtExecute_Sxds ( +AcpiUtExecutePowerMethods ( ACPI_NAMESPACE_NODE *DeviceNode, - UINT8 *Highest) + const char **MethodNames, + UINT8 MethodCount, + UINT8 *OutValues) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; + ACPI_STATUS FinalStatus = AE_NOT_FOUND; UINT32 i; - ACPI_FUNCTION_TRACE (UtExecute_Sxds); + ACPI_FUNCTION_TRACE (UtExecutePowerMethods); - for (i = 0; i < 4; i++) + for (i = 0; i < MethodCount; i++) { - Highest[i] = 0xFF; + /* + * Execute the power method (_SxD or _SxW). The only allowable + * return type is an Integer. + */ Status = AcpiUtEvaluateObject (DeviceNode, - ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]), + ACPI_CAST_PTR (char, MethodNames[i]), ACPI_BTYPE_INTEGER, &ObjDesc); - if (ACPI_FAILURE (Status)) + if (ACPI_SUCCESS (Status)) { - if (Status != AE_NOT_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%s on Device %4.4s, %s\n", - ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]), - AcpiUtGetNodeName (DeviceNode), - AcpiFormatException (Status))); - - return_ACPI_STATUS (Status); - } - } - else - { - /* Extract the Dstate value */ - - Highest[i] = (UINT8) ObjDesc->Integer.Value; + OutValues[i] = (UINT8) ObjDesc->Integer.Value; /* Delete the return object */ AcpiUtRemoveReference (ObjDesc); + FinalStatus = AE_OK; /* At least one value is valid */ + continue; } + + OutValues[i] = ACPI_UINT8_MAX; + if (Status == AE_NOT_FOUND) + { + continue; /* Ignore if not found */ + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Failed %s on Device %4.4s, %s\n", + ACPI_CAST_PTR (char, MethodNames[i]), + AcpiUtGetNodeName (DeviceNode), AcpiFormatException (Status))); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (FinalStatus); } diff --git a/utilities/utglobal.c b/utilities/utglobal.c index c40a90013847..7b63b75110b9 100644 --- a/utilities/utglobal.c +++ b/utilities/utglobal.c @@ -172,7 +172,16 @@ const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] = "\\_S5_" }; -const char *AcpiGbl_HighestDstateNames[4] = +const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS] = +{ + "_S0W", + "_S1W", + "_S2W", + "_S3W", + "_S4W" +}; + +const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] = { "_S1D", "_S2D", @@ -398,6 +407,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = "SMBus", "SystemCMOS", "PCIBARTarget", + "IPMI", "DataTable" }; diff --git a/utilities/utids.c b/utilities/utids.c new file mode 100644 index 000000000000..766933050083 --- /dev/null +++ b/utilities/utids.c @@ -0,0 +1,497 @@ +/****************************************************************************** + * + * Module Name: utids - support for device IDs - HID, UID, CID + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTIDS_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utids") + +/* Local prototypes */ + +static void +AcpiUtCopyIdString ( + char *Destination, + char *Source); + + +/******************************************************************************* + * + * FUNCTION: AcpiUtCopyIdString + * + * PARAMETERS: Destination - Where to copy the string + * Source - Source string + * + * RETURN: None + * + * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. + * Performs removal of a leading asterisk if present -- workaround + * for a known issue on a bunch of machines. + * + ******************************************************************************/ + +static void +AcpiUtCopyIdString ( + char *Destination, + char *Source) +{ + + /* + * Workaround for ID strings that have a leading asterisk. This construct + * is not allowed by the ACPI specification (ID strings must be + * alphanumeric), but enough existing machines have this embedded in their + * ID strings that the following code is useful. + */ + if (*Source == '*') + { + Source++; + } + + /* Do the actual copy */ + + ACPI_STRCPY (Destination, Source); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_HID + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the string HID is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _HID control method that returns the hardware + * ID of the device. The HID is either an 32-bit encoded EISAID + * Integer or a String. A string is always returned. An EISAID + * is converted to a string. + * + * NOTE: Internal function, no parameter validation + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_HID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_DEVICE_ID *Hid; + UINT32 Length; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (UtExecute_HID); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + Length = ACPI_EISAID_STRING_SIZE; + } + else + { + Length = ObjDesc->String.Length + 1; + } + + /* Allocate a buffer for the HID */ + + Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Hid) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after DEVICE_ID struct */ + + Hid->String = ACPI_ADD_PTR (char, Hid, sizeof (ACPI_DEVICE_ID)); + + /* Convert EISAID to a string or simply copy existing string */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + AcpiExEisaIdToString (Hid->String, ObjDesc->Integer.Value); + } + else + { + AcpiUtCopyIdString (Hid->String, ObjDesc->String.Pointer); + } + + Hid->Length = Length; + *ReturnId = Hid; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_UID + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the string UID is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _UID control method that returns the unique + * ID of the device. The UID is either a 64-bit Integer (NOT an + * EISAID) or a string. Always returns a string. A 64-bit integer + * is converted to a decimal string. + * + * NOTE: Internal function, no parameter validation + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_UID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_DEVICE_ID *Uid; + UINT32 Length; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (UtExecute_UID); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + Length = ACPI_MAX64_DECIMAL_DIGITS + 1; + } + else + { + Length = ObjDesc->String.Length + 1; + } + + /* Allocate a buffer for the UID */ + + Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Uid) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after DEVICE_ID struct */ + + Uid->String = ACPI_ADD_PTR (char, Uid, sizeof (ACPI_DEVICE_ID)); + + /* Convert an Integer to string, or just copy an existing string */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + AcpiExIntegerToString (Uid->String, ObjDesc->Integer.Value); + } + else + { + AcpiUtCopyIdString (Uid->String, ObjDesc->String.Pointer); + } + + Uid->Length = Length; + *ReturnId = Uid; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_CID + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnCidList - Where the CID list is returned + * + * RETURN: Status, list of CID strings + * + * DESCRIPTION: Executes the _CID control method that returns one or more + * compatible hardware IDs for the device. + * + * NOTE: Internal function, no parameter validation + * + * A _CID method can return either a single compatible ID or a package of + * compatible IDs. Each compatible ID can be one of the following: + * 1) Integer (32 bit compressed EISA ID) or + * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") + * + * The Integer CIDs are converted to string format by this function. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_CID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID_LIST **ReturnCidList) +{ + ACPI_OPERAND_OBJECT **CidObjects; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_DEVICE_ID_LIST *CidList; + char *NextIdString; + UINT32 StringAreaSize; + UINT32 Length; + UINT32 CidListSize; + ACPI_STATUS Status; + UINT32 Count; + UINT32 i; + + + ACPI_FUNCTION_TRACE (UtExecute_CID); + + + /* Evaluate the _CID method for this device */ + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, + &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Get the count and size of the returned _CIDs. _CID can return either + * a Package of Integers/Strings or a single Integer or String. + * Note: This section also validates that all CID elements are of the + * correct type (Integer or String). + */ + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) + { + Count = ObjDesc->Package.Count; + CidObjects = ObjDesc->Package.Elements; + } + else /* Single Integer or String CID */ + { + Count = 1; + CidObjects = &ObjDesc; + } + + StringAreaSize = 0; + for (i = 0; i < Count; i++) + { + /* String lengths include null terminator */ + + switch (CidObjects[i]->Common.Type) + { + case ACPI_TYPE_INTEGER: + StringAreaSize += ACPI_EISAID_STRING_SIZE; + break; + + case ACPI_TYPE_STRING: + StringAreaSize += CidObjects[i]->String.Length + 1; + break; + + default: + Status = AE_TYPE; + goto Cleanup; + } + } + + /* + * Now that we know the length of the CIDs, allocate return buffer: + * 1) Size of the base structure + + * 2) Size of the CID DEVICE_ID array + + * 3) Size of the actual CID strings + */ + CidListSize = sizeof (ACPI_DEVICE_ID_LIST) + + ((Count - 1) * sizeof (ACPI_DEVICE_ID)) + + StringAreaSize; + + CidList = ACPI_ALLOCATE_ZEROED (CidListSize); + if (!CidList) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for CID strings starts after the CID DEVICE_ID array */ + + NextIdString = ACPI_CAST_PTR (char, CidList->Ids) + + ((ACPI_SIZE) Count * sizeof (ACPI_DEVICE_ID)); + + /* Copy/convert the CIDs to the return buffer */ + + for (i = 0; i < Count; i++) + { + if (CidObjects[i]->Common.Type == ACPI_TYPE_INTEGER) + { + /* Convert the Integer (EISAID) CID to a string */ + + AcpiExEisaIdToString (NextIdString, CidObjects[i]->Integer.Value); + Length = ACPI_EISAID_STRING_SIZE; + } + else /* ACPI_TYPE_STRING */ + { + /* Copy the String CID from the returned object */ + + AcpiUtCopyIdString (NextIdString, CidObjects[i]->String.Pointer); + Length = CidObjects[i]->String.Length + 1; + } + + CidList->Ids[i].String = NextIdString; + CidList->Ids[i].Length = Length; + NextIdString += Length; + } + + /* Finish the CID list */ + + CidList->Count = Count; + CidList->ListSize = CidListSize; + *ReturnCidList = CidList; + + +Cleanup: + + /* On exit, we must delete the _CID return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + diff --git a/utilities/utmisc.c b/utilities/utmisc.c index 165b45ebf002..89e1addba65e 100644 --- a/utilities/utmisc.c +++ b/utilities/utmisc.c @@ -124,6 +124,12 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utmisc") +/* + * Common suffix for messages + */ +#define ACPI_COMMON_MSG_SUFFIX \ + AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) + /******************************************************************************* * @@ -207,6 +213,40 @@ AcpiUtValidateException ( /******************************************************************************* * + * FUNCTION: AcpiUtIsPciRootBridge + * + * PARAMETERS: Id - The HID/CID in string format + * + * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge + * + * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtIsPciRootBridge ( + char *Id) +{ + + /* + * Check if this is a PCI root bridge. + * ACPI 3.0+: check for a PCI Express root also. + */ + if (!(ACPI_STRCMP (Id, + PCI_ROOT_HID_STRING)) || + + !(ACPI_STRCMP (Id, + PCI_EXPRESS_ROOT_HID_STRING))) + { + return (TRUE); + } + + return (FALSE); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtIsAmlTable * * PARAMETERS: Table - An ACPI table @@ -1283,7 +1323,7 @@ AcpiError ( va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + ACPI_COMMON_MSG_SUFFIX; va_end (args); } @@ -1302,7 +1342,7 @@ AcpiException ( va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + ACPI_COMMON_MSG_SUFFIX; va_end (args); } @@ -1320,7 +1360,7 @@ AcpiWarning ( va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + ACPI_COMMON_MSG_SUFFIX; va_end (args); } @@ -1348,3 +1388,50 @@ ACPI_EXPORT_SYMBOL (AcpiWarning) ACPI_EXPORT_SYMBOL (AcpiInfo) +/******************************************************************************* + * + * FUNCTION: AcpiUtPredefinedWarning + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Pathname - Full pathname to the node + * NodeFlags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Warnings for the predefined validation module. Messages are + * only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of error + * messages for methods that are repeatedly evaluated. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedWarning ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...) +{ + va_list args; + + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (NodeFlags & ANOBJ_EVALUATED) + { + return; + } + + AcpiOsPrintf ("ACPI Warning for %s: ", Pathname); + + va_start (args, Format); + AcpiOsVprintf (Format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end (args); +} |