diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index f9a8ef321e3f..f913d4b4e2c5 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/dbcmds.c @@ -1,1834 +1,1834 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines * $Revision: 115 $ * ******************************************************************************/ /****************************************************************************** * * 1. Copyright Notice * * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License * * 2.1. This is your license from Intel Corp. under its intellectual property * rights. You may have additional license terms from the party that provided * you this software, covering your right to use that party's intellectual * property rights. * * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a * copy of the source code appearing in this file ("Covered Code") an * irrevocable, perpetual, worldwide license under Intel's copyrights in the * base code distributed originally by Intel ("Original Intel Code") to copy, * make derivatives, distribute, use and display any portion of the Covered * Code in any form, with the right to sublicense such rights; and * * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent * license (with the right to sublicense), under only those claims of Intel * patents that are infringed by the Original Intel Code, to make, use, sell, * offer to sell, and import the Covered Code and derivative works thereof * solely to the minimum extent necessary to exercise the above copyright * license, and in no event shall the patent license extend to any additions * to or modifications of the Original Intel Code. No other license or right * is granted directly or by implication, estoppel or otherwise; * * The above copyright and patent license is granted only if the following * conditions are met: * * 3. Conditions * * 3.1. Redistribution of Source with Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification with rights to further distribute source must include * the above Copyright Notice, the above License, this list of Conditions, * and the following Disclaimer and Export Compliance provision. In addition, * Licensee must cause all Covered Code to which Licensee contributes to * contain a file documenting the changes Licensee made to create that Covered * Code and the date of any change. Licensee must include in that file the * documentation of any changes made by any predecessor Licensee. Licensee * must include a prominent statement that the modification is derived, * directly or indirectly, from Original Intel Code. * * 3.2. Redistribution of Source with no Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification without rights to further distribute source must * include the following Disclaimer and Export Compliance provision in the * documentation and/or other materials provided with distribution. In * addition, Licensee may not authorize further sublicense of source of any * portion of the Covered Code, and must include terms to the effect that the * license from Licensee to its licensee is limited to the intellectual * property embodied in the software Licensee provides to its licensee, and * not to intellectual property embodied in modifications its licensee may * make. * * 3.3. Redistribution of Executable. Redistribution in executable form of any * substantial portion of the Covered Code or modification must reproduce the * above Copyright Notice, and the following Disclaimer and Export Compliance * provision in the documentation and/or other materials provided with the * distribution. * * 3.4. Intel retains all right, title, and interest in and to the Original * Intel Code. * * 3.5. Neither the name Intel nor any other trademark owned or controlled by * Intel shall be used in advertising or otherwise to promote the sale, use or * other dealings in products derived from or relating to the Covered Code * without prior written authorization from Intel. * * 4. Disclaimer and Export Compliance * * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A * PARTICULAR PURPOSE. * * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY * LIMITED REMEDY. * * 4.3. Licensee shall not export, either directly or indirectly, any of this * software or system incorporating such software without first obtaining any * required license or other approval from the U. S. Department of Commerce or * any other agency or department of the United States Government. In the * event Licensee exports any such software from the United States or * re-exports any such software from a foreign destination, Licensee shall * ensure that the distribution and export/re-export of the software is in * compliance with all laws, regulations, orders, or other restrictions of the * U.S. Export Administration Regulations. Licensee agrees that neither it nor * any of its subsidiaries will export/re-export any technical data, process, * software, or service, directly or indirectly, to any country for which the * United States government or any agency thereof requires an export license, * other governmental approval, or letter of assurance, without first obtaining * such license, approval or letter. * *****************************************************************************/ #include #include #include #include #include #include #include #include #include #ifdef ACPI_DEBUGGER #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"}, {"INTEGERS"}, {"STRINGS"}, {"BUFFERS"}, {"PACKAGES"}, {"FIELDS"}, {"DEVICES"}, {"EVENTS"}, {"METHODS"}, {"MUTEXES"}, {"REGIONS"}, {"POWERRESOURCES"}, {"PROCESSORS"}, {"THERMALZONES"}, {"BUFFERFIELDS"}, {"DDBHANDLES"}, {NULL} /* Must be null terminated */ }; /******************************************************************************* * * 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) * * RETURN: Status * * DESCRIPTION: Simulate a sleep/wake sequence * ******************************************************************************/ ACPI_STATUS AcpiDbSleep ( char *ObjectArg) { #if ACPI_MACHINE_WIDTH == 16 return (AE_OK); #else ACPI_STATUS Status; UINT8 SleepState; SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0); AcpiOsPrintf ("**** Prepare to sleep ****\n"); Status = AcpiEnterSleepStatePrep (SleepState); if (ACPI_FAILURE (Status)) { return (Status); } AcpiOsPrintf ("**** Going to sleep ****\n"); Status = AcpiEnterSleepState (SleepState); if (ACPI_FAILURE (Status)) { return (Status); } AcpiOsPrintf ("**** returning from sleep ****\n"); Status = AcpiLeaveSleepState (SleepState); return (Status); #endif } /******************************************************************************* * * FUNCTION: AcpiDbWalkForReferences * * PARAMETERS: Callback from WalkNamespace * * RETURN: Status * * DESCRIPTION: Check if this namespace object refers to the target object * that is passed in as the context value. * * Note: Currently doesn't check subobjects within the Node's object * ******************************************************************************/ static ACPI_STATUS AcpiDbWalkForReferences ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue) { ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; /* Check for match against the namespace node itself */ if (Node == (void *) ObjDesc) { AcpiOsPrintf ("Object is a Node [%4.4s]\n", AcpiUtGetNodeName (Node)); } /* Check for match against the object attached to the node */ if (AcpiNsGetAttachedObject (Node) == ObjDesc) { AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", Node, AcpiUtGetNodeName (Node)); } return (AE_OK); } /******************************************************************************* * * FUNCTION: AcpiDbFindReferences * * PARAMETERS: ObjectArg - String with hex value of the object * * RETURN: None * * DESCRIPTION: Search namespace for all references to the input object * ******************************************************************************/ void AcpiDbFindReferences ( char *ObjectArg) { ACPI_OPERAND_OBJECT *ObjDesc; /* Convert string to object pointer */ ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); /* Search all nodes in namespace */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbWalkForReferences, (void *) ObjDesc, NULL); } /******************************************************************************* * * FUNCTION: AcpiDbDisplayLocks * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display information about internal mutexes. * ******************************************************************************/ void AcpiDbDisplayLocks ( void) { UINT32 i; for (i = 0; i < MAX_MUTEX; i++) { AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED ? "Locked" : "Unlocked"); } } /******************************************************************************* * * FUNCTION: AcpiDbDisplayTableInfo * * PARAMETERS: TableArg - String with name of table to be displayed * * RETURN: None * * DESCRIPTION: Display information about loaded tables. Current * implementation displays all loaded tables. * ******************************************************************************/ void AcpiDbDisplayTableInfo ( char *TableArg) { UINT32 i; ACPI_TABLE_DESC *TableDesc; for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { TableDesc = AcpiGbl_TableLists[i].Next; while (TableDesc) { AcpiOsPrintf ( "%s at %p length %.5X", AcpiGbl_TableData[i].Name, TableDesc->Pointer, (UINT32) TableDesc->Length); if (i != ACPI_TABLE_FACS) { AcpiOsPrintf (" OemID=%6s TableId=%8s OemRevision=%8.8X", TableDesc->Pointer->OemId, TableDesc->Pointer->OemTableId, TableDesc->Pointer->OemRevision); } AcpiOsPrintf ("\n"); TableDesc = TableDesc->Next; } } } /******************************************************************************* * * FUNCTION: AcpiDbUnloadAcpiTable * * PARAMETERS: TableArg - Name of the table to be unloaded * InstanceArg - Which instance of the table to unload (if * there are multiple tables of the same type) * * RETURN: Nonde * * DESCRIPTION: Unload an ACPI table. * Instance is not implemented * ******************************************************************************/ void AcpiDbUnloadAcpiTable ( char *TableArg, char *InstanceArg) { UINT32 i; ACPI_STATUS Status; /* Search all tables for the target type */ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature, AcpiGbl_TableData[i].SigLength)) { /* Found the table, unload it */ Status = AcpiUnloadTable (i); if (ACPI_SUCCESS (Status)) { AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg); } else { AcpiOsPrintf ("%s, while unloading [%s]\n", AcpiFormatException (Status), TableArg); } return; } } AcpiOsPrintf ("Unknown table type [%s]\n", TableArg); } /******************************************************************************* * * FUNCTION: AcpiDbSetMethodBreakpoint * * PARAMETERS: Location - AML offset of breakpoint * WalkState - Current walk info * Op - Current Op (from parse walk) * * RETURN: None * * DESCRIPTION: Set a breakpoint in a control method at the specified * AML offset * ******************************************************************************/ void AcpiDbSetMethodBreakpoint ( char *Location, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) { UINT32 Address; if (!Op) { AcpiOsPrintf ("There is no method currently executing\n"); return; } /* Get and verify the breakpoint address */ Address = ACPI_STRTOUL (Location, NULL, 16); if (Address <= Op->Common.AmlOffset) { AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->Common.AmlOffset); } /* Save breakpoint in current walk */ WalkState->UserBreakpoint = Address; AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address); } /******************************************************************************* * * FUNCTION: AcpiDbSetMethodCallBreakpoint * * PARAMETERS: Op - Current Op (from parse walk) * * RETURN: None * * DESCRIPTION: Set a breakpoint in a control method at the specified * AML offset * ******************************************************************************/ void AcpiDbSetMethodCallBreakpoint ( ACPI_PARSE_OBJECT *Op) { if (!Op) { AcpiOsPrintf ("There is no method currently executing\n"); return; } AcpiGbl_StepToNextCall = TRUE; } /******************************************************************************* * * FUNCTION: AcpiDbDisassembleAml * * PARAMETERS: Statements - Number of statements to disassemble * Op - Current Op (from parse walk) * * RETURN: None * * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number * of statements specified. * ******************************************************************************/ void AcpiDbDisassembleAml ( char *Statements, ACPI_PARSE_OBJECT *Op) { UINT32 NumStatements = 8; if (!Op) { AcpiOsPrintf ("There is no method currently executing\n"); return; } if (Statements) { NumStatements = ACPI_STRTOUL (Statements, NULL, 0); } #ifdef ACPI_DISASSEMBLER AcpiDmDisassemble (NULL, Op, NumStatements); #endif } /******************************************************************************* * * FUNCTION: AcpiDbDisassembleMethod * * PARAMETERS: Name - Name of control method * * RETURN: None * * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number * of statements specified. * ******************************************************************************/ ACPI_STATUS AcpiDbDisassembleMethod ( char *Name) { ACPI_STATUS Status; ACPI_PARSE_OBJECT *Op; ACPI_WALK_STATE *WalkState; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Method; Method = AcpiDbConvertToNode (Name); if (!Method) { return (AE_BAD_PARAMETER); } ObjDesc = Method->Object; Op = AcpiPsCreateScopeOp (); if (!Op) { return (AE_NO_MEMORY); } /* Create and initialize a new walk state */ WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL); if (!WalkState) { return (AE_NO_MEMORY); } Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, 1); if (ACPI_FAILURE (Status)) { return (Status); } /* 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); } /******************************************************************************* * * FUNCTION: AcpiDbDumpNamespace * * PARAMETERS: StartArg - Node to begin namespace dump * DepthArg - Maximum tree depth to be dumped * * RETURN: None * * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed * with type and other information. * ******************************************************************************/ void AcpiDbDumpNamespace ( char *StartArg, char *DepthArg) { ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode; UINT32 MaxDepth = ACPI_UINT32_MAX; /* No argument given, just start at the root and dump entire namespace */ if (StartArg) { SubtreeEntry = AcpiDbConvertToNode (StartArg); if (!SubtreeEntry) { return; } /* Now we can check for the depth argument */ if (DepthArg) { MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); } } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); 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_OWNER_ID_MAX, SubtreeEntry); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); } /******************************************************************************* * * FUNCTION: AcpiDbDumpNamespaceByOwner * * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed * DepthArg - Maximum tree depth to be dumped * * RETURN: None * * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId. * ******************************************************************************/ void AcpiDbDumpNamespaceByOwner ( char *OwnerArg, char *DepthArg) { ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode; UINT32 MaxDepth = ACPI_UINT32_MAX; ACPI_OWNER_ID OwnerId; OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0); /* Now we can check for the depth argument */ if (DepthArg) { MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId); /* Display the subtree */ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, SubtreeEntry); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); } /******************************************************************************* * * FUNCTION: AcpiDbSendNotify * * PARAMETERS: Name - Name of ACPI object to send the notify to * Value - Value of the notify to send. * * RETURN: None * * DESCRIPTION: Send an ACPI notification. The value specified is sent to the * named object as an ACPI notify. * ******************************************************************************/ void AcpiDbSendNotify ( char *Name, UINT32 Value) { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; /* Translate name to an Named object */ Node = AcpiDbConvertToNode (Name); if (!Node) { return; } /* Decode Named object type */ switch (Node->Type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: /* Send the notify */ Status = AcpiEvQueueNotifyRequest (Node, Value); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not queue notify\n"); } break; default: AcpiOsPrintf ("Named object is not a device or a thermal object\n"); break; } } /******************************************************************************* * * FUNCTION: AcpiDbSetMethodData * * PARAMETERS: TypeArg - L for local, A for argument * IndexArg - which one * ValueArg - Value to set. * * RETURN: None * * DESCRIPTION: Set a local or argument for the running control method. * NOTE: only object supported is Number. * ******************************************************************************/ void AcpiDbSetMethodData ( char *TypeArg, char *IndexArg, char *ValueArg) { char Type; UINT32 Index; UINT32 Value; ACPI_WALK_STATE *WalkState; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; /* Validate TypeArg */ AcpiUtStrupr (TypeArg); Type = TypeArg[0]; if ((Type != 'L') && (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); WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); if (!WalkState) { AcpiOsPrintf ("There is no method currently executing\n"); return; } /* Create and initialize the new object */ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!ObjDesc) { AcpiOsPrintf ("Could not create an internal object\n"); return; } ObjDesc->Integer.Value = Value; /* Store the new object into the target */ switch (Type) { case 'A': /* Set a method argument */ if (Index > ACPI_METHOD_MAX_ARG) { AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index); return; } Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return; } ObjDesc = WalkState->Arguments[Index].Object; AcpiOsPrintf ("Arg%d: ", Index); AcpiDmDisplayInternalObject (ObjDesc, WalkState); break; case 'L': /* Set a method local */ if (Index > ACPI_METHOD_MAX_LOCAL) { AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index); return; } Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return; } ObjDesc = WalkState->LocalVariables[Index].Object; AcpiOsPrintf ("Local%d: ", Index); AcpiDmDisplayInternalObject (ObjDesc, WalkState); break; default: break; } } /******************************************************************************* * * FUNCTION: AcpiDbWalkForSpecificObjects * * PARAMETERS: Callback from WalkNamespace * * RETURN: Status * * DESCRIPTION: Display short info about objects in the namespace * ******************************************************************************/ static ACPI_STATUS AcpiDbWalkForSpecificObjects ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue) { ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; ACPI_BUFFER Buffer; ACPI_STATUS Status; Info->Count++; /* Get and display the full pathname to this 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); } AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); ACPI_MEM_FREE (Buffer.Pointer); /* Dump short info about the object */ (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL); return (AE_OK); } /******************************************************************************* * * FUNCTION: AcpiDbDisplayObjects * * PARAMETERS: ObjTypeArg - Type of object to display * DisplayCountArg - Max depth to display * * RETURN: None * * DESCRIPTION: Display objects in the namespace of the requested type * ******************************************************************************/ ACPI_STATUS AcpiDbDisplayObjects ( char *ObjTypeArg, char *DisplayCountArg) { ACPI_WALK_INFO Info; ACPI_OBJECT_TYPE Type; /* Get the object type */ Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes); if (Type == ACPI_TYPE_NOT_FOUND) { AcpiOsPrintf ("Invalid or unsupported argument\n"); return (AE_OK); } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); 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 *) &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); } /******************************************************************************* * * FUNCTION: AcpiDbWalkAndMatchName * * PARAMETERS: Callback from WalkNamespace * * RETURN: Status * * DESCRIPTION: Find a particular name/names within the namespace. Wildcards * are supported -- '?' matches any character. * ******************************************************************************/ static ACPI_STATUS AcpiDbWalkAndMatchName ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue) { ACPI_STATUS Status; char *RequestedName = (char *) Context; UINT32 i; ACPI_BUFFER Buffer; ACPI_WALK_INFO Info; /* Check for a name match */ for (i = 0; i < 4; i++) { /* Wildcard support */ if ((RequestedName[i] != '?') && (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i])) { /* No match, just exit */ return (AE_OK); } } /* Get the full pathname to this 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); } else { 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); } return (AE_OK); } /******************************************************************************* * * FUNCTION: AcpiDbFindNameInNamespace * * PARAMETERS: NameArg - The 4-character ACPI name to find. * wildcards are supported. * * RETURN: None * * DESCRIPTION: Search the namespace for a given name (with wildcards) * ******************************************************************************/ ACPI_STATUS AcpiDbFindNameInNamespace ( char *NameArg) { if (ACPI_STRLEN (NameArg) > 4) { AcpiOsPrintf ("Name must be no longer than 4 characters\n"); return (AE_OK); } /* Walk the namespace from the root */ AcpiUtStrupr (NameArg); (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbWalkAndMatchName, NameArg, NULL); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return (AE_OK); } /******************************************************************************* * * FUNCTION: AcpiDbSetScope * * PARAMETERS: Name - New scope path * * RETURN: Status * * DESCRIPTION: Set the "current scope" as maintained by this utility. * The scope is used as a prefix to ACPI paths. * ******************************************************************************/ void AcpiDbSetScope ( char *Name) { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; if (!Name || Name[0] == 0) { AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf); return; } AcpiDbPrepNamestring (Name); if (Name[0] == '\\') { /* Validate new scope from the root */ Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode, ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { goto ErrorExit; } ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name); ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\"); } else { /* Validate new scope relative to old scope */ Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode, ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { goto ErrorExit; } ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name); ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\"); } AcpiGbl_DbScopeNode = Node; AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf); return; ErrorExit: 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); } /******************************************************************************* * * FUNCTION: AcpiDbDisplayResources * * PARAMETERS: ObjectArg - String with hex value of the object * * RETURN: None * * DESCRIPTION: Display the resource objects associated with a device. * ******************************************************************************/ void AcpiDbDisplayResources ( char *ObjectArg) { #if ACPI_MACHINE_WIDTH != 16 ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_BUFFER ReturnObj; AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); AcpiDbgLevel |= ACPI_LV_RESOURCES; /* Convert string to object pointer */ Node = AcpiDbConvertToNode (ObjectArg); if (!Node) { return; } /* Prepare for a return object of arbitrary size */ ReturnObj.Pointer = AcpiGbl_DbBuffer; ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; /* _PRT */ AcpiOsPrintf ("Evaluating _PRT\n"); /* 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)); goto GetCrs; } ReturnObj.Pointer = AcpiGbl_DbBuffer; ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); if (ACPI_FAILURE (Status)) { 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; /* 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)); goto GetPrs; } /* Get the _CRS resource list */ ReturnObj.Pointer = AcpiGbl_DbBuffer; ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; Status = AcpiGetCurrentResources (Node, &ReturnObj); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status)); goto GetPrs; } /* 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)); goto GetPrs; } /* _PRS */ GetPrs: AcpiOsPrintf ("Evaluating _PRS\n"); ReturnObj.Pointer = AcpiGbl_DbBuffer; ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; /* 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)); goto Cleanup; } ReturnObj.Pointer = AcpiGbl_DbBuffer; ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; Status = AcpiGetPossibleResources (Node, &ReturnObj); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiFormatException (Status)); goto Cleanup; } AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); Cleanup: AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return; #endif } /******************************************************************************* * * FUNCTION: AcpiDbIntegrityWalk * * PARAMETERS: Callback from WalkNamespace * * RETURN: Status * * DESCRIPTION: Examine one NS node for valid values. * ******************************************************************************/ static ACPI_STATUS AcpiDbIntegrityWalk ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue) { ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_OPERAND_OBJECT *Object; Info->Nodes++; if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s]\n", Node, AcpiUtGetDescriptorName (Node)); } if (Node->Type > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", Node, Node->Type); } if (!AcpiUtValidAcpiName (Node->Name.Integer)) { AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); } Object = AcpiNsGetAttachedObject (Node); if (Object) { Info->Objects++; if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n", Object, AcpiUtGetDescriptorName (Object)); } } return (AE_OK); } /******************************************************************************* * * FUNCTION: AcpiDbCheckIntegrity * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Check entire namespace for data structure integrity * ******************************************************************************/ void AcpiDbCheckIntegrity ( void) { ACPI_INTEGRITY_INFO Info = {0,0}; /* Search all nodes in namespace */ (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); } /******************************************************************************* * * FUNCTION: AcpiDbGenerateGpe * * PARAMETERS: GpeArg - Raw GPE number, ascii string * BlockArg - GPE block number, ascii string * 0 or 1 for FADT GPE blocks * * RETURN: None * * DESCRIPTION: Generate a GPE * ******************************************************************************/ void AcpiDbGenerateGpe ( char *GpeArg, char *BlockArg) { UINT32 BlockNumber; UINT32 GpeNumber; ACPI_GPE_EVENT_INFO *GpeEventInfo; GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0); BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), GpeNumber); if (!GpeEventInfo) { AcpiOsPrintf ("Invalid GPE\n"); return; } (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); + Status = AcpiGetHandle (Node, METHOD_NAME__PRT, (ACPI_HANDLE *) &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/osunixxf.c b/sys/contrib/dev/acpica/osunixxf.c index b693305cb91c..91e11fda443c 100644 --- a/sys/contrib/dev/acpica/osunixxf.c +++ b/sys/contrib/dev/acpica/osunixxf.c @@ -1,1112 +1,1112 @@ /****************************************************************************** * * Module Name: osunixxf - UNIX OSL interfaces * *****************************************************************************/ /****************************************************************************** * * 1. Copyright Notice * * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License * * 2.1. This is your license from Intel Corp. under its intellectual property * rights. You may have additional license terms from the party that provided * you this software, covering your right to use that party's intellectual * property rights. * * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a * copy of the source code appearing in this file ("Covered Code") an * irrevocable, perpetual, worldwide license under Intel's copyrights in the * base code distributed originally by Intel ("Original Intel Code") to copy, * make derivatives, distribute, use and display any portion of the Covered * Code in any form, with the right to sublicense such rights; and * * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent * license (with the right to sublicense), under only those claims of Intel * patents that are infringed by the Original Intel Code, to make, use, sell, * offer to sell, and import the Covered Code and derivative works thereof * solely to the minimum extent necessary to exercise the above copyright * license, and in no event shall the patent license extend to any additions * to or modifications of the Original Intel Code. No other license or right * is granted directly or by implication, estoppel or otherwise; * * The above copyright and patent license is granted only if the following * conditions are met: * * 3. Conditions * * 3.1. Redistribution of Source with Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification with rights to further distribute source must include * the above Copyright Notice, the above License, this list of Conditions, * and the following Disclaimer and Export Compliance provision. In addition, * Licensee must cause all Covered Code to which Licensee contributes to * contain a file documenting the changes Licensee made to create that Covered * Code and the date of any change. Licensee must include in that file the * documentation of any changes made by any predecessor Licensee. Licensee * must include a prominent statement that the modification is derived, * directly or indirectly, from Original Intel Code. * * 3.2. Redistribution of Source with no Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification without rights to further distribute source must * include the following Disclaimer and Export Compliance provision in the * documentation and/or other materials provided with distribution. In * addition, Licensee may not authorize further sublicense of source of any * portion of the Covered Code, and must include terms to the effect that the * license from Licensee to its licensee is limited to the intellectual * property embodied in the software Licensee provides to its licensee, and * not to intellectual property embodied in modifications its licensee may * make. * * 3.3. Redistribution of Executable. Redistribution in executable form of any * substantial portion of the Covered Code or modification must reproduce the * above Copyright Notice, and the following Disclaimer and Export Compliance * provision in the documentation and/or other materials provided with the * distribution. * * 3.4. Intel retains all right, title, and interest in and to the Original * Intel Code. * * 3.5. Neither the name Intel nor any other trademark owned or controlled by * Intel shall be used in advertising or otherwise to promote the sale, use or * other dealings in products derived from or relating to the Covered Code * without prior written authorization from Intel. * * 4. Disclaimer and Export Compliance * * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A * PARTICULAR PURPOSE. * * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY * LIMITED REMEDY. * * 4.3. Licensee shall not export, either directly or indirectly, any of this * software or system incorporating such software without first obtaining any * required license or other approval from the U. S. Department of Commerce or * any other agency or department of the United States Government. In the * event Licensee exports any such software from the United States or * re-exports any such software from a foreign destination, Licensee shall * ensure that the distribution and export/re-export of the software is in * compliance with all laws, regulations, orders, or other restrictions of the * U.S. Export Administration Regulations. Licensee agrees that neither it nor * any of its subsidiaries will export/re-export any technical data, process, * software, or service, directly or indirectly, to any country for which the * United States government or any agency thereof requires an export license, * other governmental approval, or letter of assurance, without first obtaining * such license, approval or letter. * *****************************************************************************/ /* * These interfaces are required in order to compile the ASL compiler under * Linux. */ #include #include #include #include #include #include #include #include #include #include #define _COMPONENT ACPI_OS_SERVICES ACPI_MODULE_NAME ("osunixxf") extern FILE *AcpiGbl_DebugFile; FILE *AcpiGbl_OutputFile; /****************************************************************************** * * FUNCTION: AcpiOsInitialize, AcpiOsTerminate * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Init and terminate. Nothing to do. * *****************************************************************************/ ACPI_STATUS AcpiOsInitialize (void) { AcpiGbl_OutputFile = stdout; return AE_OK; } ACPI_STATUS AcpiOsTerminate (void) { return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsGetRootPointer * * PARAMETERS: Flags - Logical or physical addressing mode * Address - Where the address is returned * * RETURN: Status * * DESCRIPTION: Gets the root pointer (RSDP) * *****************************************************************************/ ACPI_STATUS AcpiOsGetRootPointer ( UINT32 Flags, ACPI_POINTER *Address) { - return (AeLocalGetRootPointer(Flags, Address)); + return (AeLocalGetRootPointer(Flags, (ACPI_PHYSICAL_ADDRESS *) Address)); } /****************************************************************************** * * FUNCTION: AcpiOsPredefinedOverride * * PARAMETERS: InitVal - Initial value of the predefined object * NewVal - The new value for the object * * RETURN: Status, pointer to value. Null pointer returned if not * overriding. * * DESCRIPTION: Allow the OS to override predefined names * *****************************************************************************/ ACPI_STATUS AcpiOsPredefinedOverride ( const ACPI_PREDEFINED_NAMES *InitVal, ACPI_STRING *NewVal) { if (!InitVal || !NewVal) { return (AE_BAD_PARAMETER); } *NewVal = NULL; return (AE_OK); } /****************************************************************************** * * FUNCTION: AcpiOsTableOverride * * PARAMETERS: ExistingTable - Header of current table (probably firmware) * NewTable - Where an entire new table is returned. * * RETURN: Status, pointer to new table. Null pointer returned if no * table is available to override * * DESCRIPTION: Return a different version of a table if one is available * *****************************************************************************/ ACPI_STATUS AcpiOsTableOverride ( ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable) { if (!ExistingTable || !NewTable) { return (AE_BAD_PARAMETER); } *NewTable = NULL; #ifdef ACPI_EXEC_APP /* This code exercises the table override mechanism in the core */ if (!ACPI_STRNCMP (ExistingTable->Signature, DSDT_SIG, ACPI_NAME_SIZE)) { /* override DSDT with itself */ *NewTable = AcpiGbl_DbTablePtr; } return (AE_OK); #else return AE_NO_ACPI_TABLES; #endif } /****************************************************************************** * * FUNCTION: AcpiOsReadable * * PARAMETERS: Pointer - Area to be verified * Length - Size of area * * RETURN: TRUE if readable for entire length * * DESCRIPTION: Verify that a pointer is valid for reading * *****************************************************************************/ BOOLEAN AcpiOsReadable ( void *Pointer, ACPI_SIZE Length) { return (TRUE); } /****************************************************************************** * * FUNCTION: AcpiOsWritable * * PARAMETERS: Pointer - Area to be verified * Length - Size of area * * RETURN: TRUE if writable for entire length * * DESCRIPTION: Verify that a pointer is valid for writing * *****************************************************************************/ BOOLEAN AcpiOsWritable ( void *Pointer, ACPI_SIZE Length) { return (TRUE); } /****************************************************************************** * * FUNCTION: AcpiOsRedirectOutput * * PARAMETERS: Destination - An open file handle/pointer * * RETURN: None * * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf * *****************************************************************************/ void AcpiOsRedirectOutput ( void *Destination) { AcpiGbl_OutputFile = Destination; } /****************************************************************************** * * FUNCTION: AcpiOsPrintf * * PARAMETERS: fmt, ... Standard printf format * * RETURN: None * * DESCRIPTION: Formatted output * *****************************************************************************/ void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf ( const char *Fmt, ...) { va_list Args; va_start (Args, Fmt); AcpiOsVprintf (Fmt, Args); va_end (Args); return; } /****************************************************************************** * * FUNCTION: AcpiOsVprintf * * PARAMETERS: fmt Standard printf format * args Argument list * * RETURN: None * * DESCRIPTION: Formatted output with argument list pointer * *****************************************************************************/ void AcpiOsVprintf ( const char *Fmt, va_list Args) { INT32 Count = 0; UINT8 Flags; Flags = AcpiGbl_DbOutputFlags; if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) { /* Output is directable to either a file (if open) or the console */ if (AcpiGbl_DebugFile) { /* Output file is open, send the output there */ Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args); } else { /* No redirection, send output to console (once only!) */ Flags |= ACPI_DB_CONSOLE_OUTPUT; } } if (Flags & ACPI_DB_CONSOLE_OUTPUT) { Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args); } return; } /****************************************************************************** * * FUNCTION: AcpiOsGetLine * * PARAMETERS: fmt Standard printf format * args Argument list * * RETURN: Actual bytes read * * DESCRIPTION: Formatted input with argument list pointer * *****************************************************************************/ UINT32 AcpiOsGetLine ( char *Buffer) { UINT8 Temp; UINT32 i; for (i = 0; ; i++) { scanf ("%1c", &Temp); if (!Temp || Temp == '\n') { break; } Buffer [i] = Temp; } /* Null terminate the buffer */ Buffer [i] = 0; /* Return the number of bytes in the string */ return (i); } /****************************************************************************** * * FUNCTION: AcpiOsMapMemory * * PARAMETERS: where Physical address of memory to be mapped * length How much memory to map * there Logical address of mapped memory * * RETURN: Pointer to mapped memory. Null on error. * * DESCRIPTION: Map physical memory into caller's address space * *****************************************************************************/ ACPI_STATUS AcpiOsMapMemory ( ACPI_PHYSICAL_ADDRESS where, ACPI_SIZE length, void **there) { *there = ACPI_TO_POINTER (where); return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsUnmapMemory * * PARAMETERS: where Logical address of memory to be unmapped * length How much memory to unmap * * RETURN: None. * * DESCRIPTION: Delete a previously created mapping. Where and Length must * correspond to a previous mapping exactly. * *****************************************************************************/ void AcpiOsUnmapMemory ( void *where, ACPI_SIZE length) { return; } /****************************************************************************** * * FUNCTION: AcpiOsAllocate * * PARAMETERS: Size Amount to allocate, in bytes * * RETURN: Pointer to the new allocation. Null on error. * * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. * *****************************************************************************/ void * AcpiOsAllocate ( ACPI_SIZE size) { void *Mem; Mem = (void *) malloc ((size_t) size); return Mem; } /****************************************************************************** * * FUNCTION: AcpiOsFree * * PARAMETERS: mem Pointer to previously allocated memory * * RETURN: None. * * DESCRIPTION: Free memory allocated via AcpiOsAllocate * *****************************************************************************/ void AcpiOsFree ( void *mem) { free (mem); } /****************************************************************************** * * FUNCTION: AcpiOsCreateSemaphore * * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore * OutHandle - Where a handle will be returned * * RETURN: Status * * DESCRIPTION: Create an OS semaphore * *****************************************************************************/ ACPI_STATUS AcpiOsCreateSemaphore ( UINT32 MaxUnits, UINT32 InitialUnits, ACPI_HANDLE *OutHandle) { *OutHandle = (ACPI_HANDLE) 1; return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsDeleteSemaphore * * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore * * RETURN: Status * * DESCRIPTION: Delete an OS semaphore * *****************************************************************************/ ACPI_STATUS AcpiOsDeleteSemaphore ( ACPI_HANDLE Handle) { if (!Handle) { return AE_BAD_PARAMETER; } return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsWaitSemaphore * * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore * Units - How many units to wait for * Timeout - How long to wait * * RETURN: Status * * DESCRIPTION: Wait for units * *****************************************************************************/ ACPI_STATUS AcpiOsWaitSemaphore ( ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout) { return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsSignalSemaphore * * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore * Units - Number of units to send * * RETURN: Status * * DESCRIPTION: Send units * *****************************************************************************/ ACPI_STATUS AcpiOsSignalSemaphore ( ACPI_HANDLE Handle, UINT32 Units) { return AE_OK; } ACPI_STATUS AcpiOsCreateLock ( ACPI_HANDLE *OutHandle) { return (AcpiOsCreateSemaphore (1, 1, OutHandle)); } void AcpiOsDeleteLock ( ACPI_HANDLE Handle) { AcpiOsDeleteSemaphore (Handle); } ACPI_NATIVE_UINT AcpiOsAcquireLock ( ACPI_HANDLE Handle) { AcpiOsWaitSemaphore (Handle, 1, 0xFFFF); return (0); } void AcpiOsReleaseLock ( ACPI_HANDLE Handle, ACPI_NATIVE_UINT Flags) { AcpiOsSignalSemaphore (Handle, 1); } /****************************************************************************** * * FUNCTION: AcpiOsInstallInterruptHandler * * PARAMETERS: InterruptNumber Level handler should respond to. * Isr Address of the ACPI interrupt handler * ExceptPtr Where status is returned * * RETURN: Handle to the newly installed handler. * * DESCRIPTION: Install an interrupt handler. Used to install the ACPI * OS-independent handler. * *****************************************************************************/ UINT32 AcpiOsInstallInterruptHandler ( UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine, void *Context) { return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsRemoveInterruptHandler * * PARAMETERS: Handle Returned when handler was installed * * RETURN: Status * * DESCRIPTION: Uninstalls an interrupt handler. * *****************************************************************************/ ACPI_STATUS AcpiOsRemoveInterruptHandler ( UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine) { return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsQueueForExecution * * PARAMETERS: Priority - Requested execution priority * Function - Address of the function to execute * Context - Passed as a parameter to the function * * RETURN: Status. * * DESCRIPTION: Sleep at microsecond granularity * *****************************************************************************/ ACPI_STATUS AcpiOsQueueForExecution ( UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function, void *Context) { // _beginthread (Function, (unsigned) 0, Context); return 0; } /****************************************************************************** * * FUNCTION: AcpiOsBreakpoint * * PARAMETERS: Msg Message to print * * RETURN: Status * * DESCRIPTION: Print a message and break to the debugger. * *****************************************************************************/ ACPI_STATUS AcpiOsBreakpoint ( char *Msg) { /* Print the message and do an INT 3 */ if (Msg) { AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg); } else { AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); } return AE_OK; } /****************************************************************************** * * FUNCTION: AcpiOsStall * * PARAMETERS: microseconds To sleep * * RETURN: Blocks until sleep is completed. * * DESCRIPTION: Sleep at microsecond granularity * *****************************************************************************/ void AcpiOsStall ( UINT32 microseconds) { if (microseconds) { usleep (microseconds); } return; } /****************************************************************************** * * FUNCTION: AcpiOsSleep * * PARAMETERS: milliseconds To sleep * * RETURN: Blocks until sleep is completed. * * DESCRIPTION: Sleep at millisecond granularity * *****************************************************************************/ void AcpiOsSleep ( ACPI_INTEGER milliseconds) { sleep (milliseconds / 1000); /* Sleep for whole seconds */ /* * Arg to usleep() must be less than 1,000,000 (1 second) */ usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ return; } /****************************************************************************** * * FUNCTION: AcpiOsGetTimer * * PARAMETERS: None * * RETURN: Current time in 100 nanosecond units * * DESCRIPTION: Get the current system time * *****************************************************************************/ UINT64 AcpiOsGetTimer (void) { struct timeval time; gettimeofday(&time, NULL); /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */ return (((UINT64) time.tv_sec * 10000000) + ((UINT64) time.tv_usec * 10)); } /****************************************************************************** * * FUNCTION: AcpiOsReadPciConfiguration * * PARAMETERS: PciId Seg/Bus/Dev * Register Device Register * Value Buffer where value is placed * Width Number of bits * * RETURN: Status * * DESCRIPTION: Read data from PCI configuration space * *****************************************************************************/ ACPI_STATUS AcpiOsReadPciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Register, void *Value, UINT32 Width) { return (AE_OK); } /****************************************************************************** * * FUNCTION: AcpiOsWritePciConfiguration * * PARAMETERS: PciId Seg/Bus/Dev * Register Device Register * Value Value to be written * Width Number of bits * * RETURN: Status. * * DESCRIPTION: Write data to PCI configuration space * *****************************************************************************/ ACPI_STATUS AcpiOsWritePciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Register, ACPI_INTEGER Value, UINT32 Width) { return (AE_OK); } /* TEMPORARY STUB FUNCTION */ void AcpiOsDerivePciId( ACPI_HANDLE rhandle, ACPI_HANDLE chandle, ACPI_PCI_ID **PciId) { } /****************************************************************************** * * FUNCTION: AcpiOsReadPort * * PARAMETERS: Address Address of I/O port/register to read * Value Where value is placed * Width Number of bits * * RETURN: Value read from port * * DESCRIPTION: Read data from an I/O port or register * *****************************************************************************/ ACPI_STATUS AcpiOsReadPort ( ACPI_IO_ADDRESS Address, UINT32 *Value, UINT32 Width) { switch (Width) { case 8: *Value = 0xFF; break; case 16: *Value = 0xFFFF; break; case 32: *Value = 0xFFFFFFFF; break; } return (AE_OK); } /****************************************************************************** * * FUNCTION: AcpiOsWritePort * * PARAMETERS: Address Address of I/O port/register to write * Value Value to write * Width Number of bits * * RETURN: None * * DESCRIPTION: Write data to an I/O port or register * *****************************************************************************/ ACPI_STATUS AcpiOsWritePort ( ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width) { return (AE_OK); } /****************************************************************************** * * FUNCTION: AcpiOsReadMemory * * PARAMETERS: Address Physical Memory Address to read * Value Where value is placed * Width Number of bits * * RETURN: Value read from physical memory address * * DESCRIPTION: Read data from a physical memory address * *****************************************************************************/ ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value, UINT32 Width) { switch (Width) { case 8: case 16: case 32: *Value = 0; break; default: return (AE_BAD_PARAMETER); break; } return (AE_OK); } /****************************************************************************** * * FUNCTION: AcpiOsWriteMemory * * PARAMETERS: Address Physical Memory Address to write * Value Value to write * Width Number of bits * * RETURN: None * * DESCRIPTION: Write data to a physical memory address * *****************************************************************************/ ACPI_STATUS AcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width) { return (AE_OK); } UINT32 AcpiOsGetThreadId(void) { return getpid(); } /****************************************************************************** * * FUNCTION: AcpiOsSignal * * PARAMETERS: Function ACPI CA signal function code * Info Pointer to function-dependent structure * * RETURN: Status * * DESCRIPTION: Miscellaneous functions * *****************************************************************************/ ACPI_STATUS AcpiOsSignal ( UINT32 Function, void *Info) { switch (Function) { case ACPI_SIGNAL_FATAL: break; case ACPI_SIGNAL_BREAKPOINT: if (Info) { AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info); } else { AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); } break; } return (AE_OK); } diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c index 8be18b5bbb9d..d59fb92a521e 100644 --- a/sys/contrib/dev/acpica/rsdump.c +++ b/sys/contrib/dev/acpica/rsdump.c @@ -1,868 +1,868 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. * $Revision: 1.54 $ * ******************************************************************************/ /****************************************************************************** * * 1. Copyright Notice * * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License * * 2.1. This is your license from Intel Corp. under its intellectual property * rights. You may have additional license terms from the party that provided * you this software, covering your right to use that party's intellectual * property rights. * * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a * copy of the source code appearing in this file ("Covered Code") an * irrevocable, perpetual, worldwide license under Intel's copyrights in the * base code distributed originally by Intel ("Original Intel Code") to copy, * make derivatives, distribute, use and display any portion of the Covered * Code in any form, with the right to sublicense such rights; and * * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent * license (with the right to sublicense), under only those claims of Intel * patents that are infringed by the Original Intel Code, to make, use, sell, * offer to sell, and import the Covered Code and derivative works thereof * solely to the minimum extent necessary to exercise the above copyright * license, and in no event shall the patent license extend to any additions * to or modifications of the Original Intel Code. No other license or right * is granted directly or by implication, estoppel or otherwise; * * The above copyright and patent license is granted only if the following * conditions are met: * * 3. Conditions * * 3.1. Redistribution of Source with Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification with rights to further distribute source must include * the above Copyright Notice, the above License, this list of Conditions, * and the following Disclaimer and Export Compliance provision. In addition, * Licensee must cause all Covered Code to which Licensee contributes to * contain a file documenting the changes Licensee made to create that Covered * Code and the date of any change. Licensee must include in that file the * documentation of any changes made by any predecessor Licensee. Licensee * must include a prominent statement that the modification is derived, * directly or indirectly, from Original Intel Code. * * 3.2. Redistribution of Source with no Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification without rights to further distribute source must * include the following Disclaimer and Export Compliance provision in the * documentation and/or other materials provided with distribution. In * addition, Licensee may not authorize further sublicense of source of any * portion of the Covered Code, and must include terms to the effect that the * license from Licensee to its licensee is limited to the intellectual * property embodied in the software Licensee provides to its licensee, and * not to intellectual property embodied in modifications its licensee may * make. * * 3.3. Redistribution of Executable. Redistribution in executable form of any * substantial portion of the Covered Code or modification must reproduce the * above Copyright Notice, and the following Disclaimer and Export Compliance * provision in the documentation and/or other materials provided with the * distribution. * * 3.4. Intel retains all right, title, and interest in and to the Original * Intel Code. * * 3.5. Neither the name Intel nor any other trademark owned or controlled by * Intel shall be used in advertising or otherwise to promote the sale, use or * other dealings in products derived from or relating to the Covered Code * without prior written authorization from Intel. * * 4. Disclaimer and Export Compliance * * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A * PARTICULAR PURPOSE. * * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY * LIMITED REMEDY. * * 4.3. Licensee shall not export, either directly or indirectly, any of this * software or system incorporating such software without first obtaining any * required license or other approval from the U. S. Department of Commerce or * any other agency or department of the United States Government. In the * event Licensee exports any such software from the United States or * re-exports any such software from a foreign destination, Licensee shall * ensure that the distribution and export/re-export of the software is in * compliance with all laws, regulations, orders, or other restrictions of the * U.S. Export Administration Regulations. Licensee agrees that neither it nor * any of its subsidiaries will export/re-export any technical data, process, * software, or service, directly or indirectly, to any country for which the * United States government or any agency thereof requires an export license, * other governmental approval, or letter of assurance, without first obtaining * such license, approval or letter. * *****************************************************************************/ #define __RSDUMP_C__ #include #include #include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsdump") #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* Local prototypes */ static void AcpiRsOutString ( char *Title, char *Value); static void AcpiRsOutInteger8 ( char *Title, UINT8 Value); static void AcpiRsOutInteger16 ( char *Title, UINT16 Value); static void AcpiRsOutInteger32 ( char *Title, UINT32 Value); static void AcpiRsOutInteger64 ( char *Title, UINT64 Value); static void AcpiRsOutTitle ( char *Title); static void AcpiRsDumpByteList ( UINT16 Length, UINT8 *Data); static void AcpiRsDumpDwordList ( UINT8 Length, UINT32 *Data); static void AcpiRsDumpShortByteList ( UINT8 Length, UINT8 *Data); static void AcpiRsDumpResourceSource ( ACPI_RESOURCE_SOURCE *ResourceSource); static void AcpiRsDumpAddressCommon ( ACPI_RESOURCE_DATA *Resource); static void AcpiRsDumpDescriptor ( void *Resource, ACPI_RSDUMP_INFO *Table); #define ACPI_RSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f) #define ACPI_PRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f) #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_RSDUMP_INFO)) /******************************************************************************* * * Resource Descriptor info tables * * Note: The first table entry must be a Title or Literal and must contain * the table length (number of table entries) * ******************************************************************************/ ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HEDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LLDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_SHRDecode}, {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL}, {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TYPDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BMDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SIZDecode}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL}, {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[3] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf), "Start-Dependent-Functions",NULL}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority), "Compatibility Priority", AcpiGbl_ConfigDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness), "Performance/Robustness", AcpiGbl_ConfigDecode} }; ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[1] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf), "End-Dependent-Functions", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpIo[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo), "I/O", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode), "Address Decoding", AcpiGbl_IoDecode}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.Alignment), "Alignment", NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.AddressLength), "Address Length", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[3] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo), "Fixed I/O", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedIo.Address), "Address", NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedIo.AddressLength), "Address Length", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpVendor[3] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor), "Vendor Specific", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Vendor.ByteLength), "Length", NULL}, {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]), "Vendor Data", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag), "EndTag", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.AddressLength), "Address Length", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.AddressLength), "Address Length", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpAddress16[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16), "16-Bit WORD Address Space",NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Granularity), "Granularity", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.TranslationOffset), "Translation Offset", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.AddressLength), "Address Length", NULL}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address16.ResourceSource), NULL, NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpAddress32[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32), "32-Bit DWORD Address Space", NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Granularity), "Granularity", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.TranslationOffset), "Translation Offset", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.AddressLength), "Address Length", NULL}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address32.ResourceSource), NULL, NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpAddress64[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64), "64-Bit QWORD Address Space", NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Granularity), "Granularity", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.TranslationOffset), "Translation Offset", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.AddressLength), "Address Length", NULL}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address64.ResourceSource), NULL, NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64), "64-Bit Extended Address Space", NULL}, {ACPI_RSD_ADDRESS, 0, NULL, NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Granularity), "Granularity", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset), "Translation Offset", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.AddressLength), "Address Length", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific), "Type-Specific Attribute", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HEDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LLDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_SHRDecode}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL}, {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg), "Generic Register", NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.SpaceId), "Space ID", NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitWidth), "Bit Width", NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitOffset), "Bit Offset", NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.AccessSize), "Access Size", NULL}, {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (GenericReg.Address), "Address", NULL} }; /* * Tables used for common address descriptor flag fields */ static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DECDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode} }; static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] = { {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", "Memory Range"}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MEMDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MTPDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TTPDecode} }; static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] = { {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", "I/O Range"}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RNGDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TTPDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TRSDecode} }; /* * Table used to dump _PRT contents */ static ACPI_RSDUMP_INFO AcpiRsDumpPrt[5] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt), NULL, NULL}, {ACPI_RSD_UINT64, ACPI_PRT_OFFSET (Address), "Address", NULL}, {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (Pin), "Pin", NULL}, {ACPI_RSD_STRING, ACPI_PRT_OFFSET (Source[0]), "Source", NULL}, {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (SourceIndex), "Source Index", NULL} }; /******************************************************************************* * * FUNCTION: AcpiRsDumpDescriptor * * PARAMETERS: Resource * * RETURN: None * * DESCRIPTION: * ******************************************************************************/ static void AcpiRsDumpDescriptor ( void *Resource, ACPI_RSDUMP_INFO *Table) { void *Target = NULL; void *PreviousTarget; char *Name; UINT8 Count; /* First table entry must contain the table length (# of table entries) */ Count = Table->Offset; while (Count) { PreviousTarget = Target; Target = ((UINT8 *) Resource) + Table->Offset; Name = Table->Name; switch (Table->Opcode) { case ACPI_RSD_TITLE: /* * Optional resource title */ if (Table->Name) { AcpiOsPrintf ("%s Resource\n", Name); } break; /* Strings */ case ACPI_RSD_LITERAL: - AcpiRsOutString (Name, (char *) Table->Pointer); + AcpiRsOutString (Name, (char *) (uintptr_t) Table->Pointer); break; case ACPI_RSD_STRING: - AcpiRsOutString (Name, (char *) Target); + AcpiRsOutString (Name, (char *) (uintptr_t) Target); break; /* Data items, 8/16/32/64 bit */ case ACPI_RSD_UINT8: AcpiRsOutInteger8 (Name, *(UINT8 *) Target); break; case ACPI_RSD_UINT16: AcpiRsOutInteger16 (Name, *(UINT16 *) Target); break; case ACPI_RSD_UINT32: AcpiRsOutInteger32 (Name, *(UINT32 *) Target); break; case ACPI_RSD_UINT64: AcpiRsOutInteger64 (Name, *(UINT64 *) Target); break; /* Flags: 1-bit and 2-bit flags supported */ case ACPI_RSD_1BITFLAG: - AcpiRsOutString (Name, (char *) - ((const char **) Table->Pointer)[(*(UINT8 *) Target) & 0x01]); + AcpiRsOutString (Name, (char *) (uintptr_t) + ((const char **) (uintptr_t) Table->Pointer)[(*(UINT8 *) Target) & 0x01]); break; case ACPI_RSD_2BITFLAG: - AcpiRsOutString (Name, (char *) - ((const char **) Table->Pointer)[(*(UINT8 *) Target) & 0x03]); + AcpiRsOutString (Name, (char *) (uintptr_t) + ((const char **) (uintptr_t) Table->Pointer)[(*(UINT8 *) Target) & 0x03]); break; case ACPI_RSD_SHORTLIST: /* * Short byte list (single line output) for DMA and IRQ resources * Note: The list length is obtained from the previous table entry */ if (PreviousTarget) { AcpiRsOutTitle (Name); AcpiRsDumpShortByteList (*((UINT8 *) PreviousTarget), (UINT8 *) Target); } break; case ACPI_RSD_LONGLIST: /* * Long byte list for Vendor resource data * Note: The list length is obtained from the previous table entry */ if (PreviousTarget) { AcpiRsDumpByteList (*((UINT16 *) PreviousTarget), (UINT8 *) Target); } break; case ACPI_RSD_DWORDLIST: /* * Dword list for Extended Interrupt resources * Note: The list length is obtained from the previous table entry */ if (PreviousTarget) { AcpiRsDumpDwordList (*((UINT8 *) PreviousTarget), (UINT32 *) Target); } break; case ACPI_RSD_ADDRESS: /* * Common flags for all Address resources */ AcpiRsDumpAddressCommon ((ACPI_RESOURCE_DATA *) Target); break; case ACPI_RSD_SOURCE: /* * Optional ResourceSource for Address resources */ AcpiRsDumpResourceSource ((ACPI_RESOURCE_SOURCE *) Target); break; default: AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Table->Opcode); return; } Table++; Count--; } } /******************************************************************************* * * FUNCTION: AcpiRsDumpResourceSource * * PARAMETERS: ResourceSource - Pointer to a Resource Source struct * * RETURN: None * * DESCRIPTION: Common routine for dumping the optional ResourceSource and the * corresponding ResourceSourceIndex. * ******************************************************************************/ static void AcpiRsDumpResourceSource ( ACPI_RESOURCE_SOURCE *ResourceSource) { ACPI_FUNCTION_ENTRY (); if (ResourceSource->Index == 0xFF) { return; } AcpiRsOutInteger8 ("Resource Source Index", ResourceSource->Index); AcpiRsOutString ("Resource Source", ResourceSource->StringPtr ? ResourceSource->StringPtr : "[Not Specified]"); } /******************************************************************************* * * FUNCTION: AcpiRsDumpAddressCommon * * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * * DESCRIPTION: Dump the fields that are common to all Address resource * descriptors * ******************************************************************************/ static void AcpiRsDumpAddressCommon ( ACPI_RESOURCE_DATA *Resource) { ACPI_FUNCTION_ENTRY (); /* Decode the type-specific flags */ switch (Resource->Address.ResourceType) { case ACPI_MEMORY_RANGE: AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags); break; case ACPI_IO_RANGE: AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags); break; case ACPI_BUS_NUMBER_RANGE: AcpiRsOutString ("Resource Type", "Bus Number Range"); break; default: AcpiRsOutInteger8 ("Resource Type", (UINT8) Resource->Address.ResourceType); break; } /* Decode the general flags */ AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags); } /******************************************************************************* * * FUNCTION: AcpiRsDumpResourceList * * PARAMETERS: ResourceList - Pointer to a resource descriptor list * * RETURN: None * * DESCRIPTION: Dispatches the structure to the correct dump routine. * ******************************************************************************/ void AcpiRsDumpResourceList ( ACPI_RESOURCE *ResourceList) { UINT32 Count = 0; UINT32 Type; ACPI_FUNCTION_ENTRY (); if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer)) { return; } /* Walk list and dump all resource descriptors (END_TAG terminates) */ do { AcpiOsPrintf ("\n[%02X] ", Count); Count++; /* Validate Type before dispatch */ Type = ResourceList->Type; if (Type > ACPI_RESOURCE_TYPE_MAX) { AcpiOsPrintf ( "Invalid descriptor type (%X) in resource list\n", ResourceList->Type); return; } /* Dump the resource descriptor */ AcpiRsDumpDescriptor (&ResourceList->Data, AcpiGbl_DumpResourceDispatch[Type]); /* Point to the next resource structure */ ResourceList = ACPI_PTR_ADD (ACPI_RESOURCE, ResourceList, ResourceList->Length); /* Exit when END_TAG descriptor is reached */ } while (Type != ACPI_RESOURCE_TYPE_END_TAG); } /******************************************************************************* * * FUNCTION: AcpiRsDumpIrqList * * PARAMETERS: RouteTable - Pointer to the routing table to dump. * * RETURN: None * * DESCRIPTION: Print IRQ routing table * ******************************************************************************/ void AcpiRsDumpIrqList ( UINT8 *RouteTable) { ACPI_PCI_ROUTING_TABLE *PrtElement; UINT8 Count; ACPI_FUNCTION_ENTRY (); if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer)) { return; } PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable); /* Dump all table elements, Exit on zero length element */ for (Count = 0; PrtElement->Length; Count++) { AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count); AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt); PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, ((UINT8 *) PrtElement) + PrtElement->Length); } } /******************************************************************************* * * FUNCTION: AcpiRsOut* * * PARAMETERS: Title - Name of the resource field * Value - Value of the resource field * * RETURN: None * * DESCRIPTION: Miscellaneous helper functions to consistently format the * output of the resource dump routines * ******************************************************************************/ static void AcpiRsOutString ( char *Title, char *Value) { AcpiOsPrintf ("%27s : %s\n", Title, Value); } static void AcpiRsOutInteger8 ( char *Title, UINT8 Value) { AcpiOsPrintf ("%27s : %2.2X\n", Title, Value); } static void AcpiRsOutInteger16 ( char *Title, UINT16 Value) { AcpiOsPrintf ("%27s : %4.4X\n", Title, Value); } static void AcpiRsOutInteger32 ( char *Title, UINT32 Value) { AcpiOsPrintf ("%27s : %8.8X\n", Title, Value); } static void AcpiRsOutInteger64 ( char *Title, UINT64 Value) { AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title, ACPI_FORMAT_UINT64 (Value)); } static void AcpiRsOutTitle ( char *Title) { AcpiOsPrintf ("%27s : ", Title); } /******************************************************************************* * * FUNCTION: AcpiRsDump*List * * PARAMETERS: Length - Number of elements in the list * Data - Start of the list * * RETURN: None * * DESCRIPTION: Miscellaneous functions to dump lists of raw data * ******************************************************************************/ static void AcpiRsDumpByteList ( UINT16 Length, UINT8 *Data) { UINT8 i; for (i = 0; i < Length; i++) { AcpiOsPrintf ("%25s%2.2X : %2.2X\n", "Byte", i, Data[i]); } } static void AcpiRsDumpShortByteList ( UINT8 Length, UINT8 *Data) { UINT8 i; for (i = 0; i < Length; i++) { AcpiOsPrintf ("%X ", Data[i]); } AcpiOsPrintf ("\n"); } static void AcpiRsDumpDwordList ( UINT8 Length, UINT32 *Data) { UINT8 i; for (i = 0; i < Length; i++) { AcpiOsPrintf ("%25s%2.2X : %8.8X\n", "Dword", i, Data[i]); } } #endif diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c index 7d78a4cda3fb..884614075134 100644 --- a/sys/contrib/dev/acpica/utdebug.c +++ b/sys/contrib/dev/acpica/utdebug.c @@ -1,768 +1,768 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines * $Revision: 1.126 $ * *****************************************************************************/ /****************************************************************************** * * 1. Copyright Notice * * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License * * 2.1. This is your license from Intel Corp. under its intellectual property * rights. You may have additional license terms from the party that provided * you this software, covering your right to use that party's intellectual * property rights. * * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a * copy of the source code appearing in this file ("Covered Code") an * irrevocable, perpetual, worldwide license under Intel's copyrights in the * base code distributed originally by Intel ("Original Intel Code") to copy, * make derivatives, distribute, use and display any portion of the Covered * Code in any form, with the right to sublicense such rights; and * * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent * license (with the right to sublicense), under only those claims of Intel * patents that are infringed by the Original Intel Code, to make, use, sell, * offer to sell, and import the Covered Code and derivative works thereof * solely to the minimum extent necessary to exercise the above copyright * license, and in no event shall the patent license extend to any additions * to or modifications of the Original Intel Code. No other license or right * is granted directly or by implication, estoppel or otherwise; * * The above copyright and patent license is granted only if the following * conditions are met: * * 3. Conditions * * 3.1. Redistribution of Source with Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification with rights to further distribute source must include * the above Copyright Notice, the above License, this list of Conditions, * and the following Disclaimer and Export Compliance provision. In addition, * Licensee must cause all Covered Code to which Licensee contributes to * contain a file documenting the changes Licensee made to create that Covered * Code and the date of any change. Licensee must include in that file the * documentation of any changes made by any predecessor Licensee. Licensee * must include a prominent statement that the modification is derived, * directly or indirectly, from Original Intel Code. * * 3.2. Redistribution of Source with no Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification without rights to further distribute source must * include the following Disclaimer and Export Compliance provision in the * documentation and/or other materials provided with distribution. In * addition, Licensee may not authorize further sublicense of source of any * portion of the Covered Code, and must include terms to the effect that the * license from Licensee to its licensee is limited to the intellectual * property embodied in the software Licensee provides to its licensee, and * not to intellectual property embodied in modifications its licensee may * make. * * 3.3. Redistribution of Executable. Redistribution in executable form of any * substantial portion of the Covered Code or modification must reproduce the * above Copyright Notice, and the following Disclaimer and Export Compliance * provision in the documentation and/or other materials provided with the * distribution. * * 3.4. Intel retains all right, title, and interest in and to the Original * Intel Code. * * 3.5. Neither the name Intel nor any other trademark owned or controlled by * Intel shall be used in advertising or otherwise to promote the sale, use or * other dealings in products derived from or relating to the Covered Code * without prior written authorization from Intel. * * 4. Disclaimer and Export Compliance * * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A * PARTICULAR PURPOSE. * * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY * LIMITED REMEDY. * * 4.3. Licensee shall not export, either directly or indirectly, any of this * software or system incorporating such software without first obtaining any * required license or other approval from the U. S. Department of Commerce or * any other agency or department of the United States Government. In the * event Licensee exports any such software from the United States or * re-exports any such software from a foreign destination, Licensee shall * ensure that the distribution and export/re-export of the software is in * compliance with all laws, regulations, orders, or other restrictions of the * U.S. Export Administration Regulations. Licensee agrees that neither it nor * any of its subsidiaries will export/re-export any technical data, process, * software, or service, directly or indirectly, to any country for which the * United States government or any agency thereof requires an export license, * other governmental approval, or letter of assurance, without first obtaining * such license, approval or letter. * *****************************************************************************/ #define __UTDEBUG_C__ #include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdebug") #ifdef ACPI_DEBUG_OUTPUT static UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; static char *AcpiGbl_FnEntryStr = "----Entry"; static char *AcpiGbl_FnExitStr = "----Exit-"; /* Local prototypes */ static const char * AcpiUtTrimFunctionName ( const char *FunctionName); /******************************************************************************* * * FUNCTION: AcpiUtInitStackPtrTrace * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Save the current CPU stack pointer at subsystem startup * ******************************************************************************/ void AcpiUtInitStackPtrTrace ( void) { UINT32 CurrentSp; AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL); } /******************************************************************************* * * FUNCTION: AcpiUtTrackStackPtr * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Save the current CPU stack pointer * ******************************************************************************/ void AcpiUtTrackStackPtr ( void) { ACPI_SIZE CurrentSp; CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL); if (CurrentSp < AcpiGbl_LowestStackPointer) { AcpiGbl_LowestStackPointer = CurrentSp; } if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) { AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel; } } /******************************************************************************* * * FUNCTION: AcpiUtTrimFunctionName * * PARAMETERS: FunctionName - Ascii string containing a procedure name * * RETURN: Updated pointer to the function name * * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. * This allows compiler macros such as __FUNCTION__ to be used * with no change to the debug output. * ******************************************************************************/ static const char * AcpiUtTrimFunctionName ( const char *FunctionName) { /* All Function names are longer than 4 chars, check is safe */ - if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED) + if (*((UINT32 *) (uintptr_t) FunctionName) == ACPI_PREFIX_MIXED) { /* This is the case where the original source has not been modified */ return (FunctionName + 4); } - if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER) + if (*((UINT32 *) (uintptr_t) FunctionName) == ACPI_PREFIX_LOWER) { /* This is the case where the source has been 'linuxized' */ return (FunctionName + 5); } return (FunctionName); } /******************************************************************************* * * FUNCTION: AcpiUtDebugPrint * * PARAMETERS: RequestedDebugLevel - Requested debug print level * LineNumber - Caller's line number (for error output) * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * Format - Printf format field * ... - Optional printf arguments * * RETURN: None * * DESCRIPTION: Print error message with prefix consisting of the module name, * line number, and component ID. * ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE AcpiUtDebugPrint ( UINT32 RequestedDebugLevel, UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *Format, ...) { UINT32 ThreadId; va_list args; /* * Stay silent if the debug level or component ID is disabled */ if (!(RequestedDebugLevel & AcpiDbgLevel) || !(ComponentId & AcpiDbgLayer)) { return; } /* * Thread tracking and context switch notification */ ThreadId = AcpiOsGetThreadId (); if (ThreadId != AcpiGbl_PrevThreadId) { if (ACPI_LV_THREADS & AcpiDbgLevel) { AcpiOsPrintf ( "\n**** Context Switch from TID %X to TID %X ****\n\n", AcpiGbl_PrevThreadId, ThreadId); } AcpiGbl_PrevThreadId = ThreadId; } /* * Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber); if (ACPI_LV_THREADS & AcpiDbgLevel) { AcpiOsPrintf ("[%04lX] ", ThreadId); } AcpiOsPrintf ("[%02ld] %-22.22s: ", AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName)); va_start (args, Format); AcpiOsVprintf (Format, args); } /******************************************************************************* * * FUNCTION: AcpiUtDebugPrintRaw * * PARAMETERS: RequestedDebugLevel - Requested debug print level * LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * Format - Printf format field * ... - Optional printf arguments * * RETURN: None * * DESCRIPTION: Print message with no headers. Has same interface as * DebugPrint so that the same macros can be used. * ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE AcpiUtDebugPrintRaw ( UINT32 RequestedDebugLevel, UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *Format, ...) { va_list args; if (!(RequestedDebugLevel & AcpiDbgLevel) || !(ComponentId & AcpiDbgLayer)) { return; } va_start (args, Format); AcpiOsVprintf (Format, args); } /******************************************************************************* * * FUNCTION: AcpiUtTrace * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * * RETURN: None * * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel * ******************************************************************************/ void AcpiUtTrace ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId) { AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s\n", AcpiGbl_FnEntryStr); } /******************************************************************************* * * FUNCTION: AcpiUtTracePtr * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * Pointer - Pointer to display * * RETURN: None * * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel * ******************************************************************************/ void AcpiUtTracePtr ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, void *Pointer) { AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %p\n", AcpiGbl_FnEntryStr, Pointer); } /******************************************************************************* * * FUNCTION: AcpiUtTraceStr * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * String - Additional string to display * * RETURN: None * * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel * ******************************************************************************/ void AcpiUtTraceStr ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *String) { AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %s\n", AcpiGbl_FnEntryStr, String); } /******************************************************************************* * * FUNCTION: AcpiUtTraceU32 * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * Integer - Integer to display * * RETURN: None * * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel * ******************************************************************************/ void AcpiUtTraceU32 ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, UINT32 Integer) { AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %08X\n", AcpiGbl_FnEntryStr, Integer); } /******************************************************************************* * * FUNCTION: AcpiUtExit * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * * RETURN: None * * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel * ******************************************************************************/ void AcpiUtExit ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId) { AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s\n", AcpiGbl_FnExitStr); AcpiGbl_NestingLevel--; } /******************************************************************************* * * FUNCTION: AcpiUtStatusExit * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * Status - Exit status code * * RETURN: None * * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel. Prints exit status also. * ******************************************************************************/ void AcpiUtStatusExit ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, ACPI_STATUS Status) { if (ACPI_SUCCESS (Status)) { AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %s\n", AcpiGbl_FnExitStr, AcpiFormatException (Status)); } else { AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s ****Exception****: %s\n", AcpiGbl_FnExitStr, AcpiFormatException (Status)); } AcpiGbl_NestingLevel--; } /******************************************************************************* * * FUNCTION: AcpiUtValueExit * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * Value - Value to be printed with exit msg * * RETURN: None * * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel. Prints exit value also. * ******************************************************************************/ void AcpiUtValueExit ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, ACPI_INTEGER Value) { AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, ACPI_FORMAT_UINT64 (Value)); AcpiGbl_NestingLevel--; } /******************************************************************************* * * FUNCTION: AcpiUtPtrExit * * PARAMETERS: LineNumber - Caller's line number * FunctionName - Caller's procedure name * ModuleName - Caller's module name * ComponentId - Caller's component ID * Ptr - Pointer to display * * RETURN: None * * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is * set in DebugLevel. Prints exit value also. * ******************************************************************************/ void AcpiUtPtrExit ( UINT32 LineNumber, const char *FunctionName, char *ModuleName, UINT32 ComponentId, UINT8 *Ptr) { AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %p\n", AcpiGbl_FnExitStr, Ptr); AcpiGbl_NestingLevel--; } #endif /******************************************************************************* * * FUNCTION: AcpiUtDumpBuffer * * PARAMETERS: Buffer - Buffer to dump * Count - Amount to dump, in bytes * Display - BYTE, WORD, DWORD, or QWORD display * ComponentID - Caller's component ID * * RETURN: None * * DESCRIPTION: Generic dump buffer in both hex and ascii. * ******************************************************************************/ void AcpiUtDumpBuffer ( UINT8 *Buffer, UINT32 Count, UINT32 Display, UINT32 ComponentId) { ACPI_NATIVE_UINT i = 0; ACPI_NATIVE_UINT j; UINT32 Temp32; UINT8 BufChar; /* Only dump the buffer if tracing is enabled */ if (!((ACPI_LV_TABLES & AcpiDbgLevel) && (ComponentId & AcpiDbgLayer))) { return; } if ((Count < 4) || (Count & 0x01)) { Display = DB_BYTE_DISPLAY; } /* Nasty little dump buffer routine! */ while (i < Count) { /* Print current offset */ AcpiOsPrintf ("%6.4X: ", (UINT32) i); /* Print 16 hex chars */ for (j = 0; j < 16;) { if (i + j >= Count) { /* Dump fill spaces */ AcpiOsPrintf ("%*s", ((Display * 2) + 1), " "); j += (ACPI_NATIVE_UINT) Display; continue; } switch (Display) { default: /* Default is BYTE display */ AcpiOsPrintf ("%02X ", Buffer[i + j]); break; case DB_WORD_DISPLAY: ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%04X ", Temp32); break; case DB_DWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%08X ", Temp32); break; case DB_QWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%08X", Temp32); ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j + 4]); AcpiOsPrintf ("%08X ", Temp32); break; } j += (ACPI_NATIVE_UINT) Display; } /* * Print the ASCII equivalent characters but watch out for the bad * unprintable ones (printable chars are 0x20 through 0x7E) */ AcpiOsPrintf (" "); for (j = 0; j < 16; j++) { if (i + j >= Count) { AcpiOsPrintf ("\n"); return; } BufChar = Buffer[i + j]; if (ACPI_IS_PRINT (BufChar)) { AcpiOsPrintf ("%c", BufChar); } else { AcpiOsPrintf ("."); } } /* Done with that line. */ AcpiOsPrintf ("\n"); i += 16; } return; }