From c7d200796139e4d9568cfa1a4636feeea300b5f6 Mon Sep 17 00:00:00 2001 From: aystarik Date: Wed, 29 Jun 2005 18:18:26 +0000 Subject: [PATCH] Update copyrights for 2004 date 2004.01.13.23.06.00; author rmoore1; state Exp; --- source/components/namespace/nsaccess.c | 4 +- source/components/namespace/nsalloc.c | 4 +- source/components/namespace/nsdump.c | 25 +-- source/components/namespace/nsdumpdv.c | 18 +- source/components/namespace/nseval.c | 4 +- source/components/namespace/nsinit.c | 4 +- source/components/namespace/nsload.c | 28 +-- source/components/namespace/nsnames.c | 6 +- source/components/namespace/nsobject.c | 7 +- source/components/namespace/nsparse.c | 7 +- source/components/namespace/nssearch.c | 4 +- source/components/namespace/nsutils.c | 4 +- source/components/namespace/nswalk.c | 17 +- source/components/namespace/nsxfeval.c | 42 ++-- source/components/namespace/nsxfname.c | 4 +- source/components/namespace/nsxfobj.c | 6 +- source/components/resources/rsaddr.c | 171 ++++++++-------- source/components/resources/rscalc.c | 22 +- source/components/resources/rscreate.c | 6 +- source/components/resources/rsdump.c | 109 +++++----- source/components/resources/rsio.c | 16 +- source/components/resources/rsirq.c | 76 ++++--- source/components/resources/rslist.c | 8 +- source/components/resources/rsmemory.c | 62 +++--- source/components/resources/rsmisc.c | 8 +- source/components/resources/rsutils.c | 58 +++++- source/components/resources/rsxface.c | 167 +++++++++++++++- source/components/tables/tbinstal.c | 238 ++++++++++------------ source/components/tables/tbutils.c | 23 +-- source/components/tables/tbxface.c | 24 +-- source/components/tables/tbxfroot.c | 17 +- source/components/utilities/utalloc.c | 61 +----- source/components/utilities/utclib.c | 4 +- source/components/utilities/utcopy.c | 39 ++-- source/components/utilities/utdebug.c | 18 +- source/components/utilities/utdelete.c | 89 ++++----- source/components/utilities/uteval.c | 218 ++++++++++++++++---- source/components/utilities/utglobal.c | 155 +++++++++++--- source/components/utilities/utinit.c | 32 ++- source/components/utilities/utmath.c | 4 +- source/components/utilities/utmisc.c | 76 ++++--- source/components/utilities/utobject.c | 53 ++--- source/components/utilities/utxface.c | 90 +++++---- source/include/acapps.h | 10 +- source/include/acconfig.h | 57 +++--- source/include/acdebug.h | 60 ++++-- source/include/acdisasm.h | 36 +++- source/include/acdispat.h | 4 +- source/include/acevents.h | 54 ++++- source/include/acexcep.h | 14 +- source/include/acglobal.h | 43 ++-- source/include/achware.h | 38 ++-- source/include/acinterp.h | 10 +- source/include/aclocal.h | 158 +++++++-------- source/include/acmacros.h | 266 +++++++++++++++++-------- source/include/acnamesp.h | 9 +- source/include/acobject.h | 48 ++--- source/include/acoutput.h | 4 +- source/include/acparser.h | 4 +- source/include/acpi.h | 4 +- source/include/acpiosxf.h | 74 +++++-- source/include/acpixf.h | 80 ++++++-- source/include/acresrc.h | 10 +- source/include/acstruct.h | 7 +- source/include/actables.h | 14 +- source/include/actbl.h | 256 ++++++++++++++++++------ source/include/actbl1.h | 8 +- source/include/actbl2.h | 24 ++- 68 files changed, 2088 insertions(+), 1232 deletions(-) diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index abf7e15c7..6478bd7a7 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 1.175 $ + * $Revision: 1.176 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index 46547f3c0..d280017b1 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 1.83 $ + * $Revision: 1.84 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index b04cfb5f8..f606b17ad 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.153 $ + * $Revision: 1.157 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -125,8 +125,8 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsdump") -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /******************************************************************************* * @@ -152,7 +152,7 @@ AcpiNsPrintPathname ( return; } - /* Print the entire name */ + /* Print the entire name */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); @@ -337,8 +337,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_INTEGER: AcpiOsPrintf ("= %8.8X%8.8X\n", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; @@ -396,8 +395,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_HIDWORD (ObjDesc->Region.Address), - ACPI_LODWORD (ObjDesc->Region.Address), + ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length); } else @@ -468,7 +466,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - AcpiOsPrintf ("Off %.2X Len %.2X Acc %.2hd\n", + AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n", (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BitLength, @@ -507,8 +505,8 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value), - ACPI_LODWORD(ObjDesc->Integer.Value)); + AcpiOsPrintf (" I:%8.8X8.8%X\n", + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: @@ -589,7 +587,8 @@ AcpiNsDumpOneObject ( default: - AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n"); + AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor) [%s]\n", + AcpiUtGetDescriptorName (ObjDesc)); BytesToDump = 16; break; } @@ -687,7 +686,6 @@ AcpiNsDumpObjects ( Info.OwnerId = OwnerId; Info.DisplayType = DisplayType; - (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, (void *) &Info, NULL); @@ -736,7 +734,6 @@ AcpiNsDumpTables ( ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); } - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, ACPI_UINT32_MAX, SearchHandle); return_VOID; diff --git a/source/components/namespace/nsdumpdv.c b/source/components/namespace/nsdumpdv.c index 8450d7ee9..628343395 100644 --- a/source/components/namespace/nsdumpdv.c +++ b/source/components/namespace/nsdumpdv.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.5 $ + * $Revision: 1.10 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -147,7 +147,8 @@ AcpiNsDumpOneDevice ( void *Context, void **ReturnValue) { - ACPI_DEVICE_INFO Info; + ACPI_BUFFER Buffer; + ACPI_DEVICE_INFO *Info; ACPI_STATUS Status; UINT32 i; @@ -157,18 +158,21 @@ AcpiNsDumpOneDevice ( Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue); - Status = AcpiGetObjectInfo (ObjHandle, &Info); + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + Status = AcpiGetObjectInfo (ObjHandle, &Buffer); if (ACPI_SUCCESS (Status)) { + Info = Buffer.Pointer; for (i = 0; i < Level; i++) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", - Info.HardwareId, - ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address), - Info.CurrentStatus)); + Info->HardwareId.Value, + ACPI_FORMAT_UINT64 (Info->Address), + Info->CurrentStatus)); + ACPI_MEM_FREE (Info); } return (Status); diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 3f6947621..628634e09 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -2,7 +2,7 @@ * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. - * $Revision: 1.121 $ + * $Revision: 1.122 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 014aa6488..0abbd4356 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 1.57 $ + * $Revision: 1.58 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c index fb7b63209..8e0fdb595 100644 --- a/source/components/namespace/nsload.c +++ b/source/components/namespace/nsload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 1.63 $ + * $Revision: 1.67 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -153,7 +153,7 @@ AcpiNsLoadTable ( /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ - if (!(AcpiGbl_AcpiTableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE)) + if (!(AcpiGbl_TableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE)) { /* Just ignore this table */ @@ -170,10 +170,12 @@ AcpiNsLoadTable ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlStart)); + /* Ignore table if there is no AML contained within */ + if (!TableDesc->AmlLength) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Zero-length AML block\n")); - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", TableDesc->Pointer->Signature)); + return_ACPI_STATUS (AE_OK); } /* @@ -261,7 +263,7 @@ AcpiNsLoadTableByType ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n")); - TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_DSDT]; + TableDesc = AcpiGbl_TableLists[ACPI_TABLE_DSDT].Next; /* If table already loaded into namespace, just return */ @@ -270,8 +272,6 @@ AcpiNsLoadTableByType ( goto UnlockAndExit; } - TableDesc->TableId = TABLE_ID_DSDT; - /* Now load the single DSDT */ Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode); @@ -286,13 +286,13 @@ AcpiNsLoadTableByType ( case ACPI_TABLE_SSDT: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n", - AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count)); + AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count)); /* * Traverse list of SSDT tables */ - TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_SSDT]; - for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count; i++) + TableDesc = AcpiGbl_TableLists[ACPI_TABLE_SSDT].Next; + for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count; i++) { /* * Only attempt to load table if it is not @@ -317,14 +317,14 @@ AcpiNsLoadTableByType ( case ACPI_TABLE_PSDT: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n", - AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count)); + AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count)); /* * Traverse list of PSDT tables */ - TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_PSDT]; + TableDesc = AcpiGbl_TableLists[ACPI_TABLE_PSDT].Next; - for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count; i++) + for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count; i++) { /* Only attempt to load table if it is not already loaded! */ diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index 1ac3c7883..f268b8e1b 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 1.82 $ + * $Revision: 1.84 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -174,7 +174,7 @@ AcpiNsBuildExternalPath ( /* Put the name into the buffer */ - ACPI_MOVE_UNALIGNED32_TO_32 ((NameBuffer + Index), &ParentNode->Name); + ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name); ParentNode = AcpiNsGetParentNode (ParentNode); /* Prefix name with the path separator */ diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c index 99ba1ee49..eeba7b5d8 100644 --- a/source/components/namespace/nsobject.c +++ b/source/components/namespace/nsobject.c @@ -2,7 +2,7 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 1.88 $ + * $Revision: 1.90 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -182,7 +182,8 @@ AcpiNsAttachObject ( { /* Not a name handle */ - ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle\n")); + ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle %p [%s]\n", + Node, AcpiUtGetDescriptorName (Node))); return_ACPI_STATUS (AE_BAD_PARAMETER); } diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index 161f4b09a..f0ca0611f 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsparse - namespace interface to AML parser - * $Revision: 1.3 $ + * $Revision: 1.5 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -160,10 +160,9 @@ AcpiNsOneCompleteParse ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* Create and initialize a new walk state */ - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + WalkState = AcpiDsCreateWalkState (TableDesc->TableId, NULL, NULL, NULL); if (!WalkState) { diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index 045ccd92f..2157ff108 100644 --- a/source/components/namespace/nssearch.c +++ b/source/components/namespace/nssearch.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 1.99 $ + * $Revision: 1.100 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 5f130f37b..57cce75a1 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -2,7 +2,7 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 1.131 $ + * $Revision: 1.132 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/namespace/nswalk.c b/source/components/namespace/nswalk.c index dae86a3a0..e996b98b7 100644 --- a/source/components/namespace/nswalk.c +++ b/source/components/namespace/nswalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nswalk - Functions for walking the ACPI namespace - * $Revision: 1.34 $ + * $Revision: 1.36 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -245,6 +245,7 @@ AcpiNsWalkNamespace ( void **ReturnValue) { ACPI_STATUS Status; + ACPI_STATUS MutexStatus; ACPI_NAMESPACE_NODE *ChildNode; ACPI_NAMESPACE_NODE *ParentNode; ACPI_OBJECT_TYPE ChildType; @@ -298,10 +299,10 @@ AcpiNsWalkNamespace ( */ if (UnlockBeforeCallback) { - Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) + MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (MutexStatus)) { - return_ACPI_STATUS (Status); + return_ACPI_STATUS (MutexStatus); } } @@ -310,10 +311,10 @@ AcpiNsWalkNamespace ( if (UnlockBeforeCallback) { - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) + MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (MutexStatus)) { - return_ACPI_STATUS (Status); + return_ACPI_STATUS (MutexStatus); } } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index b9d4d4951..1b845a124 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -2,7 +2,7 @@ * * Module Name: nsxfeval - Public interfaces to the ACPI subsystem * ACPI Object evaluation interfaces - * $Revision: 1.7 $ + * $Revision: 1.11 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -542,16 +542,15 @@ AcpiNsGetDeviceCallback ( void *Context, void **ReturnValue) { + ACPI_GET_DEVICES_INFO *Info = Context; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; UINT32 Flags; ACPI_DEVICE_ID Hid; - ACPI_DEVICE_ID Cid; - ACPI_GET_DEVICES_INFO *Info; + ACPI_COMPATIBLE_ID_LIST *Cid; + ACPI_NATIVE_UINT i; - Info = Context; - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { @@ -570,9 +569,8 @@ AcpiNsGetDeviceCallback ( return (AE_BAD_PARAMETER); } - /* - * Run _STA to determine if device is present - */ + /* Run _STA to determine if device is present */ + Status = AcpiUtExecute_STA (Node, &Flags); if (ACPI_FAILURE (Status)) { @@ -582,12 +580,12 @@ AcpiNsGetDeviceCallback ( if (!(Flags & 0x01)) { /* Don't return at the device or children of the device if not there */ + return (AE_CTRL_DEPTH); } - /* - * Filter based on device HID & CID - */ + /* Filter based on device HID & CID */ + if (Info->Hid != NULL) { Status = AcpiUtExecute_HID (Node, &Hid); @@ -600,8 +598,10 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - if (ACPI_STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0) + if (ACPI_STRNCMP (Hid.Value, Info->Hid, sizeof (Hid.Value)) != 0) { + /* Get the list of Compatible IDs */ + Status = AcpiUtExecute_CID (Node, &Cid); if (Status == AE_NOT_FOUND) { @@ -612,12 +612,18 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - /* TBD: Handle CID packages */ + /* Walk the CID list */ - if (ACPI_STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0) + for (i = 0; i < Cid->Count; i++) { - return (AE_OK); + if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid, + sizeof (ACPI_COMPATIBLE_ID)) != 0) + { + ACPI_MEM_FREE (Cid); + return (AE_OK); + } } + ACPI_MEM_FREE (Cid); } } @@ -641,8 +647,8 @@ AcpiNsGetDeviceCallback ( * * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, * starting (and ending) at the object specified by StartHandle. - * The UserFunction is called whenever an object that matches - * the type parameter is found. If the user function returns + * The UserFunction is called whenever an object of type + * Device is found. If the user function returns * a non-zero value, the search is terminated immediately and this * value is returned to the caller. * diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index b5ab6d653..896e071a1 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -2,7 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 1.98 $ + * $Revision: 1.99 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c index 1674dda86..1683df983 100644 --- a/source/components/namespace/nsxfobj.c +++ b/source/components/namespace/nsxfobj.c @@ -2,7 +2,7 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 1.115 $ + * $Revision: 1.117 $ * ******************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -242,7 +242,7 @@ AcpiGetParent ( *RetHandle = AcpiNsConvertEntryToHandle (AcpiNsGetParentNode (Node)); - /* Return exeption if parent is null */ + /* Return exception if parent is null */ if (!AcpiNsGetParentNode (Node)) { diff --git a/source/components/resources/rsaddr.c b/source/components/resources/rsaddr.c index d83791b37..d214ac97e 100644 --- a/source/components/resources/rsaddr.c +++ b/source/components/resources/rsaddr.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 1.28 $ + * $Revision: 1.34 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -166,7 +166,14 @@ AcpiRsAddress16Resource ( * Point past the Descriptor to get the number of bytes consumed */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); + + /* Validate minimum descriptor length */ + + if (Temp16 < 13) + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_ADDRESS16; @@ -227,6 +234,8 @@ AcpiRsAddress16Resource ( { OutputStruct->Data.Address16.Attribute.Io.RangeAttribute = (UINT16) (Temp8 & 0x03); + OutputStruct->Data.Address16.Attribute.Io.TranslationAttribute = + (UINT16) ((Temp8 >> 4) & 0x03); } else { @@ -239,36 +248,31 @@ AcpiRsAddress16Resource ( * Get Granularity (Bytes 6-7) */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.Granularity, - Buffer); + ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.Granularity, Buffer); /* * Get MinAddressRange (Bytes 8-9) */ Buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MinAddressRange, - Buffer); + ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MinAddressRange, Buffer); /* * Get MaxAddressRange (Bytes 10-11) */ Buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MaxAddressRange, - Buffer); + ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MaxAddressRange, Buffer); /* * Get AddressTranslationOffset (Bytes 12-13) */ Buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressTranslationOffset, - Buffer); + ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressTranslationOffset, Buffer); /* * Get AddressLength (Bytes 14-15) */ Buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressLength, - Buffer); + ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressLength, Buffer); /* * Resource Source Index (if present) @@ -281,8 +285,11 @@ AcpiRsAddress16Resource ( * pointer to where the null terminated string goes: * Each Interrupt takes 32-bits + the 5 bytes of the * stream that are default. + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ - if (*BytesConsumed > 16) + if (*BytesConsumed > (16 + 1)) { /* Dereference the Index */ @@ -431,6 +438,9 @@ AcpiRsAddress16Stream ( Temp8 = (UINT8) (LinkedList->Data.Address16.Attribute.Io.RangeAttribute & 0x03); + Temp8 |= + (LinkedList->Data.Address16.Attribute.Io.TranslationAttribute & + 0x03) << 4; } *Buffer = Temp8; @@ -439,36 +449,31 @@ AcpiRsAddress16Stream ( /* * Set the address space granularity */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.Granularity); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.Granularity); Buffer += 2; /* * Set the address range minimum */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.MinAddressRange); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MinAddressRange); Buffer += 2; /* * Set the address range maximum */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.MaxAddressRange); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MaxAddressRange); Buffer += 2; /* * Set the address translation offset */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.AddressTranslationOffset); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressTranslationOffset); Buffer += 2; /* * Set the address length */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.AddressLength); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressLength); Buffer += 2; /* @@ -491,9 +496,9 @@ AcpiRsAddress16Stream ( /* * Buffer needs to be set to the length of the sting + one for the - * terminating null + * terminating null */ - Buffer += (ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1); } /* @@ -507,7 +512,7 @@ AcpiRsAddress16Stream ( * minus the header size (3 bytes) */ ActualBytes -= 3; - ACPI_MOVE_UNALIGNED16_TO_16 (LengthField, &ActualBytes); + ACPI_MOVE_SIZE_TO_16 (LengthField, &ActualBytes); return_ACPI_STATUS (AE_OK); } @@ -559,9 +564,16 @@ AcpiRsAddress32Resource ( * Point past the Descriptor to get the number of bytes consumed */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); - *BytesConsumed = Temp16 + 3; + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); + /* Validate minimum descriptor length */ + + if (Temp16 < 23) + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } + + *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_ADDRESS32; /* @@ -624,6 +636,8 @@ AcpiRsAddress32Resource ( { OutputStruct->Data.Address32.Attribute.Io.RangeAttribute = (UINT16) (Temp8 & 0x03); + OutputStruct->Data.Address32.Attribute.Io.TranslationAttribute = + (UINT16) ((Temp8 >> 4) & 0x03); } else { @@ -636,36 +650,31 @@ AcpiRsAddress32Resource ( * Get Granularity (Bytes 6-9) */ Buffer += 1; - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.Granularity, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.Granularity, Buffer); /* * Get MinAddressRange (Bytes 10-13) */ Buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange, Buffer); /* * Get MaxAddressRange (Bytes 14-17) */ Buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange, Buffer); /* * Get AddressTranslationOffset (Bytes 18-21) */ Buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset, Buffer); /* * Get AddressLength (Bytes 22-25) */ Buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressLength, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressLength, Buffer); /* * Resource Source Index (if present) @@ -676,8 +685,11 @@ AcpiRsAddress32Resource ( * This will leave us pointing to the Resource Source Index * If it is present, then save it off and calculate the * pointer to where the null terminated string goes: + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ - if (*BytesConsumed > 26) + if (*BytesConsumed > (26 + 1)) { /* Dereference the Index */ @@ -716,8 +728,8 @@ AcpiRsAddress32Resource ( /* * In order for the StructSize to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundary. + * calculate the length of the string and expand the + * StructSize to the next 32-bit boundary. */ Temp8 = (UINT8) (Index + 1); StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8); @@ -826,6 +838,9 @@ AcpiRsAddress32Stream ( Temp8 = (UINT8) (LinkedList->Data.Address32.Attribute.Io.RangeAttribute & 0x03); + Temp8 |= + (LinkedList->Data.Address32.Attribute.Io.TranslationAttribute & + 0x03) << 4; } *Buffer = Temp8; @@ -834,36 +849,31 @@ AcpiRsAddress32Stream ( /* * Set the address space granularity */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.Granularity); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.Granularity); Buffer += 4; /* * Set the address range minimum */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.MinAddressRange); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MinAddressRange); Buffer += 4; /* * Set the address range maximum */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.MaxAddressRange); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MaxAddressRange); Buffer += 4; /* * Set the address translation offset */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.AddressTranslationOffset); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressTranslationOffset); Buffer += 4; /* * Set the address length */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.AddressLength); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressLength); Buffer += 4; /* @@ -888,7 +898,7 @@ AcpiRsAddress32Stream ( * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1); } /* @@ -952,7 +962,14 @@ AcpiRsAddress64Resource ( * Point past the Descriptor to get the number of bytes consumed */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); + + /* Validate minimum descriptor length */ + + if (Temp16 < 43) + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_ADDRESS64; @@ -1018,6 +1035,8 @@ AcpiRsAddress64Resource ( { OutputStruct->Data.Address64.Attribute.Io.RangeAttribute = (UINT16) (Temp8 & 0x03); + OutputStruct->Data.Address64.Attribute.Io.TranslationAttribute = + (UINT16) ((Temp8 >> 4) & 0x03); } else { @@ -1030,36 +1049,31 @@ AcpiRsAddress64Resource ( * Get Granularity (Bytes 6-13) */ Buffer += 1; - ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.Granularity, - Buffer); + ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.Granularity, Buffer); /* * Get MinAddressRange (Bytes 14-21) */ Buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange, - Buffer); + ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange, Buffer); /* * Get MaxAddressRange (Bytes 22-29) */ Buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange, - Buffer); + ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange, Buffer); /* * Get AddressTranslationOffset (Bytes 30-37) */ Buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset, - Buffer); + ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset, Buffer); /* * Get AddressLength (Bytes 38-45) */ Buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressLength, - Buffer); + ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressLength, Buffer); /* * Resource Source Index (if present) @@ -1072,8 +1086,11 @@ AcpiRsAddress64Resource ( * pointer to where the null terminated string goes: * Each Interrupt takes 32-bits + the 5 bytes of the * stream that are default. + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ - if (*BytesConsumed > 46) + if (*BytesConsumed > (46 + 1)) { /* Dereference the Index */ @@ -1108,7 +1125,6 @@ AcpiRsAddress64Resource ( * Add the terminating null */ *TempPtr = 0x00; - OutputStruct->Data.Address64.ResourceSource.StringLength = Index + 1; /* @@ -1181,7 +1197,6 @@ AcpiRsAddress64Stream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; @@ -1224,6 +1239,9 @@ AcpiRsAddress64Stream ( Temp8 = (UINT8) (LinkedList->Data.Address64.Attribute.Io.RangeAttribute & 0x03); + Temp8 |= + (LinkedList->Data.Address64.Attribute.Io.RangeAttribute & + 0x03) << 4; } *Buffer = Temp8; @@ -1232,36 +1250,31 @@ AcpiRsAddress64Stream ( /* * Set the address space granularity */ - ACPI_MOVE_UNALIGNED64_TO_64 (Buffer, - &LinkedList->Data.Address64.Granularity); + ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.Granularity); Buffer += 8; /* * Set the address range minimum */ - ACPI_MOVE_UNALIGNED64_TO_64 (Buffer, - &LinkedList->Data.Address64.MinAddressRange); + ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MinAddressRange); Buffer += 8; /* * Set the address range maximum */ - ACPI_MOVE_UNALIGNED64_TO_64 (Buffer, - &LinkedList->Data.Address64.MaxAddressRange); + ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MaxAddressRange); Buffer += 8; /* * Set the address translation offset */ - ACPI_MOVE_UNALIGNED64_TO_64 (Buffer, - &LinkedList->Data.Address64.AddressTranslationOffset); + ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressTranslationOffset); Buffer += 8; /* * Set the address length */ - ACPI_MOVE_UNALIGNED64_TO_64 (Buffer, - &LinkedList->Data.Address64.AddressLength); + ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressLength); Buffer += 8; /* @@ -1283,9 +1296,9 @@ AcpiRsAddress64Stream ( /* * Buffer needs to be set to the length of the sting + one for the - * terminating null + * terminating null */ - Buffer += (ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1); } /* diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index 99712f77e..1f8f837d2 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 1.46 $ + * $Revision: 1.50 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -433,7 +433,7 @@ AcpiRsGetListLength ( Buffer = ByteStreamBuffer; ++Buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); BytesConsumed = Temp16 + 3; /* @@ -474,7 +474,7 @@ AcpiRsGetListLength ( Buffer = ByteStreamBuffer; ++Buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); BytesConsumed = Temp16 + 3; @@ -514,7 +514,7 @@ AcpiRsGetListLength ( Buffer = ByteStreamBuffer; ++Buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); BytesConsumed = Temp16 + 3; @@ -554,7 +554,7 @@ AcpiRsGetListLength ( Buffer = ByteStreamBuffer; ++Buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); BytesConsumed = Temp16 + 3; @@ -594,7 +594,7 @@ AcpiRsGetListLength ( Buffer = ByteStreamBuffer; ++Buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); BytesConsumed = Temp16 + 3; @@ -667,7 +667,7 @@ AcpiRsGetListLength ( /* * Look at the number of bits set */ - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); for (Index = 0; Index < 16; Index++) { @@ -796,7 +796,7 @@ AcpiRsGetListLength ( default: /* * If we get here, everything is out of sync, - * so exit with an error + * exit with an error */ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } @@ -804,7 +804,7 @@ AcpiRsGetListLength ( /* * Update the return value and counter */ - BufferSize += ACPI_ALIGN_RESOURCE_SIZE(StructureSize); + BufferSize += (UINT32) ACPI_ALIGN_RESOURCE_SIZE (StructureSize); BytesParsed += BytesConsumed; /* @@ -918,7 +918,7 @@ AcpiRsGetPciRoutingTableLength ( * The length String.Length field does not include the * terminating NULL, add 1 */ - TempSizeNeeded += ((*SubObjectList)->String.Length + 1); + TempSizeNeeded += ((ACPI_SIZE) (*SubObjectList)->String.Length + 1); } else { diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index c89ad82ee..dd4828d4c 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 1.64 $ + * $Revision: 1.66 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -420,7 +420,7 @@ AcpiRsCreatePciRoutingTable ( /* Now align the current length */ - UserPrt->Length = ACPI_ROUND_UP_TO_64BITS (UserPrt->Length); + UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BITS (UserPrt->Length); /* * 4) Fourth subobject: Dereference the PRT.SourceIndex diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 46bf04ea9..b8ee5527b 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 1.35 $ + * $Revision: 1.38 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -655,6 +655,11 @@ AcpiRsDumpAddress16 ( "Invalid range attribute\n"); break; } + + AcpiOsPrintf (" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + Address16Data->Attribute.Io.TranslationAttribute ? + "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: @@ -780,27 +785,32 @@ AcpiRsDumpAddress32 ( AcpiOsPrintf (" Resource Type: Io Range\n"); switch (Address32Data->Attribute.Io.RangeAttribute) - { - case ACPI_NON_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: " - "Non-ISA Io Addresses\n"); - break; + { + case ACPI_NON_ISA_ONLY_RANGES: + AcpiOsPrintf (" Type Specific: " + "Non-ISA Io Addresses\n"); + break; - case ACPI_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: " - "ISA Io Addresses\n"); - break; + case ACPI_ISA_ONLY_RANGES: + AcpiOsPrintf (" Type Specific: " + "ISA Io Addresses\n"); + break; - case ACPI_ENTIRE_RANGE: - AcpiOsPrintf (" Type Specific: " - "ISA and non-ISA Io Addresses\n"); - break; + case ACPI_ENTIRE_RANGE: + AcpiOsPrintf (" Type Specific: " + "ISA and non-ISA Io Addresses\n"); + break; - default: - AcpiOsPrintf (" Type Specific: " - "Invalid Range attribute"); - break; - } + default: + AcpiOsPrintf (" Type Specific: " + "Invalid Range attribute"); + break; + } + + AcpiOsPrintf (" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + Address32Data->Attribute.Io.TranslationAttribute ? + "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: @@ -926,27 +936,32 @@ AcpiRsDumpAddress64 ( AcpiOsPrintf (" Resource Type: Io Range\n"); switch (Address64Data->Attribute.Io.RangeAttribute) - { - case ACPI_NON_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: " - "Non-ISA Io Addresses\n"); - break; + { + case ACPI_NON_ISA_ONLY_RANGES: + AcpiOsPrintf (" Type Specific: " + "Non-ISA Io Addresses\n"); + break; - case ACPI_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: " - "ISA Io Addresses\n"); - break; + case ACPI_ISA_ONLY_RANGES: + AcpiOsPrintf (" Type Specific: " + "ISA Io Addresses\n"); + break; - case ACPI_ENTIRE_RANGE: - AcpiOsPrintf (" Type Specific: " - "ISA and non-ISA Io Addresses\n"); - break; + case ACPI_ENTIRE_RANGE: + AcpiOsPrintf (" Type Specific: " + "ISA and non-ISA Io Addresses\n"); + break; - default: - AcpiOsPrintf (" Type Specific: " - "Invalid Range attribute"); - break; - } + default: + AcpiOsPrintf (" Type Specific: " + "Invalid Range attribute"); + break; + } + + AcpiOsPrintf (" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + Address64Data->Attribute.Io.TranslationAttribute ? + "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: @@ -977,24 +992,19 @@ AcpiRsDumpAddress64 ( "" : "not "); AcpiOsPrintf (" Granularity: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->Granularity), - ACPI_LODWORD (Address64Data->Granularity)); + ACPI_FORMAT_UINT64 (Address64Data->Granularity)); AcpiOsPrintf (" Address range min: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->MinAddressRange), - ACPI_HIDWORD (Address64Data->MinAddressRange)); + ACPI_FORMAT_UINT64 (Address64Data->MinAddressRange)); AcpiOsPrintf (" Address range max: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->MaxAddressRange), - ACPI_HIDWORD (Address64Data->MaxAddressRange)); + ACPI_FORMAT_UINT64 (Address64Data->MaxAddressRange)); AcpiOsPrintf (" Address translation offset: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->AddressTranslationOffset), - ACPI_HIDWORD (Address64Data->AddressTranslationOffset)); + ACPI_FORMAT_UINT64 (Address64Data->AddressTranslationOffset)); AcpiOsPrintf (" Address Length: %8.8X%8.8X\n", - ACPI_HIDWORD (Address64Data->AddressLength), - ACPI_HIDWORD (Address64Data->AddressLength)); + ACPI_FORMAT_UINT64 (Address64Data->AddressLength)); if(0xFF != Address64Data->ResourceSource.Index) { @@ -1212,8 +1222,7 @@ AcpiRsDumpIrqList ( AcpiOsPrintf ("PCI IRQ Routing Table structure %X.\n", Count++); AcpiOsPrintf (" Address: %8.8X%8.8X\n", - ACPI_HIDWORD (PrtElement->Address), - ACPI_LODWORD (PrtElement->Address)); + ACPI_FORMAT_UINT64 (PrtElement->Address)); AcpiOsPrintf (" Pin: %X\n", PrtElement->Pin); diff --git a/source/components/resources/rsio.c b/source/components/resources/rsio.c index fc72a6db7..9285a3297 100644 --- a/source/components/resources/rsio.c +++ b/source/components/resources/rsio.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsio - IO and DMA resource descriptors - * $Revision: 1.23 $ + * $Revision: 1.25 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -180,7 +180,7 @@ AcpiRsIoResource ( * Check MinBase Address */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); OutputStruct->Data.Io.MinBaseAddress = Temp16; @@ -188,7 +188,7 @@ AcpiRsIoResource ( * Check MaxBase Address */ Buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); OutputStruct->Data.Io.MaxBaseAddress = Temp16; @@ -270,7 +270,7 @@ AcpiRsFixedIoResource ( * Check Range Base Address */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); OutputStruct->Data.FixedIo.BaseAddress = Temp16; @@ -344,7 +344,7 @@ AcpiRsIoStream ( */ Temp16 = (UINT16) LinkedList->Data.Io.MinBaseAddress; - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; /* @@ -352,7 +352,7 @@ AcpiRsIoStream ( */ Temp16 = (UINT16) LinkedList->Data.Io.MaxBaseAddress; - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; /* @@ -421,7 +421,7 @@ AcpiRsFixedIoStream ( */ Temp16 = (UINT16) LinkedList->Data.FixedIo.BaseAddress; - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; /* diff --git a/source/components/resources/rsirq.c b/source/components/resources/rsirq.c index 1a871b407..ec0155cb0 100644 --- a/source/components/resources/rsirq.c +++ b/source/components/resources/rsirq.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 1.32 $ + * $Revision: 1.38 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -175,7 +175,7 @@ AcpiRsIrqResource ( * Point to the 16-bits of Bytes 1 and 2 */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); OutputStruct->Data.Irq.NumberOfInterrupts = 0; @@ -210,30 +210,29 @@ AcpiRsIrqResource ( Temp8 = *Buffer; /* - * Check for HE, LL or HL + * Check for HE, LL interrupts */ - if (Temp8 & 0x01) + switch (Temp8 & 0x09) { + case 0x01: /* HE */ OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE; OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH; - } - else - { - if (Temp8 & 0x8) - { - OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW; - } - else - { - /* - * Only _LL and _HE polarity/trigger interrupts - * are allowed (ACPI spec v1.0b ection 6.4.2.1), - * so an error will occur if we reach this point - */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list\n")); - return_ACPI_STATUS (AE_BAD_DATA); - } + break; + + case 0x08: /* LL */ + OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE; + OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW; + break; + + default: + /* + * Only _LL and _HE polarity/trigger interrupts + * are allowed (ACPI spec, section "IRQ Format") + * so 0x00 and 0x09 are illegal. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Invalid interrupt polarity/trigger in resource list, %X\n", Temp8)); + return_ACPI_STATUS (AE_BAD_DATA); } /* @@ -328,7 +327,7 @@ AcpiRsIrqStream ( Temp16 |= 0x1 << Temp8; } - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; /* @@ -406,7 +405,14 @@ AcpiRsExtendedIrqResource ( * Point past the Descriptor to get the number of bytes consumed */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); + + /* Validate minimum descriptor length */ + + if (Temp16 < 6) + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ; @@ -446,6 +452,13 @@ AcpiRsExtendedIrqResource ( Buffer += 1; Temp8 = *Buffer; + /* Must have at least one IRQ */ + + if (Temp8 < 1) + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } + OutputStruct->Data.ExtendedIrq.NumberOfInterrupts = Temp8; /* @@ -464,7 +477,7 @@ AcpiRsExtendedIrqResource ( */ for (Index = 0; Index < Temp8; Index++) { - ACPI_MOVE_UNALIGNED32_TO_32 ( + ACPI_MOVE_32_TO_32 ( &OutputStruct->Data.ExtendedIrq.Interrupts[Index], Buffer); /* Point to the next IRQ */ @@ -478,9 +491,12 @@ AcpiRsExtendedIrqResource ( * pointer to where the null terminated string goes: * Each Interrupt takes 32-bits + the 5 bytes of the * stream that are default. + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the length. */ if (*BytesConsumed > - ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + 5) + ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + (5 + 1)) { /* Dereference the Index */ @@ -495,7 +511,7 @@ AcpiRsExtendedIrqResource ( * Point the String pointer to the end of this structure. */ OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = - (char *)(OutputStruct + StructSize); + (char *)((char *) OutputStruct + StructSize); TempPtr = (UINT8 *) OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; @@ -628,7 +644,7 @@ AcpiRsExtendedIrqStream ( for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts; Index++) { - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.ExtendedIrq.Interrupts[Index]); Buffer += 4; } @@ -653,7 +669,7 @@ AcpiRsExtendedIrqStream ( * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); } /* diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index b70fb2fe7..e93744776 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rslist - Linked list utilities - * $Revision: 1.32 $ + * $Revision: 1.34 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -390,8 +390,8 @@ AcpiRsByteStreamToList ( * Set the Buffer to the next structure */ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer); - Resource->Length = ACPI_ALIGN_RESOURCE_SIZE(Resource->Length); - Buffer += ACPI_ALIGN_RESOURCE_SIZE(StructureSize); + Resource->Length = (UINT32) ACPI_ALIGN_RESOURCE_SIZE (Resource->Length); + Buffer += ACPI_ALIGN_RESOURCE_SIZE (StructureSize); } /* end while */ diff --git a/source/components/resources/rsmemory.c b/source/components/resources/rsmemory.c index d011e8541..5735d9c2f 100644 --- a/source/components/resources/rsmemory.c +++ b/source/components/resources/rsmemory.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmem24 - Memory resource descriptors - * $Revision: 1.21 $ + * $Revision: 1.25 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -166,7 +166,7 @@ AcpiRsMemory24Resource ( */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); Buffer += 2; *BytesConsumed = (ACPI_SIZE) Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_MEM24; @@ -181,28 +181,28 @@ AcpiRsMemory24Resource ( /* * Get MinBaseAddress (Bytes 4-5) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); Buffer += 2; OutputStruct->Data.Memory24.MinBaseAddress = Temp16; /* * Get MaxBaseAddress (Bytes 6-7) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); Buffer += 2; OutputStruct->Data.Memory24.MaxBaseAddress = Temp16; /* * Get Alignment (Bytes 8-9) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); Buffer += 2; OutputStruct->Data.Memory24.Alignment = Temp16; /* * Get RangeLength (Bytes 10-11) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); OutputStruct->Data.Memory24.RangeLength = Temp16; /* @@ -258,7 +258,7 @@ AcpiRsMemory24Stream ( * The length field is static */ Temp16 = 0x09; - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; /* @@ -271,25 +271,25 @@ AcpiRsMemory24Stream ( /* * Set the Range minimum base address */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress); Buffer += 2; /* * Set the Range maximum base address */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress); Buffer += 2; /* * Set the base alignment */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment); Buffer += 2; /* * Set the range length */ - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength); + ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength); Buffer += 2; /* @@ -343,7 +343,7 @@ AcpiRsMemory32RangeResource ( */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); Buffer += 2; *BytesConsumed = (ACPI_SIZE) Temp16 + 3; @@ -352,7 +352,7 @@ AcpiRsMemory32RangeResource ( /* * Point to the place in the output buffer where the data portion will * begin. - * 1. Set the RESOURCE_DATA * Data to point to it's own address, then + * 1. Set the RESOURCE_DATA * Data to point to its own address, then * 2. Set the pointer to the next address. * * NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds @@ -370,27 +370,25 @@ AcpiRsMemory32RangeResource ( /* * Get MinBaseAddress (Bytes 4-7) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer); Buffer += 4; /* * Get MaxBaseAddress (Bytes 8-11) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer); Buffer += 4; /* * Get Alignment (Bytes 12-15) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer); Buffer += 4; /* * Get RangeLength (Bytes 16-19) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer); /* * Set the Length parameter @@ -447,7 +445,7 @@ AcpiRsFixedMemory32Resource ( * Point past the Descriptor to get the number of bytes consumed */ Buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); Buffer += 2; *BytesConsumed = (ACPI_SIZE) Temp16 + 3; @@ -464,15 +462,13 @@ AcpiRsFixedMemory32Resource ( /* * Get RangeBaseAddress (Bytes 4-7) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, Buffer); Buffer += 4; /* * Get RangeLength (Bytes 8-11) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, - Buffer); + ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer); /* * Set the Length parameter @@ -528,7 +524,7 @@ AcpiRsMemory32RangeStream ( */ Temp16 = 0x11; - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; /* @@ -541,25 +537,25 @@ AcpiRsMemory32RangeStream ( /* * Set the Range minimum base address */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress); Buffer += 4; /* * Set the Range maximum base address */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress); Buffer += 4; /* * Set the base alignment */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment); Buffer += 4; /* * Set the range length */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength); + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength); Buffer += 4; /* @@ -611,7 +607,7 @@ AcpiRsFixedMemory32Stream ( */ Temp16 = 0x09; - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; /* @@ -624,14 +620,14 @@ AcpiRsFixedMemory32Stream ( /* * Set the Range base address */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.FixedMemory32.RangeBaseAddress); Buffer += 4; /* * Set the range length */ - ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, + ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.FixedMemory32.RangeLength); Buffer += 4; diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 2a30dfece..238f12cb6 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmisc - Miscellaneous resource descriptors - * $Revision: 1.25 $ + * $Revision: 1.27 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -286,7 +286,7 @@ AcpiRsVendorResource ( /* Dereference */ - ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); /* Calculate bytes consumed */ @@ -385,7 +385,7 @@ AcpiRsVendorStream ( Temp16 = (UINT16) LinkedList->Data.VendorSpecific.Length; - ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_16_TO_16 (Buffer, &Temp16); Buffer += 2; } else diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index 9da385f2d..fb2ce3589 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 1.35 $ + * $Revision: 1.38 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -290,6 +290,60 @@ AcpiRsGetPrsMethodData ( } +/******************************************************************************* + * + * FUNCTION: AcpiRsGetMethodData + * + * PARAMETERS: Handle - a handle to the containing object + * RetBuffer - a pointer to a buffer structure for the + * results + * + * RETURN: Status + * + * DESCRIPTION: This function is called to get the _CRS or _PRS value of an + * object contained in an object specified by the handle passed in + * + * If the function fails an appropriate status will be returned + * and the contents of the callers buffer is undefined. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRsGetMethodData ( + ACPI_HANDLE Handle, + char *Path, + ACPI_BUFFER *RetBuffer) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE ("RsGetMethodData"); + + + /* Parameters guaranteed valid by caller */ + + /* + * Execute the method, no parameters + */ + Status = AcpiUtEvaluateObject (Handle, Path, ACPI_BTYPE_BUFFER, &ObjDesc); + if (ACPI_FAILURE (Status)) { + return_ACPI_STATUS (Status); + } + + /* + * Make the call to create a resource linked list from the + * byte stream buffer that comes back from the method + * execution. + */ + Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); + + /* On exit, we must delete the object returned by EvaluateObject */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + /******************************************************************************* * * FUNCTION: AcpiRsSetSrsMethodData diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index e9ba94848..e260dfc19 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the resource manager - * $Revision: 1.20 $ + * $Revision: 1.28 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -291,6 +291,96 @@ AcpiGetPossibleResources ( } +/******************************************************************************* + * + * FUNCTION: AcpiWalkResources + * + * PARAMETERS: DeviceHandle - a handle to the device object for the + * device we are querying + * Path - method name of the resources we want + * (METHOD_NAME__CRS or METHOD_NAME__PRS) + * UserFunction - called for each resource + * Context - passed to UserFunction + * + * RETURN: Status + * + * DESCRIPTION: Retrieves the current or possible resource list for the + * specified device. The UserFunction is called once for + * each resource in the list. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiWalkResources ( + ACPI_HANDLE DeviceHandle, + char *Path, + ACPI_WALK_RESOURCE_CALLBACK UserFunction, + void *Context) +{ + ACPI_STATUS Status; + ACPI_BUFFER Buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + ACPI_RESOURCE *Resource; + + + ACPI_FUNCTION_TRACE ("AcpiWalkResources"); + + + if (!DeviceHandle || + (ACPI_STRNCMP (Path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) && + ACPI_STRNCMP (Path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiRsGetMethodData (DeviceHandle, Path, &Buffer); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Resource = (ACPI_RESOURCE *) Buffer.Pointer; + for (;;) + { + if (!Resource || Resource->Id == ACPI_RSTYPE_END_TAG) + { + break; + } + + Status = UserFunction (Resource, Context); + + switch (Status) + { + case AE_OK: + case AE_CTRL_DEPTH: + + /* Just keep going */ + Status = AE_OK; + break; + + case AE_CTRL_TERMINATE: + + /* Exit now, with OK stats */ + + Status = AE_OK; + goto Cleanup; + + default: + + /* All others are valid exceptions */ + + goto Cleanup; + } + + Resource = ACPI_NEXT_RESOURCE (Resource); + } + +Cleanup: + + AcpiOsFree (Buffer.Pointer); + return_ACPI_STATUS (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiSetCurrentResources @@ -334,3 +424,76 @@ AcpiSetCurrentResources ( Status = AcpiRsSetSrsMethodData (DeviceHandle, InBuffer); return_ACPI_STATUS (Status); } + + +#define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field) +#define ACPI_COPY_ADDRESS(Out, In) \ + ACPI_COPY_FIELD(Out, In, ResourceType); \ + ACPI_COPY_FIELD(Out, In, ProducerConsumer); \ + ACPI_COPY_FIELD(Out, In, Decode); \ + ACPI_COPY_FIELD(Out, In, MinAddressFixed); \ + ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \ + ACPI_COPY_FIELD(Out, In, Attribute); \ + ACPI_COPY_FIELD(Out, In, Granularity); \ + ACPI_COPY_FIELD(Out, In, MinAddressRange); \ + ACPI_COPY_FIELD(Out, In, MaxAddressRange); \ + ACPI_COPY_FIELD(Out, In, AddressTranslationOffset); \ + ACPI_COPY_FIELD(Out, In, AddressLength); \ + ACPI_COPY_FIELD(Out, In, ResourceSource); + +/****************************************************************************** + * + * FUNCTION: AcpiResourceToAddress64 + * + * PARAMETERS: resource - Pointer to a resource + * out - Pointer to the users's return + * buffer (a struct + * acpi_resource_address64) + * + * RETURN: Status + * + * DESCRIPTION: If the resource is an address16, address32, or address64, + * copy it to the address64 return buffer. This saves the + * caller from having to duplicate code for different-sized + * addresses. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiResourceToAddress64 ( + ACPI_RESOURCE *Resource, + ACPI_RESOURCE_ADDRESS64 *Out) +{ + ACPI_RESOURCE_ADDRESS16 *Address16; + ACPI_RESOURCE_ADDRESS32 *Address32; + + + switch (Resource->Id) { + case ACPI_RSTYPE_ADDRESS16: + + Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data; + ACPI_COPY_ADDRESS(Out, Address16); + break; + + + case ACPI_RSTYPE_ADDRESS32: + + Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data; + ACPI_COPY_ADDRESS(Out, Address32); + break; + + + case ACPI_RSTYPE_ADDRESS64: + + /* Simple copy for 64 bit source */ + + ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64)); + break; + + + default: + return (AE_BAD_PARAMETER); + } + + return (AE_OK); +} diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index c5d04c236..4c83be6b5 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 1.67 $ + * $Revision: 1.73 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -154,15 +154,15 @@ AcpiTbMatchSignature ( /* * Search for a signature match among the known table types */ - for (i = 0; i < NUM_ACPI_TABLES; i++) + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { - if ((AcpiGbl_AcpiTableData[i].Flags & ACPI_TABLE_TYPE_MASK) != SearchType) + if (!(AcpiGbl_TableData[i].Flags & SearchType)) { continue; } - if (!ACPI_STRNCMP (Signature, AcpiGbl_AcpiTableData[i].Signature, - AcpiGbl_AcpiTableData[i].SigLength)) + if (!ACPI_STRNCMP (Signature, AcpiGbl_TableData[i].Signature, + AcpiGbl_TableData[i].SigLength)) { /* Found a signature match, return index if requested */ @@ -172,15 +172,15 @@ AcpiTbMatchSignature ( } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Table [%4.4s] matched and is a required ACPI table\n", - (char *) AcpiGbl_AcpiTableData[i].Signature)); + "Table [%4.4s] is an ACPI table consumed by the core subsystem\n", + (char *) AcpiGbl_TableData[i].Signature)); return_ACPI_STATUS (AE_OK); } } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Table [%4.4s] is not a required ACPI table - ignored\n", + "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n", (char *) Signature)); return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED); @@ -225,12 +225,12 @@ AcpiTbInstallTable ( Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not install ACPI table [%s], %s\n", + ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n", TableInfo->Pointer->Signature, AcpiFormatException (Status))); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", - AcpiGbl_AcpiTableData[TableInfo->Type].Name, TableInfo->Pointer)); + AcpiGbl_TableData[TableInfo->Type].Name, TableInfo->Pointer)); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); @@ -323,76 +323,84 @@ AcpiTbInitTableDescriptor ( ACPI_TABLE_TYPE TableType, ACPI_TABLE_DESC *TableInfo) { - ACPI_TABLE_DESC *ListHead; + ACPI_TABLE_LIST *ListHead; ACPI_TABLE_DESC *TableDesc; ACPI_FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType); + + /* Allocate a descriptor for this table */ + + TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC)); + if (!TableDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + /* * Install the table into the global data structure */ - ListHead = &AcpiGbl_AcpiTables[TableType]; - TableDesc = ListHead; + ListHead = &AcpiGbl_TableLists[TableType]; /* * Two major types of tables: 1) Only one instance is allowed. This * includes most ACPI tables such as the DSDT. 2) Multiple instances of * the table are allowed. This includes SSDT and PSDTs. */ - if (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags)) + if (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags)) { /* * Only one table allowed, and a table has alread been installed * at this location, so return an error. */ - if (ListHead->Pointer) + if (ListHead->Next) { return_ACPI_STATUS (AE_ALREADY_EXISTS); } - TableDesc->Count = 1; - TableDesc->Prev = NULL; - TableDesc->Next = NULL; + TableDesc->Next = ListHead->Next; + ListHead->Next = TableDesc; + + if (TableDesc->Next) + { + TableDesc->Next->Prev = TableDesc; + } + + ListHead->Count++; } else { /* - * Multiple tables allowed for this table type, we must link - * the new table in to the list of tables of this type. + * Link the new table in to the list of tables of this type. + * Insert at the end of the list, order IS IMPORTANT. + * + * TableDesc->Prev & Next are already NULL from calloc() */ - if (ListHead->Pointer) + ListHead->Count++; + + if (!ListHead->Next) { - TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC)); - if (!TableDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ListHead->Count++; - - /* Update the original previous */ - - ListHead->Prev->Next = TableDesc; - - /* Update new entry */ - - TableDesc->Prev = ListHead->Prev; - TableDesc->Next = ListHead; - - /* Update list head */ - - ListHead->Prev = TableDesc; + ListHead->Next = TableDesc; } else { - TableDesc->Count = 1; + TableDesc->Next = ListHead->Next; + + while (TableDesc->Next->Next) + { + TableDesc->Next = TableDesc->Next->Next; + } + + TableDesc->Next->Next = TableDesc; + TableDesc->Prev = TableDesc->Next; + TableDesc->Next = NULL; } } - /* Common initialization of the table descriptor */ + /* Finish initialization of the table descriptor */ - TableDesc->Type = TableInfo->Type; + TableDesc->Type = (UINT8) TableType; TableDesc->Pointer = TableInfo->Pointer; TableDesc->Length = TableInfo->Length; TableDesc->Allocation = TableInfo->Allocation; @@ -406,9 +414,9 @@ AcpiTbInitTableDescriptor ( * Set the appropriate global pointer (if there is one) to point to the * newly installed table */ - if (AcpiGbl_AcpiTableData[TableType].GlobalPtr) + if (AcpiGbl_TableData[TableType].GlobalPtr) { - *(AcpiGbl_AcpiTableData[TableType].GlobalPtr) = TableInfo->Pointer; + *(AcpiGbl_TableData[TableType].GlobalPtr) = TableInfo->Pointer; } /* Return Data */ @@ -422,7 +430,7 @@ AcpiTbInitTableDescriptor ( /******************************************************************************* * - * FUNCTION: AcpiTbDeleteAcpiTables + * FUNCTION: AcpiTbDeleteAllTables * * PARAMETERS: None. * @@ -433,25 +441,25 @@ AcpiTbInitTableDescriptor ( ******************************************************************************/ void -AcpiTbDeleteAcpiTables (void) +AcpiTbDeleteAllTables (void) { - ACPI_TABLE_TYPE Type; + ACPI_TABLE_TYPE Type; /* * Free memory allocated for ACPI tables * Memory can either be mapped or allocated */ - for (Type = 0; Type < NUM_ACPI_TABLES; Type++) + for (Type = 0; Type < NUM_ACPI_TABLE_TYPES; Type++) { - AcpiTbDeleteAcpiTable (Type); + AcpiTbDeleteTablesByType (Type); } } /******************************************************************************* * - * FUNCTION: AcpiTbDeleteAcpiTable + * FUNCTION: AcpiTbDeleteTablesByType * * PARAMETERS: Type - The table type to be deleted * @@ -463,11 +471,15 @@ AcpiTbDeleteAcpiTables (void) ******************************************************************************/ void -AcpiTbDeleteAcpiTable ( - ACPI_TABLE_TYPE Type) +AcpiTbDeleteTablesByType ( + ACPI_TABLE_TYPE Type) { + ACPI_TABLE_DESC *TableDesc; + UINT32 Count; + UINT32 i; - ACPI_FUNCTION_TRACE_U32 ("TbDeleteAcpiTable", Type); + + ACPI_FUNCTION_TRACE_U32 ("TbDeleteTablesByType", Type); if (Type > ACPI_TABLE_MAX) @@ -510,54 +522,23 @@ AcpiTbDeleteAcpiTable ( break; } - /* Free the table */ - - AcpiTbFreeAcpiTablesOfType (&AcpiGbl_AcpiTables[Type]); - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbFreeAcpiTablesOfType - * - * PARAMETERS: TableInfo - A table info struct - * - * RETURN: None. - * - * DESCRIPTION: Free the memory associated with an internal ACPI table - * Table mutex should be locked. - * - ******************************************************************************/ - -void -AcpiTbFreeAcpiTablesOfType ( - ACPI_TABLE_DESC *ListHead) -{ - ACPI_TABLE_DESC *TableDesc; - UINT32 Count; - UINT32 i; - - - ACPI_FUNCTION_TRACE_PTR ("TbFreeAcpiTablesOfType", ListHead); - - - /* Get the head of the list */ - - TableDesc = ListHead; - Count = ListHead->Count; + /* + * Free the table + * 1) Get the head of the list + */ + TableDesc = AcpiGbl_TableLists[Type].Next; + Count = AcpiGbl_TableLists[Type].Count; /* - * Walk the entire list, deleting both the allocated tables - * and the table descriptors + * 2) Walk the entire list, deleting both the allocated tables + * and the table descriptors */ for (i = 0; i < Count; i++) { TableDesc = AcpiTbUninstallTable (TableDesc); } + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_VOID; } @@ -580,33 +561,33 @@ AcpiTbDeleteSingleTable ( ACPI_TABLE_DESC *TableDesc) { - if (!TableDesc) + /* Must have a valid table descriptor and pointer */ + + if ((!TableDesc) || + (!TableDesc->Pointer)) { return; } - if (TableDesc->Pointer) + /* Valid table, determine type of memory allocation */ + + switch (TableDesc->Allocation) { - /* Valid table, determine type of memory allocation */ + case ACPI_MEM_NOT_ALLOCATED: + break; - switch (TableDesc->Allocation) - { - case ACPI_MEM_NOT_ALLOCATED: - break; + case ACPI_MEM_ALLOCATED: - case ACPI_MEM_ALLOCATED: + ACPI_MEM_FREE (TableDesc->Pointer); + break; - ACPI_MEM_FREE (TableDesc->Pointer); - break; + case ACPI_MEM_MAPPED: - case ACPI_MEM_MAPPED: + AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length); + break; - AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length); - break; - - default: - break; - } + default: + break; } } @@ -632,7 +613,7 @@ AcpiTbUninstallTable ( ACPI_TABLE_DESC *NextDesc; - ACPI_FUNCTION_TRACE_PTR ("AcpiTbUninstallTable", TableDesc); + ACPI_FUNCTION_TRACE_PTR ("TbUninstallTable", TableDesc); if (!TableDesc) @@ -640,12 +621,18 @@ AcpiTbUninstallTable ( return_PTR (NULL); } - /* Unlink the descriptor */ + /* Unlink the descriptor from the doubly linked list */ if (TableDesc->Prev) { TableDesc->Prev->Next = TableDesc->Next; } + else + { + /* Is first on list, update list head */ + + AcpiGbl_TableLists[TableDesc->Type].Next = TableDesc->Next; + } if (TableDesc->Next) { @@ -656,25 +643,12 @@ AcpiTbUninstallTable ( AcpiTbDeleteSingleTable (TableDesc); - /* Free the table descriptor (Don't delete the list head, tho) */ + /* Free the table descriptor */ - if ((TableDesc->Prev) == (TableDesc->Next)) - { - NextDesc = NULL; + NextDesc = TableDesc->Next; + ACPI_MEM_FREE (TableDesc); - /* Clear the list head */ - - TableDesc->Pointer = NULL; - TableDesc->Length = 0; - TableDesc->Count = 0; - } - else - { - /* Free the table descriptor */ - - NextDesc = TableDesc->Next; - ACPI_MEM_FREE (TableDesc); - } + /* Return pointer to the next descriptor */ return_PTR (NextDesc); } diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index b81eab12c..82a23861c 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities - * $Revision: 1.58 $ + * $Revision: 1.61 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -140,10 +140,10 @@ ACPI_STATUS AcpiTbHandleToObject ( UINT16 TableId, - ACPI_TABLE_DESC **TableDesc) + ACPI_TABLE_DESC **ReturnTableDesc) { UINT32 i; - ACPI_TABLE_DESC *ListHead; + ACPI_TABLE_DESC *TableDesc; ACPI_FUNCTION_NAME ("TbHandleToObject"); @@ -151,18 +151,17 @@ AcpiTbHandleToObject ( for (i = 0; i < ACPI_TABLE_MAX; i++) { - ListHead = &AcpiGbl_AcpiTables[i]; - do + TableDesc = AcpiGbl_TableLists[i].Next; + while (TableDesc) { - if (ListHead->TableId == TableId) + if (TableDesc->TableId == TableId) { - *TableDesc = ListHead; + *ReturnTableDesc = TableDesc; return (AE_OK); } - ListHead = ListHead->Next; - - } while (ListHead != &AcpiGbl_AcpiTables[i]); + TableDesc = TableDesc->Next; + } } ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId)); @@ -211,7 +210,7 @@ AcpiTbValidateTableHeader ( /* Ensure that the signature is 4 ASCII characters */ - ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, TableHeader->Signature); + ACPI_MOVE_32_TO_32 (&Signature, TableHeader->Signature); if (!AcpiUtValidAcpiName (Signature)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index 96722794c..4e0357fa0 100644 --- a/source/components/tables/tbxface.c +++ b/source/components/tables/tbxface.c @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 1.61 $ + * $Revision: 1.64 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -319,7 +319,7 @@ ACPI_STATUS AcpiUnloadTable ( ACPI_TABLE_TYPE TableType) { - ACPI_TABLE_DESC *ListHead; + ACPI_TABLE_DESC *TableDesc; ACPI_FUNCTION_TRACE ("AcpiUnloadTable"); @@ -335,8 +335,8 @@ AcpiUnloadTable ( /* Find all tables of the requested type */ - ListHead = &AcpiGbl_AcpiTables[TableType]; - do + TableDesc = AcpiGbl_TableLists[TableType].Next; + while (TableDesc) { /* * Delete all namespace entries owned by this table. Note that these @@ -344,14 +344,14 @@ AcpiUnloadTable ( * "Scope" operator. Thus, we need to track ownership by an ID, not * simply a position within the hierarchy */ - AcpiNsDeleteNamespaceByOwner (ListHead->TableId); + AcpiNsDeleteNamespaceByOwner (TableDesc->TableId); - /* Delete (or unmap) the actual table */ + TableDesc = TableDesc->Next; + } - AcpiTbDeleteAcpiTable (TableType); - - } while (ListHead != &AcpiGbl_AcpiTables[TableType]); + /* Delete (or unmap) all tables of this type */ + AcpiTbDeleteTablesByType (TableType); return_ACPI_STATUS (AE_OK); } @@ -400,7 +400,7 @@ AcpiGetTableHeader ( /* Check the table type and instance */ if ((TableType > ACPI_TABLE_MAX) || - (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) && + (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) && Instance > 1)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -486,7 +486,7 @@ AcpiGetTable ( /* Check the table type and instance */ if ((TableType > ACPI_TABLE_MAX) || - (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) && + (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) && Instance > 1)) { return_ACPI_STATUS (AE_BAD_PARAMETER); diff --git a/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c index 89028eb1b..9a8502b6f 100644 --- a/source/components/tables/tbxfroot.c +++ b/source/components/tables/tbxfroot.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 1.68 $ + * $Revision: 1.72 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -260,7 +260,7 @@ AcpiGetFirmwareTable ( if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { Status = AcpiOsMapMemory (RsdpAddress.Pointer.Physical, sizeof (RSDP_DESCRIPTOR), - (void **) &AcpiGbl_RSDP); + (void *) &AcpiGbl_RSDP); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -296,8 +296,7 @@ AcpiGetFirmwareTable ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", AcpiGbl_RSDP, - ACPI_HIDWORD (Address.Pointer.Value), - ACPI_LODWORD (Address.Pointer.Value))); + ACPI_FORMAT_UINT64 (Address.Pointer.Value))); /* Insert ProcessorMode flags */ @@ -331,12 +330,12 @@ AcpiGetFirmwareTable ( if (AcpiGbl_RSDP->Revision < 2) { - Address.Pointer.Value = ((RSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i]; + Address.Pointer.Value = (ACPI_CAST_PTR (RSDT_DESCRIPTOR, RsdtInfo.Pointer))->TableOffsetEntry[i]; } else { Address.Pointer.Value = ACPI_GET_ADDRESS ( - ((XSDT_DESCRIPTOR *) RsdtInfo.Pointer)->TableOffsetEntry[i]); + (ACPI_CAST_PTR (XSDT_DESCRIPTOR, RsdtInfo.Pointer))->TableOffsetEntry[i]); } /* Get the table header */ @@ -521,7 +520,7 @@ AcpiTbFindRsdp ( * 1) Search EBDA (low memory) paragraphs */ Status = AcpiOsMapMemory ((UINT64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE, - (void **) &TablePtr); + (void *) &TablePtr); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", @@ -547,7 +546,7 @@ AcpiTbFindRsdp ( * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h */ Status = AcpiOsMapMemory ((UINT64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE, - (void **) &TablePtr); + (void *) &TablePtr); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c index e9aa6d8bf..a8b6abd0d 100644 --- a/source/components/utilities/utalloc.c +++ b/source/components/utilities/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local cache and memory allocation routines - * $Revision: 1.131 $ + * $Revision: 1.135 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -908,7 +908,7 @@ AcpiUtRemoveAllocation ( ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", Allocation->Size)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", Allocation->Size)); Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return_ACPI_STATUS (Status); @@ -1019,72 +1019,31 @@ AcpiUtDumpAllocations ( Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); if (Descriptor->DescriptorId != ACPI_DESC_TYPE_CACHED) { - AcpiOsPrintf ("%p Len %04X %9.9s-%d ", + AcpiOsPrintf ("%p Len %04X %9.9s-%d [%s] ", Descriptor, Element->Size, Element->Module, - Element->Line); + Element->Line, AcpiUtGetDescriptorName (Descriptor)); - /* Most of the elements will be internal objects. */ + /* Most of the elements will be Operand objects. */ switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor)) { case ACPI_DESC_TYPE_OPERAND: - AcpiOsPrintf ("ObjType %12.12s R%hd", + AcpiOsPrintf ("%12.12s R%hd", AcpiUtGetTypeName (Descriptor->Object.Common.Type), Descriptor->Object.Common.ReferenceCount); break; case ACPI_DESC_TYPE_PARSER: - AcpiOsPrintf ("ParseObj AmlOpcode %04hX", + AcpiOsPrintf ("AmlOpcode %04hX", Descriptor->Op.Asl.AmlOpcode); break; case ACPI_DESC_TYPE_NAMED: - AcpiOsPrintf ("Node %4.4s", - Descriptor->Node.Name.Ascii); - break; - - case ACPI_DESC_TYPE_STATE: - AcpiOsPrintf ("Untyped StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_UPDATE: - AcpiOsPrintf ("UPDATE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_PACKAGE: - AcpiOsPrintf ("PACKAGE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_CONTROL: - AcpiOsPrintf ("CONTROL StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_RPSCOPE: - AcpiOsPrintf ("ROOT-PARSE-SCOPE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_PSCOPE: - AcpiOsPrintf ("PARSE-SCOPE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_WSCOPE: - AcpiOsPrintf ("WALK-SCOPE StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_RESULT: - AcpiOsPrintf ("RESULT StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_NOTIFY: - AcpiOsPrintf ("NOTIFY StateObj"); - break; - - case ACPI_DESC_TYPE_STATE_THREAD: - AcpiOsPrintf ("THREAD StateObj"); + AcpiOsPrintf ("%4.4s", + AcpiUtGetNodeName (&Descriptor->Node)); break; default: - /* All types should appear above */ break; } diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index d5f7a4bad..742ed5886 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 1.51 $ + * $Revision: 1.52 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index f69b87984..a02d6cada 100644 --- a/source/components/utilities/utcopy.c +++ b/source/components/utilities/utcopy.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 1.110 $ + * $Revision: 1.114 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -734,21 +734,30 @@ AcpiUtCopySimpleObject ( /* * Allocate and copy the actual buffer if and only if: - * 1) There is a valid buffer (length > 0) + * 1) There is a valid buffer pointer * 2) The buffer is not static (not in an ACPI table) (in this case, * the actual pointer was already copied above) */ - if ((SourceDesc->Buffer.Length) && + if ((SourceDesc->Buffer.Pointer) && (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) { - DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length); - if (!DestDesc->Buffer.Pointer) - { - return (AE_NO_MEMORY); - } + DestDesc->Buffer.Pointer = NULL; - ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer, - SourceDesc->Buffer.Length); + /* Create an actual buffer only if length > 0 */ + + if (SourceDesc->Buffer.Length) + { + DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length); + if (!DestDesc->Buffer.Pointer) + { + return (AE_NO_MEMORY); + } + + /* Copy the actual buffer data */ + + ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer, + SourceDesc->Buffer.Length); + } } break; @@ -756,21 +765,21 @@ AcpiUtCopySimpleObject ( /* * Allocate and copy the actual string if and only if: - * 1) There is a valid string (length > 0) + * 1) There is a valid string pointer * 2) The string is not static (not in an ACPI table) (in this case, * the actual pointer was already copied above) */ - if ((SourceDesc->String.Length) && + if ((SourceDesc->String.Pointer) && (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER))) { - DestDesc->String.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->String.Length + 1); + DestDesc->String.Pointer = ACPI_MEM_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1); if (!DestDesc->String.Pointer) { return (AE_NO_MEMORY); } ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer, - SourceDesc->String.Length + 1); + (ACPI_SIZE) SourceDesc->String.Length + 1); } break; diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c index ec65ce4fe..5672b868b 100644 --- a/source/components/utilities/utdebug.c +++ b/source/components/utilities/utdebug.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 1.108 $ + * $Revision: 1.111 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -530,7 +530,7 @@ AcpiUtValueExit ( AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, - ACPI_HIDWORD (Value), ACPI_LODWORD (Value)); + ACPI_FORMAT_UINT64 (Value)); AcpiGbl_NestingLevel--; } @@ -648,8 +648,7 @@ AcpiUtDumpBuffer ( case DB_WORD_DISPLAY: - ACPI_MOVE_UNALIGNED16_TO_32 (&Temp32, - &Buffer[i + j]); + ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%04X ", Temp32); j += 2; break; @@ -657,8 +656,7 @@ AcpiUtDumpBuffer ( case DB_DWORD_DISPLAY: - ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32, - &Buffer[i + j]); + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%08X ", Temp32); j += 4; break; @@ -666,12 +664,10 @@ AcpiUtDumpBuffer ( case DB_QWORD_DISPLAY: - ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32, - &Buffer[i + j]); + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%08X", Temp32); - ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32, - &Buffer[i + j + 4]); + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j + 4]); AcpiOsPrintf ("%08X ", Temp32); j += 8; break; diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 58bc53928..0160cbadf 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 1.95 $ + * $Revision: 1.99 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +119,7 @@ #include "acpi.h" #include "acinterp.h" #include "acnamesp.h" +#include "acevents.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdelete") @@ -144,6 +145,7 @@ AcpiUtDeleteInternalObj ( void *ObjPointer = NULL; ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *SecondDesc; + ACPI_OPERAND_OBJECT *NextDesc; ACPI_FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object); @@ -208,6 +210,25 @@ AcpiUtDeleteInternalObj ( break; + case ACPI_TYPE_DEVICE: + + if (Object->Device.GpeBlock) + { + (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock); + } + + /* Walk the handler list for this device */ + + HandlerDesc = Object->Device.Handler; + while (HandlerDesc) + { + NextDesc = HandlerDesc->AddressSpace.Next; + AcpiUtRemoveReference (HandlerDesc); + HandlerDesc = NextDesc; + } + break; + + case ACPI_TYPE_MUTEX: ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n", @@ -254,11 +275,15 @@ AcpiUtDeleteInternalObj ( * default handlers -- and therefore, we created the context object * locally, it was not created by an external caller. */ - HandlerDesc = Object->Region.AddrHandler; - if ((HandlerDesc) && - (HandlerDesc->AddrHandler.Hflags == ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) + HandlerDesc = Object->Region.Handler; + if (HandlerDesc) { - ObjPointer = SecondDesc->Extra.RegionContext; + if (HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) + { + ObjPointer = SecondDesc->Extra.RegionContext; + } + + AcpiUtRemoveReference (HandlerDesc); } /* Now we can free the Extra object */ @@ -284,7 +309,6 @@ AcpiUtDeleteInternalObj ( break; } - /* Free any allocated memory (pointer within the object) found above */ if (ObjPointer) @@ -375,7 +399,7 @@ AcpiUtUpdateRefCount ( NewCount = Count; /* - * Reference count action (increment, decrement, or force delete) + * Perform the reference count action (increment, decrement, or force delete) */ switch (Action) { @@ -484,8 +508,6 @@ AcpiUtUpdateObjectReference ( { ACPI_STATUS Status; UINT32 i; - ACPI_OPERAND_OBJECT *Next; - ACPI_OPERAND_OBJECT *New; ACPI_GENERIC_STATE *StateList = NULL; ACPI_GENERIC_STATE *State; @@ -500,9 +522,8 @@ AcpiUtUpdateObjectReference ( return_ACPI_STATUS (AE_OK); } - /* - * Make sure that this isn't a namespace handle - */ + /* Make sure that this isn't a namespace handle */ + if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) { ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object)); @@ -525,30 +546,8 @@ AcpiUtUpdateObjectReference ( { case ACPI_TYPE_DEVICE: - Status = AcpiUtCreateUpdateStateAndPush (Object->Device.AddrHandler, - Action, &StateList); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - AcpiUtUpdateRefCount (Object->Device.SysHandler, Action); - AcpiUtUpdateRefCount (Object->Device.DrvHandler, Action); - break; - - - case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: - - /* Must walk list of address handlers */ - - Next = Object->AddrHandler.Next; - while (Next) - { - New = Next->AddrHandler.Next; - AcpiUtUpdateRefCount (Next, Action); - - Next = New; - } + AcpiUtUpdateRefCount (Object->Device.SystemNotify, Action); + AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action); break; @@ -686,17 +685,15 @@ AcpiUtAddReference ( ACPI_FUNCTION_TRACE_PTR ("UtAddReference", Object); - /* - * Ensure that we have a valid object - */ + /* Ensure that we have a valid object */ + if (!AcpiUtValidInternalObject (Object)) { return_VOID; } - /* - * We have a valid ACPI internal object, now increment the reference count - */ + /* Increment the reference count */ + (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); return_VOID; } @@ -721,6 +718,7 @@ AcpiUtRemoveReference ( ACPI_FUNCTION_TRACE_PTR ("UtRemoveReference", Object); + /* * Allow a NULL pointer to be passed in, just ignore it. This saves * each caller from having to check. Also, ignore NS nodes. @@ -733,9 +731,8 @@ AcpiUtRemoveReference ( return_VOID; } - /* - * Ensure that we have a valid object - */ + /* Ensure that we have a valid object */ + if (!AcpiUtValidInternalObject (Object)) { return_VOID; diff --git a/source/components/utilities/uteval.c b/source/components/utilities/uteval.c index ddf856523..3156c13d0 100644 --- a/source/components/utilities/uteval.c +++ b/source/components/utilities/uteval.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 1.45 $ + * $Revision: 1.50 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -167,7 +167,7 @@ AcpiUtEvaluateObject ( if (Status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", - PrefixNode->Name.Ascii, Path)); + AcpiUtGetNodeName (PrefixNode), Path)); } else { @@ -290,6 +290,47 @@ AcpiUtEvaluateNumericObject ( } +/******************************************************************************* + * + * 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 @@ -329,13 +370,14 @@ AcpiUtExecute_HID ( { /* Convert the Numeric HID to string */ - AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer); + AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value); } else { /* Copy the String HID from the returned object */ - ACPI_STRNCPY (Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer)); + AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer, + sizeof (Hid->Value)); } /* On exit, we must delete the return object */ @@ -345,6 +387,59 @@ AcpiUtExecute_HID ( } +/******************************************************************************* + * + * 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 (ACPI_GET_OBJECT_TYPE (ObjDesc)) + { + 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 @@ -364,57 +459,95 @@ AcpiUtExecute_HID ( ACPI_STATUS AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Cid) + ACPI_COMPATIBLE_ID_LIST **ReturnCidList) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; + UINT32 Count; + UINT32 Size; + ACPI_COMPATIBLE_ID_LIST *CidList; + ACPI_NATIVE_UINT 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); + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, + &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* - * A _CID can return either a single compatible ID or a package of compatible - * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or - * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). - */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + /* Get the number of _CIDs returned */ + + Count = 1; + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) { - case ACPI_TYPE_INTEGER: - - /* Convert the Numeric CID to string */ - - AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Cid->Buffer); - break; - - case ACPI_TYPE_STRING: - - /* Copy the String CID from the returned object */ - - ACPI_STRNCPY (Cid->Buffer, ObjDesc->String.Pointer, sizeof (Cid->Buffer)); - break; - - case ACPI_TYPE_PACKAGE: - - /* TBD: Parse package elements; need different return struct, etc. */ - - Status = AE_SUPPORT; - break; - - default: - - Status = AE_TYPE; - break; + Count = ObjDesc->Package.Count; } - /* On exit, we must delete the return object */ + /* Allocate a worst-case buffer for the _CIDs */ + + Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) + + sizeof (ACPI_COMPATIBLE_ID_LIST)); + + CidList = ACPI_MEM_CALLOCATE ((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: + * -- Number (32 bit compressed EISA ID) or + * -- 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 (ACPI_GET_OBJECT_TYPE (ObjDesc) == 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_MEM_FREE (CidList); + } + else + { + *ReturnCidList = CidList; + } + + /* On exit, we must delete the _CID return object */ AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); @@ -460,13 +593,14 @@ AcpiUtExecute_UID ( { /* Convert the Numeric UID to string */ - AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer); + AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value); } else { /* Copy the String UID from the returned object */ - ACPI_STRNCPY (Uid->Buffer, ObjDesc->String.Pointer, sizeof (Uid->Buffer)); + AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer, + sizeof (Uid->Value)); } /* On exit, we must delete the return object */ @@ -512,7 +646,7 @@ AcpiUtExecute_STA ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_STA on %4.4s was not found, assuming device is present\n", - DeviceNode->Name.Ascii)); + AcpiUtGetNodeName (DeviceNode))); *Flags = 0x0F; Status = AE_OK; diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c index 46bf5e372..19a088105 100644 --- a/source/components/utilities/utglobal.c +++ b/source/components/utilities/utglobal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 1.178 $ + * $Revision: 1.192 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -380,17 +380,17 @@ AcpiUtHexToAsciiChar ( ******************************************************************************/ -ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; +ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES]; -ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = +ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] = { /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}, - /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE}, - /* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}, - /* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE}, + /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE}, + /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}, + /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE}, /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE}, /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}, @@ -439,7 +439,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE}, /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, - /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, 0, 0}, + /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, }; /***************************************************************************** @@ -458,6 +458,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = { +/*! [Begin] no source code translation (keep these ASL Keywords as-is) */ "SystemMemory", "SystemIO", "PCI_Config", @@ -465,7 +466,8 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = "SMBus", "CMOS", "PCIBARTarget", - "DataTable", + "DataTable" +/*! [End] no source code translation !*/ }; @@ -481,7 +483,7 @@ AcpiUtGetRegionName ( else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) { - return ("InvalidSpaceID"); + return ("InvalidSpaceId"); } return ((char *) AcpiGbl_RegionTypes[SpaceId]); @@ -613,13 +615,104 @@ AcpiUtGetObjectTypeName ( } -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +/***************************************************************************** + * + * FUNCTION: AcpiUtGetNodeName + * + * PARAMETERS: Object - A namespace node + * + * RETURN: Pointer to a string + * + * DESCRIPTION: Validate the node and return the node's ACPI name. + * + ****************************************************************************/ +char * +AcpiUtGetNodeName ( + void *Object) +{ + ACPI_NAMESPACE_NODE *Node; + + + if (!Object) + { + return ("NULL NODE"); + } + + Node = (ACPI_NAMESPACE_NODE *) Object; + + if (Node->Descriptor != ACPI_DESC_TYPE_NAMED) + { + return ("****"); + } + + if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii)) + { + return ("----"); + } + + return (Node->Name.Ascii); +} + + +/***************************************************************************** + * + * FUNCTION: AcpiUtGetDescriptorName + * + * PARAMETERS: Object - An ACPI object + * + * RETURN: Pointer to a string + * + * DESCRIPTION: Validate object and return the descriptor type + * + ****************************************************************************/ + +static const char *AcpiGbl_DescTypeNames[] = /* printable names of descriptor types */ +{ + /* 00 */ "Invalid", + /* 01 */ "Cached", + /* 02 */ "State-Generic", + /* 03 */ "State-Update", + /* 04 */ "State-Package", + /* 05 */ "State-Control", + /* 06 */ "State-RootParseScope", + /* 07 */ "State-ParseScope", + /* 08 */ "State-WalkScope", + /* 09 */ "State-Result", + /* 10 */ "State-Notify", + /* 11 */ "State-Thread", + /* 12 */ "Walk", + /* 13 */ "Parser", + /* 14 */ "Operand", + /* 15 */ "Node" +}; + + +char * +AcpiUtGetDescriptorName ( + void *Object) +{ + + if (!Object) + { + return ("NULL OBJECT"); + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) + { + return ((char *) AcpiGbl_BadType); + } + + return ((char *) AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]); + +} + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* * Strings and procedures used for debug only */ - /***************************************************************************** * * FUNCTION: AcpiUtGetMutexName @@ -637,7 +730,7 @@ AcpiUtGetMutexName ( UINT32 MutexId) { - if (MutexId > MAX_MTX) + if (MutexId > MAX_MUTEX) { return ("Invalid Mutex ID"); } @@ -645,7 +738,6 @@ AcpiUtGetMutexName ( return (AcpiGbl_MutexNames[MutexId]); } - #endif @@ -709,9 +801,12 @@ AcpiUtAllocateOwnerId ( OwnerId = AcpiGbl_NextTableOwnerId; AcpiGbl_NextTableOwnerId++; + /* Check for wraparound */ + if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID) { AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID; + ACPI_REPORT_WARNING (("Table owner ID wraparound\n")); } break; @@ -723,6 +818,8 @@ AcpiUtAllocateOwnerId ( if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID) { + /* Check for wraparound */ + AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID; } break; @@ -789,29 +886,31 @@ AcpiUtInitGlobals ( /* ACPI table structure */ - for (i = 0; i < NUM_ACPI_TABLES; i++) + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { - AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i]; - AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i]; - AcpiGbl_AcpiTables[i].Pointer = NULL; - AcpiGbl_AcpiTables[i].Length = 0; - AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED; - AcpiGbl_AcpiTables[i].Count = 0; + AcpiGbl_TableLists[i].Next = NULL; + AcpiGbl_TableLists[i].Count = 0; } /* Mutex locked flags */ - for (i = 0; i < NUM_MTX; i++) + for (i = 0; i < NUM_MUTEX; i++) { - AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; - AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; - AcpiGbl_AcpiMutexInfo[i].UseCount = 0; + AcpiGbl_MutexInfo[i].Mutex = NULL; + AcpiGbl_MutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; + AcpiGbl_MutexInfo[i].UseCount = 0; } + /* GPE support */ + + AcpiGbl_GpeXruptListHead = NULL; + AcpiGbl_GpeFadtBlocks[0] = NULL; + AcpiGbl_GpeFadtBlocks[1] = NULL; + /* Global notify handlers */ - AcpiGbl_SysNotify.Handler = NULL; - AcpiGbl_DrvNotify.Handler = NULL; + AcpiGbl_SystemNotify.Handler = NULL; + AcpiGbl_DeviceNotify.Handler = NULL; AcpiGbl_InitHandler = NULL; /* Global "typed" ACPI table pointers */ @@ -845,8 +944,6 @@ AcpiUtInitGlobals ( /* Hardware oriented */ - AcpiGbl_GpeRegisterInfo = NULL; - AcpiGbl_GpeNumberInfo = NULL; AcpiGbl_EventsInitialized = FALSE; /* Namespace */ diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c index 58dd64e34..f3733418d 100644 --- a/source/components/utilities/utinit.c +++ b/source/components/utilities/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 1.116 $ + * $Revision: 1.118 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -250,20 +250,44 @@ AcpiUtValidateFadt ( * * RETURN: none * - * DESCRIPTION: free memory allocated for table storage. + * DESCRIPTION: free global memory * ******************************************************************************/ void AcpiUtTerminate (void) { + ACPI_GPE_BLOCK_INFO *GpeBlock; + ACPI_GPE_BLOCK_INFO *NextGpeBlock; + ACPI_GPE_XRUPT_INFO *GpeXruptInfo; + ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo; + ACPI_FUNCTION_TRACE ("UtTerminate"); /* Free global tables, etc. */ - /* Nothing to do at this time */ + + /* Free global GPE blocks and related info structures */ + + GpeXruptInfo = AcpiGbl_GpeXruptListHead; + while (GpeXruptInfo) + { + GpeBlock = GpeXruptInfo->GpeBlockListHead; + while (GpeBlock) + { + NextGpeBlock = GpeBlock->Next; + ACPI_MEM_FREE (GpeBlock->EventInfo); + ACPI_MEM_FREE (GpeBlock->RegisterInfo); + ACPI_MEM_FREE (GpeBlock); + + GpeBlock = NextGpeBlock; + } + NextGpeXruptInfo = GpeXruptInfo->Next; + ACPI_MEM_FREE (GpeXruptInfo); + GpeXruptInfo = NextGpeXruptInfo; + } return_VOID; } diff --git a/source/components/utilities/utmath.c b/source/components/utilities/utmath.c index af59ca6dc..a7801de46 100644 --- a/source/components/utilities/utmath.c +++ b/source/components/utilities/utmath.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmath - Integer math support routines - * $Revision: 1.12 $ + * $Revision: 1.13 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index 193fda648..ade980415 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 1.93 $ + * $Revision: 1.99 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -284,13 +284,15 @@ AcpiUtSetIntegerWidth ( if (Revision <= 1) { - AcpiGbl_IntegerBitWidth = 32; - AcpiGbl_IntegerByteWidth = 4; + AcpiGbl_IntegerBitWidth = 32; + AcpiGbl_IntegerNybbleWidth = 8; + AcpiGbl_IntegerByteWidth = 4; } else { - AcpiGbl_IntegerBitWidth = 64; - AcpiGbl_IntegerByteWidth = 8; + AcpiGbl_IntegerBitWidth = 64; + AcpiGbl_IntegerNybbleWidth = 16; + AcpiGbl_IntegerByteWidth = 8; } } @@ -389,7 +391,8 @@ AcpiUtValidAcpiName ( UINT32 Name) { char *NamePtr = (char *) &Name; - UINT32 i; + char Character; + ACPI_NATIVE_UINT i; ACPI_FUNCTION_ENTRY (); @@ -397,9 +400,12 @@ AcpiUtValidAcpiName ( for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (!((NamePtr[i] == '_') || - (NamePtr[i] >= 'A' && NamePtr[i] <= 'Z') || - (NamePtr[i] >= '0' && NamePtr[i] <= '9'))) + Character = *NamePtr; + NamePtr++; + + if (!((Character == '_') || + (Character >= 'A' && Character <= 'Z') || + (Character >= '0' && Character <= '9'))) { return (FALSE); } @@ -656,7 +662,7 @@ AcpiUtMutexInitialize ( /* * Create each of the predefined mutex objects */ - for (i = 0; i < NUM_MTX; i++) + for (i = 0; i < NUM_MUTEX; i++) { Status = AcpiUtCreateMutex (i); if (ACPI_FAILURE (Status)) @@ -665,6 +671,9 @@ AcpiUtMutexInitialize ( } } + + Status = AcpiOsCreateLock (&AcpiGbl_GpeLock); + return_ACPI_STATUS (AE_OK); } @@ -694,11 +703,12 @@ AcpiUtMutexTerminate ( /* * Delete each predefined mutex object */ - for (i = 0; i < NUM_MTX; i++) + for (i = 0; i < NUM_MUTEX; i++) { (void) AcpiUtDeleteMutex (i); } + AcpiOsDeleteLock (AcpiGbl_GpeLock); return_VOID; } @@ -725,17 +735,17 @@ AcpiUtCreateMutex ( ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId); - if (MutexId > MAX_MTX) + if (MutexId > MAX_MUTEX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - if (!AcpiGbl_AcpiMutexInfo[MutexId].Mutex) + if (!AcpiGbl_MutexInfo[MutexId].Mutex) { Status = AcpiOsCreateSemaphore (1, 1, - &AcpiGbl_AcpiMutexInfo[MutexId].Mutex); - AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; - AcpiGbl_AcpiMutexInfo[MutexId].UseCount = 0; + &AcpiGbl_MutexInfo[MutexId].Mutex); + AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; + AcpiGbl_MutexInfo[MutexId].UseCount = 0; } return_ACPI_STATUS (Status); @@ -764,15 +774,15 @@ AcpiUtDeleteMutex ( ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId); - if (MutexId > MAX_MTX) + if (MutexId > MAX_MUTEX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - Status = AcpiOsDeleteSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex); + Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex); - AcpiGbl_AcpiMutexInfo[MutexId].Mutex = NULL; - AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; + AcpiGbl_MutexInfo[MutexId].Mutex = NULL; + AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; return_ACPI_STATUS (Status); } @@ -802,7 +812,7 @@ AcpiUtAcquireMutex ( ACPI_FUNCTION_NAME ("UtAcquireMutex"); - if (MutexId > MAX_MTX) + if (MutexId > MAX_MUTEX) { return (AE_BAD_PARAMETER); } @@ -815,9 +825,9 @@ AcpiUtAcquireMutex ( * the mutex ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = MutexId; i < MAX_MTX; i++) + for (i = MutexId; i < MAX_MUTEX; i++) { - if (AcpiGbl_AcpiMutexInfo[i].OwnerId == ThisThreadId) + if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId) { if (i == MutexId) { @@ -841,15 +851,15 @@ AcpiUtAcquireMutex ( "Thread %X attempting to acquire Mutex [%s]\n", ThisThreadId, AcpiUtGetMutexName (MutexId))); - Status = AcpiOsWaitSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, + Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", ThisThreadId, AcpiUtGetMutexName (MutexId))); - AcpiGbl_AcpiMutexInfo[MutexId].UseCount++; - AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ThisThreadId; + AcpiGbl_MutexInfo[MutexId].UseCount++; + AcpiGbl_MutexInfo[MutexId].OwnerId = ThisThreadId; } else { @@ -891,7 +901,7 @@ AcpiUtReleaseMutex ( "Thread %X releasing Mutex [%s]\n", ThisThreadId, AcpiUtGetMutexName (MutexId))); - if (MutexId > MAX_MTX) + if (MutexId > MAX_MUTEX) { return (AE_BAD_PARAMETER); } @@ -899,7 +909,7 @@ AcpiUtReleaseMutex ( /* * Mutex must be acquired in order to release it! */ - if (AcpiGbl_AcpiMutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED) + if (AcpiGbl_MutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Mutex [%s] is not acquired, cannot release\n", @@ -914,9 +924,9 @@ AcpiUtReleaseMutex ( * ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = MutexId; i < MAX_MTX; i++) + for (i = MutexId; i < MAX_MUTEX; i++) { - if (AcpiGbl_AcpiMutexInfo[i].OwnerId == ThisThreadId) + if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId) { if (i == MutexId) { @@ -933,9 +943,9 @@ AcpiUtReleaseMutex ( /* Mark unlocked FIRST */ - AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; + AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; - Status = AcpiOsSignalSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, 1); + Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1); if (ACPI_FAILURE (Status)) { diff --git a/source/components/utilities/utobject.c b/source/components/utilities/utobject.c index 40c3713ee..84d2d5110 100644 --- a/source/components/utilities/utobject.c +++ b/source/components/utilities/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 1.82 $ + * $Revision: 1.86 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -226,7 +226,7 @@ AcpiUtCreateBufferObject ( ACPI_SIZE BufferSize) { ACPI_OPERAND_OBJECT *BufferDesc; - UINT8 *Buffer; + UINT8 *Buffer = NULL; ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize); @@ -241,15 +241,20 @@ AcpiUtCreateBufferObject ( return_PTR (NULL); } - /* Allocate the actual buffer */ + /* Create an actual buffer only if size > 0 */ - Buffer = ACPI_MEM_CALLOCATE (BufferSize); - if (!Buffer) + if (BufferSize > 0) { - ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n", - (UINT32) BufferSize)); - AcpiUtRemoveReference (BufferDesc); - return_PTR (NULL); + /* Allocate the actual buffer */ + + Buffer = ACPI_MEM_CALLOCATE (BufferSize); + if (!Buffer) + { + ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n", + (UINT32) BufferSize)); + AcpiUtRemoveReference (BufferDesc); + return_PTR (NULL); + } } /* Complete buffer object initialization */ @@ -300,29 +305,10 @@ AcpiUtValidInternalObject ( return (TRUE); - case ACPI_DESC_TYPE_NAMED: - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Obj %p is a named obj, not ACPI obj\n", Object)); - break; - - case ACPI_DESC_TYPE_PARSER: - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Obj %p is a parser obj, not ACPI obj\n", Object)); - break; - - case ACPI_DESC_TYPE_CACHED: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "**** Obj %p has already been released to internal cache\n", Object)); - break; - default: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "**** Obj %p has unknown descriptor type %X\n", Object, - ACPI_GET_DESCRIPTOR_TYPE (Object))); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "%p is not not an ACPI operand obj [%s]\n", + Object, AcpiUtGetDescriptorName (Object))); break; } @@ -401,7 +387,8 @@ AcpiUtDeleteObjectDesc ( if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Obj %p is not an ACPI object\n", Object)); + "%p is not an ACPI Operand object [%s]\n", Object, + AcpiUtGetDescriptorName (Object))); return_VOID; } diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index f9f26d8ff..0a5c8209c 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 1.101 $ + * $Revision: 1.105 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -222,25 +222,9 @@ AcpiEnableSubsystem ( ACPI_FUNCTION_TRACE ("AcpiEnableSubsystem"); - /* - * Install the default OpRegion handlers. These are installed unless - * other handlers have already been installed via the - * InstallAddressSpaceHandler interface - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); - - Status = AcpiEvInitAddressSpaces (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - /* * We must initialize the hardware before we can enable ACPI. - * FADT values are validated here. + * The values from the FADT are validated here. */ if (!(Flags & ACPI_NO_HARDWARE_INIT)) { @@ -254,7 +238,7 @@ AcpiEnableSubsystem ( } /* - * Enable ACPI on this platform + * Enable ACPI mode */ if (!(Flags & ACPI_NO_ACPI_ENABLE)) { @@ -271,8 +255,9 @@ AcpiEnableSubsystem ( } /* - * Note: - * We must have the hardware AND events initialized before we can execute + * Initialize ACPI Event handling + * + * NOTE: We must have the hardware AND events initialized before we can execute * ANY control methods SAFELY. Any control method can require ACPI hardware * support, so the hardware MUST be initialized before execution! */ @@ -287,7 +272,7 @@ AcpiEnableSubsystem ( } } - /* Install SCI handler, Global Lock handler, GPE handlers */ + /* Install the SCI handler, Global Lock handler, and GPE handlers */ if (!(Flags & ACPI_NO_HANDLER_INIT)) { @@ -325,6 +310,43 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE ("AcpiInitializeObjects"); + + /* + * Install the default OpRegion handlers. These are installed unless + * other handlers have already been installed via the + * InstallAddressSpaceHandler interface. + * + * NOTE: This will cause _REG methods to be run. Any objects accessed + * by the _REG methods will be automatically initialized, even if they + * contain executable AML (see call to AcpiNsInitializeObjects below). + */ + if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); + + Status = AcpiEvInitAddressSpaces (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + /* + * Initialize the objects that remain uninitialized. This + * runs the executable AML that may be part of the declaration of these + * objects: OperationRegions, BufferFields, Buffers, and Packages. + */ + if (!(Flags & ACPI_NO_OBJECT_INIT)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Objects\n")); + + Status = AcpiNsInitializeObjects (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + /* * Initialize all device objects in the namespace * This runs the _STA and _INI methods. @@ -340,22 +362,6 @@ AcpiInitializeObjects ( } } - /* - * Initialize the objects that remain uninitialized. This - * runs the executable AML that is part of the declaration of OpRegions - * and Fields. - */ - if (!(Flags & ACPI_NO_OBJECT_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Objects\n")); - - Status = AcpiNsInitializeObjects (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - /* * Empty the caches (delete the cached objects) on the assumption that * the table load filled them up more than they will be at runtime -- @@ -530,10 +536,10 @@ AcpiGetSystemInfo ( /* Current status of the ACPI tables, per table type */ - InfoPtr->NumTableTypes = NUM_ACPI_TABLES; - for (i = 0; i < NUM_ACPI_TABLES; i++) + InfoPtr->NumTableTypes = NUM_ACPI_TABLE_TYPES; + for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { - InfoPtr->TableInfo[i].Count = AcpiGbl_AcpiTables[i].Count; + InfoPtr->TableInfo[i].Count = AcpiGbl_TableLists[i].Count; } return_ACPI_STATUS (AE_OK); diff --git a/source/include/acapps.h b/source/include/acapps.h index 1d2af4754..8e5b85442 100644 --- a/source/include/acapps.h +++ b/source/include/acapps.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -171,16 +171,18 @@ void AdDumpTables (void); ACPI_STATUS -AdGetTables ( +AdGetLocalTables ( char *Filename, BOOLEAN GetAllTables); ACPI_STATUS -AdParseTables (void); +AdParseTable ( + ACPI_TABLE_HEADER *Table); ACPI_STATUS AdDisplayTables ( - char *Filename); + char *Filename, + ACPI_TABLE_HEADER *Table); ACPI_STATUS AdDisplayStatistics (void); diff --git a/source/include/acconfig.h b/source/include/acconfig.h index e52878b08..d3229790a 100644 --- a/source/include/acconfig.h +++ b/source/include/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 1.124 $ + * $Revision: 1.145 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,7 @@ /****************************************************************************** * - * Compile-time options + * Configuration options * *****************************************************************************/ @@ -135,21 +135,9 @@ * */ - -/****************************************************************************** - * - * Subsystem Constants - * - *****************************************************************************/ - - /* Version string */ -#define ACPI_CA_VERSION 0x20021217 - -/* Version of ACPI supported */ - -#define ACPI_CA_SUPPORT_LEVEL 2 +#define ACPI_CA_VERSION 0x20031203 /* Maximum objects in the various object caches */ @@ -159,6 +147,23 @@ #define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ #define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ +/* + * Should the subystem abort the loading of an ACPI table if the + * table checksum is incorrect? + */ +#define ACPI_CHECKSUM_ABORT FALSE + + +/****************************************************************************** + * + * Subsystem Constants + * + *****************************************************************************/ + +/* Version of ACPI supported */ + +#define ACPI_CA_SUPPORT_LEVEL 2 + /* String size constants */ #define ACPI_MAX_STRING_LENGTH 512 @@ -177,20 +182,6 @@ #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 -/****************************************************************************** - * - * Configuration of subsystem behavior - * - *****************************************************************************/ - - -/* - * Should the subystem abort the loading of an ACPI table if the - * table checksum is incorrect? - */ -#define ACPI_CHECKSUM_ABORT FALSE - - /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) @@ -215,6 +206,11 @@ #define ACPI_MAX_STRING_CONVERSION 200 +/* Length of _HID, _UID, and _CID values */ + +#define ACPI_DEVICE_ID_LENGTH 0x09 +#define ACPI_MAX_CID_LENGTH 48 + /* * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG */ @@ -269,7 +265,6 @@ * *****************************************************************************/ - #define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ #define ACPI_DEBUGGER_COMMAND_PROMPT '-' diff --git a/source/include/acdebug.h b/source/include/acdebug.h index b05d4f9f6..e26fea11b 100644 --- a/source/include/acdebug.h +++ b/source/include/acdebug.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 1.66 $ + * $Revision: 1.73 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -142,15 +142,15 @@ typedef struct ArgumentInfo #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ AcpiOsPrintf PARAM_LIST(fp);} -#define EX_NO_SINGLE_STEP 1 -#define EX_SINGLE_STEP 2 +#define EX_NO_SINGLE_STEP 1 +#define EX_SINGLE_STEP 2 /* Prototypes */ /* - * dbapi - external debugger interfaces + * dbxface - external debugger interfaces */ ACPI_STATUS @@ -167,6 +167,15 @@ AcpiDbSingleStep ( ACPI_PARSE_OBJECT *Op, UINT32 OpType); +ACPI_STATUS +AcpiDbStartCommand ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbMethodEnd ( + ACPI_WALK_STATE *WalkState); + /* * dbcmds - debug commands and output routines @@ -242,6 +251,9 @@ void AcpiDbDisplayResources ( char *ObjectArg); +void +AcpiDbDisplayGpes (void); + void AcpiDbCheckIntegrity ( void); @@ -274,6 +286,10 @@ AcpiDbWalkForSpecificObjects ( void *Context, void **ReturnValue); +void +AcpiDbGenerateGpe ( + char *GpeArg, + char *BlockArg); /* * dbdisply - debug display commands @@ -288,10 +304,6 @@ AcpiDbDecodeAndDisplayObject ( char *Target, char *OutputType); -void -AcpiDbDecodeNode ( - ACPI_NAMESPACE_NODE *Node); - void AcpiDbDisplayResultObject ( ACPI_OPERAND_OBJECT *ObjDesc, @@ -301,11 +313,6 @@ ACPI_STATUS AcpiDbDisplayAllMethods ( char *DisplayCountArg); -void -AcpiDbDisplayInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); - void AcpiDbDisplayArguments ( void); @@ -322,6 +329,10 @@ void AcpiDbDisplayCallingTree ( void); +void +AcpiDbDisplayObjectType ( + char *ObjectArg); + void AcpiDbDisplayArgumentObject ( ACPI_OPERAND_OBJECT *ObjDesc, @@ -335,10 +346,6 @@ void * AcpiDbGetPointer ( void *Target); -void -AcpiDbDecodeInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - /* * dbexec - debugger control method execution @@ -373,6 +380,13 @@ void ACPI_SYSTEM_XFACE AcpiDbMethodThread ( void *Context); +ACPI_STATUS +AcpiDbExecutionWalk ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + /* * dbfileio - Debugger file I/O commands @@ -400,8 +414,14 @@ AcpiDbLoadAcpiTable ( char *Filename); ACPI_STATUS -AcpiDbGetAcpiTable ( - char *Filename); +AcpiDbGetTableFromFile ( + char *Filename, + ACPI_TABLE_HEADER **Table); + +ACPI_STATUS +AcpiDbReadTableFromFile ( + char *Filename, + ACPI_TABLE_HEADER **Table); /* * dbhistry - debugger HISTORY command diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 79230493a..441ba71dc 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdisasm.h - AML disassembler - * $Revision: 1.8 $ + * $Revision: 1.11 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -226,10 +226,6 @@ void AcpiDmDecodeInternalObject ( ACPI_OPERAND_OBJECT *ObjDesc); -void -AcpiDmDecodeNode ( - ACPI_NAMESPACE_NODE *Node); - UINT32 AcpiDmBlockType ( ACPI_PARSE_OBJECT *Op); @@ -276,6 +272,34 @@ AcpiDmCommaIfFieldMember ( ACPI_PARSE_OBJECT *Op); +/* + * dmobject + */ + +void +AcpiDmDecodeNode ( + ACPI_NAMESPACE_NODE *Node); + +void +AcpiDmDisplayInternalObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +void +AcpiDmDisplayArguments ( + ACPI_WALK_STATE *WalkState); + +void +AcpiDmDisplayLocals ( + ACPI_WALK_STATE *WalkState); + +void +AcpiDmDumpMethodInfo ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + + /* * dmbuffer */ diff --git a/source/include/acdispat.h b/source/include/acdispat.h index b7acfabc1..3989af0bd 100644 --- a/source/include/acdispat.h +++ b/source/include/acdispat.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 1.56 $ + * $Revision: 1.57 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/include/acevents.h b/source/include/acevents.h index cbf628fda..77b97ca06 100644 --- a/source/include/acevents.h +++ b/source/include/acevents.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 1.81 $ + * $Revision: 1.93 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -164,10 +164,6 @@ ACPI_STATUS AcpiEvInitGlobalLockHandler ( void); -UINT32 -AcpiEvGetGpeRegisterIndex ( - UINT32 GpeNumber); - UINT32 AcpiEvGetGpeNumberIndex ( UINT32 GpeNumber); @@ -186,21 +182,44 @@ AcpiEvNotifyDispatch ( * Evgpe - GPE handling and dispatch */ +ACPI_STATUS +AcpiEvWalkGpeList ( + ACPI_GPE_CALLBACK GpeWalkCallback); + +BOOLEAN +AcpiEvValidGpeEvent ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + +ACPI_GPE_EVENT_INFO * +AcpiEvGetGpeEventInfo ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber); + ACPI_STATUS AcpiEvGpeInitialize ( void); ACPI_STATUS -AcpiEvInitGpeControlMethods ( - void); +AcpiEvCreateGpeBlock ( + ACPI_NAMESPACE_NODE *GpeDevice, + ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT32 RegisterCount, + UINT8 GpeBlockBaseNumber, + UINT32 InterruptLevel, + ACPI_GPE_BLOCK_INFO **ReturnGpeBlock); + +ACPI_STATUS +AcpiEvDeleteGpeBlock ( + ACPI_GPE_BLOCK_INFO *GpeBlock); UINT32 AcpiEvGpeDispatch ( + ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber); UINT32 AcpiEvGpeDetect ( - void); + ACPI_GPE_XRUPT_INFO *GpeXruptList); /* * Evregion - Address Space handling @@ -219,7 +238,7 @@ AcpiEvAddressSpaceDispatch ( void *Value); ACPI_STATUS -AcpiEvAddrHandlerHelper ( +AcpiEvInstallHandler ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, @@ -236,6 +255,17 @@ AcpiEvDetachRegion ( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked); +ACPI_STATUS +AcpiEvExecuteRegMethod ( + ACPI_OPERAND_OBJECT *RegionObj, + UINT32 Function); + +ACPI_STATUS +AcpiEvRegRun ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); /* * Evregini - Region initialization and setup @@ -293,6 +323,10 @@ AcpiEvInitializeRegion ( * Evsci - SCI (System Control Interrupt) handling/dispatch */ +UINT32 ACPI_SYSTEM_XFACE +AcpiEvGpeXruptHandler ( + void *Context); + UINT32 AcpiEvInstallSciHandler ( void); diff --git a/source/include/acexcep.h b/source/include/acexcep.h index 7e641db9b..fcee979f4 100644 --- a/source/include/acexcep.h +++ b/source/include/acexcep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 1.67 $ + * $Revision: 1.70 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -167,8 +167,9 @@ #define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) #define AE_LOGICAL_ADDRESS (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL) #define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL) +#define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL) -#define AE_CODE_ENV_MAX 0x001C +#define AE_CODE_ENV_MAX 0x001D /* * Programmer exceptions @@ -235,6 +236,7 @@ #define AE_AML_NO_RESOURCE_END_TAG (ACPI_STATUS) (0x001E | AE_CODE_AML) #define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001F | AE_CODE_AML) #define AE_AML_CIRCULAR_REFERENCE (ACPI_STATUS) (0x0020 | AE_CODE_AML) +#define AE_AML_BAD_RESOURCE_LENGTH (ACPI_STATUS) (0x0021 | AE_CODE_AML) #define AE_CODE_AML_MAX 0x0020 @@ -292,7 +294,8 @@ char const *AcpiGbl_ExceptionNames_Env[] = "AE_NO_HARDWARE_RESPONSE", "AE_NO_GLOBAL_LOCK", "AE_LOGICAL_ADDRESS", - "AE_ABORT_METHOD" + "AE_ABORT_METHOD", + "AE_SAME_HANDLER" }; char const *AcpiGbl_ExceptionNames_Pgm[] = @@ -351,7 +354,8 @@ char const *AcpiGbl_ExceptionNames_Aml[] = "AE_AML_ALIGNMENT", "AE_AML_NO_RESOURCE_END_TAG", "AE_AML_BAD_RESOURCE_VALUE", - "AE_AML_CIRCULAR_REFERENCE" + "AE_AML_CIRCULAR_REFERENCE", + "AE_AML_BAD_RESOURCE_LENGTH" }; char const *AcpiGbl_ExceptionNames_Ctrl[] = diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 11ee12d78..d8ed31070 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 1.136 $ + * $Revision: 1.145 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -178,6 +178,12 @@ ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS; */ ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth; ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; +ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; + +/* Keep local copies of these FADT-based registers */ + +ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; +ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; /* * Since there may be multiple SSDTs and PSDTS, a single pointer is not @@ -188,15 +194,15 @@ ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; /* * ACPI Table info arrays */ -extern ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; -extern ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES]; +extern ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES]; +extern ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES]; /* * Predefined mutex objects. This array contains the * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. * (The table maps local handles to the real OS handles) */ -ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_AcpiMutexInfo [NUM_MTX]; +ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[NUM_MUTEX]; /***************************************************************************** @@ -207,8 +213,8 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_AcpiMutexInfo [NUM_MTX]; ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS]; -ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DrvNotify; -ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify; +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify; +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify; ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore; @@ -273,7 +279,7 @@ ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; ****************************************************************************/ -ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList; +ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList; /* Control method single step flag */ @@ -286,7 +292,7 @@ ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; * ****************************************************************************/ -ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot; +ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot; /***************************************************************************** * @@ -307,22 +313,9 @@ ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; - -ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeObjHandle; -ACPI_EXTERN UINT32 AcpiGbl_GpeRegisterCount; -ACPI_EXTERN UINT32 AcpiGbl_GpeNumberMax; -ACPI_EXTERN ACPI_GPE_REGISTER_INFO *AcpiGbl_GpeRegisterInfo; -ACPI_EXTERN ACPI_GPE_NUMBER_INFO *AcpiGbl_GpeNumberInfo; -ACPI_EXTERN ACPI_GPE_BLOCK_INFO AcpiGbl_GpeBlockInfo[ACPI_MAX_GPE_BLOCKS]; - -/* - * GPE translation table - * Indexed by the GPE number, returns a valid index into the global GPE tables. - * - * This table is needed because the GPE numbers supported by block 1 do not - * have to be contiguous with the GPE numbers supported by block 0. - */ -ACPI_EXTERN ACPI_GPE_INDEX_INFO *AcpiGbl_GpeNumberToIndex; +ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; +ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; +ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeLock; /***************************************************************************** diff --git a/source/include/achware.h b/source/include/achware.h index 0bb4c3c76..e0cdbaee2 100644 --- a/source/include/achware.h +++ b/source/include/achware.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 1.61 $ + * $Revision: 1.68 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -171,50 +171,54 @@ ACPI_STATUS AcpiHwLowLevelRead ( UINT32 Width, UINT32 *Value, - ACPI_GENERIC_ADDRESS *Reg, - UINT32 Offset); + ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS AcpiHwLowLevelWrite ( UINT32 Width, UINT32 Value, - ACPI_GENERIC_ADDRESS *Reg, - UINT32 Offset); + ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS AcpiHwClearAcpiStatus ( - void); + UINT32 Flags); /* GPE support */ -UINT8 -AcpiHwGetGpeBitMask ( - UINT32 GpeNumber); - ACPI_STATUS AcpiHwEnableGpe ( - UINT32 GpeNumber); + ACPI_GPE_EVENT_INFO *GpeEventInfo); void AcpiHwEnableGpeForWakeup ( - UINT32 GpeNumber); + ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS AcpiHwDisableGpe ( - UINT32 GpeNumber); + ACPI_GPE_EVENT_INFO *GpeEventInfo); + +ACPI_STATUS +AcpiHwDisableGpeBlock ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock); void AcpiHwDisableGpeForWakeup ( - UINT32 GpeNumber); + ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS AcpiHwClearGpe ( - UINT32 GpeNumber); + ACPI_GPE_EVENT_INFO *GpeEventInfo); + +ACPI_STATUS +AcpiHwClearGpeBlock ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock); ACPI_STATUS AcpiHwGetGpeStatus ( - UINT32 GpeNumber, + ACPI_GPE_EVENT_INFO *GpeEventInfo, ACPI_EVENT_STATUS *EventStatus); ACPI_STATUS diff --git a/source/include/acinterp.h b/source/include/acinterp.h index 7a429ddc3..9f2d3f0da 100644 --- a/source/include/acinterp.h +++ b/source/include/acinterp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 1.145 $ + * $Revision: 1.147 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -237,15 +237,17 @@ void AcpiExGetBufferDatum( ACPI_INTEGER *Datum, void *Buffer, + UINT32 BufferLength, UINT32 ByteGranularity, - UINT32 Offset); + UINT32 BufferOffset); void AcpiExSetBufferDatum ( ACPI_INTEGER MergedDatum, void *Buffer, + UINT32 BufferLength, UINT32 ByteGranularity, - UINT32 Offset); + UINT32 BufferOffset); ACPI_STATUS AcpiExReadDataFromField ( diff --git a/source/include/aclocal.h b/source/include/aclocal.h index bff65655c..aa20de8de 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 1.186 $ + * $Revision: 1.198 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,7 @@ #define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ -typedef void* ACPI_MUTEX; +typedef void * ACPI_MUTEX; typedef UINT32 ACPI_MUTEX_HANDLE; @@ -160,8 +160,8 @@ typedef UINT32 ACPI_MUTEX_HANDLE; #define ACPI_MTX_DEBUG_CMD_COMPLETE 11 #define ACPI_MTX_DEBUG_CMD_READY 12 -#define MAX_MTX 12 -#define NUM_MTX MAX_MTX+1 +#define MAX_MUTEX 12 +#define NUM_MUTEX MAX_MUTEX+1 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) @@ -214,12 +214,8 @@ typedef struct acpi_mutex_info typedef UINT16 ACPI_OWNER_ID; #define ACPI_OWNER_TYPE_TABLE 0x0 #define ACPI_OWNER_TYPE_METHOD 0x1 -#define ACPI_FIRST_METHOD_ID 0x0000 -#define ACPI_FIRST_TABLE_ID 0x8000 - -/* TBD: [Restructure] get rid of the need for this! */ - -#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0x8000 +#define ACPI_FIRST_METHOD_ID 0x0001 +#define ACPI_FIRST_TABLE_ID 0xF000 /* Field access granularities */ @@ -257,8 +253,8 @@ typedef enum typedef union acpi_name_union { - UINT32 Integer; - char Ascii[4]; + UINT32 Integer; + char Ascii[4]; } ACPI_NAME_UNION; @@ -271,7 +267,7 @@ typedef struct acpi_namespace_node union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */ - struct acpi_namespace_node *Child; /* first child */ + struct acpi_namespace_node *Child; /* First child */ struct acpi_namespace_node *Peer; /* Next peer*/ UINT16 ReferenceCount; /* Current count of references and children */ UINT8 Flags; @@ -308,7 +304,6 @@ typedef struct acpi_table_desc UINT64 PhysicalAddress; UINT32 AmlLength; ACPI_SIZE Length; - UINT32 Count; ACPI_OWNER_ID TableId; UINT8 Type; UINT8 Allocation; @@ -316,6 +311,13 @@ typedef struct acpi_table_desc } ACPI_TABLE_DESC; +typedef struct acpi_table_list +{ + struct acpi_table_desc *Next; + UINT32 Count; + +} ACPI_TABLE_LIST; + typedef struct acpi_find_context { @@ -390,53 +392,65 @@ typedef struct acpi_create_field_info * ****************************************************************************/ -/* Information about each GPE register block */ +/* Information about a GPE, one per each GPE in an array */ -typedef struct acpi_gpe_block_info +typedef struct acpi_gpe_event_info { - ACPI_GENERIC_ADDRESS *BlockAddress; - UINT16 RegisterCount; - UINT8 BlockBaseNumber; + ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ + ACPI_GPE_HANDLER Handler; /* Address of handler, if any */ + void *Context; /* Context to be passed to handler */ + struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ + UINT8 Flags; /* Level or Edge */ + UINT8 BitMask; /* This GPE within the register */ -} ACPI_GPE_BLOCK_INFO; +} ACPI_GPE_EVENT_INFO; -/* Information about a particular GPE register pair */ +/* Information about a GPE register pair, one per each status/enable pair in an array */ typedef struct acpi_gpe_register_info { - ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ - ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ - UINT8 Status; /* Current value of status reg */ - UINT8 Enable; /* Current value of enable reg */ - UINT8 WakeEnable; /* Mask of bits to keep enabled when sleeping */ - UINT8 BaseGpeNumber; /* Base GPE number for this register */ + ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ + ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ + UINT8 Status; /* Current value of status reg */ + UINT8 Enable; /* Current value of enable reg */ + UINT8 WakeEnable; /* Mask of bits to keep enabled when sleeping */ + UINT8 BaseGpeNumber; /* Base GPE number for this register */ } ACPI_GPE_REGISTER_INFO; - -#define ACPI_GPE_LEVEL_TRIGGERED 1 -#define ACPI_GPE_EDGE_TRIGGERED 2 - - -/* Information about each particular GPE level */ - -typedef struct acpi_gpe_number_info +/* + * Information about a GPE register block, one per each installed block -- + * GPE0, GPE1, and one per each installed GPE Block Device. + */ +typedef struct acpi_gpe_block_info { - ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ - ACPI_GPE_HANDLER Handler; /* Address of handler, if any */ - void *Context; /* Context to be passed to handler */ - UINT8 Type; /* Level or Edge */ - UINT8 BitMask; + struct acpi_gpe_block_info *Previous; + struct acpi_gpe_block_info *Next; + struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */ + ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */ + ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */ + ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */ + UINT32 RegisterCount; /* Number of register pairs in block */ + UINT8 BlockBaseNumber;/* Base GPE number for this block */ +} ACPI_GPE_BLOCK_INFO; -} ACPI_GPE_NUMBER_INFO; +/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ - -typedef struct acpi_gpe_index_info +typedef struct acpi_gpe_xrupt_info { - UINT8 NumberIndex; + struct acpi_gpe_xrupt_info *Previous; + struct acpi_gpe_xrupt_info *Next; + ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */ + UINT32 InterruptLevel; /* System interrupt level */ + +} ACPI_GPE_XRUPT_INFO; + + +typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock); -} ACPI_GPE_INDEX_INFO; /* Information about each particular fixed event */ @@ -447,7 +461,6 @@ typedef struct acpi_fixed_event_handler } ACPI_FIXED_EVENT_HANDLER; - typedef struct acpi_fixed_event_info { UINT8 StatusRegisterId; @@ -558,10 +571,10 @@ typedef struct acpi_scope_state typedef struct acpi_pscope_state { ACPI_STATE_COMMON - union acpi_parse_object *Op; /* current op being parsed */ - UINT8 *ArgEnd; /* current argument end */ - UINT8 *PkgEnd; /* current package end */ - UINT32 ArgList; /* next argument to parse */ + union acpi_parse_object *Op; /* Current op being parsed */ + UINT8 *ArgEnd; /* Current argument end */ + UINT8 *PkgEnd; /* Current package end */ + UINT32 ArgList; /* Next argument to parse */ UINT32 ArgCount; /* Number of fixed arguments */ } ACPI_PSCOPE_STATE; @@ -673,11 +686,8 @@ typedef struct acpi_opcode_info typedef union acpi_parse_value { - ACPI_INTEGER Integer; /* integer constant (Up to 64 bits) */ + ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */ UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */ - UINT32 Integer32; /* integer constant, 32 bits only */ - UINT16 Integer16; /* integer constant, 16 bits only */ - UINT8 Integer8; /* integer constant, 8 bits only */ UINT32 Size; /* bytelist or field size */ char *String; /* NULL terminated string */ UINT8 *Buffer; /* buffer or string */ @@ -691,15 +701,15 @@ typedef union acpi_parse_value UINT8 DataType; /* To differentiate various internal objs */\ UINT8 Flags; /* Type of Op */\ UINT16 AmlOpcode; /* AML opcode */\ - UINT32 AmlOffset; /* offset of declaration in AML */\ - union acpi_parse_object *Parent; /* parent op */\ - union acpi_parse_object *Next; /* next op */\ + UINT32 AmlOffset; /* Offset of declaration in AML */\ + union acpi_parse_object *Parent; /* Parent op */\ + union acpi_parse_object *Next; /* Next op */\ ACPI_DISASM_ONLY_MEMBERS (\ UINT8 DisasmFlags; /* Used during AML disassembly */\ UINT8 DisasmOpcode; /* Subtype used for disassembly */\ - char AmlOpName[16]) /* op name (debug only) */\ - /* NON-DEBUG members below: */\ - ACPI_NAMESPACE_NODE *Node; /* for use by interpreter */\ + char AmlOpName[16]) /* Op name (debug only) */\ + /* NON-DEBUG members below: */\ + ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ @@ -739,10 +749,7 @@ typedef struct acpi_parse_obj_named typedef struct acpi_parse_obj_asl { ACPI_PARSE_COMMON - union acpi_parse_object *Child; - - union acpi_parse_object *ParentMethod; char *Filename; char *ExternalName; @@ -786,14 +793,14 @@ typedef union acpi_parse_object typedef struct acpi_parse_state { UINT32 AmlSize; - UINT8 *AmlStart; /* first AML byte */ - UINT8 *Aml; /* next AML byte */ + UINT8 *AmlStart; /* First AML byte */ + UINT8 *Aml; /* Next AML byte */ UINT8 *AmlEnd; /* (last + 1) AML byte */ - UINT8 *PkgStart; /* current package begin */ - UINT8 *PkgEnd; /* current package end */ - union acpi_parse_object *StartOp; /* root of parse tree */ + UINT8 *PkgStart; /* Current package begin */ + UINT8 *PkgEnd; /* Current package end */ + union acpi_parse_object *StartOp; /* Root of parse tree */ struct acpi_namespace_node *StartNode; - union acpi_generic_state *Scope; /* current scope */ + union acpi_generic_state *Scope; /* Current scope */ union acpi_parse_object *StartScope; } ACPI_PARSE_STATE; @@ -955,17 +962,6 @@ typedef struct acpi_bit_register_info #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A -/* String version of device HIDs and UIDs */ - -#define ACPI_DEVICE_ID_LENGTH 0x09 - -typedef struct acpi_device_id -{ - char Buffer[ACPI_DEVICE_ID_LENGTH]; - -} ACPI_DEVICE_ID; - - /***************************************************************************** * * Miscellaneous diff --git a/source/include/acmacros.h b/source/include/acmacros.h index 0440037cc..1be4be768 100644 --- a/source/include/acmacros.h +++ b/source/include/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 1.137 $ + * $Revision: 1.148 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -121,7 +121,6 @@ /* * Data manipulation macros */ - #define ACPI_LOWORD(l) ((UINT16)(UINT32)(l)) #define ACPI_HIWORD(l) ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF)) #define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l)) @@ -167,10 +166,18 @@ #endif #endif - /* - * Extract a byte of data using a pointer. Any more than a byte and we - * get into potential aligment issues -- see the STORE macros below - */ +/* + * printf() format helpers + */ + +/* Split 64-bit integer into two 32-bit values. Use with %8,8X%8.8X */ + +#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) + +/* + * Extract a byte of data using a pointer. Any more than a byte and we + * get into potential aligment issues -- see the STORE macros below + */ #define ACPI_GET8(addr) (*(UINT8*)(addr)) /* Pointer arithmetic */ @@ -189,7 +196,7 @@ #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) #if ACPI_MACHINE_WIDTH == 16 -#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_UNALIGNED32_TO_32(d,s) +#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) #define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i) #else @@ -202,49 +209,175 @@ * If the hardware supports the transfer of unaligned data, just do the store. * Otherwise, we have to move one byte at a time. */ +#ifdef ACPI_BIG_ENDIAN +/* + * Macros for big-endian machines + */ -#ifdef _HW_ALIGNMENT_SUPPORT +/* This macro sets a buffer index, starting from the end of the buffer */ -/* The hardware supports unaligned transfers, just do the move */ +#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) ((BufLen) - (((BufOffset)+1) * (ByteGran))) -#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) -#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) +/* These macros reverse the bytes during the move, converting little-endian to big endian */ + + /* Big Endian <== Little Endian */ + /* Hi...Lo Lo...Hi */ +/* 16-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\ + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];} + +#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d))=0;\ + ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ + ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} + +#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\ + ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ + ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} + +/* 32-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ + +#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\ + (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ + (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} + +#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\ + ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ + ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ + ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ + ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} + +/* 64-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ + +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ + +#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\ + (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\ + (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\ + (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ + (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ + (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ + (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} +#else +/* + * Macros for little-endian machines + */ + +/* This macro sets a buffer index, starting from the beginning of the buffer */ + +#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) (BufOffset) + +#ifdef ACPI_MISALIGNED_TRANSFERS + +/* The hardware supports unaligned transfers, just do the little-endian move */ + +#if ACPI_MACHINE_WIDTH == 16 + +/* No 64-bit integers */ +/* 16-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s) + +/* 32-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) +#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) + +/* 64-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) + +#else +/* 16-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_16_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s) + +/* 32-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) +#define ACPI_MOVE_32_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s) + +/* 64-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) +#endif #else /* * The hardware does not support unaligned transfers. We must move the * data one byte at a time. These macros work whether the source or - * the destination (or both) is/are unaligned. + * the destination (or both) is/are unaligned. (Little-endian move) */ -#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ - ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} +/* 16-bit source, 16/32/64 destination */ -#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ - ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ - ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ - ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];} +#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} -#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(void *)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);} +#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} +#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} -#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ - ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ - ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ - ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\ - ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\ - ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\ - ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\ - ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];} +/* 32-bit source, 16/32/64 destination */ +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ + +#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ + (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ + (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];} + +#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);} + +/* 64-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ + (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ + (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\ + (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\ + (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\ + (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\ + (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];} +#endif +#endif + +/* Macros based on machine integer width */ + +#if ACPI_MACHINE_WIDTH == 16 +#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) + +#elif ACPI_MACHINE_WIDTH == 32 +#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) + +#elif ACPI_MACHINE_WIDTH == 64 +#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s) + +#else +#error unknown ACPI_MACHINE_WIDTH #endif /* * Fast power-of-two math macros for non-optimized compilers */ - #define _ACPI_DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2))) #define _ACPI_MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2))) #define _ACPI_MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1))) @@ -305,21 +438,6 @@ #if ACPI_MACHINE_WIDTH != 16 -#define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000 -#define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000 -#define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF - -/* - * Obsolete - */ - -/* -#define ACPI_PCI_FUNCTION(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_FUNCTION_MASK)) >> 16)) -#define ACPI_PCI_DEVICE(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_DEVICE_MASK)) >> 32)) -#define ACPI_PCI_REGISTER(a) (UINT16) (((UINT64)((UINT64)(a) & ACPI_PCI_REGISTER_MASK))) -*/ - - #define ACPI_PCI_DEVICE(a) (UINT16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF) #define ACPI_PCI_FUNCTION(a) (UINT16) ((ACPI_LODWORD ((a))) >> 16) #define ACPI_PCI_REGISTER(a) (UINT16) ((ACPI_LODWORD ((a))) & 0x0000FFFF) @@ -400,38 +518,16 @@ #define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) -/* - * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions) - * - * 1) Address space - * 2) Length in bytes -- convert to length in bits - * 3) Bit offset is zero - * 4) Reserved field is zero - * 5) Expand address to 64 bits - */ -#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) do {a.AddressSpaceId = (UINT8) d;\ - a.RegisterBitWidth = (UINT8) ACPI_MUL_8 (b);\ - a.RegisterBitOffset = 0;\ - a.Reserved = 0;\ - ACPI_STORE_ADDRESS (a.Address,(ACPI_PHYSICAL_ADDRESS) c);} while (0) - -/* ACPI V1.0 entries -- address space is always I/O */ - -#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c) ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ACPI_ADR_SPACE_SYSTEM_IO) - - /* * Reporting macros that are never compiled out */ - -#define ACPI_PARAM_LIST(pl) pl +#define ACPI_PARAM_LIST(pl) pl /* * Error reporting. These versions add callers module and line#. Since * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only * use it in debug mode. */ - #ifdef ACPI_DEBUG_OUTPUT #define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \ @@ -470,7 +566,6 @@ /* * Debug macros that are conditionally compiled */ - #ifdef ACPI_DEBUG_OUTPUT #define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; @@ -480,22 +575,21 @@ * The first parameter should be the procedure name as a quoted string. This is declared * as a local string ("_ProcName) so that it can be also used by the function exit macros below. */ +#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \ + _Dbg.ComponentId = _COMPONENT; \ + _Dbg.ProcName = a; \ + _Dbg.ModuleName = _THIS_MODULE; -#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \ - _Dbg.ComponentId = _COMPONENT; \ - _Dbg.ProcName = a; \ - _Dbg.ModuleName = _THIS_MODULE; +#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ + AcpiUtTrace(__LINE__,&_Dbg) +#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ + AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b) +#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ + AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b) +#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ + AcpiUtTraceStr(__LINE__,&_Dbg,(char *)b) -#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a)\ - AcpiUtTrace(__LINE__,&_Dbg) -#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a)\ - AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b) -#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a)\ - AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b) -#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a)\ - AcpiUtTraceStr(__LINE__,&_Dbg,(char *)b) - -#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr() +#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr() /* * Function exit tracing. @@ -542,7 +636,6 @@ /* * Generate INT3 on ACPI_ERROR (Debug only!) */ - #define ACPI_ERROR_BREAK #ifdef ACPI_ERROR_BREAK #define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \ @@ -557,7 +650,6 @@ * 1) Debug print for the current component is enabled * 2) Debug error level or trace level for the print statement is enabled */ - #define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl) #define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl) @@ -567,7 +659,6 @@ * This is the non-debug case -- make everything go away, * leaving no executable debug code! */ - #define ACPI_MODULE_NAME(name) #define _THIS_MODULE "" @@ -642,7 +733,6 @@ /* * Memory allocation tracking (DEBUG ONLY) */ - #ifndef ACPI_DBG_TRACK_ALLOCATIONS /* Memory allocation */ diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 05fc64d87..288e4480e 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 1.133 $ + * $Revision: 1.135 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -274,6 +274,11 @@ AcpiNsCompareNames ( char *Name1, char *Name2); +void +AcpiNsRemoveReference ( + ACPI_NAMESPACE_NODE *Node); + + /* * Namespace modification - nsmodify */ diff --git a/source/include/acobject.h b/source/include/acobject.h index 1329bff69..fac337803 100644 --- a/source/include/acobject.h +++ b/source/include/acobject.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 1.118 $ + * $Revision: 1.123 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -185,9 +185,9 @@ * Common fields for objects that support ASL notifications */ #define ACPI_COMMON_NOTIFY_INFO \ - union acpi_operand_object *SysHandler; /* Handler for system notifies */\ - union acpi_operand_object *DrvHandler; /* Handler for driver notifies */\ - union acpi_operand_object *AddrHandler; /* Handler for Address space */ + union acpi_operand_object *SystemNotify; /* Handler for system notifies */\ + union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\ + union acpi_operand_object *Handler; /* Handler for Address space */ /****************************************************************************** @@ -295,7 +295,7 @@ typedef struct acpi_object_region ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId; - union acpi_operand_object *AddrHandler; /* Handler for system notifies */ + union acpi_operand_object *Handler; /* Handler for region access */ ACPI_NAMESPACE_NODE *Node; /* containing object */ union acpi_operand_object *Next; UINT32 Length; @@ -322,6 +322,7 @@ typedef struct acpi_object_device { ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO + ACPI_GPE_BLOCK_INFO *GpeBlock; } ACPI_OBJECT_DEVICE; @@ -542,8 +543,8 @@ typedef union acpi_operand_object ACPI_OBJECT_BUFFER_FIELD BufferField; ACPI_OBJECT_BANK_FIELD BankField; ACPI_OBJECT_INDEX_FIELD IndexField; - ACPI_OBJECT_NOTIFY_HANDLER NotifyHandler; - ACPI_OBJECT_ADDR_HANDLER AddrHandler; + ACPI_OBJECT_NOTIFY_HANDLER Notify; + ACPI_OBJECT_ADDR_HANDLER AddressSpace; ACPI_OBJECT_REFERENCE Reference; ACPI_OBJECT_EXTRA Extra; ACPI_OBJECT_DATA Data; @@ -561,21 +562,22 @@ typedef union acpi_operand_object /* Object descriptor types */ -#define ACPI_DESC_TYPE_CACHED 0x11 /* Used only when object is cached */ -#define ACPI_DESC_TYPE_STATE 0x20 -#define ACPI_DESC_TYPE_STATE_UPDATE 0x21 -#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22 -#define ACPI_DESC_TYPE_STATE_CONTROL 0x23 -#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24 -#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25 -#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26 -#define ACPI_DESC_TYPE_STATE_RESULT 0x27 -#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28 -#define ACPI_DESC_TYPE_STATE_THREAD 0x29 -#define ACPI_DESC_TYPE_WALK 0x44 -#define ACPI_DESC_TYPE_PARSER 0x66 -#define ACPI_DESC_TYPE_OPERAND 0x88 -#define ACPI_DESC_TYPE_NAMED 0xAA +#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ +#define ACPI_DESC_TYPE_STATE 0x02 +#define ACPI_DESC_TYPE_STATE_UPDATE 0x03 +#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 +#define ACPI_DESC_TYPE_STATE_CONTROL 0x05 +#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06 +#define ACPI_DESC_TYPE_STATE_PSCOPE 0x07 +#define ACPI_DESC_TYPE_STATE_WSCOPE 0x08 +#define ACPI_DESC_TYPE_STATE_RESULT 0x09 +#define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A +#define ACPI_DESC_TYPE_STATE_THREAD 0x0B +#define ACPI_DESC_TYPE_WALK 0x0C +#define ACPI_DESC_TYPE_PARSER 0x0D +#define ACPI_DESC_TYPE_OPERAND 0x0E +#define ACPI_DESC_TYPE_NAMED 0x0F +#define ACPI_DESC_TYPE_MAX 0x0F typedef union acpi_descriptor diff --git a/source/include/acoutput.h b/source/include/acoutput.h index a9a338bfb..ccc1a8d54 100644 --- a/source/include/acoutput.h +++ b/source/include/acoutput.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 1.93 $ + * $Revision: 1.94 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/include/acparser.h b/source/include/acparser.h index ee2fc8cf6..49a539240 100644 --- a/source/include/acparser.h +++ b/source/include/acparser.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 1.65 $ + * $Revision: 1.66 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/include/acpi.h b/source/include/acpi.h index 293270890..572eac19b 100644 --- a/source/include/acpi.h +++ b/source/include/acpi.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acpi.h - Master include file, Publics and external data. - * $Revision: 1.56 $ + * $Revision: 1.57 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h index 42e51a163..fc1dae6a3 100644 --- a/source/include/acpiosxf.h +++ b/source/include/acpiosxf.h @@ -12,7 +12,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -150,19 +150,6 @@ typedef struct acpi_signal_fatal_info } ACPI_SIGNAL_FATAL_INFO; -/* - * Types specific to the OS service interfaces - */ - -typedef UINT32 -(ACPI_SYSTEM_XFACE *OSD_HANDLER) ( - void *Context); - -typedef void -(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) ( - void *Context); - - /* * OSL Initialization and shutdown primitives */ @@ -185,6 +172,11 @@ AcpiOsGetRootPointer ( UINT32 Flags, ACPI_POINTER *Address); +ACPI_STATUS +AcpiOsPredefinedOverride ( + const ACPI_PREDEFINED_NAMES *InitVal, + ACPI_STRING *NewVal); + ACPI_STATUS AcpiOsTableOverride ( ACPI_TABLE_HEADER *ExistingTable, @@ -216,6 +208,24 @@ AcpiOsSignalSemaphore ( ACPI_HANDLE Handle, UINT32 Units); +ACPI_STATUS +AcpiOsCreateLock ( + ACPI_HANDLE *OutHandle); + +void +AcpiOsDeleteLock ( + ACPI_HANDLE Handle); + +void +AcpiOsAcquireLock ( + ACPI_HANDLE Handle, + UINT32 Flags); + +void +AcpiOsReleaseLock ( + ACPI_HANDLE Handle, + UINT32 Flags); + /* * Memory allocation and mapping @@ -293,13 +303,13 @@ AcpiOsStall ( ACPI_STATUS AcpiOsReadPort ( ACPI_IO_ADDRESS Address, - void *Value, + UINT32 *Value, UINT32 Width); ACPI_STATUS AcpiOsWritePort ( ACPI_IO_ADDRESS Address, - ACPI_INTEGER Value, + UINT32 Value, UINT32 Width); @@ -310,13 +320,13 @@ AcpiOsWritePort ( ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, - void *Value, + UINT32 *Value, UINT32 Width); ACPI_STATUS AcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS Address, - ACPI_INTEGER Value, + UINT32 Value, UINT32 Width); @@ -354,12 +364,12 @@ AcpiOsDerivePciId( BOOLEAN AcpiOsReadable ( void *Pointer, - UINT32 Length); + ACPI_SIZE Length); BOOLEAN AcpiOsWritable ( void *Pointer, - UINT32 Length); + ACPI_SIZE Length); UINT32 AcpiOsGetTimer ( @@ -398,6 +408,30 @@ AcpiOsGetLine ( char *Buffer); +/* + * Directory manipulation + */ + +void * +AcpiOsOpenDirectory ( + char *Pathname, + char *WildcardSpec, + char RequestedFileType); + +/* RequesteFileType values */ + +#define REQUEST_FILE_ONLY 0 +#define REQUEST_DIR_ONLY 1 + + +char * +AcpiOsGetNextFilename ( + void *DirHandle); + +void +AcpiOsCloseDirectory ( + void *DirHandle); + /* * Debug */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index e7b4cb52f..d836f58b9 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -240,7 +240,7 @@ AcpiWalkNamespace ( UINT32 MaxDepth, ACPI_WALK_CALLBACK UserFunction, void *Context, - void * *ReturnValue); + void **ReturnValue); ACPI_STATUS AcpiGetDevices ( @@ -300,8 +300,8 @@ AcpiEvaluateObjectTyped ( ACPI_STATUS AcpiGetObjectInfo ( - ACPI_HANDLE Device, - ACPI_DEVICE_INFO *Info); + ACPI_HANDLE Handle, + ACPI_BUFFER *ReturnBuffer); ACPI_STATUS AcpiGetNextObject ( @@ -365,6 +365,7 @@ AcpiRemoveAddressSpaceHandler ( ACPI_STATUS AcpiInstallGpeHandler ( + ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, ACPI_GPE_HANDLER Handler, @@ -381,36 +382,76 @@ AcpiReleaseGlobalLock ( ACPI_STATUS AcpiRemoveGpeHandler ( + ACPI_HANDLE GpeDevice, UINT32 GpeNumber, ACPI_GPE_HANDLER Handler); ACPI_STATUS AcpiEnableEvent ( - UINT32 AcpiEvent, - UINT32 Type, + UINT32 Event, UINT32 Flags); ACPI_STATUS AcpiDisableEvent ( - UINT32 AcpiEvent, - UINT32 Type, + UINT32 Event, UINT32 Flags); ACPI_STATUS AcpiClearEvent ( - UINT32 AcpiEvent, - UINT32 Type); + UINT32 Event); ACPI_STATUS AcpiGetEventStatus ( - UINT32 AcpiEvent, - UINT32 Type, + UINT32 Event, ACPI_EVENT_STATUS *EventStatus); +ACPI_STATUS +AcpiEnableGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Flags); + +ACPI_STATUS +AcpiDisableGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Flags); + +ACPI_STATUS +AcpiClearGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Flags); + +ACPI_STATUS +AcpiGetGpeStatus ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Flags, + ACPI_EVENT_STATUS *EventStatus); + +ACPI_STATUS +AcpiInstallGpeBlock ( + ACPI_HANDLE GpeDevice, + ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT32 RegisterCount, + UINT32 InterruptLevel); + +ACPI_STATUS +AcpiRemoveGpeBlock ( + ACPI_HANDLE GpeDevice); + + /* * Resource interfaces */ +typedef +ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) ( + ACPI_RESOURCE *Resource, + void *Context); + + ACPI_STATUS AcpiGetCurrentResources( ACPI_HANDLE DeviceHandle, @@ -421,6 +462,13 @@ AcpiGetPossibleResources( ACPI_HANDLE DeviceHandle, ACPI_BUFFER *RetBuffer); +ACPI_STATUS +AcpiWalkResources ( + ACPI_HANDLE DeviceHandle, + char *Path, + ACPI_WALK_RESOURCE_CALLBACK UserFunction, + void *Context); + ACPI_STATUS AcpiSetCurrentResources ( ACPI_HANDLE DeviceHandle, @@ -431,6 +479,10 @@ AcpiGetIrqRoutingTable ( ACPI_HANDLE BusDeviceHandle, ACPI_BUFFER *RetBuffer); +ACPI_STATUS +AcpiResourceToAddress64 ( + ACPI_RESOURCE *Resource, + ACPI_RESOURCE_ADDRESS64 *Out); /* * Hardware (ACPI device) interfaces @@ -470,6 +522,10 @@ ACPI_STATUS AcpiEnterSleepState ( UINT8 SleepState); +ACPI_STATUS +AcpiEnterSleepStateS4bios ( + void); + ACPI_STATUS AcpiLeaveSleepState ( UINT8 SleepState); diff --git a/source/include/acresrc.h b/source/include/acresrc.h index 55a04596b..ac3a3bf8f 100644 --- a/source/include/acresrc.h +++ b/source/include/acresrc.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acresrc.h - Resource Manager function prototypes - * $Revision: 1.35 $ + * $Revision: 1.38 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -139,6 +139,12 @@ AcpiRsGetPrsMethodData ( ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer); +ACPI_STATUS +AcpiRsGetMethodData ( + ACPI_HANDLE Handle, + char *Path, + ACPI_BUFFER *RetBuffer); + ACPI_STATUS AcpiRsSetSrsMethodData ( ACPI_HANDLE Handle, diff --git a/source/include/acstruct.h b/source/include/acstruct.h index c428167ac..d1c0c6900 100644 --- a/source/include/acstruct.h +++ b/source/include/acstruct.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acstruct.h - Internal structs - * $Revision: 1.25 $ + * $Revision: 1.27 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -164,11 +164,12 @@ typedef struct acpi_walk_state struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ union acpi_operand_object **CallerReturnDesc; ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ + struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */ struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ struct acpi_namespace_node *MethodCallNode; /* Called method Node*/ ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */ - struct acpi_namespace_node *MethodNode; /* Method Node if running a method */ + struct acpi_namespace_node *MethodNode; /* Method node if running a method. */ ACPI_PARSE_OBJECT *Op; /* Current parser op */ union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ diff --git a/source/include/actables.h b/source/include/actables.h index fa05e36bb..1d406dd73 100644 --- a/source/include/actables.h +++ b/source/include/actables.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actables.h - ACPI table management - * $Revision: 1.44 $ + * $Revision: 1.46 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -230,7 +230,7 @@ AcpiTbMatchSignature ( ACPI_STATUS AcpiTbRecognizeTable ( ACPI_TABLE_DESC *TableInfo, - UINT8 SearchType); + UINT8 SearchType); ACPI_STATUS AcpiTbInitTableDescriptor ( @@ -243,11 +243,11 @@ AcpiTbInitTableDescriptor ( */ void -AcpiTbDeleteAcpiTables ( +AcpiTbDeleteAllTables ( void); void -AcpiTbDeleteAcpiTable ( +AcpiTbDeleteTablesByType ( ACPI_TABLE_TYPE Type); void @@ -258,10 +258,6 @@ ACPI_TABLE_DESC * AcpiTbUninstallTable ( ACPI_TABLE_DESC *TableDesc); -void -AcpiTbFreeAcpiTablesOfType ( - ACPI_TABLE_DESC *TableInfo); - /* * tbrsd - RSDP, RSDT utilities diff --git a/source/include/actbl.h b/source/include/actbl.h index 46be60123..542140c40 100644 --- a/source/include/actbl.h +++ b/source/include/actbl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl.h - Table data structures defined in ACPI specification - * $Revision: 1.56 $ + * $Revision: 1.64 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -138,16 +138,6 @@ #define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ -/* values of Mapic.Model */ - -#define DUAL_PIC 0 -#define MULTIPLE_APIC 1 - -/* values of Type in APIC_HEADER */ - -#define APIC_PROC 0 -#define APIC_IO 1 - /* * Common table types. The base code can remain @@ -162,8 +152,10 @@ #pragma pack(1) /* - * Architecture-independent tables - * The architecture dependent tables are in separate files + * ACPI Version-independent tables + * + * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) + * are in separate files. */ typedef struct rsdp_descriptor /* Root System Descriptor Pointer */ { @@ -180,21 +172,6 @@ typedef struct rsdp_descriptor /* Root System Descriptor Pointer */ } RSDP_DESCRIPTOR; -typedef struct acpi_table_header /* ACPI common table header */ -{ - char Signature [4]; /* ACPI signature (4 ASCII characters) */ - UINT32 Length; /* Length of table, in bytes, including header */ - UINT8 Revision; /* ACPI Specification minor version # */ - UINT8 Checksum; /* To make sum of entire table == 0 */ - char OemId [6]; /* OEM identification */ - char OemTableId [8]; /* OEM table identification */ - UINT32 OemRevision; /* OEM revision number */ - char AslCompilerId [4]; /* ASL compiler vendor ID */ - UINT32 AslCompilerRevision; /* ASL compiler revision number */ - -} ACPI_TABLE_HEADER; - - typedef struct acpi_common_facs /* Common FACS for internal use */ { UINT32 *GlobalLock; @@ -204,64 +181,214 @@ typedef struct acpi_common_facs /* Common FACS for internal use */ } ACPI_COMMON_FACS; -typedef struct /* APIC Table */ +#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ + char Signature [4]; /* ACPI signature (4 ASCII characters) */\ + UINT32 Length; /* Length of table, in bytes, including header */\ + UINT8 Revision; /* ACPI Specification minor version # */\ + UINT8 Checksum; /* To make sum of entire table == 0 */\ + char OemId [6]; /* OEM identification */\ + char OemTableId [8]; /* OEM table identification */\ + UINT32 OemRevision; /* OEM revision number */\ + char AslCompilerId [4]; /* ASL compiler vendor ID */\ + UINT32 AslCompilerRevision; /* ASL compiler revision number */ + + +typedef struct acpi_table_header /* ACPI common table header */ { - ACPI_TABLE_HEADER Header; /* ACPI table header */ - UINT32 LocalApicAddress; /* Physical address for accessing local APICs */ - UINT32_BIT PCATCompat : 1; /* a one indicates system also has dual 8259s */ + ACPI_TABLE_HEADER_DEF + +} ACPI_TABLE_HEADER; + + +/* + * MADT values and structures + */ + +/* Values for MADT PCATCompat */ + +#define DUAL_PIC 0 +#define MULTIPLE_APIC 1 + + +/* Master MADT */ + +typedef struct multiple_apic_table +{ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + UINT32 LocalApicAddress; /* Physical address of local APIC */ + UINT32_BIT PCATCompat : 1; /* A one indicates system also has dual 8259s */ UINT32_BIT Reserved1 : 31; -} APIC_TABLE; +} MULTIPLE_APIC_TABLE; -typedef struct /* APIC Header */ +/* Values for Type in APIC_HEADER_DEF */ + +#define APIC_PROCESSOR 0 +#define APIC_IO 1 +#define APIC_XRUPT_OVERRIDE 2 +#define APIC_NMI 3 +#define APIC_LOCAL_NMI 4 +#define APIC_ADDRESS_OVERRIDE 5 +#define APIC_IO_SAPIC 6 +#define APIC_LOCAL_SAPIC 7 +#define APIC_XRUPT_SOURCE 8 +#define APIC_RESERVED 9 /* 9 and greater are reserved */ + +/* + * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) + */ +#define APIC_HEADER_DEF /* Common APIC sub-structure header */\ + UINT8 Type; \ + UINT8 Length; + +typedef struct apic_header { - UINT8 Type; /* APIC type. Either APIC_PROC or APIC_IO */ - UINT8 Length; /* Length of APIC structure */ + APIC_HEADER_DEF } APIC_HEADER; +/* Values for MPS INTI flags */ -typedef struct /* Processor APIC */ +#define POLARITY_CONFORMS 0 +#define POLARITY_ACTIVE_HIGH 1 +#define POLARITY_RESERVED 2 +#define POLARITY_ACTIVE_LOW 3 + +#define TRIGGER_CONFORMS 0 +#define TRIGGER_EDGE 1 +#define TRIGGER_RESERVED 2 +#define TRIGGER_LEVEL 3 + +/* Common flag definitions */ + +#define MPS_INTI_FLAGS \ + UINT16_BIT Polarity : 2; /* Polarity of APIC I/O input signals */\ + UINT16_BIT TriggerMode : 2; /* Trigger mode of APIC input signals */\ + UINT16_BIT Reserved1 : 12; /* Reserved, must be zero */ + +#define LOCAL_APIC_FLAGS \ + UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */\ + UINT32_BIT Reserved2 : 31; /* Reserved, must be zero */ + +/* Sub-structures for MADT */ + +typedef struct madt_processor_apic { - APIC_HEADER Header; - UINT8 ProcessorApicId; /* ACPI processor id */ + APIC_HEADER_DEF + UINT8 ProcessorId; /* ACPI processor id */ UINT8 LocalApicId; /* Processor's local APIC id */ - UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */ - UINT32_BIT Reserved1 : 31; + LOCAL_APIC_FLAGS -} PROCESSOR_APIC; +} MADT_PROCESSOR_APIC; - -typedef struct /* IO APIC */ +typedef struct madt_io_apic { - APIC_HEADER Header; + APIC_HEADER_DEF UINT8 IoApicId; /* I/O APIC ID */ UINT8 Reserved; /* Reserved - must be zero */ - UINT32 IoApicAddress; /* APIC's physical address */ - UINT32 Vector; /* Interrupt vector index where INTI + UINT32 Address; /* APIC physical address */ + UINT32 Interrupt; /* Global system interrupt where INTI * lines start */ -} IO_APIC; +} MADT_IO_APIC; - -/* - * IA64 TBD: Add SAPIC Tables - */ - -/* - * IA64 TBD: Modify Smart Battery Description to comply with ACPI IA64 - * extensions. - */ -typedef struct /* Smart Battery Description Table */ +typedef struct madt_interrupt_override { - ACPI_TABLE_HEADER Header; + APIC_HEADER_DEF + UINT8 Bus; /* 0 - ISA */ + UINT8 Source; /* Interrupt source (IRQ) */ + UINT32 Interrupt; /* Global system interrupt */ + MPS_INTI_FLAGS + +} MADT_INTERRUPT_OVERRIDE; + +typedef struct madt_nmi_source +{ + APIC_HEADER_DEF + MPS_INTI_FLAGS + UINT32 Interrupt; /* Global system interrupt */ + +} MADT_NMI_SOURCE; + +typedef struct madt_local_apic_nmi +{ + APIC_HEADER_DEF + UINT8 ProcessorId; /* ACPI processor id */ + MPS_INTI_FLAGS + UINT8 Lint; /* LINTn to which NMI is connected */ + +} MADT_LOCAL_APIC_NMI; + +typedef struct madt_address_override +{ + APIC_HEADER_DEF + UINT16 Reserved; /* Reserved - must be zero */ + UINT64 Address; /* APIC physical address */ + +} MADT_ADDRESS_OVERRIDE; + +typedef struct madt_io_sapic +{ + APIC_HEADER_DEF + UINT8 IoSapicId; /* I/O SAPIC ID */ + UINT8 Reserved; /* Reserved - must be zero */ + UINT32 InterruptBase; /* Glocal interrupt for SAPIC start */ + UINT64 Address; /* SAPIC physical address */ + +} MADT_IO_SAPIC; + +typedef struct madt_local_sapic +{ + APIC_HEADER_DEF + UINT8 ProcessorId; /* ACPI processor id */ + UINT8 LocalSapicId; /* SAPIC ID */ + UINT8 LocalSapicEid; /* SAPIC EID */ + UINT8 Reserved [3]; /* Reserved - must be zero */ + LOCAL_APIC_FLAGS + +} MADT_LOCAL_SAPIC; + +typedef struct madt_interrupt_source +{ + APIC_HEADER_DEF + MPS_INTI_FLAGS + UINT8 InterruptType; /* 1=PMI, 2=INIT, 3=corrected */ + UINT8 ProcessorId; /* Processor ID */ + UINT8 ProcessorEid; /* Processor EID */ + UINT8 IoSapicVector; /* Vector value for PMI interrupts */ + UINT32 Interrupt; /* Global system interrupt */ + UINT32 Reserved; /* Reserved - must be zero */ + +} MADT_INTERRUPT_SOURCE; + + +/* + * Smart Battery + */ +typedef struct smart_battery_table +{ + ACPI_TABLE_HEADER_DEF UINT32 WarningLevel; UINT32 LowLevel; UINT32 CriticalLevel; -} SMART_BATTERY_DESCRIPTION_TABLE; +} SMART_BATTERY_TABLE; +/* + * High performance timer + */ +typedef struct hpet_table +{ + ACPI_TABLE_HEADER_DEF + UINT32 HardwareId; + UINT32 BaseAddress [3]; + UINT8 HpetNumber; + UINT16 ClockTick; + UINT8 Attributes; + +} HPET_TABLE; + #pragma pack() @@ -283,12 +410,12 @@ typedef struct /* Smart Battery Description Table */ #define ACPI_TABLE_ROOT 0x00 #define ACPI_TABLE_PRIMARY 0x10 #define ACPI_TABLE_SECONDARY 0x20 -#define ACPI_TABLE_OTHER 0x30 +#define ACPI_TABLE_ALL 0x30 #define ACPI_TABLE_TYPE_MASK 0x30 /* Data about each known table type */ -typedef struct _AcpiTableSupport +typedef struct acpi_table_support { char *Name; char *Signature; @@ -300,9 +427,10 @@ typedef struct _AcpiTableSupport /* - * Get the architecture-specific tables + * Get the ACPI version-specific tables */ #include "actbl1.h" /* Acpi 1.0 table definitions */ #include "actbl2.h" /* Acpi 2.0 table definitions */ + #endif /* __ACTBL_H__ */ diff --git a/source/include/actbl1.h b/source/include/actbl1.h index c15c38044..7fe0caa0e 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl1.h - ACPI 1.0 tables - * $Revision: 1.26 $ + * $Revision: 1.28 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -124,7 +124,7 @@ */ typedef struct rsdt_descriptor_rev1 { - ACPI_TABLE_HEADER Header; /* ACPI Table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 TableOffsetEntry [1]; /* Array of pointers to other */ /* ACPI tables */ } RSDT_DESCRIPTOR_REV1; @@ -152,7 +152,7 @@ typedef struct facs_descriptor_rev1 */ typedef struct fadt_descriptor_rev1 { - ACPI_TABLE_HEADER Header; /* ACPI Table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 FirmwareCtrl; /* Physical address of FACS */ UINT32 Dsdt; /* Physical address of DSDT */ UINT8 Model; /* System Interrupt Model */ diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 64eae0e9b..de34f5a6c 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl2.h - ACPI Specification Revision 2.0 Tables - * $Revision: 1.32 $ + * $Revision: 1.35 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. * All rights reserved. * * 2. License @@ -144,7 +144,7 @@ */ typedef struct rsdt_descriptor_rev2 { - ACPI_TABLE_HEADER Header; /* ACPI table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 TableOffsetEntry [1]; /* Array of pointers to */ /* ACPI table headers */ } RSDT_DESCRIPTOR_REV2; @@ -155,7 +155,7 @@ typedef struct rsdt_descriptor_rev2 */ typedef struct xsdt_descriptor_rev2 { - ACPI_TABLE_HEADER Header; /* ACPI table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT64 TableOffsetEntry [1]; /* Array of pointers to */ /* ACPI table headers */ } XSDT_DESCRIPTOR_REV2; @@ -199,7 +199,7 @@ typedef struct acpi_generic_address */ typedef struct fadt_descriptor_rev2 { - ACPI_TABLE_HEADER Header; /* ACPI table header */ + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */ UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */ UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ @@ -271,6 +271,20 @@ typedef struct fadt_descriptor_rev2 } FADT_DESCRIPTOR_REV2; +/* Embedded Controller */ + +typedef struct ec_boot_resources +{ + ACPI_TABLE_HEADER_DEF + ACPI_GENERIC_ADDRESS EcControl; /* Address of EC command/status register */ + ACPI_GENERIC_ADDRESS EcData; /* Address of EC data register */ + UINT32 Uid; /* Unique ID - must be same as the EC _UID method */ + UINT8 GpeBit; /* The GPE for the EC */ + UINT8 EcId[1]; /* Full namepath of the EC in the ACPI namespace */ + +} EC_BOOT_RESOURCES; + + #pragma pack() #endif /* __ACTBL2_H__ */