diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/contrib/dev/acpica/dbcmds.c | 705 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dbfileio.c | 81 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dbxface.c | 108 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dmopcode.c | 22 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hwregs.c | 118 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hwsleep.c | 116 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/uteval.c | 55 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utglobal.c | 260 |
8 files changed, 968 insertions, 497 deletions
diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index ded7af5..f9a8ef3 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/dbcmds.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -132,16 +132,61 @@ #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbcmds") +/* Local prototypes */ + +static ACPI_STATUS +AcpiDbIntegrityWalk ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +static ACPI_STATUS +AcpiDbWalkAndMatchName ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +static ACPI_STATUS +AcpiDbWalkForReferences ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +static ACPI_STATUS +AcpiDbWalkForSpecificObjects ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +static ACPI_NAMESPACE_NODE * +AcpiDbConvertToNode ( + char *InString); + +static void +AcpiDmCompareAmlResources ( + UINT8 *Aml1Buffer, + ACPI_RSDESC_SIZE Aml1BufferLength, + UINT8 *Aml2Buffer, + ACPI_RSDESC_SIZE Aml2BufferLength); + +static ACPI_STATUS +AcpiDmTestResourceConversion ( + ACPI_NAMESPACE_NODE *Node, + char *Name); + /* * Arguments for the Objects command * These object types map directly to the ACPI_TYPES */ - static ARGUMENT_INFO AcpiDbObjectTypes [] = { {"ANY"}, - {"NUMBERS"}, + {"INTEGERS"}, {"STRINGS"}, {"BUFFERS"}, {"PACKAGES"}, @@ -162,6 +207,64 @@ static ARGUMENT_INFO AcpiDbObjectTypes [] = /******************************************************************************* * + * FUNCTION: AcpiDbConvertToNode + * + * PARAMETERS: InString - String to convert + * + * RETURN: Pointer to a NS node + * + * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or + * alpha strings. + * + ******************************************************************************/ + +static ACPI_NAMESPACE_NODE * +AcpiDbConvertToNode ( + char *InString) +{ + ACPI_NAMESPACE_NODE *Node; + + + if ((*InString >= 0x30) && (*InString <= 0x39)) + { + /* Numeric argument, convert */ + + Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16)); + if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) + { + AcpiOsPrintf ("Address %p is invalid in this address space\n", + Node); + return (NULL); + } + + /* Make sure pointer is valid NS node */ + + if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n", + Node, AcpiUtGetDescriptorName (Node)); + return (NULL); + } + } + else + { + /* Alpha argument */ + /* The parameter is a name string that must be resolved to a + * Named obj + */ + Node = AcpiDbLocalNsLookup (InString); + if (!Node) + { + Node = AcpiGbl_RootNode; + } + } + + return (Node); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbSleep * * PARAMETERS: ObjectArg - Desired sleep state (0-5) @@ -222,7 +325,7 @@ AcpiDbSleep ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbWalkForReferences ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, @@ -296,7 +399,8 @@ AcpiDbFindReferences ( ******************************************************************************/ void -AcpiDbDisplayLocks (void) +AcpiDbDisplayLocks ( + void) { UINT32 i; @@ -304,7 +408,7 @@ AcpiDbDisplayLocks (void) for (i = 0; i < MAX_MUTEX; i++) { AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i), - AcpiGbl_MutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED + AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED ? "Locked" : "Unlocked"); } } @@ -442,7 +546,8 @@ AcpiDbSetMethodBreakpoint ( Address = ACPI_STRTOUL (Location, NULL, 16); if (Address <= Op->Common.AmlOffset) { - AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->Common.AmlOffset); + AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", + Address, Op->Common.AmlOffset); } /* Save breakpoint in current walk */ @@ -524,7 +629,7 @@ AcpiDbDisassembleAml ( * * FUNCTION: AcpiDbDisassembleMethod * - * PARAMETERS: Method - Name of control method + * PARAMETERS: Name - Name of control method * * RETURN: None * @@ -544,7 +649,7 @@ AcpiDbDisassembleMethod ( ACPI_NAMESPACE_NODE *Method; - Method = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ACPI_STRTOUL (Name, NULL, 16)); + Method = AcpiDbConvertToNode (Name); if (!Method) { return (AE_BAD_PARAMETER); @@ -577,9 +682,12 @@ AcpiDbDisassembleMethod ( /* Parse the AML */ WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; + WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; Status = AcpiPsParseAml (WalkState); +#ifdef ACPI_DISASSEMBLER AcpiDmDisassemble (NULL, Op, 0); +#endif AcpiPsDeleteParseTree (Op); return (AE_OK); } @@ -612,34 +720,10 @@ AcpiDbDumpNamespace ( if (StartArg) { - /* Check if numeric argument, must be a Node */ - - if ((StartArg[0] >= 0x30) && (StartArg[0] <= 0x39)) - { - SubtreeEntry = ACPI_TO_POINTER (ACPI_STRTOUL (StartArg, NULL, 16)); - if (!AcpiOsReadable (SubtreeEntry, sizeof (ACPI_NAMESPACE_NODE))) - { - AcpiOsPrintf ("Address %p is invalid in this address space\n", SubtreeEntry); - return; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (SubtreeEntry) != ACPI_DESC_TYPE_NAMED) - { - AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n", - SubtreeEntry, AcpiUtGetDescriptorName (SubtreeEntry)); - return; - } - } - else + SubtreeEntry = AcpiDbConvertToNode (StartArg); + if (!SubtreeEntry) { - /* Alpha argument */ - /* The parameter is a name string that must be resolved to a Named obj*/ - - SubtreeEntry = AcpiDbLocalNsLookup (StartArg); - if (!SubtreeEntry) - { - SubtreeEntry = AcpiGbl_RootNode; - } + return; } /* Now we can check for the depth argument */ @@ -651,12 +735,14 @@ AcpiDbDumpNamespace ( } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("ACPI Namespace (from %p subtree):\n", SubtreeEntry); + AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", + ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); /* Display the subtree */ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, ACPI_UINT32_MAX, SubtreeEntry); + AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, + ACPI_OWNER_ID_MAX, SubtreeEntry); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); } @@ -681,10 +767,10 @@ AcpiDbDumpNamespaceByOwner ( { ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode; UINT32 MaxDepth = ACPI_UINT32_MAX; - UINT16 OwnerId; + ACPI_OWNER_ID OwnerId; - OwnerId = (UINT16) ACPI_STRTOUL (OwnerArg, NULL, 0); + OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0); /* Now we can check for the depth argument */ @@ -699,7 +785,8 @@ AcpiDbDumpNamespaceByOwner ( /* Display the subtree */ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, SubtreeEntry); + AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, + SubtreeEntry); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); } @@ -729,7 +816,7 @@ AcpiDbSendNotify ( /* Translate name to an Named object */ - Node = AcpiDbLocalNsLookup (Name); + Node = AcpiDbConvertToNode (Name); if (!Node) { return; @@ -785,23 +872,39 @@ AcpiDbSetMethodData ( ACPI_WALK_STATE *WalkState; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; /* Validate TypeArg */ - ACPI_STRUPR (TypeArg); + AcpiUtStrupr (TypeArg); Type = TypeArg[0]; if ((Type != 'L') && - (Type != 'A')) + (Type != 'A') && + (Type != 'N')) { AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg); return; } + Value = ACPI_STRTOUL (ValueArg, NULL, 16); + + if (Type == 'N') + { + Node = AcpiDbConvertToNode (IndexArg); + if (Node->Type != ACPI_TYPE_INTEGER) + { + AcpiOsPrintf ("Can only set Integer nodes\n"); + return; + } + ObjDesc = Node->Object; + ObjDesc->Integer.Value = Value; + return; + } + /* Get the index and value */ Index = ACPI_STRTOUL (IndexArg, NULL, 16); - Value = ACPI_STRTOUL (ValueArg, NULL, 16); WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); if (!WalkState) @@ -835,7 +938,8 @@ AcpiDbSetMethodData ( return; } - Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState); + Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, + WalkState); if (ACPI_FAILURE (Status)) { return; @@ -857,7 +961,8 @@ AcpiDbSetMethodData ( return; } - Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState); + Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, + WalkState); if (ACPI_FAILURE (Status)) { return; @@ -887,19 +992,19 @@ AcpiDbSetMethodData ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbWalkForSpecificObjects ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue) { - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; + ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; ACPI_BUFFER Buffer; + ACPI_STATUS Status; - ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle); + Info->Count++; /* Get and display the full pathname to this object */ @@ -914,50 +1019,9 @@ AcpiDbWalkForSpecificObjects ( AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); ACPI_MEM_FREE (Buffer.Pointer); - /* Display short information about the object */ + /* Dump short info about the object */ - if (ObjDesc) - { - AcpiOsPrintf (" %p/%p", ObjHandle, ObjDesc); - - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) - { - case ACPI_TYPE_METHOD: - AcpiOsPrintf (" #Args %d Concurrency %X", - ObjDesc->Method.ParamCount, ObjDesc->Method.Concurrency); - break; - - case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" Value %8.8X%8.8X", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - case ACPI_TYPE_STRING: - AcpiOsPrintf (" \"%s\"", ObjDesc->String.Pointer); - break; - - case ACPI_TYPE_REGION: - AcpiOsPrintf (" SpaceId %X Length %X Address %8.8X%8.8X", - ObjDesc->Region.SpaceId, - ObjDesc->Region.Length, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address)); - break; - - case ACPI_TYPE_PACKAGE: - AcpiOsPrintf (" #Elements %X", ObjDesc->Package.Count); - break; - - case ACPI_TYPE_BUFFER: - AcpiOsPrintf (" Length %X", ObjDesc->Buffer.Length); - break; - - default: - /* Ignore other object types */ - break; - } - } - - AcpiOsPrintf ("\n"); + (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL); return (AE_OK); } @@ -980,6 +1044,7 @@ AcpiDbDisplayObjects ( char *ObjTypeArg, char *DisplayCountArg) { + ACPI_WALK_INFO Info; ACPI_OBJECT_TYPE Type; @@ -993,15 +1058,25 @@ AcpiDbDisplayObjects ( } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n", + AcpiOsPrintf ( + "Objects of type [%s] defined in the current ACPI Namespace:\n", AcpiUtGetTypeName (Type)); AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); + Info.Count = 0; + Info.OwnerId = ACPI_OWNER_ID_MAX; + Info.DebugLevel = ACPI_UINT32_MAX; + Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; + /* Walk the namespace from the root */ (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForSpecificObjects, (void *) &Type, NULL); + AcpiDbWalkForSpecificObjects, (void *) &Info, NULL); + + AcpiOsPrintf ( + "\nFound %u objects of type [%s] in the current ACPI Namespace\n", + Info.Count, AcpiUtGetTypeName (Type)); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return (AE_OK); @@ -1021,7 +1096,7 @@ AcpiDbDisplayObjects ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbWalkAndMatchName ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, @@ -1032,6 +1107,7 @@ AcpiDbWalkAndMatchName ( char *RequestedName = (char *) Context; UINT32 i; ACPI_BUFFER Buffer; + ACPI_WALK_INFO Info; /* Check for a name match */ @@ -1059,8 +1135,12 @@ AcpiDbWalkAndMatchName ( } else { - AcpiOsPrintf ("%32s (%p) - %s\n", (char *) Buffer.Pointer, ObjHandle, - AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type)); + Info.OwnerId = ACPI_OWNER_ID_MAX; + Info.DebugLevel = ACPI_UINT32_MAX; + Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; + + AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); + (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL); ACPI_MEM_FREE (Buffer.Pointer); } @@ -1094,6 +1174,7 @@ AcpiDbFindNameInNamespace ( /* Walk the namespace from the root */ + AcpiUtStrupr (NameArg); (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbWalkAndMatchName, NameArg, NULL); @@ -1135,7 +1216,8 @@ AcpiDbSetScope ( { /* Validate new scope from the root */ - Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode, ACPI_NS_NO_UPSEARCH, &Node); + Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode, + ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -1148,7 +1230,8 @@ AcpiDbSetScope ( { /* Validate new scope relative to old scope */ - Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode, ACPI_NS_NO_UPSEARCH, &Node); + Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode, + ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -1164,7 +1247,179 @@ AcpiDbSetScope ( ErrorExit: - AcpiOsPrintf ("Could not attach scope: %s, %s\n", Name, AcpiFormatException (Status)); + AcpiOsPrintf ("Could not attach scope: %s, %s\n", + Name, AcpiFormatException (Status)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmCompareAmlResources + * + * PARAMETERS: Aml1Buffer - Contains first resource list + * Aml1BufferLength - Length of first resource list + * Aml2Buffer - Contains second resource list + * Aml2BufferLength - Length of second resource list + * + * RETURN: None + * + * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in + * order to isolate a miscompare to an individual resource) + * + ******************************************************************************/ + +static void +AcpiDmCompareAmlResources ( + UINT8 *Aml1Buffer, + ACPI_RSDESC_SIZE Aml1BufferLength, + UINT8 *Aml2Buffer, + ACPI_RSDESC_SIZE Aml2BufferLength) +{ + UINT8 *Aml1; + UINT8 *Aml2; + ACPI_RSDESC_SIZE Aml1Length; + ACPI_RSDESC_SIZE Aml2Length; + ACPI_RSDESC_SIZE Offset = 0; + UINT8 ResourceType; + UINT32 Count = 0; + + + /* Compare overall buffer sizes (may be different due to size rounding) */ + + if (Aml1BufferLength != Aml2BufferLength) + { + AcpiOsPrintf ( + "**** Buffer length mismatch in converted AML: original %X new %X ****\n", + Aml1BufferLength, Aml2BufferLength); + } + + Aml1 = Aml1Buffer; + Aml2 = Aml2Buffer; + + /* Walk the descriptor lists, comparing each descriptor */ + + while (Aml1 < (Aml1Buffer + Aml1BufferLength)) + { + /* Get the lengths of each descriptor */ + + Aml1Length = AcpiUtGetDescriptorLength (Aml1); + Aml2Length = AcpiUtGetDescriptorLength (Aml2); + ResourceType = AcpiUtGetResourceType (Aml1); + + /* Check for descriptor length match */ + + if (Aml1Length != Aml2Length) + { + AcpiOsPrintf ( + "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n", + Count, ResourceType, Offset, Aml1Length, Aml2Length); + return; + } + + /* Check for descriptor byte match */ + + if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length)) + { + AcpiOsPrintf ( + "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", + Count, ResourceType, Offset); + } + + /* Exit on EndTag descriptor */ + + if (ResourceType == ACPI_RESOURCE_NAME_END_TAG) + { + return; + } + + /* Point to next descriptor in each buffer */ + + Count++; + Offset += Aml1Length; + Aml1 += Aml1Length; + Aml2 += Aml1Length; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmTestResourceConversion + * + * PARAMETERS: Node - Parent device node + * Name - resource method name (_CRS) + * + * RETURN: Status + * + * DESCRIPTION: Compare the original AML with a conversion of the AML to + * internal resource list, then back to AML. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmTestResourceConversion ( + ACPI_NAMESPACE_NODE *Node, + char *Name) +{ + ACPI_STATUS Status; + ACPI_BUFFER ReturnObj; + ACPI_BUFFER ResourceObj; + ACPI_BUFFER NewAml; + ACPI_OBJECT *OriginalAml; + + + AcpiOsPrintf ("Resource Conversion Comparison:\n"); + + NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + + /* Get the original _CRS AML resource template */ + + Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not obtain %s: %s\n", + Name, AcpiFormatException (Status)); + return (Status); + } + + /* Get the AML resource template, converted to internal resource structs */ + + Status = AcpiGetCurrentResources (Node, &ResourceObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", + AcpiFormatException (Status)); + goto Exit1; + } + + /* Convert internal resource list to external AML resource template */ + + Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n", + AcpiFormatException (Status)); + goto Exit2; + } + + /* Compare original AML to the newly created AML resource list */ + + OriginalAml = ReturnObj.Pointer; + + AcpiDmCompareAmlResources ( + OriginalAml->Buffer.Pointer, OriginalAml->Buffer.Length, + NewAml.Pointer, NewAml.Length); + + /* Cleanup and exit */ + + ACPI_MEM_FREE (NewAml.Pointer); +Exit2: + ACPI_MEM_FREE (ResourceObj.Pointer); +Exit1: + ACPI_MEM_FREE (ReturnObj.Pointer); + return (Status); } @@ -1186,7 +1441,7 @@ AcpiDbDisplayResources ( { #if ACPI_MACHINE_WIDTH != 16 - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_BUFFER ReturnObj; @@ -1196,71 +1451,94 @@ AcpiDbDisplayResources ( /* Convert string to object pointer */ - ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); + Node = AcpiDbConvertToNode (ObjectArg); + if (!Node) + { + return; + } /* Prepare for a return object of arbitrary size */ - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; /* _PRT */ AcpiOsPrintf ("Evaluating _PRT\n"); - Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj); + /* Check if _PRT exists */ + + Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiFormatException (Status)); + AcpiOsPrintf ("Could not obtain _PRT: %s\n", + AcpiFormatException (Status)); goto GetCrs; } - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj); + Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiFormatException (Status)); - } - else - { - AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer); + AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", + AcpiFormatException (Status)); + goto GetCrs; } + AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer); + /* _CRS */ GetCrs: AcpiOsPrintf ("Evaluating _CRS\n"); - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - Status = AcpiEvaluateObject (ObjDesc, "_CRS", NULL, &ReturnObj); + /* Check if _CRS exists */ + + Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not obtain _CRS: %s\n", AcpiFormatException (Status)); + AcpiOsPrintf ("Could not obtain _CRS: %s\n", + AcpiFormatException (Status)); goto GetPrs; } - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + /* Get the _CRS resource list */ + + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - Status = AcpiGetCurrentResources (ObjDesc, &ReturnObj); + Status = AcpiGetCurrentResources (Node, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status)); + AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", + AcpiFormatException (Status)); goto GetPrs; } - else - { - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); - } - Status = AcpiSetCurrentResources (ObjDesc, &ReturnObj); + /* Dump the _CRS resource list */ + + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, + ReturnObj.Pointer)); + + /* + * Perform comparison of original AML to newly created AML. This tests both + * the AML->Resource conversion and the Resource->Aml conversion. + */ + Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); + + /* Execute _SRS with the resource list */ + + Status = AcpiSetCurrentResources (Node, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", AcpiFormatException (Status)); + AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", + AcpiFormatException (Status)); goto GetPrs; } @@ -1270,29 +1548,32 @@ GetCrs: GetPrs: AcpiOsPrintf ("Evaluating _PRS\n"); - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - Status = AcpiEvaluateObject (ObjDesc, "_PRS", NULL, &ReturnObj); + /* Check if _PRS exists */ + + Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not obtain _PRS: %s\n", AcpiFormatException (Status)); + AcpiOsPrintf ("Could not obtain _PRS: %s\n", + AcpiFormatException (Status)); goto Cleanup; } - ReturnObj.Pointer = AcpiGbl_DbBuffer; - ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj.Pointer = AcpiGbl_DbBuffer; + ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; - Status = AcpiGetPossibleResources (ObjDesc, &ReturnObj); + Status = AcpiGetPossibleResources (Node, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiFormatException (Status)); - } - else - { - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); + AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", + AcpiFormatException (Status)); + goto Cleanup; } + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); + Cleanup: AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); @@ -1313,7 +1594,7 @@ Cleanup: * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbIntegrityWalk ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, @@ -1371,7 +1652,8 @@ AcpiDbIntegrityWalk ( ******************************************************************************/ void -AcpiDbCheckIntegrity (void) +AcpiDbCheckIntegrity ( + void) { ACPI_INTEGRITY_INFO Info = {0,0}; @@ -1380,7 +1662,8 @@ AcpiDbCheckIntegrity (void) (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbIntegrityWalk, (void *) &Info, NULL); - AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", Info.Nodes, Info.Objects); + AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", + Info.Nodes, Info.Objects); } @@ -1388,7 +1671,9 @@ AcpiDbCheckIntegrity (void) * * FUNCTION: AcpiDbGenerateGpe * - * PARAMETERS: None + * PARAMETERS: GpeArg - Raw GPE number, ascii string + * BlockArg - GPE block number, ascii string + * 0 or 1 for FADT GPE blocks * * RETURN: None * @@ -1410,7 +1695,8 @@ AcpiDbGenerateGpe ( BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); - GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), GpeNumber); + GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), + GpeNumber); if (!GpeEventInfo) { AcpiOsPrintf ("Invalid GPE\n"); @@ -1420,4 +1706,129 @@ AcpiDbGenerateGpe ( (void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber); } + +/******************************************************************************* + * + * FUNCTION: AcpiDbBusWalk + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Display info about device objects that have a corresponding + * _PRT method. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbBusWalk ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_STATUS Status; + ACPI_BUFFER Buffer; + ACPI_INTEGER ADR; + ACPI_DEVICE_ID Id; + ACPI_COMPATIBLE_ID_LIST *Cid; + ACPI_NAMESPACE_NODE *TempNode; + + + /* Exit if there is no _PRT under this device */ + + Status = AcpiGetHandle (Node, METHOD_NAME__PRT, &TempNode); + if (ACPI_FAILURE (Status)) + { + return (AE_OK); + } + + /* Get the full path to this device object */ + + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); + return (AE_OK); + } + + /* Display the full path */ + + AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer); + ACPI_MEM_FREE (Buffer.Pointer); + + /* _PRT info */ + + AcpiOsPrintf ("_PRT=%p", TempNode); + + /* Get the _ADR value */ + + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &ADR); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf (" No _ADR "); + } + else + { + AcpiOsPrintf (" _ADR=%8.8X", (UINT32) ADR); + } + + /* Get the _HID if present */ + + Status = AcpiUtExecute_HID (Node, &Id); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf (" _HID=%s", Id.Value); + } + else + { + AcpiOsPrintf (" "); + } + + /* Get the _UID if present */ + + Status = AcpiUtExecute_UID (Node, &Id); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf (" _UID=%s", Id.Value); + } + + /* Get the _CID if present */ + + Status = AcpiUtExecute_CID (Node, &Cid); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value); + ACPI_MEM_FREE (Cid); + } + + AcpiOsPrintf ("\n"); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbGetBusInfo + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Display info about system busses. + * + ******************************************************************************/ + +void +AcpiDbGetBusInfo ( + void) +{ + /* Search all nodes in namespace */ + + (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + AcpiDbBusWalk, NULL, NULL); +} + #endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index 3183760..b82c0ec 100644 --- a/sys/contrib/dev/acpica/dbfileio.c +++ b/sys/contrib/dev/acpica/dbfileio.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -126,7 +126,6 @@ #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbfileio") - /* * NOTE: this is here for lack of a better place. It is used in all * flavors of the debugger, need LCD file @@ -138,13 +137,30 @@ FILE *AcpiGbl_DebugFile = NULL; #ifdef ACPI_DEBUGGER + +/* Local prototypes */ + +#ifdef ACPI_APPLICATION + +static ACPI_STATUS +AcpiDbCheckTextModeCorruption ( + UINT8 *Table, + UINT32 TableLength, + UINT32 FileLength); + +static ACPI_STATUS +AeLocalLoadTable ( + ACPI_TABLE_HEADER *TablePtr); + +#endif + /******************************************************************************* * * FUNCTION: AcpiDbCloseDebugFile * * PARAMETERS: None * - * RETURN: Status + * RETURN: None * * DESCRIPTION: If open, close the current debug output file * @@ -174,7 +190,7 @@ AcpiDbCloseDebugFile ( * * PARAMETERS: Name - Filename to open * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Open a file where debug output will be directed. * @@ -206,7 +222,6 @@ AcpiDbOpenDebugFile ( #ifdef ACPI_APPLICATION - /******************************************************************************* * * FUNCTION: AcpiDbCheckTextModeCorruption @@ -235,8 +250,9 @@ AcpiDbCheckTextModeCorruption ( if (TableLength != FileLength) { - ACPI_REPORT_WARNING (("File length (0x%X) is not the same as the table length (0x%X)\n", - FileLength, TableLength)); + ACPI_REPORT_WARNING (( + "File length (0x%X) is not the same as the table length (0x%X)\n", + FileLength, TableLength)); } /* Scan entire table to determine if each LF has been prefixed with a CR */ @@ -247,7 +263,7 @@ AcpiDbCheckTextModeCorruption ( { if (Table[i - 1] != 0x0D) { - /* the LF does not have a preceeding CR, table is not corrupted */ + /* The LF does not have a preceeding CR, table not corrupted */ return (AE_OK); } @@ -303,25 +319,35 @@ AcpiDbReadTable ( fseek (fp, 0, SEEK_END); - FileSize = ftell (fp); + FileSize = (UINT32) ftell (fp); fseek (fp, 0, SEEK_SET); /* Read the table header */ - if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != sizeof (ACPI_TABLE_HEADER)) + if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != + sizeof (ACPI_TABLE_HEADER)) { - AcpiOsPrintf ("Couldn't read the table header\n"); - return (AE_BAD_SIGNATURE); + AcpiOsPrintf ("Could not read the table header\n"); + return (AE_BAD_HEADER); } /* Validate the table header/length */ Status = AcpiTbValidateTableHeader (&TableHeader); - if ((ACPI_FAILURE (Status)) || - (TableHeader.Length > 0x800000)) /* 8 Mbyte should be enough */ + if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Table header is invalid!\n"); - return (AE_ERROR); + return (Status); + } + + /* File size must be at least as long as the Header-specified length */ + + if (TableHeader.Length > FileSize) + { + AcpiOsPrintf ( + "TableHeader length [0x%X] greater than the input file size [0x%X]\n", + TableHeader.Length, FileSize); + return (AE_BAD_HEADER); } /* We only support a limited number of table types */ @@ -330,7 +356,8 @@ AcpiDbReadTable ( ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) && ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4)) { - AcpiOsPrintf ("Table signature is invalid\n"); + AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n", + (char *) TableHeader.Signature); ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); return (AE_ERROR); } @@ -341,8 +368,9 @@ AcpiDbReadTable ( *Table = AcpiOsAllocate ((size_t) (FileSize)); if (!*Table) { - AcpiOsPrintf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n", - TableHeader.Signature, TableHeader.Length); + AcpiOsPrintf ( + "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", + TableHeader.Signature, TableHeader.Length); return (AE_NO_MEMORY); } @@ -379,7 +407,6 @@ AcpiDbReadTable ( return (AE_ERROR); } -#endif /******************************************************************************* @@ -398,7 +425,7 @@ AcpiDbReadTable ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AeLocalLoadTable ( ACPI_TABLE_HEADER *Table) { @@ -426,6 +453,13 @@ AeLocalLoadTable ( Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { + if (Status == AE_ALREADY_EXISTS) + { + /* Table already exists, no error */ + + Status = AE_OK; + } + /* Free table allocated by AcpiTbGetTable */ AcpiTbDeleteSingleTable (&TableInfo); @@ -448,7 +482,6 @@ AeLocalLoadTable ( } -#ifdef ACPI_APPLICATION /******************************************************************************* * * FUNCTION: AcpiDbReadTableFromFile @@ -489,7 +522,7 @@ AcpiDbReadTableFromFile ( if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Couldn't get table from the file\n"); + AcpiOsPrintf ("Could not get table from the file\n"); return (Status); } @@ -502,8 +535,8 @@ AcpiDbReadTableFromFile ( * * FUNCTION: AcpiDbGetTableFromFile * - * PARAMETERS: Filename - File where table is located - * Table - Where a pointer to the table is returned + * PARAMETERS: Filename - File where table is located + * ReturnTable - Where a pointer to the table is returned * * RETURN: Status * diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c index 6b35df1..cb4ee43 100644 --- a/sys/contrib/dev/acpica/dbxface.c +++ b/sys/contrib/dev/acpica/dbxface.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -127,11 +127,26 @@ ACPI_MODULE_NAME ("dbxface") +/* Local prototypes */ + +static ACPI_STATUS +AcpiDbStartCommand ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +#ifdef ACPI_OBSOLETE_FUNCTIONS +void +AcpiDbMethodEnd ( + ACPI_WALK_STATE *WalkState); +#endif + + /******************************************************************************* * * FUNCTION: AcpiDbStartCommand * * PARAMETERS: WalkState - Current walk + * Op - Current executing Op, from AML interpreter * * RETURN: Status * @@ -139,7 +154,7 @@ * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbStartCommand ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) @@ -147,7 +162,7 @@ AcpiDbStartCommand ( ACPI_STATUS Status; - /* TBD: [Investigate] what are the namespace locking issues here */ + /* TBD: [Investigate] are there namespace locking issues here? */ /* AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); */ @@ -208,38 +223,10 @@ AcpiDbStartCommand ( /******************************************************************************* * - * FUNCTION: AcpiDbMethodEnd - * - * PARAMETERS: WalkState - Current walk - * - * RETURN: Status - * - * DESCRIPTION: - * - ******************************************************************************/ - -void -AcpiDbMethodEnd ( - ACPI_WALK_STATE *WalkState) -{ - - if (!AcpiGbl_CmSingleStep) - { - return; - } - - AcpiOsPrintf ("<Method Terminating>\n"); - - AcpiDbStartCommand (WalkState, NULL); -} - - -/******************************************************************************* - * * FUNCTION: AcpiDbSingleStep * * PARAMETERS: WalkState - Current walk - * Op - Current executing op + * Op - Current executing op (from aml interpreter) * OpcodeClass - Class of the current AML Opcode * * RETURN: Status @@ -291,7 +278,8 @@ AcpiDbSingleStep ( else if (WalkState->UserBreakpoint && (WalkState->UserBreakpoint == Op->Common.AmlOffset)) { - AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", Op->Common.AmlOffset); + AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", + Op->Common.AmlOffset); AcpiGbl_CmSingleStep = TRUE; AcpiGbl_StepToNextCall = FALSE; WalkState->MethodBreakpoint = 0; @@ -331,9 +319,9 @@ AcpiDbSingleStep ( } /* - * Display this op (and only this op - zero out the NEXT field temporarily, - * and disable parser trace output for the duration of the display because - * we don't want the extraneous debug output) + * Display this op (and only this op - zero out the NEXT field + * temporarily, and disable parser trace output for the duration of + * the display because we don't want the extraneous debug output) */ OriginalDebugLevel = AcpiDbgLevel; AcpiDbgLevel &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS); @@ -346,7 +334,8 @@ AcpiDbSingleStep ( if (ParentOp) { if ((WalkState->ControlState) && - (WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING)) + (WalkState->ControlState->Common.State == + ACPI_CONTROL_PREDICATE_EXECUTING)) { /* * We are executing the predicate of an IF or WHILE statement @@ -448,10 +437,14 @@ AcpiDbSingleStep ( */ if (Op->Common.AmlOpcode == AML_INT_METHODCALL_OP) { - AcpiGbl_CmSingleStep = FALSE; /* No more single step while executing called method */ + /* Force no more single stepping while executing called method */ - /* Set the breakpoint on/before the call, it will stop execution as soon as we return */ + AcpiGbl_CmSingleStep = FALSE; + /* + * Set the breakpoint on/before the call, it will stop execution + * as soon as we return + */ WalkState->MethodBreakpoint = 1; /* Must be non-zero! */ } @@ -477,7 +470,8 @@ AcpiDbSingleStep ( ******************************************************************************/ ACPI_STATUS -AcpiDbInitialize (void) +AcpiDbInitialize ( + void) { ACPI_STATUS Status; @@ -564,14 +558,15 @@ AcpiDbInitialize (void) * * PARAMETERS: None * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Stop debugger * ******************************************************************************/ void -AcpiDbTerminate (void) +AcpiDbTerminate ( + void) { if (AcpiGbl_DbTablePtr) @@ -585,4 +580,33 @@ AcpiDbTerminate (void) } +#ifdef ACPI_OBSOLETE_FUNCTIONS +/******************************************************************************* + * + * FUNCTION: AcpiDbMethodEnd + * + * PARAMETERS: WalkState - Current walk + * + * RETURN: Status + * + * DESCRIPTION: Called at method termination + * + ******************************************************************************/ + +void +AcpiDbMethodEnd ( + ACPI_WALK_STATE *WalkState) +{ + + if (!AcpiGbl_CmSingleStep) + { + return; + } + + AcpiOsPrintf ("<Method Terminating>\n"); + + AcpiDbStartCommand (WalkState, NULL); +} +#endif + #endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/dmopcode.c b/sys/contrib/dev/acpica/dmopcode.c index 3bf5a37..934d4ba 100644 --- a/sys/contrib/dev/acpica/dmopcode.c +++ b/sys/contrib/dev/acpica/dmopcode.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,12 @@ #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmopcode") +/* Local prototypes */ + +static void +AcpiDmMatchKeyword ( + ACPI_PARSE_OBJECT *Op); + /******************************************************************************* * @@ -328,7 +334,7 @@ AcpiDmMatchOp ( * ******************************************************************************/ -void +static void AcpiDmMatchKeyword ( ACPI_PARSE_OBJECT *Op) { @@ -340,7 +346,8 @@ AcpiDmMatchKeyword ( } else { - AcpiOsPrintf ("%s", (char *) (uintptr_t)AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]); + AcpiOsPrintf ("%s", (char *) (uintptr_t) + AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]); } } @@ -474,7 +481,7 @@ AcpiDmDisassembleOneOp ( * types of buffers, we have to closely look at the data in the * buffer to determine the type. */ - if (AcpiDmIsResourceDescriptor (Op)) + if (AcpiDmIsResourceTemplate (Op)) { Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; AcpiOsPrintf ("ResourceTemplate"); @@ -513,14 +520,14 @@ AcpiDmDisassembleOneOp ( case AML_INT_NAMEPATH_OP: AcpiDmNamestring (Op->Common.Value.Name); - AcpiDmValidateName (Op->Common.Value.Name, Op); break; case AML_INT_NAMEDFIELD_OP: Length = AcpiDmDumpName ((char *) &Op->Named.Name); - AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", (UINT32) Op->Common.Value.Integer); + AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", + (UINT32) Op->Common.Value.Integer); AcpiDmCommaIfFieldMember (Op); Info->BitOffset += (UINT32) Op->Common.Value.Integer; @@ -590,7 +597,8 @@ AcpiDmDisassembleOneOp ( (WalkState->Results->Results.NumResults)) { AcpiDmDecodeInternalObject ( - WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]); + WalkState->Results->Results.ObjDesc [ + WalkState->Results->Results.NumResults-1]); } #endif break; diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c index 099c4ff..a3d80cb 100644 --- a/sys/contrib/dev/acpica/hwregs.c +++ b/sys/contrib/dev/acpica/hwregs.c @@ -11,7 +11,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -162,8 +162,9 @@ AcpiHwClearAcpiStatus ( } } - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + ACPI_BITMASK_ALL_FIXED_STATUS); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -183,7 +184,7 @@ AcpiHwClearAcpiStatus ( /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, ACPI_ISR); + Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock); UnlockAndExit: if (Flags & ACPI_MTX_LOCK) @@ -217,30 +218,32 @@ AcpiGetSleepTypeData ( { ACPI_STATUS Status = AE_OK; ACPI_PARAMETER_INFO Info; + char *SleepStateName; ACPI_FUNCTION_TRACE ("AcpiGetSleepTypeData"); - /* - * Validate parameters - */ + /* Validate parameters */ + if ((SleepState > ACPI_S_STATES_MAX) || !SleepTypeA || !SleepTypeB) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * Evaluate the namespace object containing the values for this state - */ + /* Evaluate the namespace object containing the values for this state */ + Info.Parameters = NULL; - Status = AcpiNsEvaluateByName ((char *) (uintptr_t) AcpiGbl_SleepStateNames[SleepState], - &Info); + Info.ReturnObject = NULL; + SleepStateName = (char *) (uintptr_t) AcpiGbl_SleepStateNames[SleepState]; + + Status = AcpiNsEvaluateByName (SleepStateName, &Info); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating SleepState [%s]\n", - AcpiFormatException (Status), AcpiGbl_SleepStateNames[SleepState])); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "%s while evaluating SleepState [%s]\n", + AcpiFormatException (Status), SleepStateName)); return_ACPI_STATUS (Status); } @@ -249,7 +252,8 @@ AcpiGetSleepTypeData ( if (!Info.ReturnObject) { - ACPI_REPORT_ERROR (("Missing Sleep State object\n")); + ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n", + SleepStateName)); Status = AE_NOT_EXIST; } @@ -257,42 +261,53 @@ AcpiGetSleepTypeData ( else if (ACPI_GET_OBJECT_TYPE (Info.ReturnObject) != ACPI_TYPE_PACKAGE) { - ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); + ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n")); Status = AE_AML_OPERAND_TYPE; } - /* The package must have at least two elements */ - + /* + * The package must have at least two elements. NOTE (March 2005): This + * goes against the current ACPI spec which defines this object as a + * package with one encoded DWORD element. However, existing practice + * by BIOS vendors seems to be to have 2 or more elements, at least + * one per sleep type (A/B). + */ else if (Info.ReturnObject->Package.Count < 2) { - ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); + ACPI_REPORT_ERROR (( + "Sleep State return package does not have at least two elements\n")); Status = AE_AML_NO_OPERAND; } /* The first two elements must both be of type Integer */ - else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0]) != ACPI_TYPE_INTEGER) || - (ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1]) != ACPI_TYPE_INTEGER)) + else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0]) + != ACPI_TYPE_INTEGER) || + (ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1]) + != ACPI_TYPE_INTEGER)) { - ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", + ACPI_REPORT_ERROR (( + "Sleep State return package elements are not both Integers (%s, %s)\n", AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[0]), AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[1]))); Status = AE_AML_OPERAND_TYPE; } else { - /* - * Valid _Sx_ package size, type, and value - */ - *SleepTypeA = (UINT8) (Info.ReturnObject->Package.Elements[0])->Integer.Value; - *SleepTypeB = (UINT8) (Info.ReturnObject->Package.Elements[1])->Integer.Value; + /* Valid _Sx_ package size, type, and value */ + + *SleepTypeA = (UINT8) + (Info.ReturnObject->Package.Elements[0])->Integer.Value; + *SleepTypeB = (UINT8) + (Info.ReturnObject->Package.Elements[1])->Integer.Value; } if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "While evaluating SleepState [%s], bad Sleep object %p type %s\n", - AcpiGbl_SleepStateNames[SleepState], Info.ReturnObject, + "%s While evaluating SleepState [%s], bad Sleep object %p type %s\n", + AcpiFormatException (Status), + SleepStateName, Info.ReturnObject, AcpiUtGetObjectTypeName (Info.ReturnObject))); } @@ -307,9 +322,9 @@ AcpiGetSleepTypeData ( * * PARAMETERS: RegisterId - Index of ACPI Register to access * - * RETURN: The bit mask to be used when accessing the register + * RETURN: The bitmask to be used when accessing the register * - * DESCRIPTION: Map RegisterId into a register bit mask. + * DESCRIPTION: Map RegisterId into a register bitmask. * ******************************************************************************/ @@ -453,7 +468,7 @@ AcpiSetRegister ( /* Always do a register read first so we can insert the new bits */ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, - BitRegInfo->ParentRegister, &RegisterValue); + BitRegInfo->ParentRegister, &RegisterValue); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -493,7 +508,7 @@ AcpiSetRegister ( BitRegInfo->AccessBitMask, Value); Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue); + ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue); break; @@ -510,7 +525,7 @@ AcpiSetRegister ( BitRegInfo->AccessBitMask, Value); Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue); + ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue); break; @@ -525,17 +540,19 @@ AcpiSetRegister ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", RegisterValue, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS ( + AcpiGbl_FADT->XPm2CntBlk.Address)))); ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value); ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", RegisterValue, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS ( + AcpiGbl_FADT->XPm2CntBlk.Address)))); Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue)); + ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue)); break; @@ -553,7 +570,9 @@ UnlockAndExit: /* Normalize the value that was read */ - ACPI_DEBUG_EXEC (RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition)); + ACPI_DEBUG_EXEC (RegisterValue = + ((RegisterValue & BitRegInfo->AccessBitMask) >> + BitRegInfo->BitPosition)); ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", Value, RegisterValue, BitRegInfo->ParentRegister)); @@ -567,7 +586,7 @@ UnlockAndExit: * * PARAMETERS: UseLock - Mutex hw access * RegisterId - RegisterID + Offset - * ReturnValue - Value that was read from the register + * ReturnValue - Where the register value is returned * * RETURN: Status and the value read. * @@ -661,7 +680,8 @@ AcpiHwRegisterRead ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", RegisterId)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", + RegisterId)); Status = AE_BAD_PARAMETER; break; } @@ -879,10 +899,11 @@ AcpiHwLowLevelRead ( return (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *Value, Width, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)), - AcpiUtGetRegionName (Reg->AddressSpaceId))); + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *Value, Width, + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)), + AcpiUtGetRegionName (Reg->AddressSpaceId))); return (Status); } @@ -960,10 +981,11 @@ AcpiHwLowLevelWrite ( return (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - Value, Width, - ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)), - AcpiUtGetRegionName (Reg->AddressSpaceId))); + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + Value, Width, + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)), + AcpiUtGetRegionName (Reg->AddressSpaceId))); return (Status); } diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index 40c78b6..fc07c05 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hwsleep.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -121,20 +121,7 @@ ACPI_MODULE_NAME ("hwsleep") -#define METHOD_NAME__BFS "\\_BFS" -#define METHOD_NAME__GTS "\\_GTS" -#define METHOD_NAME__PTS "\\_PTS" -#define METHOD_NAME__SST "\\_SI._SST" -#define METHOD_NAME__WAK "\\_WAK" - -#define ACPI_SST_INDICATOR_OFF 0 -#define ACPI_SST_WORKING 1 -#define ACPI_SST_WAKING 2 -#define ACPI_SST_SLEEPING 3 -#define ACPI_SST_SLEEP_CONTEXT 4 - - -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiSetFirmwareWakingVector * @@ -143,7 +130,7 @@ * * RETURN: Status * - * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS + * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS * ******************************************************************************/ @@ -172,17 +159,17 @@ AcpiSetFirmwareWakingVector ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiGetFirmwareWakingVector * - * PARAMETERS: *PhysicalAddress - Output buffer where contents of + * PARAMETERS: *PhysicalAddress - Where the contents of * the FirmwareWakingVector field of - * the FACS will be stored. + * the FACS will be returned. * - * RETURN: Status + * RETURN: Status, vector * - * DESCRIPTION: Access function for FirmwareWakingVector field in FACS + * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS * ******************************************************************************/ @@ -216,7 +203,7 @@ AcpiGetFirmwareWakingVector ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEnterSleepStatePrep * @@ -294,7 +281,7 @@ AcpiEnterSleepStatePrep ( break; default: - Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */ + Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is off */ break; } @@ -303,14 +290,15 @@ AcpiEnterSleepStatePrep ( Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status))); + ACPI_REPORT_ERROR (("Method _SST failed, %s\n", + AcpiFormatException (Status))); } return_ACPI_STATUS (AE_OK); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEnterSleepState * @@ -370,7 +358,8 @@ AcpiEnterSleepState ( { /* Disable BM arbitration */ - Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); + Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, + 1, ACPI_MTX_DO_NOT_LOCK); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -381,14 +370,14 @@ AcpiEnterSleepState ( * 1) Disable/Clear all GPEs * 2) Enable all wakeup GPEs */ - Status = AcpiHwDisableAllGpes (ACPI_ISR); + Status = AcpiHwDisableAllGpes (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } AcpiGbl_SystemAwakeAndRunning = FALSE; - Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR); + Status = AcpiHwEnableAllWakeupGpes (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -396,16 +385,19 @@ AcpiEnterSleepState ( /* Get current value of PM1A control */ - Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1AControl); + Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, &PM1AControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", SleepState)); + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, + "Entering sleep state [S%d]\n", SleepState)); /* Clear SLP_EN and SLP_TYP fields */ - PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | SleepEnableRegInfo->AccessBitMask); + PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | + SleepEnableRegInfo->AccessBitMask); PM1BControl = PM1AControl; /* Insert SLP_TYP bits */ @@ -420,13 +412,15 @@ AcpiEnterSleepState ( /* Write #1: fill in SLP_TYP data */ - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1A_CONTROL, PM1AControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1B_CONTROL, PM1BControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -441,13 +435,15 @@ AcpiEnterSleepState ( ACPI_FLUSH_CPU_CACHE (); - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1A_CONTROL, PM1AControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1B_CONTROL, PM1BControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -456,10 +452,11 @@ AcpiEnterSleepState ( if (SleepState > ACPI_STATE_S3) { /* - * We wanted to sleep > S3, but it didn't happen (by virtue of the fact that - * we are still executing!) + * We wanted to sleep > S3, but it didn't happen (by virtue of the + * fact that we are still executing!) * - * Wait ten seconds, then try again. This is to get S4/S5 to work on all machines. + * Wait ten seconds, then try again. This is to get S4/S5 to work on + * all machines. * * We wait so long to allow chipsets that poll this reg very slowly to * still read the right value. Ideally, this block would go @@ -467,7 +464,8 @@ AcpiEnterSleepState ( */ AcpiOsStall (10000000); - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, SleepEnableRegInfo->AccessBitMask); if (ACPI_FAILURE (Status)) { @@ -480,7 +478,8 @@ AcpiEnterSleepState ( Retry = 1000; do { - Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK); + Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, + ACPI_MTX_DO_NOT_LOCK); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -503,7 +502,7 @@ AcpiEnterSleepState ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEnterSleepStateS4bios * @@ -543,14 +542,14 @@ AcpiEnterSleepStateS4bios ( * 1) Disable/Clear all GPEs * 2) Enable all wakeup GPEs */ - Status = AcpiHwDisableAllGpes (ACPI_ISR); + Status = AcpiHwDisableAllGpes (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } AcpiGbl_SystemAwakeAndRunning = FALSE; - Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR); + Status = AcpiHwEnableAllWakeupGpes (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -558,11 +557,13 @@ AcpiEnterSleepStateS4bios ( ACPI_FLUSH_CPU_CACHE (); - Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (UINT32) AcpiGbl_FADT->S4BiosReq, 8); + Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, + (UINT32) AcpiGbl_FADT->S4BiosReq, 8); do { AcpiOsStall(1000); - Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK); + Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, + ACPI_MTX_DO_NOT_LOCK); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -573,7 +574,7 @@ AcpiEnterSleepStateS4bios ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiLeaveSleepState * @@ -656,20 +657,23 @@ AcpiLeaveSleepState ( Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status))); + ACPI_REPORT_ERROR (("Method _SST failed, %s\n", + AcpiFormatException (Status))); } Arg.Integer.Value = SleepState; Status = AcpiEvaluateObject (NULL, METHOD_NAME__BFS, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", AcpiFormatException (Status))); + ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", + AcpiFormatException (Status))); } Status = AcpiEvaluateObject (NULL, METHOD_NAME__WAK, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status))); + ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", + AcpiFormatException (Status))); } /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ @@ -678,14 +682,14 @@ AcpiLeaveSleepState ( * 1) Disable/Clear all GPEs * 2) Enable all runtime GPEs */ - Status = AcpiHwDisableAllGpes (ACPI_NOT_ISR); + Status = AcpiHwDisableAllGpes (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } AcpiGbl_SystemAwakeAndRunning = TRUE; - Status = AcpiHwEnableAllRuntimeGpes (ACPI_NOT_ISR); + Status = AcpiHwEnableAllRuntimeGpes (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -693,9 +697,12 @@ AcpiLeaveSleepState ( /* Enable power button */ - (void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, + (void) AcpiSetRegister( + AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, 1, ACPI_MTX_DO_NOT_LOCK); - (void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, + + (void) AcpiSetRegister( + AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, 1, ACPI_MTX_DO_NOT_LOCK); /* Enable BM arbitration */ @@ -710,7 +717,8 @@ AcpiLeaveSleepState ( Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { - ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status))); + ACPI_REPORT_ERROR (("Method _SST failed, %s\n", + AcpiFormatException (Status))); } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c index e1f184d..453a327 100644 --- a/sys/contrib/dev/acpica/uteval.c +++ b/sys/contrib/dev/acpica/uteval.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,19 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("uteval") +/* Local prototypes */ + +static void +AcpiUtCopyIdString ( + char *Destination, + char *Source, + ACPI_SIZE MaxLength); + +static ACPI_STATUS +AcpiUtTranslateOneCid ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_COMPATIBLE_ID *OneCid); + /******************************************************************************* * @@ -282,6 +295,18 @@ AcpiUtEvaluateObject ( break; } + if ((AcpiGbl_EnableInterpreterSlack) && + (!ExpectedReturnBtypes)) + { + /* + * We received a return object, but one was not expected. This can + * happen frequently if the "implicit return" feature is enabled. + * Just delete the return object and return AE_OK. + */ + AcpiUtRemoveReference (Info.ReturnObject); + return_ACPI_STATUS (AE_OK); + } + /* Is the return object one of the expected types? */ if (!(ExpectedReturnBtypes & ReturnBtype)) @@ -290,8 +315,9 @@ AcpiUtEvaluateObject ( PrefixNode, Path, AE_TYPE); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from %s was incorrect: %X\n", - Path, ACPI_GET_OBJECT_TYPE (Info.ReturnObject))); + "Type returned from %s was incorrect: %s, expected Btypes: %X\n", + Path, AcpiUtGetObjectTypeName (Info.ReturnObject), + ExpectedReturnBtypes)); /* On error exit, we must delete the return object */ @@ -310,9 +336,9 @@ AcpiUtEvaluateObject ( * * FUNCTION: AcpiUtEvaluateNumericObject * - * PARAMETERS: *ObjectName - Object name to be evaluated + * PARAMETERS: ObjectName - Object name to be evaluated * DeviceNode - Node for the device - * *Address - Where the value is returned + * Address - Where the value is returned * * RETURN: Status * @@ -377,7 +403,6 @@ AcpiUtCopyIdString ( 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 @@ -400,7 +425,7 @@ AcpiUtCopyIdString ( * FUNCTION: AcpiUtExecute_HID * * PARAMETERS: DeviceNode - Node for the device - * *Hid - Where the HID is returned + * Hid - Where the HID is returned * * RETURN: Status * @@ -509,7 +534,7 @@ AcpiUtTranslateOneCid ( * FUNCTION: AcpiUtExecute_CID * * PARAMETERS: DeviceNode - Node for the device - * *Cid - Where the CID is returned + * ReturnCidList - Where the CID list is returned * * RETURN: Status * @@ -571,10 +596,10 @@ AcpiUtExecute_CID ( 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"). + * A _CID can return either a single compatible ID or a package of + * compatible IDs. Each compatible ID can be one of the following: + * 1) Integer (32 bit compressed EISA ID) or + * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") */ /* The _CID object can be either a single CID or a package (list) of CIDs */ @@ -623,7 +648,7 @@ AcpiUtExecute_CID ( * FUNCTION: AcpiUtExecute_UID * * PARAMETERS: DeviceNode - Node for the device - * *Uid - Where the UID is returned + * Uid - Where the UID is returned * * RETURN: Status * @@ -679,7 +704,7 @@ AcpiUtExecute_UID ( * FUNCTION: AcpiUtExecute_STA * * PARAMETERS: DeviceNode - Node for the device - * *Flags - Where the status flags are returned + * Flags - Where the status flags are returned * * RETURN: Status * @@ -735,7 +760,7 @@ AcpiUtExecute_STA ( * FUNCTION: AcpiUtExecute_Sxds * * PARAMETERS: DeviceNode - Node for the device - * *Flags - Where the status flags are returned + * Flags - Where the status flags are returned * * RETURN: Status * diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index 35215c27..03321fd 100644 --- a/sys/contrib/dev/acpica/utglobal.c +++ b/sys/contrib/dev/acpica/utglobal.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -124,13 +124,14 @@ ACPI_MODULE_NAME ("utglobal") -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiFormatException * * PARAMETERS: Status - The ACPI_STATUS code to be formatted * - * RETURN: A string containing the exception text + * RETURN: A string containing the exception text. A valid pointer is + * always returned. * * DESCRIPTION: This function translates an ACPI exception into an ASCII string. * @@ -140,8 +141,8 @@ const char * AcpiFormatException ( ACPI_STATUS Status) { - const char *Exception = "UNKNOWN_STATUS_CODE"; ACPI_STATUS SubStatus; + const char *Exception = NULL; ACPI_FUNCTION_NAME ("FormatException"); @@ -156,61 +157,60 @@ AcpiFormatException ( if (SubStatus <= AE_CODE_ENV_MAX) { Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; - break; } - goto Unknown; + break; case AE_CODE_PROGRAMMER: if (SubStatus <= AE_CODE_PGM_MAX) { Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; - break; } - goto Unknown; + break; case AE_CODE_ACPI_TABLES: if (SubStatus <= AE_CODE_TBL_MAX) { Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; - break; } - goto Unknown; + break; case AE_CODE_AML: if (SubStatus <= AE_CODE_AML_MAX) { Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; - break; } - goto Unknown; + break; case AE_CODE_CONTROL: if (SubStatus <= AE_CODE_CTRL_MAX) { Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; - break; } - goto Unknown; + break; default: - goto Unknown; + break; } + if (!Exception) + { + /* Exception code was not recognized */ - return ((const char *) Exception); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Unknown exception code: 0x%8.8X\n", Status)); -Unknown: + return ((const char *) "UNKNOWN_STATUS_CODE"); + } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", Status)); return ((const char *) Exception); } -/****************************************************************************** +/******************************************************************************* * * Static global variable initialization. * @@ -275,6 +275,8 @@ const char *AcpiGbl_HighestDstateNames[4] = */ const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS] = { + /* Operating System Vendor Strings */ + "Linux", "Windows 2000", "Windows 2001", @@ -283,23 +285,28 @@ const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS] = "Windows 2001 SP1", "Windows 2001 SP2", "Windows 2001 SP3", - "Windows 2001 SP4" + "Windows 2001 SP4", + + /* Feature Group Strings */ + + "Extended Address Space Descriptor" }; -/****************************************************************************** +/******************************************************************************* * * Namespace globals * ******************************************************************************/ - /* * Predefined ACPI Names (Built-in to the Interpreter) * * NOTES: * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run * during the initialization sequence. + * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to + * perform a Notify() operation on it. */ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = { @@ -308,16 +315,18 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = {"_SB_", ACPI_TYPE_DEVICE, NULL}, {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_TZ_", ACPI_TYPE_THERMAL, NULL}, - {"_REV", ACPI_TYPE_INTEGER, "2"}, + {"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, - {"_GL_", ACPI_TYPE_MUTEX, "0"}, + {"_GL_", ACPI_TYPE_MUTEX, (char *) 1}, #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) - {"_OSI", ACPI_TYPE_METHOD, "1"}, + {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, #endif - {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */ -}; + /* Table terminator */ + + {NULL, ACPI_TYPE_ANY, NULL} +}; /* * Properties of the ACPI Object Types, both internal and external. @@ -362,22 +371,25 @@ const UINT8 AcpiGbl_NsProperties[] = /* Hex to ASCII conversion table */ static const char AcpiGbl_HexToAscii[] = - {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; +{ + '0','1','2','3','4','5','6','7', + '8','9','A','B','C','D','E','F' +}; + -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtHexToAsciiChar * * PARAMETERS: Integer - Contains the hex digit * Position - bit position of the digit within the - * integer + * integer (multiple of 4) * - * RETURN: Ascii character + * RETURN: The converted Ascii character * - * DESCRIPTION: Convert a hex digit to an ascii character + * DESCRIPTION: Convert a hex digit to an Ascii character * - ****************************************************************************/ + ******************************************************************************/ char AcpiUtHexToAsciiChar ( @@ -389,7 +401,7 @@ AcpiUtHexToAsciiChar ( } -/****************************************************************************** +/******************************************************************************* * * Table name globals * @@ -398,7 +410,7 @@ AcpiUtHexToAsciiChar ( * that are not used by the subsystem are simply ignored. * * Do NOT add any table to this list that is not consumed directly by this - * subsystem. + * subsystem (No MADT, ECDT, SBST, etc.) * ******************************************************************************/ @@ -435,6 +447,7 @@ ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] = /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS}, /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS}, /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS}, + /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, ACPI_BITMASK_PCIEXP_WAKE_STATUS}, /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE}, /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, @@ -442,6 +455,7 @@ ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] = /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE}, /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, + /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE}, /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD}, @@ -463,7 +477,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, }; -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtGetRegionName * @@ -473,7 +487,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = * * DESCRIPTION: Translate a Space ID into a name string (Debug only) * - ****************************************************************************/ + ******************************************************************************/ /* Region type decoding */ @@ -501,7 +515,6 @@ AcpiUtGetRegionName ( { return ("UserDefinedRegion"); } - else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) { return ("InvalidSpaceId"); @@ -511,7 +524,7 @@ AcpiUtGetRegionName ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtGetEventName * @@ -521,17 +534,19 @@ AcpiUtGetRegionName ( * * DESCRIPTION: Translate a Event ID into a name string (Debug only) * - ****************************************************************************/ + ******************************************************************************/ /* Event type decoding */ static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = { +/*! [Begin] no source code translation (keep these strings as-is) */ "PM_Timer", "GlobalLock", "PowerButton", "SleepButton", "RealTimeClock", +/*! [End] no source code translation !*/ }; @@ -549,7 +564,7 @@ AcpiUtGetEventName ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtGetTypeName * @@ -559,21 +574,23 @@ AcpiUtGetEventName ( * * DESCRIPTION: Translate a Type ID into a name string (Debug only) * - ****************************************************************************/ + ******************************************************************************/ /* * Elements of AcpiGbl_NsTypeNames below must match * one-to-one with values of ACPI_OBJECT_TYPE * - * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when - * stored in a table it really means that we have thus far seen no evidence to - * indicate what type is actually going to be stored for this entry. + * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; + * when stored in a table it really means that we have thus far seen no + * evidence to indicate what type is actually going to be stored for this entry. */ static const char AcpiGbl_BadType[] = "UNDEFINED"; -#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */ -static const char *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ +/* Printable names of the ACPI object types */ + +static const char *AcpiGbl_NsTypeNames[] = { +/*! [Begin] no source code translation (keep these strings as-is) */ /* 00 */ "Untyped", /* 01 */ "Integer", /* 02 */ "String", @@ -605,6 +622,7 @@ static const char *AcpiGbl_NsTypeNames[] = /* printable names of AC /* 28 */ "Extra", /* 29 */ "Data", /* 30 */ "Invalid" +/*! [End] no source code translation !*/ }; @@ -636,7 +654,7 @@ AcpiUtGetObjectTypeName ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtGetNodeName * @@ -646,7 +664,7 @@ AcpiUtGetObjectTypeName ( * * DESCRIPTION: Validate the node and return the node's ACPI name. * - ****************************************************************************/ + ******************************************************************************/ char * AcpiUtGetNodeName ( @@ -690,7 +708,7 @@ AcpiUtGetNodeName ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtGetDescriptorName * @@ -700,10 +718,13 @@ AcpiUtGetNodeName ( * * DESCRIPTION: Validate object and return the descriptor type * - ****************************************************************************/ + ******************************************************************************/ -static const char *AcpiGbl_DescTypeNames[] = /* printable names of descriptor types */ +/* Printable names of object descriptor types */ + +static const char *AcpiGbl_DescTypeNames[] = { +/*! [Begin] no source code translation (keep these ASL Keywords as-is) */ /* 00 */ "Invalid", /* 01 */ "Cached", /* 02 */ "State-Generic", @@ -720,6 +741,7 @@ static const char *AcpiGbl_DescTypeNames[] = /* printable names of /* 13 */ "Parser", /* 14 */ "Operand", /* 15 */ "Node" +/*! [End] no source code translation !*/ }; @@ -748,17 +770,18 @@ AcpiUtGetDescriptorName ( * Strings and procedures used for debug only */ -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtGetMutexName * - * PARAMETERS: None. + * PARAMETERS: MutexId - The predefined ID for this mutex. * - * RETURN: Status + * RETURN: String containing the name of the mutex. Always returns a valid + * pointer. * * DESCRIPTION: Translate a mutex ID into a name string (Debug only) * - ****************************************************************************/ + ******************************************************************************/ char * AcpiUtGetMutexName ( @@ -772,21 +795,20 @@ AcpiUtGetMutexName ( return (AcpiGbl_MutexNames[MutexId]); } - #endif -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtValidObjectType * * PARAMETERS: Type - Object type to be validated * - * RETURN: TRUE if valid object type + * RETURN: TRUE if valid object type, FALSE otherwise * * DESCRIPTION: Validate an object type * - ****************************************************************************/ + ******************************************************************************/ BOOLEAN AcpiUtValidObjectType ( @@ -804,121 +826,37 @@ AcpiUtValidObjectType ( } -/**************************************************************************** - * - * FUNCTION: AcpiUtAllocateOwnerId - * - * PARAMETERS: IdType - Type of ID (method or table) - * - * DESCRIPTION: Allocate a table or method owner id - * - ***************************************************************************/ - -ACPI_OWNER_ID -AcpiUtAllocateOwnerId ( - UINT32 IdType) -{ - ACPI_OWNER_ID OwnerId = 0xFFFF; - - - ACPI_FUNCTION_TRACE ("UtAllocateOwnerId"); - - - if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES))) - { - return (0); - } - - switch (IdType) - { - case ACPI_OWNER_TYPE_TABLE: - - 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; - - - case ACPI_OWNER_TYPE_METHOD: - - OwnerId = AcpiGbl_NextMethodOwnerId; - AcpiGbl_NextMethodOwnerId++; - - if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID) - { - /* Check for wraparound */ - - AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID; - } - break; - - default: - break; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); - return_VALUE (OwnerId); -} - - -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiUtInitGlobals * - * PARAMETERS: none + * PARAMETERS: None + * + * RETURN: None * * DESCRIPTION: Init library globals. All globals that require specific * initialization should be initialized here! * - ***************************************************************************/ + ******************************************************************************/ void AcpiUtInitGlobals ( void) { + ACPI_STATUS Status; UINT32 i; ACPI_FUNCTION_TRACE ("UtInitGlobals"); - /* Memory allocation and cache lists */ - - ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS); + /* Create all memory caches */ - AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL); - - AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJ_COMMON); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE_OBJ_NAMED); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE); - - AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = ACPI_MAX_STATE_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = ACPI_MAX_PARSE_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = ACPI_MAX_EXTPARSE_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = ACPI_MAX_OBJECT_CACHE_DEPTH; - AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = ACPI_MAX_WALK_CACHE_DEPTH; - - ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation"); - ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes"); - ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName = "State Object Cache"); - ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName = "Parse Node Cache"); - ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName = "Extended Parse Node Cache"); - ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName = "Operand Object Cache"); - ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName = "Tree Walk Node Cache"); + Status = AcpiUtCreateCaches (); + if (ACPI_FAILURE (Status)) + { + return; + } /* ACPI table structure */ @@ -933,7 +871,7 @@ AcpiUtInitGlobals ( for (i = 0; i < NUM_MUTEX; i++) { AcpiGbl_MutexInfo[i].Mutex = NULL; - AcpiGbl_MutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; + AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; AcpiGbl_MutexInfo[i].UseCount = 0; } @@ -974,8 +912,10 @@ AcpiUtInitGlobals ( AcpiGbl_NsLookupCount = 0; AcpiGbl_PsFindCount = 0; AcpiGbl_AcpiHardwarePresent = TRUE; - AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID; - AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID; + AcpiGbl_OwnerIdMask = 0; + AcpiGbl_TraceMethodName = 0; + AcpiGbl_TraceDbgLevel = 0; + AcpiGbl_TraceDbgLayer = 0; AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; |