diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2005-11-01 22:11:18 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2005-11-01 22:11:18 +0000 |
commit | fba7fc7e34e95963b681b882698b951b35d1ba48 (patch) | |
tree | 4450b2c84d749dd8a8425a8feb88b084809f6ef0 /sys/contrib/dev/acpica/dbexec.c | |
parent | 28f22a242b27179668329edee7235b98ed7e2af9 (diff) | |
download | src-test2-fba7fc7e34e95963b681b882698b951b35d1ba48.tar.gz src-test2-fba7fc7e34e95963b681b882698b951b35d1ba48.zip |
Notes
Diffstat (limited to 'sys/contrib/dev/acpica/dbexec.c')
-rw-r--r-- | sys/contrib/dev/acpica/dbexec.c | 128 |
1 files changed, 85 insertions, 43 deletions
diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c index 463ac4a93de1..12c03bc4290b 100644 --- a/sys/contrib/dev/acpica/dbexec.c +++ b/sys/contrib/dev/acpica/dbexec.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbexec - debugger control method execution - * $Revision: 62 $ + * $Revision: 1.70 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -127,6 +127,38 @@ static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; +/* Local prototypes */ + +static ACPI_STATUS +AcpiDbExecuteMethod ( + ACPI_DB_METHOD_INFO *Info, + ACPI_BUFFER *ReturnObj); + +static void +AcpiDbExecuteSetup ( + ACPI_DB_METHOD_INFO *Info); + +static UINT32 +AcpiDbGetOutstandingAllocations ( + void); + +static void ACPI_SYSTEM_XFACE +AcpiDbMethodThread ( + void *Context); + +static ACPI_STATUS +AcpiDbExecutionWalk ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS +static UINT32 +AcpiDbGetCacheInfo ( + ACPI_MEMORY_LIST *Cache); +#endif + /******************************************************************************* * @@ -141,7 +173,7 @@ static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbExecuteMethod ( ACPI_DB_METHOD_INFO *Info, ACPI_BUFFER *ReturnObj) @@ -163,37 +195,38 @@ AcpiDbExecuteMethod ( { for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++) { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16); + Params[i].Type = ACPI_TYPE_INTEGER; + Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16); } - ParamObjects.Pointer = Params; - ParamObjects.Count = i; + ParamObjects.Pointer = Params; + ParamObjects.Count = i; } else { /* Setup default parameters */ - Params[0].Type = ACPI_TYPE_INTEGER; - Params[0].Integer.Value = 0x01020304; + Params[0].Type = ACPI_TYPE_INTEGER; + Params[0].Integer.Value = 0x01020304; - Params[1].Type = ACPI_TYPE_STRING; - Params[1].String.Length = 12; - Params[1].String.Pointer = "AML Debugger"; + Params[1].Type = ACPI_TYPE_STRING; + Params[1].String.Length = 12; + Params[1].String.Pointer = "AML Debugger"; - ParamObjects.Pointer = Params; - ParamObjects.Count = 2; + ParamObjects.Pointer = Params; + ParamObjects.Count = 2; } /* Prepare for a return object of arbitrary size */ - ReturnObj->Pointer = AcpiGbl_DbBuffer; - ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE; + ReturnObj->Pointer = AcpiGbl_DbBuffer; + ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE; /* Do the actual method execution */ AcpiGbl_MethodExecuting = TRUE; - Status = AcpiEvaluateObject (NULL, Info->Pathname, &ParamObjects, ReturnObj); + Status = AcpiEvaluateObject (NULL, + Info->Pathname, &ParamObjects, ReturnObj); AcpiGbl_CmSingleStep = FALSE; AcpiGbl_MethodExecuting = FALSE; @@ -208,13 +241,13 @@ AcpiDbExecuteMethod ( * * PARAMETERS: Info - Valid method info * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Setup info segment prior to method execution * ******************************************************************************/ -void +static void AcpiDbExecuteSetup ( ACPI_DB_METHOD_INFO *Info) { @@ -249,6 +282,16 @@ AcpiDbExecuteSetup ( } +#ifdef ACPI_DBG_TRACK_ALLOCATIONS +static UINT32 +AcpiDbGetCacheInfo ( + ACPI_MEMORY_LIST *Cache) +{ + + return (Cache->TotalAllocated - Cache->TotalFreed - Cache->CurrentDepth); +} +#endif + /******************************************************************************* * * FUNCTION: AcpiDbGetOutstandingAllocations @@ -263,22 +306,18 @@ AcpiDbExecuteSetup ( * ******************************************************************************/ -UINT32 +static UINT32 AcpiDbGetOutstandingAllocations ( void) { UINT32 Outstanding = 0; #ifdef ACPI_DBG_TRACK_ALLOCATIONS - UINT32 i; - - for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++) - { - Outstanding += (AcpiGbl_MemoryLists[i].TotalAllocated - - AcpiGbl_MemoryLists[i].TotalFreed - - AcpiGbl_MemoryLists[i].CacheDepth); - } + Outstanding += AcpiDbGetCacheInfo (AcpiGbl_StateCache); + Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeCache); + Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeExtCache); + Outstanding += AcpiDbGetCacheInfo (AcpiGbl_OperandCache); #endif return (Outstanding); @@ -298,7 +337,7 @@ AcpiDbGetOutstandingAllocations ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbExecutionWalk ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, @@ -345,7 +384,7 @@ AcpiDbExecutionWalk ( * Args - Parameters to the method * Flags - single step/no single step * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Execute a control method. Name is relative to the current * scope. @@ -374,12 +413,13 @@ AcpiDbExecute ( if (*Name == '*') { - (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbExecutionWalk, NULL, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL); return; } else { + AcpiUtStrupr (Name); AcpiGbl_DbMethodInfo.Name = Name; AcpiGbl_DbMethodInfo.Args = Args; AcpiGbl_DbMethodInfo.Flags = Flags; @@ -395,7 +435,7 @@ AcpiDbExecute ( * Allow any handlers in separate threads to complete. * (Such as Notify handlers invoked from AML executed above). */ - AcpiOsSleep (10); + AcpiOsSleep ((ACPI_INTEGER) 10); #ifdef ACPI_DEBUG_OUTPUT @@ -418,7 +458,6 @@ AcpiDbExecute ( AcpiOsPrintf ("Execution of %s failed with status %s\n", AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status)); } - else { /* Display a return object, if any */ @@ -428,7 +467,7 @@ AcpiDbExecute ( AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); - AcpiDbDumpObject (ReturnObj.Pointer, 1); + AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); } else { @@ -454,7 +493,7 @@ AcpiDbExecute ( * ******************************************************************************/ -void ACPI_SYSTEM_XFACE +static void ACPI_SYSTEM_XFACE AcpiDbMethodThread ( void *Context) { @@ -494,7 +533,7 @@ AcpiDbMethodThread ( { AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); - AcpiDbDumpObject (ReturnObj.Pointer, 1); + AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); } #endif } @@ -543,7 +582,8 @@ AcpiDbCreateExecutionThreads ( if (!NumThreads || !NumLoops) { - AcpiOsPrintf ("Bad argument: Threads %X, Loops %X\n", NumThreads, NumLoops); + AcpiOsPrintf ("Bad argument: Threads %X, Loops %X\n", + NumThreads, NumLoops); return; } @@ -552,7 +592,8 @@ AcpiDbCreateExecutionThreads ( Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not create semaphore, %s\n", AcpiFormatException (Status)); + AcpiOsPrintf ("Could not create semaphore, %s\n", + AcpiFormatException (Status)); return; } @@ -568,11 +609,13 @@ AcpiDbCreateExecutionThreads ( /* Create the threads */ - AcpiOsPrintf ("Creating %X threads to execute %X times each\n", NumThreads, NumLoops); + AcpiOsPrintf ("Creating %X threads to execute %X times each\n", + NumThreads, NumLoops); for (i = 0; i < (NumThreads); i++) { - Status = AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread, &AcpiGbl_DbMethodInfo); + Status = AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread, + &AcpiGbl_DbMethodInfo); if (ACPI_FAILURE (Status)) { break; @@ -582,7 +625,7 @@ AcpiDbCreateExecutionThreads ( /* Wait for all threads to complete */ i = NumThreads; - while (i) /* Brain damage for OSD implementations that only support wait of 1 unit */ + while (i) /* Brain damage for host OSs that only support wait of 1 unit */ { Status = AcpiOsWaitSemaphore (ThreadGate, 1, ACPI_WAIT_FOREVER); i--; @@ -597,7 +640,6 @@ AcpiDbCreateExecutionThreads ( AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); } - #endif /* ACPI_DEBUGGER */ |