diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-30 18:04:07 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-30 18:04:07 +0100 |
| commit | 08eeda990be33db8048031df2a40ec28955e6430 (patch) | |
| tree | 95806a0189c32818b5d2a8a9a4cef0a844a883b9 /Private/acpiSDK/source/components/debugger | |
| parent | 1be243700efc9e36060c5fb65c951d5db6b98e94 (diff) | |
Moved ACPI SDK into it's own repository.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/acpiSDK/source/components/debugger')
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbcmds.c | 1508 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbconvert.c | 642 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbdisply.c | 1328 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbexec.c | 1113 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbfileio.c | 281 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbhistry.c | 378 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbinput.c | 1479 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbmethod.c | 806 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbnames.c | 1314 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbobject.c | 710 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbstats.c | 664 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbtest.c | 1340 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbutils.c | 621 | ||||
| -rw-r--r-- | Private/acpiSDK/source/components/debugger/dbxface.c | 722 |
14 files changed, 0 insertions, 12906 deletions
diff --git a/Private/acpiSDK/source/components/debugger/dbcmds.c b/Private/acpiSDK/source/components/debugger/dbcmds.c deleted file mode 100644 index 6636f7b9..00000000 --- a/Private/acpiSDK/source/components/debugger/dbcmds.c +++ /dev/null @@ -1,1508 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbcmds - Miscellaneous debug commands and output routines - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acevents.h" -#include "acdebug.h" -#include "acnamesp.h" -#include "acresrc.h" -#include "actables.h" -#include "limits.h" - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbcmds") - - -/* Local prototypes */ - -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); - -static ACPI_STATUS -AcpiDbResourceCallback ( - ACPI_RESOURCE *Resource, - void *Context); - -static ACPI_STATUS -AcpiDbDeviceResources ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static void -AcpiDbDoOneSleepState ( - UINT8 SleepState); - - -static char *AcpiDbTraceMethodName = NULL; - - -/******************************************************************************* - * - * 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 - * alphanumeric strings. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiDbConvertToNode ( - char *InString) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_SIZE Address; - - - if ((*InString >= 0x30) && (*InString <= 0x39)) - { - /* Numeric argument, convert */ - - Address = strtoul (InString, NULL, 16); - Node = ACPI_TO_POINTER (Address); - if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) - { - AcpiOsPrintf ("Address %p is invalid", 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 namespace node [%s]\n", - Node, AcpiUtGetDescriptorName (Node)); - return (NULL); - } - } - else - { - /* - * Alpha argument: The parameter is a name string that must be - * resolved to a Namespace object. - */ - Node = AcpiDbLocalNsLookup (InString); - if (!Node) - { - AcpiOsPrintf ( - "Could not find [%s] in namespace, defaulting to root node\n", - InString); - Node = AcpiGbl_RootNode; - } - } - - return (Node); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSleep - * - * PARAMETERS: ObjectArg - Desired sleep state (0-5). NULL means - * invoke all possible sleep states. - * - * RETURN: Status - * - * DESCRIPTION: Simulate sleep/wake sequences - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbSleep ( - char *ObjectArg) -{ - UINT8 SleepState; - UINT32 i; - - - ACPI_FUNCTION_TRACE (AcpiDbSleep); - - - /* Null input (no arguments) means to invoke all sleep states */ - - if (!ObjectArg) - { - AcpiOsPrintf ("Invoking all possible sleep states, 0-%d\n", - ACPI_S_STATES_MAX); - - for (i = 0; i <= ACPI_S_STATES_MAX; i++) - { - AcpiDbDoOneSleepState ((UINT8) i); - } - - return_ACPI_STATUS (AE_OK); - } - - /* Convert argument to binary and invoke the sleep state */ - - SleepState = (UINT8) strtoul (ObjectArg, NULL, 0); - AcpiDbDoOneSleepState (SleepState); - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDoOneSleepState - * - * PARAMETERS: SleepState - Desired sleep state (0-5) - * - * RETURN: None - * - * DESCRIPTION: Simulate a sleep/wake sequence - * - ******************************************************************************/ - -static void -AcpiDbDoOneSleepState ( - UINT8 SleepState) -{ - ACPI_STATUS Status; - UINT8 SleepTypeA; - UINT8 SleepTypeB; - - - /* Validate parameter */ - - if (SleepState > ACPI_S_STATES_MAX) - { - AcpiOsPrintf ("Sleep state %d out of range (%d max)\n", - SleepState, ACPI_S_STATES_MAX); - return; - } - - AcpiOsPrintf ("\n---- Invoking sleep state S%d (%s):\n", - SleepState, AcpiGbl_SleepStateNames[SleepState]); - - /* Get the values for the sleep type registers (for display only) */ - - Status = AcpiGetSleepTypeData (SleepState, &SleepTypeA, &SleepTypeB); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not evaluate [%s] method, %s\n", - AcpiGbl_SleepStateNames[SleepState], - AcpiFormatException (Status)); - return; - } - - AcpiOsPrintf ( - "Register values for sleep state S%d: Sleep-A: %.2X, Sleep-B: %.2X\n", - SleepState, SleepTypeA, SleepTypeB); - - /* Invoke the various sleep/wake interfaces */ - - AcpiOsPrintf ("**** Sleep: Prepare to sleep (S%d) ****\n", - SleepState); - Status = AcpiEnterSleepStatePrep (SleepState); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - AcpiOsPrintf ("**** Sleep: Going to sleep (S%d) ****\n", - SleepState); - Status = AcpiEnterSleepState (SleepState); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - AcpiOsPrintf ("**** Wake: Prepare to return from sleep (S%d) ****\n", - SleepState); - Status = AcpiLeaveSleepStatePrep (SleepState); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - AcpiOsPrintf ("**** Wake: Return from sleep (S%d) ****\n", - SleepState); - Status = AcpiLeaveSleepState (SleepState); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - return; - - -ErrorExit: - ACPI_EXCEPTION ((AE_INFO, Status, "During invocation of sleep state S%d", - SleepState)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayLocks - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display information about internal mutexes. - * - ******************************************************************************/ - -void -AcpiDbDisplayLocks ( - void) -{ - UINT32 i; - - - for (i = 0; i < ACPI_MAX_MUTEX; i++) - { - AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i), - AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED - ? "Locked" : "Unlocked"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayTableInfo - * - * PARAMETERS: TableArg - 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; - ACPI_STATUS Status; - - - /* Header */ - - AcpiOsPrintf ("Idx ID Status Type " - "TableHeader (Sig, Address, Length, Misc)\n"); - - /* Walk the entire root table list */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - TableDesc = &AcpiGbl_RootTableList.Tables[i]; - - /* Index and Table ID */ - - AcpiOsPrintf ("%3u %.2u ", i, TableDesc->OwnerId); - - /* Decode the table flags */ - - if (!(TableDesc->Flags & ACPI_TABLE_IS_LOADED)) - { - AcpiOsPrintf ("NotLoaded "); - } - else - { - AcpiOsPrintf (" Loaded "); - } - - switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) - { - case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: - - AcpiOsPrintf ("External/virtual "); - break; - - case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: - - AcpiOsPrintf ("Internal/physical "); - break; - - case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: - - AcpiOsPrintf ("Internal/virtual "); - break; - - default: - - AcpiOsPrintf ("INVALID TYPE "); - break; - } - - /* Make sure that the table is mapped */ - - Status = AcpiTbValidateTable (TableDesc); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Dump the table header */ - - if (TableDesc->Pointer) - { - AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); - } - else - { - /* If the pointer is null, the table has been unloaded */ - - ACPI_INFO (("%4.4s - Table has been unloaded", - TableDesc->Signature.Ascii)); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbUnloadAcpiTable - * - * PARAMETERS: ObjectName - Namespace pathname for an object that - * is owned by the table to be unloaded - * - * RETURN: None - * - * DESCRIPTION: Unload an ACPI table, via any namespace node that is owned - * by the table. - * - ******************************************************************************/ - -void -AcpiDbUnloadAcpiTable ( - char *ObjectName) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Translate name to an Named object */ - - Node = AcpiDbConvertToNode (ObjectName); - if (!Node) - { - return; - } - - Status = AcpiUnloadParentTable (ACPI_CAST_PTR (ACPI_HANDLE, Node)); - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf ("Parent of [%s] (%p) unloaded and uninstalled\n", - ObjectName, Node); - } - else - { - AcpiOsPrintf ("%s, while unloading parent table of [%s]\n", - AcpiFormatException (Status), ObjectName); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSendNotify - * - * PARAMETERS: Name - Name of ACPI object where to send notify - * 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; - } - - /* Dispatch the notify if legal */ - - if (AcpiEvIsNotifyObject (Node)) - { - Status = AcpiEvQueueNotifyRequest (Node, Value); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not queue notify\n"); - } - } - else - { - AcpiOsPrintf ( - "Named object [%4.4s] Type %s, " - "must be Device/Thermal/Processor type\n", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayInterfaces - * - * PARAMETERS: ActionArg - Null, "install", or "remove" - * InterfaceNameArg - Name for install/remove options - * - * RETURN: None - * - * DESCRIPTION: Display or modify the global _OSI interface list - * - ******************************************************************************/ - -void -AcpiDbDisplayInterfaces ( - char *ActionArg, - char *InterfaceNameArg) -{ - ACPI_INTERFACE_INFO *NextInterface; - char *SubString; - ACPI_STATUS Status; - - - /* If no arguments, just display current interface list */ - - if (!ActionArg) - { - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); - - NextInterface = AcpiGbl_SupportedInterfaces; - while (NextInterface) - { - if (!(NextInterface->Flags & ACPI_OSI_INVALID)) - { - AcpiOsPrintf ("%s\n", NextInterface->Name); - } - - NextInterface = NextInterface->Next; - } - - AcpiOsReleaseMutex (AcpiGbl_OsiMutex); - return; - } - - /* If ActionArg exists, so must InterfaceNameArg */ - - if (!InterfaceNameArg) - { - AcpiOsPrintf ("Missing Interface Name argument\n"); - return; - } - - /* Uppercase the action for match below */ - - AcpiUtStrupr (ActionArg); - - /* Install - install an interface */ - - SubString = strstr ("INSTALL", ActionArg); - if (SubString) - { - Status = AcpiInstallInterface (InterfaceNameArg); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s, while installing \"%s\"\n", - AcpiFormatException (Status), InterfaceNameArg); - } - return; - } - - /* Remove - remove an interface */ - - SubString = strstr ("REMOVE", ActionArg); - if (SubString) - { - Status = AcpiRemoveInterface (InterfaceNameArg); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s, while removing \"%s\"\n", - AcpiFormatException (Status), InterfaceNameArg); - } - return; - } - - /* Invalid ActionArg */ - - AcpiOsPrintf ("Invalid action argument: %s\n", ActionArg); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayTemplate - * - * PARAMETERS: BufferArg - Buffer name or address - * - * RETURN: None - * - * DESCRIPTION: Dump a buffer that contains a resource template - * - ******************************************************************************/ - -void -AcpiDbDisplayTemplate ( - char *BufferArg) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_BUFFER ReturnBuffer; - - - /* Translate BufferArg to an Named object */ - - Node = AcpiDbConvertToNode (BufferArg); - if (!Node || (Node == AcpiGbl_RootNode)) - { - AcpiOsPrintf ("Invalid argument: %s\n", BufferArg); - return; - } - - /* We must have a buffer object */ - - if (Node->Type != ACPI_TYPE_BUFFER) - { - AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n", - BufferArg); - return; - } - - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - - /* Attempt to convert the raw buffer to a resource list */ - - Status = AcpiRsCreateResourceList (Node->Object, &ReturnBuffer); - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiDbgLevel |= ACPI_LV_RESOURCES; - - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ( - "Could not convert Buffer to a resource list: %s, %s\n", - BufferArg, AcpiFormatException (Status)); - goto DumpBuffer; - } - - /* Now we can dump the resource list */ - - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, - ReturnBuffer.Pointer)); - -DumpBuffer: - AcpiOsPrintf ("\nRaw data buffer:\n"); - AcpiUtDebugDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer, - Node->Object->Buffer.Length, - DB_BYTE_DISPLAY, ACPI_UINT32_MAX); - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - return; -} - - -/******************************************************************************* - * - * 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; - UINT8 *Aml1End; - UINT8 *Aml2End; - ACPI_RSDESC_SIZE Aml1Length; - ACPI_RSDESC_SIZE Aml2Length; - ACPI_RSDESC_SIZE Offset = 0; - UINT8 ResourceType; - UINT32 Count = 0; - UINT32 i; - - - /* 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; - Aml1End = Aml1Buffer + Aml1BufferLength; - Aml2End = Aml2Buffer + Aml2BufferLength; - - /* Walk the descriptor lists, comparing each descriptor */ - - while ((Aml1 < Aml1End) && (Aml2 < Aml2End)) - { - /* 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 Len1 %X, Len2 %X ****\n", - Count, ResourceType, Offset, Aml1Length, Aml2Length); - } - - /* Check for descriptor byte match */ - - else if (memcmp (Aml1, Aml2, Aml1Length)) - { - AcpiOsPrintf ( - "**** Data mismatch in descriptor [%.2X] type %2.2X, " - "Offset %8.8X ****\n", - Count, ResourceType, Offset); - - for (i = 0; i < Aml1Length; i++) - { - if (Aml1[i] != Aml2[i]) - { - AcpiOsPrintf ( - "Mismatch at byte offset %.2X: is %2.2X, " - "should be %2.2X\n", - i, Aml2[i], Aml1[i]); - } - } - } - - /* 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 += Aml2Length; - } -} - - -/******************************************************************************* - * - * 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 ReturnBuffer; - ACPI_BUFFER ResourceBuffer; - ACPI_BUFFER NewAml; - ACPI_OBJECT *OriginalAml; - - - AcpiOsPrintf ("Resource Conversion Comparison:\n"); - - NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - ResourceBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - - /* Get the original _CRS AML resource template */ - - Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnBuffer); - 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, &ResourceBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto Exit1; - } - - /* Convert internal resource list to external AML resource template */ - - Status = AcpiRsCreateAmlResources (&ResourceBuffer, &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 = ReturnBuffer.Pointer; - - AcpiDmCompareAmlResources (OriginalAml->Buffer.Pointer, - (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, - NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length); - - /* Cleanup and exit */ - - ACPI_FREE (NewAml.Pointer); -Exit2: - ACPI_FREE (ResourceBuffer.Pointer); -Exit1: - ACPI_FREE (ReturnBuffer.Pointer); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbResourceCallback - * - * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Simple callback to exercise AcpiWalkResources and - * AcpiWalkResourceBuffer. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbResourceCallback ( - ACPI_RESOURCE *Resource, - void *Context) -{ - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDeviceResources - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbDeviceResources ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_NAMESPACE_NODE *PrtNode = NULL; - ACPI_NAMESPACE_NODE *CrsNode = NULL; - ACPI_NAMESPACE_NODE *PrsNode = NULL; - ACPI_NAMESPACE_NODE *AeiNode = NULL; - char *ParentPath; - ACPI_BUFFER ReturnBuffer; - ACPI_STATUS Status; - - - Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); - if (!ParentPath) - { - return (AE_NO_MEMORY); - } - - /* Get handles to the resource methods for this device */ - - (void) AcpiGetHandle (Node, METHOD_NAME__PRT, - ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode)); - (void) AcpiGetHandle (Node, METHOD_NAME__CRS, - ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode)); - (void) AcpiGetHandle (Node, METHOD_NAME__PRS, - ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode)); - (void) AcpiGetHandle (Node, METHOD_NAME__AEI, - ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode)); - - if (!PrtNode && !CrsNode && !PrsNode && !AeiNode) - { - goto Cleanup; /* Nothing to do */ - } - - AcpiOsPrintf ("\nDevice: %s\n", ParentPath); - - /* Prepare for a return object of arbitrary size */ - - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - - - /* _PRT */ - - if (PrtNode) - { - AcpiOsPrintf ("Evaluating _PRT\n"); - - Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not evaluate _PRT: %s\n", - AcpiFormatException (Status)); - goto GetCrs; - } - - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiGetIrqRoutingTable (Node, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", - AcpiFormatException (Status)); - goto GetCrs; - } - - AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer)); - } - - - /* _CRS */ - -GetCrs: - if (CrsNode) - { - AcpiOsPrintf ("Evaluating _CRS\n"); - - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not evaluate _CRS: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } - - /* This code exercises the AcpiWalkResources interface */ - - Status = AcpiWalkResources (Node, METHOD_NAME__CRS, - AcpiDbResourceCallback, NULL); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiWalkResources failed: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } - - /* Get the _CRS resource list (test ALLOCATE buffer) */ - - ReturnBuffer.Pointer = NULL; - ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - - Status = AcpiGetCurrentResources (Node, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto GetPrs; - } - - /* This code exercises the AcpiWalkResourceBuffer interface */ - - Status = AcpiWalkResourceBuffer (&ReturnBuffer, - AcpiDbResourceCallback, NULL); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiWalkResourceBuffer failed: %s\n", - AcpiFormatException (Status)); - goto EndCrs; - } - - /* Dump the _CRS resource list */ - - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, - ReturnBuffer.Pointer)); - - /* - * Perform comparison of original AML to newly created AML. This - * tests both the AML->Resource conversion and the Resource->AML - * conversion. - */ - (void) AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); - - /* Execute _SRS with the resource list */ - - AcpiOsPrintf ("Evaluating _SRS\n"); - - Status = AcpiSetCurrentResources (Node, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", - AcpiFormatException (Status)); - goto EndCrs; - } - -EndCrs: - ACPI_FREE (ReturnBuffer.Pointer); - } - - - /* _PRS */ - -GetPrs: - if (PrsNode) - { - AcpiOsPrintf ("Evaluating _PRS\n"); - - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not evaluate _PRS: %s\n", - AcpiFormatException (Status)); - goto GetAei; - } - - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiGetPossibleResources (Node, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", - AcpiFormatException (Status)); - goto GetAei; - } - - AcpiRsDumpResourceList (ACPI_CAST_PTR ( - ACPI_RESOURCE, AcpiGbl_DbBuffer)); - } - - - /* _AEI */ - -GetAei: - if (AeiNode) - { - AcpiOsPrintf ("Evaluating _AEI\n"); - - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not evaluate _AEI: %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - ReturnBuffer.Pointer = AcpiGbl_DbBuffer; - ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; - - Status = AcpiGetEventResources (Node, &ReturnBuffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("AcpiGetEventResources failed: %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - AcpiRsDumpResourceList (ACPI_CAST_PTR ( - ACPI_RESOURCE, AcpiGbl_DbBuffer)); - } - - -Cleanup: - ACPI_FREE (ParentPath); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayResources - * - * PARAMETERS: ObjectArg - String object name or object pointer. - * NULL or "*" means "display resources for - * all devices" - * - * RETURN: None - * - * DESCRIPTION: Display the resource objects associated with a device. - * - ******************************************************************************/ - -void -AcpiDbDisplayResources ( - char *ObjectArg) -{ - ACPI_NAMESPACE_NODE *Node; - - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiDbgLevel |= ACPI_LV_RESOURCES; - - /* Asterisk means "display resources for all devices" */ - - if (!ObjectArg || (!strcmp (ObjectArg, "*"))) - { - (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL); - } - else - { - /* Convert string to object pointer */ - - Node = AcpiDbConvertToNode (ObjectArg); - if (Node) - { - if (Node->Type != ACPI_TYPE_DEVICE) - { - AcpiOsPrintf ( - "%4.4s: Name is not a device object (%s)\n", - Node->Name.Ascii, AcpiUtGetTypeName (Node->Type)); - } - else - { - (void) AcpiDbDeviceResources (Node, 0, NULL, NULL); - } - } - } - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGenerateGed - * - * PARAMETERS: GedArg - Raw GED number, ascii string - * - * RETURN: None - * - * DESCRIPTION: Simulate firing of a GED - * - ******************************************************************************/ - -void -AcpiDbGenerateInterrupt ( - char *GsivArg) -{ - UINT32 GsivNumber; - ACPI_GED_HANDLER_INFO *GedInfo = AcpiGbl_GedHandlerList; - - if (!GedInfo) { - AcpiOsPrintf ("No GED handling present\n"); - } - - GsivNumber = strtoul (GsivArg, NULL, 0); - - while (GedInfo) { - - if (GedInfo->IntId == GsivNumber) { - ACPI_OBJECT_LIST ArgList; - ACPI_OBJECT Arg0; - ACPI_HANDLE EvtHandle = GedInfo->EvtMethod; - ACPI_STATUS Status; - - AcpiOsPrintf ("Evaluate GED _EVT (GSIV=%d)\n", GsivNumber); - - if (!EvtHandle) { - AcpiOsPrintf ("Undefined _EVT method\n"); - return; - } - - Arg0.Integer.Type = ACPI_TYPE_INTEGER; - Arg0.Integer.Value = GsivNumber; - - ArgList.Count = 1; - ArgList.Pointer = &Arg0; - - Status = AcpiEvaluateObject (EvtHandle, NULL, &ArgList, NULL); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not evaluate _EVT\n"); - return; - } - - } - GedInfo = GedInfo->Next; - } -} - -#if (!ACPI_REDUCED_HARDWARE) -/******************************************************************************* - * - * 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: Simulate firing of a GPE - * - ******************************************************************************/ - -void -AcpiDbGenerateGpe ( - char *GpeArg, - char *BlockArg) -{ - UINT32 BlockNumber = 0; - UINT32 GpeNumber; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - - - GpeNumber = strtoul (GpeArg, NULL, 0); - - /* - * If no block arg, or block arg == 0 or 1, use the FADT-defined - * GPE blocks. - */ - if (BlockArg) - { - BlockNumber = strtoul (BlockArg, NULL, 0); - if (BlockNumber == 1) - { - BlockNumber = 0; - } - } - - GpeEventInfo = AcpiEvGetGpeEventInfo ( - ACPI_TO_POINTER (BlockNumber), GpeNumber); - if (!GpeEventInfo) - { - AcpiOsPrintf ("Invalid GPE\n"); - return; - } - - (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGenerateSci - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Simulate an SCI -- just call the SCI dispatch. - * - ******************************************************************************/ - -void -AcpiDbGenerateSci ( - void) -{ - AcpiEvSciDispatch (); -} - -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTrace - * - * PARAMETERS: EnableArg - ENABLE/AML to enable tracer - * DISABLE to disable tracer - * MethodArg - Method to trace - * OnceArg - Whether trace once - * - * RETURN: None - * - * DESCRIPTION: Control method tracing facility - * - ******************************************************************************/ - -void -AcpiDbTrace ( - char *EnableArg, - char *MethodArg, - char *OnceArg) -{ - UINT32 DebugLevel = 0; - UINT32 DebugLayer = 0; - UINT32 Flags = 0; - - - AcpiUtStrupr (EnableArg); - AcpiUtStrupr (OnceArg); - - if (MethodArg) - { - if (AcpiDbTraceMethodName) - { - ACPI_FREE (AcpiDbTraceMethodName); - AcpiDbTraceMethodName = NULL; - } - - AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1); - if (!AcpiDbTraceMethodName) - { - AcpiOsPrintf ("Failed to allocate method name (%s)\n", - MethodArg); - return; - } - - strcpy (AcpiDbTraceMethodName, MethodArg); - } - - if (!strcmp (EnableArg, "ENABLE") || - !strcmp (EnableArg, "METHOD") || - !strcmp (EnableArg, "OPCODE")) - { - if (!strcmp (EnableArg, "ENABLE")) - { - /* Inherit current console settings */ - - DebugLevel = AcpiGbl_DbConsoleDebugLevel; - DebugLayer = AcpiDbgLayer; - } - else - { - /* Restrict console output to trace points only */ - - DebugLevel = ACPI_LV_TRACE_POINT; - DebugLayer = ACPI_EXECUTER; - } - - Flags = ACPI_TRACE_ENABLED; - - if (!strcmp (EnableArg, "OPCODE")) - { - Flags |= ACPI_TRACE_OPCODE; - } - - if (OnceArg && !strcmp (OnceArg, "ONCE")) - { - Flags |= ACPI_TRACE_ONESHOT; - } - } - - (void) AcpiDebugTrace (AcpiDbTraceMethodName, - DebugLevel, DebugLayer, Flags); -} diff --git a/Private/acpiSDK/source/components/debugger/dbconvert.c b/Private/acpiSDK/source/components/debugger/dbconvert.c deleted file mode 100644 index 0b852261..00000000 --- a/Private/acpiSDK/source/components/debugger/dbconvert.c +++ /dev/null @@ -1,642 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbconvert - debugger miscellaneous conversion routines - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbconvert") - - -#define DB_DEFAULT_PKG_ELEMENTS 33 - - -/******************************************************************************* - * - * FUNCTION: AcpiDbHexCharToValue - * - * PARAMETERS: HexChar - Ascii Hex digit, 0-9|a-f|A-F - * ReturnValue - Where the converted value is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a single hex character to a 4-bit number (0-16). - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbHexCharToValue ( - int HexChar, - UINT8 *ReturnValue) -{ - UINT8 Value; - - - /* Digit must be ascii [0-9a-fA-F] */ - - if (!isxdigit (HexChar)) - { - return (AE_BAD_HEX_CONSTANT); - } - - if (HexChar <= 0x39) - { - Value = (UINT8) (HexChar - 0x30); - } - else - { - Value = (UINT8) (toupper (HexChar) - 0x37); - } - - *ReturnValue = Value; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbHexByteToBinary - * - * PARAMETERS: HexByte - Double hex digit (0x00 - 0xFF) in format: - * HiByte then LoByte. - * ReturnValue - Where the converted value is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert two hex characters to an 8 bit number (0 - 255). - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbHexByteToBinary ( - char *HexByte, - UINT8 *ReturnValue) -{ - UINT8 Local0; - UINT8 Local1; - ACPI_STATUS Status; - - - /* High byte */ - - Status = AcpiDbHexCharToValue (HexByte[0], &Local0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Low byte */ - - Status = AcpiDbHexCharToValue (HexByte[1], &Local1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *ReturnValue = (UINT8) ((Local0 << 4) | Local1); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbConvertToBuffer - * - * PARAMETERS: String - Input string to be converted - * Object - Where the buffer object is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a string to a buffer object. String is treated a list - * of buffer elements, each separated by a space or comma. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbConvertToBuffer ( - char *String, - ACPI_OBJECT *Object) -{ - UINT32 i; - UINT32 j; - UINT32 Length; - UINT8 *Buffer; - ACPI_STATUS Status; - - - /* Skip all preceding white space*/ - - AcpiUtRemoveWhitespace (&String); - - /* Generate the final buffer length */ - - for (i = 0, Length = 0; String[i];) - { - i+=2; - Length++; - - while (String[i] && - ((String[i] == ',') || (String[i] == ' '))) - { - i++; - } - } - - Buffer = ACPI_ALLOCATE (Length); - if (!Buffer) - { - return (AE_NO_MEMORY); - } - - /* Convert the command line bytes to the buffer */ - - for (i = 0, j = 0; String[i];) - { - Status = AcpiDbHexByteToBinary (&String[i], &Buffer[j]); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (Buffer); - return (Status); - } - - j++; - i += 2; - while (String[i] && - ((String[i] == ',') || (String[i] == ' '))) - { - i++; - } - } - - Object->Type = ACPI_TYPE_BUFFER; - Object->Buffer.Pointer = Buffer; - Object->Buffer.Length = Length; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbConvertToPackage - * - * PARAMETERS: String - Input string to be converted - * Object - Where the package object is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a string to a package object. Handles nested packages - * via recursion with AcpiDbConvertToObject. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbConvertToPackage ( - char *String, - ACPI_OBJECT *Object) -{ - char *This; - char *Next; - UINT32 i; - ACPI_OBJECT_TYPE Type; - ACPI_OBJECT *Elements; - ACPI_STATUS Status; - - - Elements = ACPI_ALLOCATE_ZEROED ( - DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT)); - - This = String; - for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) - { - This = AcpiDbGetNextToken (This, &Next, &Type); - if (!This) - { - break; - } - - /* Recursive call to convert each package element */ - - Status = AcpiDbConvertToObject (Type, This, &Elements[i]); - if (ACPI_FAILURE (Status)) - { - AcpiDbDeleteObjects (i + 1, Elements); - ACPI_FREE (Elements); - return (Status); - } - - This = Next; - } - - Object->Type = ACPI_TYPE_PACKAGE; - Object->Package.Count = i; - Object->Package.Elements = Elements; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbConvertToObject - * - * PARAMETERS: Type - Object type as determined by parser - * String - Input string to be converted - * Object - Where the new object is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a typed and tokenized string to an ACPI_OBJECT. Typing: - * 1) String objects were surrounded by quotes. - * 2) Buffer objects were surrounded by parentheses. - * 3) Package objects were surrounded by brackets "[]". - * 4) All standalone tokens are treated as integers. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbConvertToObject ( - ACPI_OBJECT_TYPE Type, - char *String, - ACPI_OBJECT *Object) -{ - ACPI_STATUS Status = AE_OK; - - - switch (Type) - { - case ACPI_TYPE_STRING: - - Object->Type = ACPI_TYPE_STRING; - Object->String.Pointer = String; - Object->String.Length = (UINT32) strlen (String); - break; - - case ACPI_TYPE_BUFFER: - - Status = AcpiDbConvertToBuffer (String, Object); - break; - - case ACPI_TYPE_PACKAGE: - - Status = AcpiDbConvertToPackage (String, Object); - break; - - default: - - Object->Type = ACPI_TYPE_INTEGER; - Status = AcpiUtStrtoul64 (String, &Object->Integer.Value); - break; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEncodePldBuffer - * - * PARAMETERS: PldInfo - _PLD buffer struct (Using local struct) - * - * RETURN: Encode _PLD buffer suitable for return value from _PLD - * - * DESCRIPTION: Bit-packs a _PLD buffer struct. Used to test the _PLD macros - * - ******************************************************************************/ - -UINT8 * -AcpiDbEncodePldBuffer ( - ACPI_PLD_INFO *PldInfo) -{ - UINT32 *Buffer; - UINT32 Dword; - - - Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE); - if (!Buffer) - { - return (NULL); - } - - /* First 32 bits */ - - Dword = 0; - ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision); - ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor); - ACPI_PLD_SET_RED (&Dword, PldInfo->Red); - ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green); - ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue); - ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword); - - /* Second 32 bits */ - - Dword = 0; - ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width); - ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height); - ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword); - - /* Third 32 bits */ - - Dword = 0; - ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible); - ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock); - ACPI_PLD_SET_LID (&Dword, PldInfo->Lid); - ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel); - ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition); - ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition); - ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape); - ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation); - ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken); - ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition); - ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay); - ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword); - - /* Fourth 32 bits */ - - Dword = 0; - ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable); - ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired); - ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber); - ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber); - ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference); - ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation); - ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order); - ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword); - - if (PldInfo->Revision >= 2) - { - /* Fifth 32 bits */ - - Dword = 0; - ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset); - ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset); - ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword); - } - - return (ACPI_CAST_PTR (UINT8, Buffer)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpPldBuffer - * - * PARAMETERS: ObjDesc - Object returned from _PLD method - * - * RETURN: None. - * - * DESCRIPTION: Dumps formatted contents of a _PLD return buffer. - * - ******************************************************************************/ - -#define ACPI_PLD_OUTPUT "%20s : %-6X\n" - -void -AcpiDbDumpPldBuffer ( - ACPI_OBJECT *ObjDesc) -{ - ACPI_OBJECT *BufferDesc; - ACPI_PLD_INFO *PldInfo; - UINT8 *NewBuffer; - ACPI_STATUS Status; - - - /* Object must be of type Package with at least one Buffer element */ - - if (ObjDesc->Type != ACPI_TYPE_PACKAGE) - { - return; - } - - BufferDesc = &ObjDesc->Package.Elements[0]; - if (BufferDesc->Type != ACPI_TYPE_BUFFER) - { - return; - } - - /* Convert _PLD buffer to local _PLD struct */ - - Status = AcpiDecodePldBuffer (BufferDesc->Buffer.Pointer, - BufferDesc->Buffer.Length, &PldInfo); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Encode local _PLD struct back to a _PLD buffer */ - - NewBuffer = AcpiDbEncodePldBuffer (PldInfo); - if (!NewBuffer) - { - goto Exit; - } - - /* The two bit-packed buffers should match */ - - if (memcmp (NewBuffer, BufferDesc->Buffer.Pointer, - BufferDesc->Buffer.Length)) - { - AcpiOsPrintf ("Converted _PLD buffer does not compare. New:\n"); - - AcpiUtDumpBuffer (NewBuffer, - BufferDesc->Buffer.Length, DB_BYTE_DISPLAY, 0); - } - - /* First 32-bit dword */ - - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Revision", PldInfo->Revision); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_IgnoreColor", PldInfo->IgnoreColor); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Red", PldInfo->Red); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Green", PldInfo->Green); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Blue", PldInfo->Blue); - - /* Second 32-bit dword */ - - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Width", PldInfo->Width); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Height", PldInfo->Height); - - /* Third 32-bit dword */ - - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_UserVisible", PldInfo->UserVisible); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Dock", PldInfo->Dock); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Lid", PldInfo->Lid); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Panel", PldInfo->Panel); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_VerticalPosition", PldInfo->VerticalPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalPosition", PldInfo->HorizontalPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Shape", PldInfo->Shape); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupOrientation", PldInfo->GroupOrientation); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupToken", PldInfo->GroupToken); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupPosition", PldInfo->GroupPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Bay", PldInfo->Bay); - - /* Fourth 32-bit dword */ - - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Ejectable", PldInfo->Ejectable); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_EjectRequired", PldInfo->OspmEjectRequired); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_CabinetNumber", PldInfo->CabinetNumber); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_CardCageNumber", PldInfo->CardCageNumber); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Reference", PldInfo->Reference); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Rotation", PldInfo->Rotation); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Order", PldInfo->Order); - - /* Fifth 32-bit dword */ - - if (BufferDesc->Buffer.Length > 16) - { - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_VerticalOffset", PldInfo->VerticalOffset); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalOffset", PldInfo->HorizontalOffset); - } - - ACPI_FREE (NewBuffer); -Exit: - ACPI_FREE (PldInfo); -} diff --git a/Private/acpiSDK/source/components/debugger/dbdisply.c b/Private/acpiSDK/source/components/debugger/dbdisply.c deleted file mode 100644 index ad69737f..00000000 --- a/Private/acpiSDK/source/components/debugger/dbdisply.c +++ /dev/null @@ -1,1328 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbdisply - debug display commands - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acparser.h" -#include "acinterp.h" -#include "acevents.h" -#include "acdebug.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbdisply") - -/* Local prototypes */ - -static void -AcpiDbDumpParserDescriptor ( - ACPI_PARSE_OBJECT *Op); - -static void * -AcpiDbGetPointer ( - void *Target); - -static ACPI_STATUS -AcpiDbDisplayNonRootHandlers ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -/* - * System handler information. - * Used for Handlers command, in AcpiDbDisplayHandlers. - */ -#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " -#define ACPI_HANDLER_NAME_STRING "%30s : " -#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" -#define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)" -#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" - -/* All predefined Address Space IDs */ - -static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] = -{ - ACPI_ADR_SPACE_SYSTEM_MEMORY, - ACPI_ADR_SPACE_SYSTEM_IO, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_ADR_SPACE_EC, - ACPI_ADR_SPACE_SMBUS, - ACPI_ADR_SPACE_CMOS, - ACPI_ADR_SPACE_PCI_BAR_TARGET, - ACPI_ADR_SPACE_IPMI, - ACPI_ADR_SPACE_GPIO, - ACPI_ADR_SPACE_GSBUS, - ACPI_ADR_SPACE_PLATFORM_COMM, - ACPI_ADR_SPACE_PLATFORM_RT, - ACPI_ADR_SPACE_DATA_TABLE, - ACPI_ADR_SPACE_FIXED_HARDWARE -}; - -/* Global handler information */ - -typedef struct acpi_handler_info -{ - void *Handler; - char *Name; - -} ACPI_HANDLER_INFO; - -static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] = -{ - {&AcpiGbl_GlobalNotify[0].Handler, "System Notifications"}, - {&AcpiGbl_GlobalNotify[1].Handler, "Device Notifications"}, - {&AcpiGbl_TableHandler, "ACPI Table Events"}, - {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"}, - {&AcpiGbl_InterfaceHandler, "OSI Invocations"} -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetPointer - * - * PARAMETERS: Target - Pointer to string to be converted - * - * RETURN: Converted pointer - * - * DESCRIPTION: Convert an ascii pointer value to a real value - * - ******************************************************************************/ - -static void * -AcpiDbGetPointer ( - void *Target) -{ - void *ObjPtr; - ACPI_SIZE Address; - - - Address = strtoul (Target, NULL, 16); - ObjPtr = ACPI_TO_POINTER (Address); - return (ObjPtr); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpParserDescriptor - * - * PARAMETERS: Op - A parser Op descriptor - * - * RETURN: None - * - * DESCRIPTION: Display a formatted parser object - * - ******************************************************************************/ - -static void -AcpiDbDumpParserDescriptor ( - ACPI_PARSE_OBJECT *Op) -{ - const ACPI_OPCODE_INFO *Info; - - - Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - AcpiOsPrintf ("Parser Op Descriptor:\n"); - AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); - - ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", - Info->Name)); - - AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); - AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); - AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDecodeAndDisplayObject - * - * PARAMETERS: Target - String with object to be displayed. Names - * and hex pointers are supported. - * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) - * - * RETURN: None - * - * DESCRIPTION: Display a formatted ACPI object - * - ******************************************************************************/ - -void -AcpiDbDecodeAndDisplayObject ( - char *Target, - char *OutputType) -{ - void *ObjPtr; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 Display = DB_BYTE_DISPLAY; - char Buffer[80]; - ACPI_BUFFER RetBuf; - ACPI_STATUS Status; - UINT32 Size; - - - if (!Target) - { - return; - } - - /* Decode the output type */ - - if (OutputType) - { - AcpiUtStrupr (OutputType); - if (OutputType[0] == 'W') - { - Display = DB_WORD_DISPLAY; - } - else if (OutputType[0] == 'D') - { - Display = DB_DWORD_DISPLAY; - } - else if (OutputType[0] == 'Q') - { - Display = DB_QWORD_DISPLAY; - } - } - - RetBuf.Length = sizeof (Buffer); - RetBuf.Pointer = Buffer; - - /* Differentiate between a number and a name */ - - if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) - { - ObjPtr = AcpiDbGetPointer (Target); - if (!AcpiOsReadable (ObjPtr, 16)) - { - AcpiOsPrintf ( - "Address %p is invalid in this address space\n", - ObjPtr); - return; - } - - /* Decode the object type */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) - { - case ACPI_DESC_TYPE_NAMED: - - /* This is a namespace Node */ - - if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) - { - AcpiOsPrintf ( - "Cannot read entire Named object at address %p\n", - ObjPtr); - return; - } - - Node = ObjPtr; - goto DumpNode; - - case ACPI_DESC_TYPE_OPERAND: - - /* This is a ACPI OPERAND OBJECT */ - - if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) - { - AcpiOsPrintf ( - "Cannot read entire ACPI object at address %p\n", - ObjPtr); - return; - } - - AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), - Display, ACPI_UINT32_MAX); - AcpiExDumpObjectDescriptor (ObjPtr, 1); - break; - - case ACPI_DESC_TYPE_PARSER: - - /* This is a Parser Op object */ - - if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) - { - AcpiOsPrintf ( - "Cannot read entire Parser object at address %p\n", - ObjPtr); - return; - } - - AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), - Display, ACPI_UINT32_MAX); - AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); - break; - - default: - - /* Is not a recognizable object */ - - AcpiOsPrintf ( - "Not a known ACPI internal object, descriptor type %2.2X\n", - ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)); - - Size = 16; - if (AcpiOsReadable (ObjPtr, 64)) - { - Size = 64; - } - - /* Just dump some memory */ - - AcpiUtDebugDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); - break; - } - - return; - } - - /* The parameter is a name string that must be resolved to a Named obj */ - - Node = AcpiDbLocalNsLookup (Target); - if (!Node) - { - return; - } - - -DumpNode: - /* Now dump the NS node */ - - Status = AcpiGetName (Node, ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not convert name to pathname\n"); - } - - else - { - AcpiOsPrintf ("Object %p: Namespace Node - Pathname: %s\n", - Node, (char *) RetBuf.Pointer); - } - - if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) - { - AcpiOsPrintf ("Invalid Named object at address %p\n", Node); - return; - } - - AcpiUtDebugDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), - Display, ACPI_UINT32_MAX); - AcpiExDumpNamespaceNode (Node, 1); - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) - { - AcpiOsPrintf ("\nAttached Object %p:", ObjDesc); - if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) - { - AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", - ObjDesc); - return; - } - - if (ACPI_GET_DESCRIPTOR_TYPE ( - ((ACPI_NAMESPACE_NODE *) ObjDesc)) == ACPI_DESC_TYPE_NAMED) - { - AcpiOsPrintf (" Namespace Node - "); - Status = AcpiGetName ((ACPI_NAMESPACE_NODE *) ObjDesc, - ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not convert name to pathname\n"); - } - else - { - AcpiOsPrintf ("Pathname: %s", - (char *) RetBuf.Pointer); - } - - AcpiOsPrintf ("\n"); - AcpiUtDebugDumpBuffer ((void *) ObjDesc, - sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); - } - else - { - AcpiOsPrintf ("\n"); - AcpiUtDebugDumpBuffer ((void *) ObjDesc, - sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); - } - - AcpiExDumpObjectDescriptor (ObjDesc, 1); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayMethodInfo - * - * PARAMETERS: StartOp - Root of the control method parse tree - * - * RETURN: None - * - * DESCRIPTION: Display information about the current method - * - ******************************************************************************/ - -void -AcpiDbDisplayMethodInfo ( - ACPI_PARSE_OBJECT *StartOp) -{ - ACPI_WALK_STATE *WalkState; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *RootOp; - ACPI_PARSE_OBJECT *Op; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 NumOps = 0; - UINT32 NumOperands = 0; - UINT32 NumOperators = 0; - UINT32 NumRemainingOps = 0; - UINT32 NumRemainingOperands = 0; - UINT32 NumRemainingOperators = 0; - BOOLEAN CountRemaining = FALSE; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; - - AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", - AcpiUtGetNodeName (Node)); - AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n", - (UINT32) ObjDesc->Method.ParamCount, - (UINT32) ObjDesc->Method.SyncLevel); - - RootOp = StartOp; - while (RootOp->Common.Parent) - { - RootOp = RootOp->Common.Parent; - } - - Op = RootOp; - - while (Op) - { - if (Op == StartOp) - { - CountRemaining = TRUE; - } - - NumOps++; - if (CountRemaining) - { - NumRemainingOps++; - } - - /* Decode the opcode */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - switch (OpInfo->Class) - { - case AML_CLASS_ARGUMENT: - - if (CountRemaining) - { - NumRemainingOperands++; - } - - NumOperands++; - break; - - case AML_CLASS_UNKNOWN: - - /* Bad opcode or ASCII character */ - - continue; - - default: - - if (CountRemaining) - { - NumRemainingOperators++; - } - - NumOperators++; - break; - } - - Op = AcpiPsGetDepthNext (StartOp, Op); - } - - AcpiOsPrintf ( - "Method contains: %X AML Opcodes - %X Operators, %X Operands\n", - NumOps, NumOperators, NumOperands); - - AcpiOsPrintf ( - "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", - NumRemainingOps, NumRemainingOperators, NumRemainingOperands); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayLocals - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display all locals for the currently running control method - * - ******************************************************************************/ - -void -AcpiDbDisplayLocals ( - void) -{ - ACPI_WALK_STATE *WalkState; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - AcpiDbDecodeLocals (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayArguments - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display all arguments for the currently running control method - * - ******************************************************************************/ - -void -AcpiDbDisplayArguments ( - void) -{ - ACPI_WALK_STATE *WalkState; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - AcpiDbDecodeArguments (WalkState); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayResults - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display current contents of a method result stack - * - ******************************************************************************/ - -void -AcpiDbDisplayResults ( - void) -{ - UINT32 i; - ACPI_WALK_STATE *WalkState; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 ResultCount = 0; - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE *Frame; - UINT32 Index; /* Index onto current frame */ - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - Node = WalkState->MethodNode; - - if (WalkState->Results) - { - ResultCount = WalkState->ResultCount; - } - - AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", - AcpiUtGetNodeName (Node), ResultCount); - - /* From the top element of result stack */ - - Frame = WalkState->Results; - Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM; - - for (i = 0; i < ResultCount; i++) - { - ObjDesc = Frame->Results.ObjDesc[Index]; - AcpiOsPrintf ("Result%u: ", i); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); - - if (Index == 0) - { - Frame = Frame->Results.Next; - Index = ACPI_RESULTS_FRAME_OBJ_NUM; - } - - Index--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayCallingTree - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display current calling tree of nested control methods - * - ******************************************************************************/ - -void -AcpiDbDisplayCallingTree ( - void) -{ - ACPI_WALK_STATE *WalkState; - ACPI_NAMESPACE_NODE *Node; - - - WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); - if (!WalkState) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - AcpiOsPrintf ("Current Control Method Call Tree\n"); - - while (WalkState) - { - Node = WalkState->MethodNode; - AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); - - WalkState = WalkState->Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayObjectType - * - * PARAMETERS: ObjectArg - User entered NS node handle - * - * RETURN: None - * - * DESCRIPTION: Display type of an arbitrary NS node - * - ******************************************************************************/ - -void -AcpiDbDisplayObjectType ( - char *ObjectArg) -{ - ACPI_SIZE Arg; - ACPI_HANDLE Handle; - ACPI_DEVICE_INFO *Info; - ACPI_STATUS Status; - UINT32 i; - - - Arg = strtoul (ObjectArg, NULL, 16); - Handle = ACPI_TO_POINTER (Arg); - - Status = AcpiGetObjectInfo (Handle, &Info); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get object info, %s\n", - AcpiFormatException (Status)); - return; - } - - AcpiOsPrintf ("ADR: %8.8X%8.8X, Flags: %X\n", - ACPI_FORMAT_UINT64 (Info->Address), Info->Flags); - - AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", - Info->HighestDstates[0], Info->HighestDstates[1], - Info->HighestDstates[2], Info->HighestDstates[3]); - - AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", - Info->LowestDstates[0], Info->LowestDstates[1], - Info->LowestDstates[2], Info->LowestDstates[3], - Info->LowestDstates[4]); - - if (Info->Valid & ACPI_VALID_HID) - { - AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); - } - - if (Info->Valid & ACPI_VALID_UID) - { - AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); - } - - if (Info->Valid & ACPI_VALID_CID) - { - for (i = 0; i < Info->CompatibleIdList.Count; i++) - { - AcpiOsPrintf ("CID %u: %s\n", i, - Info->CompatibleIdList.Ids[i].String); - } - } - - ACPI_FREE (Info); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayResultObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * WalkState - Current walk state - * - * RETURN: None - * - * DESCRIPTION: Display the result of an AML opcode - * - * Note: Currently only displays the result object if we are single stepping. - * However, this output may be useful in other contexts and could be enabled - * to do so if needed. - * - ******************************************************************************/ - -void -AcpiDbDisplayResultObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - -#ifndef ACPI_APPLICATION - if (AcpiGbl_DbThreadId != AcpiOsGetThreadId()) - { - return; - } -#endif - - /* Only display if single stepping */ - - if (!AcpiGbl_CmSingleStep) - { - return; - } - - AcpiOsPrintf ("ResultObj: "); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); - AcpiOsPrintf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayArgumentObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * WalkState - Current walk state - * - * RETURN: None - * - * DESCRIPTION: Display the result of an AML opcode - * - ******************************************************************************/ - -void -AcpiDbDisplayArgumentObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - -#ifndef ACPI_APPLICATION - if (AcpiGbl_DbThreadId != AcpiOsGetThreadId()) - { - return; - } -#endif - - if (!AcpiGbl_CmSingleStep) - { - return; - } - - AcpiOsPrintf ("ArgObj: "); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); -} - - -#if (!ACPI_REDUCED_HARDWARE) -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayGpes - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display the current GPE structures - * - ******************************************************************************/ - -void -AcpiDbDisplayGpes ( - void) -{ - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_GPE_XRUPT_INFO *GpeXruptInfo; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - char *GpeType; - ACPI_GPE_NOTIFY_INFO *Notify; - UINT32 GpeIndex; - UINT32 Block = 0; - UINT32 i; - UINT32 j; - UINT32 Count; - char Buffer[80]; - ACPI_BUFFER RetBuf; - ACPI_STATUS Status; - - - RetBuf.Length = sizeof (Buffer); - RetBuf.Pointer = Buffer; - - Block = 0; - - /* Walk the GPE lists */ - - GpeXruptInfo = AcpiGbl_GpeXruptListHead; - while (GpeXruptInfo) - { - GpeBlock = GpeXruptInfo->GpeBlockListHead; - while (GpeBlock) - { - Status = AcpiGetName (GpeBlock->Node, - ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not convert name to pathname\n"); - } - - if (GpeBlock->Node == AcpiGbl_FadtGpeDevice) - { - GpeType = "FADT-defined GPE block"; - } - else - { - GpeType = "GPE Block Device"; - } - - AcpiOsPrintf ( - "\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", - Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); - - AcpiOsPrintf ( - " Registers: %u (%u GPEs)\n", - GpeBlock->RegisterCount, GpeBlock->GpeCount); - - AcpiOsPrintf ( - " GPE range: 0x%X to 0x%X on interrupt %u\n", - GpeBlock->BlockBaseNumber, - GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), - GpeXruptInfo->InterruptNumber); - - AcpiOsPrintf ( - " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", - GpeBlock->RegisterInfo, - ACPI_FORMAT_UINT64 ( - GpeBlock->RegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 ( - GpeBlock->RegisterInfo->EnableAddress.Address)); - - AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); - - /* Examine each GPE Register within the block */ - - for (i = 0; i < GpeBlock->RegisterCount; i++) - { - GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; - - AcpiOsPrintf ( - " Reg %u: (GPE %.2X-%.2X) " - "RunEnable %2.2X WakeEnable %2.2X" - " Status %8.8X%8.8X Enable %8.8X%8.8X\n", - i, GpeRegisterInfo->BaseGpeNumber, - GpeRegisterInfo->BaseGpeNumber + - (ACPI_GPE_REGISTER_WIDTH - 1), - GpeRegisterInfo->EnableForRun, - GpeRegisterInfo->EnableForWake, - ACPI_FORMAT_UINT64 ( - GpeRegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 ( - GpeRegisterInfo->EnableAddress.Address)); - - /* Now look at the individual GPEs in this byte register */ - - for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) - { - GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; - GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; - - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_NONE) - { - /* This GPE is not used (no method or handler), ignore it */ - - continue; - } - - AcpiOsPrintf ( - " GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", - GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, - GpeEventInfo->RuntimeCount, GpeEventInfo->Flags); - - /* Decode the flags byte */ - - if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) - { - AcpiOsPrintf ("Level, "); - } - else - { - AcpiOsPrintf ("Edge, "); - } - - if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) - { - AcpiOsPrintf ("CanWake, "); - } - else - { - AcpiOsPrintf ("RunOnly, "); - } - - switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)) - { - case ACPI_GPE_DISPATCH_NONE: - - AcpiOsPrintf ("NotUsed"); - break; - - case ACPI_GPE_DISPATCH_METHOD: - - AcpiOsPrintf ("Method"); - break; - - case ACPI_GPE_DISPATCH_HANDLER: - - AcpiOsPrintf ("Handler"); - break; - - case ACPI_GPE_DISPATCH_NOTIFY: - - Count = 0; - Notify = GpeEventInfo->Dispatch.NotifyList; - while (Notify) - { - Count++; - Notify = Notify->Next; - } - - AcpiOsPrintf ("Implicit Notify on %u devices", - Count); - break; - - case ACPI_GPE_DISPATCH_RAW_HANDLER: - - AcpiOsPrintf ("RawHandler"); - break; - - default: - - AcpiOsPrintf ("UNKNOWN: %X", - ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)); - break; - } - - AcpiOsPrintf (")\n"); - } - } - - Block++; - GpeBlock = GpeBlock->Next; - } - - GpeXruptInfo = GpeXruptInfo->Next; - } -} -#endif /* !ACPI_REDUCED_HARDWARE */ - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayHandlers - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display the currently installed global handlers - * - ******************************************************************************/ - -void -AcpiDbDisplayHandlers ( - void) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_ADR_SPACE_TYPE SpaceId; - UINT32 i; - - - /* Operation region handlers */ - - AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n"); - - ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); - if (ObjDesc) - { - for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) - { - SpaceId = AcpiGbl_SpaceIdList[i]; - - AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, - AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); - - HandlerObj = AcpiEvFindRegionHandler ( - SpaceId, ObjDesc->CommonNotify.Handler); - if (HandlerObj) - { - AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, - (HandlerObj->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? - "Default" : "User", - HandlerObj->AddressSpace.Handler); - - goto FoundHandler; - } - - /* There is no handler for this SpaceId */ - - AcpiOsPrintf ("None\n"); - - FoundHandler:; - } - - /* Find all handlers for user-defined SpaceIDs */ - - HandlerObj = ObjDesc->CommonNotify.Handler; - while (HandlerObj) - { - if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) - { - AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, - "User-defined ID", HandlerObj->AddressSpace.SpaceId); - AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, - (HandlerObj->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? - "Default" : "User", - HandlerObj->AddressSpace.Handler); - } - - HandlerObj = HandlerObj->AddressSpace.Next; - } - } - -#if (!ACPI_REDUCED_HARDWARE) - - /* Fixed event handlers */ - - AcpiOsPrintf ("\nFixed Event Handlers:\n"); - - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) - { - AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); - if (AcpiGbl_FixedEventHandlers[i].Handler) - { - AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", - AcpiGbl_FixedEventHandlers[i].Handler); - } - else - { - AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); - } - } - -#endif /* !ACPI_REDUCED_HARDWARE */ - - /* Miscellaneous global handlers */ - - AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); - - for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) - { - AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, - AcpiGbl_HandlerList[i].Name); - - if (AcpiGbl_HandlerList[i].Handler) - { - AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", - AcpiGbl_HandlerList[i].Handler); - } - else - { - AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); - } - } - - - /* Other handlers that are installed throughout the namespace */ - - AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); - - (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, - NULL, NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayNonRootHandlers - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Display information about all handlers installed for a - * device object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbDisplayNonRootHandlers ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - char *Pathname; - - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return (AE_OK); - } - - Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); - if (!Pathname) - { - return (AE_OK); - } - - /* Display all handlers associated with this device */ - - HandlerObj = ObjDesc->CommonNotify.Handler; - while (HandlerObj) - { - AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, - AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId), - HandlerObj->AddressSpace.SpaceId); - - AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2, - (HandlerObj->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", - HandlerObj->AddressSpace.Handler); - - AcpiOsPrintf (" Device Name: %s (%p)\n", Pathname, Node); - - HandlerObj = HandlerObj->AddressSpace.Next; - } - - ACPI_FREE (Pathname); - return (AE_OK); -} diff --git a/Private/acpiSDK/source/components/debugger/dbexec.c b/Private/acpiSDK/source/components/debugger/dbexec.c deleted file mode 100644 index 73759c88..00000000 --- a/Private/acpiSDK/source/components/debugger/dbexec.c +++ /dev/null @@ -1,1113 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbexec - debugger control method execution - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbexec") - - -static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDbExecuteMethod ( - ACPI_DB_METHOD_INFO *Info, - ACPI_BUFFER *ReturnObj); - -static ACPI_STATUS -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); - -static void ACPI_SYSTEM_XFACE -AcpiDbSingleExecutionThread ( - void *Context); - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDeleteObjects - * - * PARAMETERS: Count - Count of objects in the list - * Objects - Array of ACPI_OBJECTs to be deleted - * - * RETURN: None - * - * DESCRIPTION: Delete a list of ACPI_OBJECTS. Handles packages and nested - * packages via recursion. - * - ******************************************************************************/ - -void -AcpiDbDeleteObjects ( - UINT32 Count, - ACPI_OBJECT *Objects) -{ - UINT32 i; - - - for (i = 0; i < Count; i++) - { - switch (Objects[i].Type) - { - case ACPI_TYPE_BUFFER: - - ACPI_FREE (Objects[i].Buffer.Pointer); - break; - - case ACPI_TYPE_PACKAGE: - - /* Recursive call to delete package elements */ - - AcpiDbDeleteObjects (Objects[i].Package.Count, - Objects[i].Package.Elements); - - /* Free the elements array */ - - ACPI_FREE (Objects[i].Package.Elements); - break; - - default: - - break; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecuteMethod - * - * PARAMETERS: Info - Valid info segment - * ReturnObj - Where to put return object - * - * RETURN: Status - * - * DESCRIPTION: Execute a control method. Used to evaluate objects via the - * "EXECUTE" or "EVALUATE" commands. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbExecuteMethod ( - ACPI_DB_METHOD_INFO *Info, - ACPI_BUFFER *ReturnObj) -{ - ACPI_STATUS Status; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_DEBUGGER_MAX_ARGS + 1]; - UINT32 i; - - - ACPI_FUNCTION_TRACE (DbExecuteMethod); - - - if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel) - { - AcpiOsPrintf ("Warning: debug output is not enabled!\n"); - } - - ParamObjects.Count = 0; - ParamObjects.Pointer = NULL; - - /* Pass through any command-line arguments */ - - if (Info->Args && Info->Args[0]) - { - /* Get arguments passed on the command line */ - - for (i = 0; (Info->Args[i] && *(Info->Args[i])); i++) - { - /* Convert input string (token) to an actual ACPI_OBJECT */ - - Status = AcpiDbConvertToObject (Info->Types[i], - Info->Args[i], &Params[i]); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While parsing method arguments")); - goto Cleanup; - } - } - - ParamObjects.Count = i; - ParamObjects.Pointer = Params; - } - - /* Prepare for a return object of arbitrary 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); - - AcpiGbl_CmSingleStep = FALSE; - AcpiGbl_MethodExecuting = FALSE; - - if (ACPI_FAILURE (Status)) - { - if ((Status == AE_ABORT_METHOD) || AcpiGbl_AbortMethod) - { - /* Clear the abort and fall back to the debugger prompt */ - - ACPI_EXCEPTION ((AE_INFO, Status, - "Aborting top-level method")); - - AcpiGbl_AbortMethod = FALSE; - Status = AE_OK; - goto Cleanup; - } - - ACPI_EXCEPTION ((AE_INFO, Status, - "while executing %s from AML Debugger", Info->Pathname)); - - if (Status == AE_BUFFER_OVERFLOW) - { - ACPI_ERROR ((AE_INFO, - "Possible buffer overflow within AML Debugger " - "buffer (size 0x%X needed 0x%X)", - ACPI_DEBUG_BUFFER_SIZE, (UINT32) ReturnObj->Length)); - } - } - -Cleanup: - AcpiDbDeleteObjects (ParamObjects.Count, Params); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecuteSetup - * - * PARAMETERS: Info - Valid method info - * - * RETURN: None - * - * DESCRIPTION: Setup info segment prior to method execution - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbExecuteSetup ( - ACPI_DB_METHOD_INFO *Info) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (DbExecuteSetup); - - - /* Concatenate the current scope to the supplied name */ - - Info->Pathname[0] = 0; - if ((Info->Name[0] != '\\') && - (Info->Name[0] != '/')) - { - if (AcpiUtSafeStrcat (Info->Pathname, sizeof (Info->Pathname), - AcpiGbl_DbScopeBuf)) - { - Status = AE_BUFFER_OVERFLOW; - goto ErrorExit; - } - } - - if (AcpiUtSafeStrcat (Info->Pathname, sizeof (Info->Pathname), - Info->Name)) - { - Status = AE_BUFFER_OVERFLOW; - goto ErrorExit; - } - - AcpiDbPrepNamestring (Info->Pathname); - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("Evaluating %s\n", Info->Pathname); - - if (Info->Flags & EX_SINGLE_STEP) - { - AcpiGbl_CmSingleStep = TRUE; - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - } - - else - { - /* No single step, allow redirection to a file */ - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - } - - return (AE_OK); - -ErrorExit: - - ACPI_EXCEPTION ((AE_INFO, Status, "During setup for method execution")); - return (Status); -} - - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS -UINT32 -AcpiDbGetCacheInfo ( - ACPI_MEMORY_LIST *Cache) -{ - - return (Cache->TotalAllocated - Cache->TotalFreed - Cache->CurrentDepth); -} -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetOutstandingAllocations - * - * PARAMETERS: None - * - * RETURN: Current global allocation count minus cache entries - * - * DESCRIPTION: Determine the current number of "outstanding" allocations -- - * those allocations that have not been freed and also are not - * in one of the various object caches. - * - ******************************************************************************/ - -static UINT32 -AcpiDbGetOutstandingAllocations ( - void) -{ - UINT32 Outstanding = 0; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_StateCache); - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeCache); - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeExtCache); - Outstanding += AcpiDbGetCacheInfo (AcpiGbl_OperandCache); -#endif - - return (Outstanding); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecutionWalk - * - * PARAMETERS: WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Execute a control method. Name is relative to the current - * scope. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbExecutionWalk ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc->Method.ParamCount) - { - return (AE_OK); - } - - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - AcpiNsPrintNodePathname (Node, "Evaluating"); - - /* Do the actual method execution */ - - AcpiOsPrintf ("\n"); - AcpiGbl_MethodExecuting = TRUE; - - Status = AcpiEvaluateObject (Node, NULL, NULL, &ReturnObj); - - AcpiGbl_MethodExecuting = FALSE; - - AcpiOsPrintf ("Evaluation of [%4.4s] returned %s\n", - AcpiUtGetNodeName (Node), - AcpiFormatException (Status)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecute - * - * PARAMETERS: Name - Name of method to execute - * Args - Parameters to the method - * Types - - * Flags - single step/no single step - * - * RETURN: None - * - * DESCRIPTION: Execute a control method. Name is relative to the current - * scope. Function used for the "EXECUTE", "EVALUATE", and - * "ALL" commands - * - ******************************************************************************/ - -void -AcpiDbExecute ( - char *Name, - char **Args, - ACPI_OBJECT_TYPE *Types, - UINT32 Flags) -{ - ACPI_STATUS Status; - ACPI_BUFFER ReturnObj; - char *NameString; - -#ifdef ACPI_DEBUG_OUTPUT - UINT32 PreviousAllocations; - UINT32 Allocations; -#endif - - - /* - * Allow one execution to be performed by debugger or single step - * execution will be dead locked by the interpreter mutexes. - */ - if (AcpiGbl_MethodExecuting) - { - AcpiOsPrintf ("Only one debugger execution is allowed.\n"); - return; - } - -#ifdef ACPI_DEBUG_OUTPUT - /* Memory allocation tracking */ - - PreviousAllocations = AcpiDbGetOutstandingAllocations (); -#endif - - if (*Name == '*') - { - (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); - return; - } - - if ((Flags & EX_ALL) && (strlen (Name) > 4)) - { - AcpiOsPrintf ("Input name (%s) must be a 4-char NameSeg\n", Name); - return; - } - - NameString = ACPI_ALLOCATE (strlen (Name) + 1); - if (!NameString) - { - return; - } - - memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); - strcpy (NameString, Name); - AcpiUtStrupr (NameString); - - /* Subcommand to Execute all predefined names in the namespace */ - - if (!strncmp (NameString, "PREDEF", 6)) - { - AcpiDbEvaluatePredefinedNames (); - ACPI_FREE (NameString); - return; - } - - /* Command (ALL <nameseg>) to execute all methods of a particular name */ - - else if (Flags & EX_ALL) - { - AcpiGbl_DbMethodInfo.Name = NameString; - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - AcpiDbEvaluateAll (NameString); - ACPI_FREE (NameString); - return; - } - else - { - AcpiGbl_DbMethodInfo.Name = NameString; - AcpiGbl_DbMethodInfo.Args = Args; - AcpiGbl_DbMethodInfo.Types = Types; - AcpiGbl_DbMethodInfo.Flags = Flags; - - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - } - - Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (NameString); - return; - } - - /* Get the NS node, determines existence also */ - - Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, - &AcpiGbl_DbMethodInfo.Method); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, - &ReturnObj); - } - ACPI_FREE (NameString); - - /* - * Allow any handlers in separate threads to complete. - * (Such as Notify handlers invoked from AML executed above). - */ - AcpiOsSleep ((UINT64) 10); - -#ifdef ACPI_DEBUG_OUTPUT - - /* Memory allocation tracking */ - - Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations; - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - - if (Allocations > 0) - { - AcpiOsPrintf ( - "0x%X Outstanding allocations after evaluation of %s\n", - Allocations, AcpiGbl_DbMethodInfo.Pathname); - } -#endif - - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Evaluation of %s failed with status %s\n", - AcpiGbl_DbMethodInfo.Pathname, - AcpiFormatException (Status)); - } - else - { - /* Display a return object, if any */ - - if (ReturnObj.Length) - { - AcpiOsPrintf ( - "Evaluation of %s returned object %p, " - "external buffer length %X\n", - AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, - (UINT32) ReturnObj.Length); - - AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); - AcpiOsPrintf ("\n"); - - /* Dump a _PLD buffer if present */ - - if (ACPI_COMPARE_NAMESEG ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - AcpiGbl_DbMethodInfo.Method)->Name.Ascii), - METHOD_NAME__PLD)) - { - AcpiDbDumpPldBuffer (ReturnObj.Pointer); - } - } - else - { - AcpiOsPrintf ("No object was returned from evaluation of %s\n", - AcpiGbl_DbMethodInfo.Pathname); - } - } - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbMethodThread - * - * PARAMETERS: Context - Execution info segment - * - * RETURN: None - * - * DESCRIPTION: Debugger execute thread. Waits for a command line, then - * simply dispatches it. - * - ******************************************************************************/ - -static void ACPI_SYSTEM_XFACE -AcpiDbMethodThread ( - void *Context) -{ - ACPI_STATUS Status; - ACPI_DB_METHOD_INFO *Info = Context; - ACPI_DB_METHOD_INFO LocalInfo; - UINT32 i; - UINT8 Allow; - ACPI_BUFFER ReturnObj; - - - /* - * AcpiGbl_DbMethodInfo.Arguments will be passed as method arguments. - * Prevent AcpiGbl_DbMethodInfo from being modified by multiple threads - * concurrently. - * - * Note: The arguments we are passing are used by the ASL test suite - * (aslts). Do not change them without updating the tests. - */ - (void) AcpiOsWaitSemaphore (Info->InfoGate, 1, ACPI_WAIT_FOREVER); - - if (Info->InitArgs) - { - AcpiDbUint32ToHexString (Info->NumCreated, - Info->IndexOfThreadStr); - AcpiDbUint32ToHexString ((UINT32) AcpiOsGetThreadId (), - Info->IdOfThreadStr); - } - - if (Info->Threads && (Info->NumCreated < Info->NumThreads)) - { - Info->Threads[Info->NumCreated++] = AcpiOsGetThreadId(); - } - - LocalInfo = *Info; - LocalInfo.Args = LocalInfo.Arguments; - LocalInfo.Arguments[0] = LocalInfo.NumThreadsStr; - LocalInfo.Arguments[1] = LocalInfo.IdOfThreadStr; - LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr; - LocalInfo.Arguments[3] = NULL; - - LocalInfo.Types = LocalInfo.ArgTypes; - - (void) AcpiOsSignalSemaphore (Info->InfoGate, 1); - - for (i = 0; i < Info->NumLoops; i++) - { - Status = AcpiDbExecuteMethod (&LocalInfo, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s During evaluation of %s at iteration %X\n", - AcpiFormatException (Status), Info->Pathname, i); - if (Status == AE_ABORT_METHOD) - { - break; - } - } - -#if 0 - if ((i % 100) == 0) - { - AcpiOsPrintf ("%u loops, Thread 0x%x\n", - i, AcpiOsGetThreadId ()); - } - - if (ReturnObj.Length) - { - AcpiOsPrintf ("Evaluation of %s returned object %p Buflen %X\n", - Info->Pathname, ReturnObj.Pointer, - (UINT32) ReturnObj.Length); - AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); - } -#endif - } - - /* Signal our completion */ - - Allow = 0; - (void) AcpiOsWaitSemaphore (Info->ThreadCompleteGate, - 1, ACPI_WAIT_FOREVER); - Info->NumCompleted++; - - if (Info->NumCompleted == Info->NumThreads) - { - /* Do signal for main thread once only */ - Allow = 1; - } - - (void) AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1); - - if (Allow) - { - Status = AcpiOsSignalSemaphore (Info->MainThreadGate, 1); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ( - "Could not signal debugger thread sync semaphore, %s\n", - AcpiFormatException (Status)); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSingleExecutionThread - * - * PARAMETERS: Context - Method info struct - * - * RETURN: None - * - * DESCRIPTION: Create one thread and execute a method - * - ******************************************************************************/ - -static void ACPI_SYSTEM_XFACE -AcpiDbSingleExecutionThread ( - void *Context) -{ - ACPI_DB_METHOD_INFO *Info = Context; - ACPI_STATUS Status; - ACPI_BUFFER ReturnObj; - - - AcpiOsPrintf ("\n"); - - Status = AcpiDbExecuteMethod (Info, &ReturnObj); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s During evaluation of %s\n", - AcpiFormatException (Status), Info->Pathname); - return; - } - - /* Display a return object, if any */ - - if (ReturnObj.Length) - { - AcpiOsPrintf ("Evaluation of %s returned object %p, " - "external buffer length %X\n", - AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, - (UINT32) ReturnObj.Length); - - AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); - } - - AcpiOsPrintf ("\nBackground thread completed\n%c ", - ACPI_DEBUGGER_COMMAND_PROMPT); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCreateExecutionThread - * - * PARAMETERS: MethodNameArg - Control method to execute - * Arguments - Array of arguments to the method - * Types - Corresponding array of object types - * - * RETURN: None - * - * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles - * arguments passed on command line for control methods. - * - ******************************************************************************/ - -void -AcpiDbCreateExecutionThread ( - char *MethodNameArg, - char **Arguments, - ACPI_OBJECT_TYPE *Types) -{ - ACPI_STATUS Status; - UINT32 i; - - - memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); - AcpiGbl_DbMethodInfo.Name = MethodNameArg; - AcpiGbl_DbMethodInfo.InitArgs = 1; - AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments; - AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes; - - /* Setup method arguments, up to 7 (0-6) */ - - for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *Arguments; i++) - { - AcpiGbl_DbMethodInfo.Arguments[i] = *Arguments; - Arguments++; - - AcpiGbl_DbMethodInfo.ArgTypes[i] = *Types; - Types++; - } - - Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Get the NS node, determines existence also */ - - Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, - &AcpiGbl_DbMethodInfo.Method); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s Could not get handle for %s\n", - AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname); - return; - } - - Status = AcpiOsExecute (OSL_DEBUGGER_EXEC_THREAD, - AcpiDbSingleExecutionThread, &AcpiGbl_DbMethodInfo); - if (ACPI_FAILURE (Status)) - { - return; - } - - AcpiOsPrintf ("\nBackground thread started\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCreateExecutionThreads - * - * PARAMETERS: NumThreadsArg - Number of threads to create - * NumLoopsArg - Loop count for the thread(s) - * MethodNameArg - Control method to execute - * - * RETURN: None - * - * DESCRIPTION: Create threads to execute method(s) - * - ******************************************************************************/ - -void -AcpiDbCreateExecutionThreads ( - char *NumThreadsArg, - char *NumLoopsArg, - char *MethodNameArg) -{ - ACPI_STATUS Status; - UINT32 NumThreads; - UINT32 NumLoops; - UINT32 i; - UINT32 Size; - ACPI_MUTEX MainThreadGate; - ACPI_MUTEX ThreadCompleteGate; - ACPI_MUTEX InfoGate; - - - /* Get the arguments */ - - NumThreads = strtoul (NumThreadsArg, NULL, 0); - NumLoops = strtoul (NumLoopsArg, NULL, 0); - - if (!NumThreads || !NumLoops) - { - AcpiOsPrintf ("Bad argument: Threads %X, Loops %X\n", - NumThreads, NumLoops); - return; - } - - /* - * Create the semaphore for synchronization of - * the created threads with the main thread. - */ - Status = AcpiOsCreateSemaphore (1, 0, &MainThreadGate); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not create semaphore for " - "synchronization with the main thread, %s\n", - AcpiFormatException (Status)); - return; - } - - /* - * Create the semaphore for synchronization - * between the created threads. - */ - Status = AcpiOsCreateSemaphore (1, 1, &ThreadCompleteGate); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not create semaphore for " - "synchronization between the created threads, %s\n", - AcpiFormatException (Status)); - - (void) AcpiOsDeleteSemaphore (MainThreadGate); - return; - } - - Status = AcpiOsCreateSemaphore (1, 1, &InfoGate); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not create semaphore for " - "synchronization of AcpiGbl_DbMethodInfo, %s\n", - AcpiFormatException (Status)); - - (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); - (void) AcpiOsDeleteSemaphore (MainThreadGate); - return; - } - - memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); - - /* Array to store IDs of threads */ - - AcpiGbl_DbMethodInfo.NumThreads = NumThreads; - Size = sizeof (ACPI_THREAD_ID) * AcpiGbl_DbMethodInfo.NumThreads; - - AcpiGbl_DbMethodInfo.Threads = AcpiOsAllocate (Size); - if (AcpiGbl_DbMethodInfo.Threads == NULL) - { - AcpiOsPrintf ("No memory for thread IDs array\n"); - (void) AcpiOsDeleteSemaphore (MainThreadGate); - (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); - (void) AcpiOsDeleteSemaphore (InfoGate); - return; - } - memset (AcpiGbl_DbMethodInfo.Threads, 0, Size); - - /* Setup the context to be passed to each thread */ - - AcpiGbl_DbMethodInfo.Name = MethodNameArg; - AcpiGbl_DbMethodInfo.Flags = 0; - AcpiGbl_DbMethodInfo.NumLoops = NumLoops; - AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate; - AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate; - AcpiGbl_DbMethodInfo.InfoGate = InfoGate; - - /* Init arguments to be passed to method */ - - AcpiGbl_DbMethodInfo.InitArgs = 1; - AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments; - AcpiGbl_DbMethodInfo.Arguments[0] = AcpiGbl_DbMethodInfo.NumThreadsStr; - AcpiGbl_DbMethodInfo.Arguments[1] = AcpiGbl_DbMethodInfo.IdOfThreadStr; - AcpiGbl_DbMethodInfo.Arguments[2] = AcpiGbl_DbMethodInfo.IndexOfThreadStr; - AcpiGbl_DbMethodInfo.Arguments[3] = NULL; - - AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes; - AcpiGbl_DbMethodInfo.ArgTypes[0] = ACPI_TYPE_INTEGER; - AcpiGbl_DbMethodInfo.ArgTypes[1] = ACPI_TYPE_INTEGER; - AcpiGbl_DbMethodInfo.ArgTypes[2] = ACPI_TYPE_INTEGER; - - AcpiDbUint32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); - - Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); - if (ACPI_FAILURE (Status)) - { - goto CleanupAndExit; - } - - /* Get the NS node, determines existence also */ - - Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, - &AcpiGbl_DbMethodInfo.Method); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s Could not get handle for %s\n", - AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname); - goto CleanupAndExit; - } - - /* Create the threads */ - - AcpiOsPrintf ("Creating %X threads to execute %X times each\n", - NumThreads, NumLoops); - - for (i = 0; i < (NumThreads); i++) - { - Status = AcpiOsExecute (OSL_DEBUGGER_EXEC_THREAD, AcpiDbMethodThread, - &AcpiGbl_DbMethodInfo); - if (ACPI_FAILURE (Status)) - { - break; - } - } - - /* Wait for all threads to complete */ - - (void) AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER); - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads); - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - -CleanupAndExit: - - /* Cleanup and exit */ - - (void) AcpiOsDeleteSemaphore (MainThreadGate); - (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); - (void) AcpiOsDeleteSemaphore (InfoGate); - - AcpiOsFree (AcpiGbl_DbMethodInfo.Threads); - AcpiGbl_DbMethodInfo.Threads = NULL; -} diff --git a/Private/acpiSDK/source/components/debugger/dbfileio.c b/Private/acpiSDK/source/components/debugger/dbfileio.c deleted file mode 100644 index 8fc11da8..00000000 --- a/Private/acpiSDK/source/components/debugger/dbfileio.c +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbfileio - Debugger file I/O commands. These can't usually - * be used when running the debugger in Ring 0 (Kernel mode) - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" -#include "actables.h" - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbfileio") - - -#ifdef ACPI_APPLICATION -#include "acapps.h" - - -#ifdef ACPI_DEBUGGER -/******************************************************************************* - * - * FUNCTION: AcpiDbCloseDebugFile - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: If open, close the current debug output file - * - ******************************************************************************/ - -void -AcpiDbCloseDebugFile ( - void) -{ - - if (AcpiGbl_DebugFile) - { - fclose (AcpiGbl_DebugFile); - AcpiGbl_DebugFile = NULL; - AcpiGbl_DbOutputToFile = FALSE; - AcpiOsPrintf ("Debug output file %s closed\n", - AcpiGbl_DbDebugFilename); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbOpenDebugFile - * - * PARAMETERS: Name - Filename to open - * - * RETURN: None - * - * DESCRIPTION: Open a file where debug output will be directed. - * - ******************************************************************************/ - -void -AcpiDbOpenDebugFile ( - char *Name) -{ - - AcpiDbCloseDebugFile (); - AcpiGbl_DebugFile = fopen (Name, "w+"); - if (!AcpiGbl_DebugFile) - { - AcpiOsPrintf ("Could not open debug file %s\n", Name); - return; - } - - AcpiOsPrintf ("Debug output file %s opened\n", Name); - AcpiUtSafeStrncpy (AcpiGbl_DbDebugFilename, Name, - sizeof (AcpiGbl_DbDebugFilename)); - AcpiGbl_DbOutputToFile = TRUE; -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbLoadTables - * - * PARAMETERS: ListHead - List of ACPI tables to load - * - * RETURN: Status - * - * DESCRIPTION: Load ACPI tables from a previously constructed table list. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbLoadTables ( - ACPI_NEW_TABLE_DESC *ListHead) -{ - ACPI_STATUS Status; - ACPI_NEW_TABLE_DESC *TableListHead; - ACPI_TABLE_HEADER *Table; - - - /* Load all ACPI tables in the list */ - - TableListHead = ListHead; - while (TableListHead) - { - Table = TableListHead->Table; - - Status = AcpiLoadTable (Table, NULL); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - AcpiOsPrintf ("Table %4.4s is already installed\n", - Table->Signature); - } - else - { - AcpiOsPrintf ("Could not install table, %s\n", - AcpiFormatException (Status)); - } - - return (Status); - } - - AcpiOsPrintf ("Acpi table [%4.4s] successfully installed and loaded\n", - Table->Signature); - - TableListHead = TableListHead->Next; - } - - return (AE_OK); -} -#endif diff --git a/Private/acpiSDK/source/components/debugger/dbhistry.c b/Private/acpiSDK/source/components/debugger/dbhistry.c deleted file mode 100644 index ecdfaeba..00000000 --- a/Private/acpiSDK/source/components/debugger/dbhistry.c +++ /dev/null @@ -1,378 +0,0 @@ -/****************************************************************************** - * - * Module Name: dbhistry - debugger HISTORY command - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbhistry") - - -#define HI_NO_HISTORY 0 -#define HI_RECORD_HISTORY 1 -#define HISTORY_SIZE 40 - - -typedef struct HistoryInfo -{ - char *Command; - UINT32 CmdNum; - -} HISTORY_INFO; - - -static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE]; -static UINT16 AcpiGbl_LoHistory = 0; -static UINT16 AcpiGbl_NumHistory = 0; -static UINT16 AcpiGbl_NextHistoryIndex = 0; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbAddToHistory - * - * PARAMETERS: CommandLine - Command to add - * - * RETURN: None - * - * DESCRIPTION: Add a command line to the history buffer. - * - ******************************************************************************/ - -void -AcpiDbAddToHistory ( - char *CommandLine) -{ - UINT16 CmdLen; - UINT16 BufferLen; - - /* Put command into the next available slot */ - - CmdLen = (UINT16) strlen (CommandLine); - if (!CmdLen) - { - return; - } - - if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL) - { - BufferLen = (UINT16) strlen ( - AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command); - - if (CmdLen > BufferLen) - { - AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex]. - Command); - AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command = - AcpiOsAllocate (CmdLen + 1); - } - } - else - { - AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command = - AcpiOsAllocate (CmdLen + 1); - } - - strcpy (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, - CommandLine); - - AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = - AcpiGbl_NextCmdNum; - - /* Adjust indexes */ - - if ((AcpiGbl_NumHistory == HISTORY_SIZE) && - (AcpiGbl_NextHistoryIndex == AcpiGbl_LoHistory)) - { - AcpiGbl_LoHistory++; - if (AcpiGbl_LoHistory >= HISTORY_SIZE) - { - AcpiGbl_LoHistory = 0; - } - } - - AcpiGbl_NextHistoryIndex++; - if (AcpiGbl_NextHistoryIndex >= HISTORY_SIZE) - { - AcpiGbl_NextHistoryIndex = 0; - } - - AcpiGbl_NextCmdNum++; - if (AcpiGbl_NumHistory < HISTORY_SIZE) - { - AcpiGbl_NumHistory++; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayHistory - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display the contents of the history buffer - * - ******************************************************************************/ - -void -AcpiDbDisplayHistory ( - void) -{ - UINT32 i; - UINT16 HistoryIndex; - - - HistoryIndex = AcpiGbl_LoHistory; - - /* Dump entire history buffer */ - - for (i = 0; i < AcpiGbl_NumHistory; i++) - { - if (AcpiGbl_HistoryBuffer[HistoryIndex].Command) - { - AcpiOsPrintf ("%3u %s\n", - AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum, - AcpiGbl_HistoryBuffer[HistoryIndex].Command); - } - - HistoryIndex++; - if (HistoryIndex >= HISTORY_SIZE) - { - HistoryIndex = 0; - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetFromHistory - * - * PARAMETERS: CommandNumArg - String containing the number of the - * command to be retrieved - * - * RETURN: Pointer to the retrieved command. Null on error. - * - * DESCRIPTION: Get a command from the history buffer - * - ******************************************************************************/ - -char * -AcpiDbGetFromHistory ( - char *CommandNumArg) -{ - UINT32 CmdNum; - - - if (CommandNumArg == NULL) - { - CmdNum = AcpiGbl_NextCmdNum - 1; - } - - else - { - CmdNum = strtoul (CommandNumArg, NULL, 0); - } - - return (AcpiDbGetHistoryByIndex (CmdNum)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetHistoryByIndex - * - * PARAMETERS: CmdNum - Index of the desired history entry. - * Values are 0...(AcpiGbl_NextCmdNum - 1) - * - * RETURN: Pointer to the retrieved command. Null on error. - * - * DESCRIPTION: Get a command from the history buffer - * - ******************************************************************************/ - -char * -AcpiDbGetHistoryByIndex ( - UINT32 CmdNum) -{ - UINT32 i; - UINT16 HistoryIndex; - - - /* Search history buffer */ - - HistoryIndex = AcpiGbl_LoHistory; - for (i = 0; i < AcpiGbl_NumHistory; i++) - { - if (AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum == CmdNum) - { - /* Found the command, return it */ - - return (AcpiGbl_HistoryBuffer[HistoryIndex].Command); - } - - /* History buffer is circular */ - - HistoryIndex++; - if (HistoryIndex >= HISTORY_SIZE) - { - HistoryIndex = 0; - } - } - - AcpiOsPrintf ("Invalid history number: %u\n", HistoryIndex); - return (NULL); -} diff --git a/Private/acpiSDK/source/components/debugger/dbinput.c b/Private/acpiSDK/source/components/debugger/dbinput.c deleted file mode 100644 index d98c2487..00000000 --- a/Private/acpiSDK/source/components/debugger/dbinput.c +++ /dev/null @@ -1,1479 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbinput - user front-end to the AML debugger - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" - -#ifdef ACPI_APPLICATION -#include "acapps.h" -#endif - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbinput") - - -/* Local prototypes */ - -static UINT32 -AcpiDbGetLine ( - char *InputBuffer); - -static UINT32 -AcpiDbMatchCommand ( - char *UserCommand); - -static void -AcpiDbDisplayCommandInfo ( - const char *Command, - BOOLEAN DisplayAll); - -static void -AcpiDbDisplayHelp ( - char *Command); - -static BOOLEAN -AcpiDbMatchCommandHelp ( - const char *Command, - const ACPI_DB_COMMAND_HELP *Help); - - -/* - * Top-level debugger commands. - * - * This list of commands must match the string table below it - */ -enum AcpiExDebuggerCommands -{ - CMD_NOT_FOUND = 0, - CMD_NULL, - CMD_ALL, - CMD_ALLOCATIONS, - CMD_ARGS, - CMD_ARGUMENTS, - CMD_BREAKPOINT, - CMD_BUSINFO, - CMD_CALL, - CMD_DEBUG, - CMD_DISASSEMBLE, - CMD_DISASM, - CMD_DUMP, - CMD_EVALUATE, - CMD_EXECUTE, - CMD_EXIT, - CMD_FIELDS, - CMD_FIND, - CMD_GO, - CMD_HANDLERS, - CMD_HELP, - CMD_HELP2, - CMD_HISTORY, - CMD_HISTORY_EXE, - CMD_HISTORY_LAST, - CMD_INFORMATION, - CMD_INTEGRITY, - CMD_INTO, - CMD_LEVEL, - CMD_LIST, - CMD_LOCALS, - CMD_LOCKS, - CMD_METHODS, - CMD_NAMESPACE, - CMD_NOTIFY, - CMD_OBJECTS, - CMD_OSI, - CMD_OWNER, - CMD_PATHS, - CMD_PREDEFINED, - CMD_PREFIX, - CMD_QUIT, - CMD_REFERENCES, - CMD_RESOURCES, - CMD_RESULTS, - CMD_SET, - CMD_STATS, - CMD_STOP, - CMD_TABLES, - CMD_TEMPLATE, - CMD_TRACE, - CMD_TREE, - CMD_TYPE, -#ifdef ACPI_APPLICATION - CMD_ENABLEACPI, - CMD_EVENT, - CMD_GPE, - CMD_GPES, - CMD_SCI, - CMD_SLEEP, - - CMD_CLOSE, - CMD_LOAD, - CMD_OPEN, - CMD_UNLOAD, - - CMD_TERMINATE, - CMD_BACKGROUND, - CMD_THREADS, - - CMD_TEST, - CMD_INTERRUPT, -#endif -}; - -#define CMD_FIRST_VALID 2 - - -/* Second parameter is the required argument count */ - -static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = -{ - {"<NOT FOUND>", 0}, - {"<NULL>", 0}, - {"ALL", 1}, - {"ALLOCATIONS", 0}, - {"ARGS", 0}, - {"ARGUMENTS", 0}, - {"BREAKPOINT", 1}, - {"BUSINFO", 0}, - {"CALL", 0}, - {"DEBUG", 1}, - {"DISASSEMBLE", 1}, - {"DISASM", 1}, - {"DUMP", 1}, - {"EVALUATE", 1}, - {"EXECUTE", 1}, - {"EXIT", 0}, - {"FIELDS", 1}, - {"FIND", 1}, - {"GO", 0}, - {"HANDLERS", 0}, - {"HELP", 0}, - {"?", 0}, - {"HISTORY", 0}, - {"!", 1}, - {"!!", 0}, - {"INFORMATION", 0}, - {"INTEGRITY", 0}, - {"INTO", 0}, - {"LEVEL", 0}, - {"LIST", 0}, - {"LOCALS", 0}, - {"LOCKS", 0}, - {"METHODS", 0}, - {"NAMESPACE", 0}, - {"NOTIFY", 2}, - {"OBJECTS", 0}, - {"OSI", 0}, - {"OWNER", 1}, - {"PATHS", 0}, - {"PREDEFINED", 0}, - {"PREFIX", 0}, - {"QUIT", 0}, - {"REFERENCES", 1}, - {"RESOURCES", 0}, - {"RESULTS", 0}, - {"SET", 3}, - {"STATS", 1}, - {"STOP", 0}, - {"TABLES", 0}, - {"TEMPLATE", 1}, - {"TRACE", 1}, - {"TREE", 0}, - {"TYPE", 1}, -#ifdef ACPI_APPLICATION - {"ENABLEACPI", 0}, - {"EVENT", 1}, - {"GPE", 1}, - {"GPES", 0}, - {"SCI", 0}, - {"SLEEP", 0}, - - {"CLOSE", 0}, - {"LOAD", 1}, - {"OPEN", 1}, - {"UNLOAD", 1}, - - {"TERMINATE", 0}, - {"BACKGROUND", 1}, - {"THREADS", 3}, - - {"TEST", 1}, - {"INTERRUPT", 1}, -#endif - {NULL, 0} -}; - -/* - * Help for all debugger commands. First argument is the number of lines - * of help to output for the command. - * - * Note: Some commands are not supported by the kernel-level version of - * the debugger. - */ -static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = -{ - {0, "\nNamespace Access:", "\n"}, - {1, " Businfo", "Display system bus info\n"}, - {1, " Disassemble <Method>", "Disassemble a control method\n"}, - {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, - {1, " Integrity", "Validate namespace integrity\n"}, - {1, " Methods", "Display list of loaded control methods\n"}, - {1, " Fields <AddressSpaceId>", "Display list of loaded field units by space ID\n"}, - {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, - {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, - {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, - {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, - {1, " Paths", "Display full pathnames of namespace objects\n"}, - {1, " Predefined", "Check all predefined names\n"}, - {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"}, - {1, " References <Addr>", "Find all references to object at addr\n"}, - {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, - {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, - {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"}, - {1, " Type <Object>", "Display object type\n"}, - - {0, "\nControl Method Execution:", "\n"}, - {1, " All <NameSeg>", "Evaluate all objects named NameSeg\n"}, - {1, " Evaluate <Namepath> [Arguments]", "Evaluate object or control method\n"}, - {1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"}, -#ifdef ACPI_APPLICATION - {1, " Background <Namepath> [Arguments]", "Evaluate object/method in a separate thread\n"}, - {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"}, -#endif - {1, " Debug <Namepath> [Arguments]", "Single-Step a control method\n"}, - {7, " [Arguments] formats:", "Control method argument formats\n"}, - {1, " Hex Integer", "Integer\n"}, - {1, " \"Ascii String\"", "String\n"}, - {1, " (Hex Byte List)", "Buffer\n"}, - {1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"}, - {1, " [Package Element List]", "Package\n"}, - {1, " [0x01 0x1234 \"string\"]", "Package example (3 elements)\n"}, - - {0, "\nMiscellaneous:", "\n"}, - {1, " Allocations", "Display list of current memory allocations\n"}, - {2, " Dump <Address>|<Namepath>", "\n"}, - {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"}, - {1, " Handlers", "Info about global handlers\n"}, - {1, " Help [Command]", "This help screen or individual command\n"}, - {1, " History", "Display command history buffer\n"}, - {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"}, - {1, " Locks", "Current status of internal mutexes\n"}, - {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"}, - {1, " Quit or Exit", "Exit this command\n"}, - {8, " Stats <SubCommand>", "Display namespace and memory statistics\n"}, - {1, " Allocations", "Display list of current memory allocations\n"}, - {1, " Memory", "Dump internal memory lists\n"}, - {1, " Misc", "Namespace search and mutex stats\n"}, - {1, " Objects", "Summary of namespace objects\n"}, - {1, " Sizes", "Sizes for each of the internal objects\n"}, - {1, " Stack", "Display CPU stack usage\n"}, - {1, " Tables", "Info about current ACPI table(s)\n"}, - {1, " Tables", "Display info about loaded ACPI tables\n"}, -#ifdef ACPI_APPLICATION - {1, " Terminate", "Delete namespace and all internal objects\n"}, -#endif - {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, - {1, " !!", "Execute last command again\n"}, - - {0, "\nMethod and Namespace Debugging:", "\n"}, - {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"}, - {1, " Enable", "Enable all messages\n"}, - {1, " Disable", "Disable tracing\n"}, - {1, " Method", "Enable method execution messages\n"}, - {1, " Opcode", "Enable opcode execution messages\n"}, - {3, " Test <TestName>", "Invoke a debug test\n"}, - {1, " Objects", "Read/write/compare all namespace data objects\n"}, - {1, " Predefined", "Validate all ACPI predefined names (_STA, etc.)\n"}, - {1, " Execute predefined", "Execute all predefined (public) methods\n"}, - - {0, "\nControl Method Single-Step Execution:","\n"}, - {1, " Arguments (or Args)", "Display method arguments\n"}, - {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, - {1, " Call", "Run to next control method invocation\n"}, - {1, " Go", "Allow method to run to completion\n"}, - {1, " Information", "Display info about the current method\n"}, - {1, " Into", "Step into (not over) a method call\n"}, - {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"}, - {1, " Locals", "Display method local variables\n"}, - {1, " Results", "Display method result stack\n"}, - {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, - {1, " Stop", "Terminate control method\n"}, - {1, " Tree", "Display control method calling tree\n"}, - {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, - -#ifdef ACPI_APPLICATION - {0, "\nFile Operations:", "\n"}, - {1, " Close", "Close debug output file\n"}, - {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, - {1, " Open <Output Filename>", "Open a file for debug output\n"}, - {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"}, - - {0, "\nHardware Simulation:", "\n"}, - {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, - {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, - {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"}, - {1, " Gpes", "Display info on all GPE devices\n"}, - {1, " Sci", "Generate an SCI\n"}, - {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, - {1, " Interrupt <GSIV>", "Simulate an interrupt\n"}, -#endif - {0, NULL, NULL} -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbMatchCommandHelp - * - * PARAMETERS: Command - Command string to match - * Help - Help table entry to attempt match - * - * RETURN: TRUE if command matched, FALSE otherwise - * - * DESCRIPTION: Attempt to match a command in the help table in order to - * print help information for a single command. - * - ******************************************************************************/ - -static BOOLEAN -AcpiDbMatchCommandHelp ( - const char *Command, - const ACPI_DB_COMMAND_HELP *Help) -{ - char *Invocation = Help->Invocation; - UINT32 LineCount; - - - /* Valid commands in the help table begin with a couple of spaces */ - - if (*Invocation != ' ') - { - return (FALSE); - } - - while (*Invocation == ' ') - { - Invocation++; - } - - /* Match command name (full command or substring) */ - - while ((*Command) && (*Invocation) && (*Invocation != ' ')) - { - if (tolower ((int) *Command) != tolower ((int) *Invocation)) - { - return (FALSE); - } - - Invocation++; - Command++; - } - - /* Print the appropriate number of help lines */ - - LineCount = Help->LineCount; - while (LineCount) - { - AcpiOsPrintf ("%-38s : %s", Help->Invocation, Help->Description); - Help++; - LineCount--; - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayCommandInfo - * - * PARAMETERS: Command - Command string to match - * DisplayAll - Display all matching commands, or just - * the first one (substring match) - * - * RETURN: None - * - * DESCRIPTION: Display help information for a Debugger command. - * - ******************************************************************************/ - -static void -AcpiDbDisplayCommandInfo ( - const char *Command, - BOOLEAN DisplayAll) -{ - const ACPI_DB_COMMAND_HELP *Next; - BOOLEAN Matched; - - - Next = AcpiGbl_DbCommandHelp; - while (Next->Invocation) - { - Matched = AcpiDbMatchCommandHelp (Command, Next); - if (!DisplayAll && Matched) - { - return; - } - - Next++; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayHelp - * - * PARAMETERS: Command - Optional command string to display help. - * if not specified, all debugger command - * help strings are displayed - * - * RETURN: None - * - * DESCRIPTION: Display help for a single debugger command, or all of them. - * - ******************************************************************************/ - -static void -AcpiDbDisplayHelp ( - char *Command) -{ - const ACPI_DB_COMMAND_HELP *Next = AcpiGbl_DbCommandHelp; - - - if (!Command) - { - /* No argument to help, display help for all commands */ - - AcpiOsPrintf ("\nSummary of AML Debugger Commands\n\n"); - - while (Next->Invocation) - { - AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description); - Next++; - } - AcpiOsPrintf ("\n"); - - } - else - { - /* Display help for all commands that match the substring */ - - AcpiDbDisplayCommandInfo (Command, TRUE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetNextToken - * - * PARAMETERS: String - Command buffer - * Next - Return value, end of next token - * - * RETURN: Pointer to the start of the next token. - * - * DESCRIPTION: Command line parsing. Get the next token on the command line - * - ******************************************************************************/ - -char * -AcpiDbGetNextToken ( - char *String, - char **Next, - ACPI_OBJECT_TYPE *ReturnType) -{ - char *Start; - UINT32 Depth; - ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER; - - - /* At end of buffer? */ - - if (!String || !(*String)) - { - return (NULL); - } - - /* Remove any spaces at the beginning, ignore blank lines */ - - while (*String && isspace ((int) *String)) - { - String++; - } - - if (!(*String)) - { - return (NULL); - } - - switch (*String) - { - case '"': - - /* This is a quoted string, scan until closing quote */ - - String++; - Start = String; - Type = ACPI_TYPE_STRING; - - /* Find end of string */ - - while (*String && (*String != '"')) - { - String++; - } - break; - - case '(': - - /* This is the start of a buffer, scan until closing paren */ - - String++; - Start = String; - Type = ACPI_TYPE_BUFFER; - - /* Find end of buffer */ - - while (*String && (*String != ')')) - { - String++; - } - break; - - case '{': - - /* This is the start of a field unit, scan until closing brace */ - - String++; - Start = String; - Type = ACPI_TYPE_FIELD_UNIT; - - /* Find end of buffer */ - - while (*String && (*String != '}')) - { - String++; - } - break; - - case '[': - - /* This is the start of a package, scan until closing bracket */ - - String++; - Depth = 1; - Start = String; - Type = ACPI_TYPE_PACKAGE; - - /* Find end of package (closing bracket) */ - - while (*String) - { - /* Handle String package elements */ - - if (*String == '"') - { - /* Find end of string */ - - String++; - while (*String && (*String != '"')) - { - String++; - } - if (!(*String)) - { - break; - } - } - else if (*String == '[') - { - Depth++; /* A nested package declaration */ - } - else if (*String == ']') - { - Depth--; - if (Depth == 0) /* Found final package closing bracket */ - { - break; - } - } - - String++; - } - break; - - default: - - Start = String; - - /* Find end of token */ - - while (*String && !isspace ((int) *String)) - { - String++; - } - break; - } - - if (!(*String)) - { - *Next = NULL; - } - else - { - *String = 0; - *Next = String + 1; - } - - *ReturnType = Type; - return (Start); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetLine - * - * PARAMETERS: InputBuffer - Command line buffer - * - * RETURN: Count of arguments to the command - * - * DESCRIPTION: Get the next command line from the user. Gets entire line - * up to the next newline - * - ******************************************************************************/ - -static UINT32 -AcpiDbGetLine ( - char *InputBuffer) -{ - UINT32 i; - UINT32 Count; - char *Next; - char *This; - - - if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf), - InputBuffer)) - { - AcpiOsPrintf ( - "Buffer overflow while parsing input line (max %u characters)\n", - (UINT32) sizeof (AcpiGbl_DbParsedBuf)); - return (0); - } - - This = AcpiGbl_DbParsedBuf; - for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) - { - AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next, - &AcpiGbl_DbArgTypes[i]); - if (!AcpiGbl_DbArgs[i]) - { - break; - } - - This = Next; - } - - /* Uppercase the actual command */ - - AcpiUtStrupr (AcpiGbl_DbArgs[0]); - - Count = i; - if (Count) - { - Count--; /* Number of args only */ - } - - return (Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbMatchCommand - * - * PARAMETERS: UserCommand - User command line - * - * RETURN: Index into command array, -1 if not found - * - * DESCRIPTION: Search command array for a command match - * - ******************************************************************************/ - -static UINT32 -AcpiDbMatchCommand ( - char *UserCommand) -{ - UINT32 i; - - - if (!UserCommand || UserCommand[0] == 0) - { - return (CMD_NULL); - } - - for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) - { - if (strstr ( - ACPI_CAST_PTR (char, AcpiGbl_DbCommands[i].Name), UserCommand) == - AcpiGbl_DbCommands[i].Name) - { - return (i); - } - } - - /* Command not recognized */ - - return (CMD_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCommandDispatch - * - * PARAMETERS: InputBuffer - Command line buffer - * WalkState - Current walk - * Op - Current (executing) parse op - * - * RETURN: Status - * - * DESCRIPTION: Command dispatcher. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbCommandDispatch ( - char *InputBuffer, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - UINT32 Temp; - UINT64 Temp64; - UINT32 CommandIndex; - UINT32 ParamCount; - char *CommandLine; - ACPI_STATUS Status = AE_CTRL_TRUE; - - - /* If AcpiTerminate has been called, terminate this thread */ - - if (AcpiGbl_DbTerminateLoop) - { - return (AE_CTRL_TERMINATE); - } - - /* Find command and add to the history buffer */ - - ParamCount = AcpiDbGetLine (InputBuffer); - CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); - - /* - * We don't want to add the !! command to the history buffer. It - * would cause an infinite loop because it would always be the - * previous command. - */ - if (CommandIndex != CMD_HISTORY_LAST) - { - AcpiDbAddToHistory (InputBuffer); - } - - /* Verify that we have the minimum number of params */ - - if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) - { - AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n", - ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, - AcpiGbl_DbCommands[CommandIndex].MinArgs); - - AcpiDbDisplayCommandInfo ( - AcpiGbl_DbCommands[CommandIndex].Name, FALSE); - return (AE_CTRL_TRUE); - } - - /* Decode and dispatch the command */ - - switch (CommandIndex) - { - case CMD_NULL: - - if (Op) - { - return (AE_OK); - } - break; - - case CMD_ALL: - - AcpiOsPrintf ("Executing all objects with NameSeg: %s\n", AcpiGbl_DbArgs[1]); - AcpiDbExecute (AcpiGbl_DbArgs[1], - &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP | EX_ALL); - break; - - case CMD_ALLOCATIONS: - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiUtDumpAllocations ((UINT32) -1, NULL); -#endif - break; - - case CMD_ARGS: - case CMD_ARGUMENTS: - - AcpiDbDisplayArguments (); - break; - - case CMD_BREAKPOINT: - - AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); - break; - - case CMD_BUSINFO: - - AcpiDbGetBusInfo (); - break; - - case CMD_CALL: - - AcpiDbSetMethodCallBreakpoint (Op); - Status = AE_OK; - break; - - case CMD_DEBUG: - - AcpiDbExecute (AcpiGbl_DbArgs[1], - &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP); - break; - - case CMD_DISASSEMBLE: - case CMD_DISASM: - -#ifdef ACPI_DISASSEMBLER - (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); -#else - AcpiOsPrintf ("The AML Disassembler is not configured/present\n"); -#endif - break; - - case CMD_DUMP: - - AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_EVALUATE: - case CMD_EXECUTE: - - AcpiDbExecute (AcpiGbl_DbArgs[1], - &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP); - break; - - case CMD_FIND: - - Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); - break; - - case CMD_FIELDS: - - Status = AcpiUtStrtoul64 (AcpiGbl_DbArgs[1], &Temp64); - - if (ACPI_FAILURE (Status) || Temp64 >= ACPI_NUM_PREDEFINED_REGIONS) - { - AcpiOsPrintf ( - "Invalid address space ID: must be between 0 and %u inclusive\n", - ACPI_NUM_PREDEFINED_REGIONS - 1); - return (AE_OK); - } - - Status = AcpiDbDisplayFields ((UINT32) Temp64); - break; - - case CMD_GO: - - AcpiGbl_CmSingleStep = FALSE; - return (AE_OK); - - case CMD_HANDLERS: - - AcpiDbDisplayHandlers (); - break; - - case CMD_HELP: - case CMD_HELP2: - - AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); - break; - - case CMD_HISTORY: - - AcpiDbDisplayHistory (); - break; - - case CMD_HISTORY_EXE: /* ! command */ - - CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]); - if (!CommandLine) - { - return (AE_CTRL_TRUE); - } - - Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); - return (Status); - - case CMD_HISTORY_LAST: /* !! command */ - - CommandLine = AcpiDbGetFromHistory (NULL); - if (!CommandLine) - { - return (AE_CTRL_TRUE); - } - - Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); - return (Status); - - case CMD_INFORMATION: - - AcpiDbDisplayMethodInfo (Op); - break; - - case CMD_INTEGRITY: - - AcpiDbCheckIntegrity (); - break; - - case CMD_INTO: - - if (Op) - { - AcpiGbl_CmSingleStep = TRUE; - return (AE_OK); - } - break; - - case CMD_LEVEL: - - if (ParamCount == 0) - { - AcpiOsPrintf ( - "Current debug level for file output is: %8.8X\n", - AcpiGbl_DbDebugLevel); - AcpiOsPrintf ( - "Current debug level for console output is: %8.8X\n", - AcpiGbl_DbConsoleDebugLevel); - } - else if (ParamCount == 2) - { - Temp = AcpiGbl_DbConsoleDebugLevel; - AcpiGbl_DbConsoleDebugLevel = - strtoul (AcpiGbl_DbArgs[1], NULL, 16); - AcpiOsPrintf ( - "Debug Level for console output was %8.8X, now %8.8X\n", - Temp, AcpiGbl_DbConsoleDebugLevel); - } - else - { - Temp = AcpiGbl_DbDebugLevel; - AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); - AcpiOsPrintf ( - "Debug Level for file output was %8.8X, now %8.8X\n", - Temp, AcpiGbl_DbDebugLevel); - } - break; - - case CMD_LIST: - -#ifdef ACPI_DISASSEMBLER - AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); -#else - AcpiOsPrintf ("The AML Disassembler is not configured/present\n"); -#endif - break; - - case CMD_LOCKS: - - AcpiDbDisplayLocks (); - break; - - case CMD_LOCALS: - - AcpiDbDisplayLocals (); - break; - - case CMD_METHODS: - - Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); - break; - - case CMD_NAMESPACE: - - AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_NOTIFY: - - Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0); - AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); - break; - - case CMD_OBJECTS: - - AcpiUtStrupr (AcpiGbl_DbArgs[1]); - Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_OSI: - - AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_OWNER: - - AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_PATHS: - - AcpiDbDumpNamespacePaths (); - break; - - case CMD_PREFIX: - - AcpiDbSetScope (AcpiGbl_DbArgs[1]); - break; - - case CMD_REFERENCES: - - AcpiDbFindReferences (AcpiGbl_DbArgs[1]); - break; - - case CMD_RESOURCES: - - AcpiDbDisplayResources (AcpiGbl_DbArgs[1]); - break; - - case CMD_RESULTS: - - AcpiDbDisplayResults (); - break; - - case CMD_SET: - - AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], - AcpiGbl_DbArgs[3]); - break; - - case CMD_STATS: - - Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); - break; - - case CMD_STOP: - - return (AE_NOT_IMPLEMENTED); - - case CMD_TABLES: - - AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); - break; - - case CMD_TEMPLATE: - - AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]); - break; - - case CMD_TRACE: - - AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); - break; - - case CMD_TREE: - - AcpiDbDisplayCallingTree (); - break; - - case CMD_TYPE: - - AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); - break; - -#ifdef ACPI_APPLICATION - - /* Hardware simulation commands. */ - - case CMD_ENABLEACPI: -#if (!ACPI_REDUCED_HARDWARE) - - Status = AcpiEnable(); - if (ACPI_FAILURE(Status)) - { - AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); - return (Status); - } -#endif /* !ACPI_REDUCED_HARDWARE */ - break; - - case CMD_EVENT: - - AcpiOsPrintf ("Event command not implemented\n"); - break; - - case CMD_INTERRUPT: - - AcpiDbGenerateInterrupt (AcpiGbl_DbArgs[1]); - break; - - case CMD_GPE: - - AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_GPES: - - AcpiDbDisplayGpes (); - break; - - case CMD_SCI: - - AcpiDbGenerateSci (); - break; - - case CMD_SLEEP: - - Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); - break; - - /* File I/O commands. */ - - case CMD_CLOSE: - - AcpiDbCloseDebugFile (); - break; - - case CMD_LOAD: - { - ACPI_NEW_TABLE_DESC *ListHead = NULL; - - Status = AcGetAllTablesFromFile (AcpiGbl_DbArgs[1], - ACPI_GET_ALL_TABLES, &ListHead); - if (ACPI_SUCCESS (Status)) - { - AcpiDbLoadTables (ListHead); - } - } - break; - - case CMD_OPEN: - - AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); - break; - - /* User space commands. */ - - case CMD_TERMINATE: - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiUtSubsystemShutdown (); - - /* - * TBD: [Restructure] Need some way to re-initialize without - * re-creating the semaphores! - */ - - AcpiGbl_DbTerminateLoop = TRUE; - /* AcpiInitialize (NULL); */ - break; - - case CMD_BACKGROUND: - - AcpiDbCreateExecutionThread (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], - &AcpiGbl_DbArgTypes[2]); - break; - - case CMD_THREADS: - - AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], - AcpiGbl_DbArgs[3]); - break; - - /* Debug test commands. */ - - case CMD_PREDEFINED: - - AcpiDbCheckPredefinedNames (); - break; - - case CMD_TEST: - - AcpiDbExecuteTest (AcpiGbl_DbArgs[1]); - break; - - case CMD_UNLOAD: - - AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]); - break; -#endif - - case CMD_EXIT: - case CMD_QUIT: - - if (Op) - { - AcpiOsPrintf ("Method execution terminated\n"); - return (AE_CTRL_TERMINATE); - } - - if (!AcpiGbl_DbOutputToFile) - { - AcpiDbgLevel = ACPI_DEBUG_DEFAULT; - } - -#ifdef ACPI_APPLICATION - AcpiDbCloseDebugFile (); -#endif - AcpiGbl_DbTerminateLoop = TRUE; - return (AE_CTRL_TERMINATE); - - case CMD_NOT_FOUND: - default: - - AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]); - return (AE_CTRL_TRUE); - } - - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_TRUE; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecuteThread - * - * PARAMETERS: Context - Not used - * - * RETURN: None - * - * DESCRIPTION: Debugger execute thread. Waits for a command line, then - * simply dispatches it. - * - ******************************************************************************/ - -void ACPI_SYSTEM_XFACE -AcpiDbExecuteThread ( - void *Context) -{ - - (void) AcpiDbUserCommands (); - AcpiGbl_DbThreadsTerminated = TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbUserCommands - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Command line execution for the AML debugger. Commands are - * matched and dispatched here. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbUserCommands ( - void) -{ - ACPI_STATUS Status = AE_OK; - - - AcpiOsPrintf ("\n"); - - /* TBD: [Restructure] Need a separate command line buffer for step mode */ - - while (!AcpiGbl_DbTerminateLoop) - { - /* Wait the readiness of the command */ - - Status = AcpiOsWaitCommandReady (); - if (ACPI_FAILURE (Status)) - { - break; - } - - /* Just call to the command line interpreter */ - - AcpiGbl_MethodExecuting = FALSE; - AcpiGbl_StepToNextCall = FALSE; - - (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); - - /* Notify the completion of the command */ - - Status = AcpiOsNotifyCommandComplete (); - if (ACPI_FAILURE (Status)) - { - break; - } - } - - if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE) - { - ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); - } - return (Status); -} diff --git a/Private/acpiSDK/source/components/debugger/dbmethod.c b/Private/acpiSDK/source/components/debugger/dbmethod.c deleted file mode 100644 index 5060bf6d..00000000 --- a/Private/acpiSDK/source/components/debugger/dbmethod.c +++ /dev/null @@ -1,806 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbmethod - Debug commands for control methods - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acdebug.h" -#include "acparser.h" -#include "acpredef.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbmethod") - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDbWalkForExecute ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbEvaluateObject ( - ACPI_NAMESPACE_NODE *Node); - - -/******************************************************************************* - * - * 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; - UINT32 AmlOffset; - - - if (!Op) - { - AcpiOsPrintf ("There is no method currently executing\n"); - return; - } - - /* Get and verify the breakpoint address */ - - Address = strtoul (Location, NULL, 16); - AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, - WalkState->ParserState.AmlStart); - if (Address <= AmlOffset) - { - AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", - Address, 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: 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 = strtoul (ValueArg, NULL, 16); - - if (Type == 'N') - { - Node = AcpiDbConvertToNode (IndexArg); - if (!Node) - { - return; - } - - 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 = 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 = AcpiUtCreateIntegerObject ((UINT64) Value); - if (!ObjDesc) - { - AcpiOsPrintf ("Could not create an internal object\n"); - return; - } - - /* Store the new object into the target */ - - switch (Type) - { - case 'A': - - /* Set a method argument */ - - if (Index > ACPI_METHOD_MAX_ARG) - { - AcpiOsPrintf ("Arg%u - Invalid argument name\n", - Index); - goto Cleanup; - } - - Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, - Index, ObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - ObjDesc = WalkState->Arguments[Index].Object; - - AcpiOsPrintf ("Arg%u: ", Index); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); - break; - - case 'L': - - /* Set a method local */ - - if (Index > ACPI_METHOD_MAX_LOCAL) - { - AcpiOsPrintf ("Local%u - Invalid local variable name\n", - Index); - goto Cleanup; - } - - Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, - Index, ObjDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - ObjDesc = WalkState->LocalVariables[Index].Object; - - AcpiOsPrintf ("Local%u: ", Index); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); - break; - - default: - - break; - } - -Cleanup: - AcpiUtRemoveReference (ObjDesc); -} - - -#ifdef ACPI_DISASSEMBLER -/******************************************************************************* - * - * 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 = strtoul (Statements, NULL, 0); - } - - AcpiDmDisassemble (NULL, Op, NumStatements); -} - - -/******************************************************************************* - * - * 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); - } - - if (Method->Type != ACPI_TYPE_METHOD) - { - ACPI_ERROR ((AE_INFO, "%s (%s): Object must be a control method", - Name, AcpiUtGetTypeName (Method->Type))); - return (AE_BAD_PARAMETER); - } - - ObjDesc = Method->Object; - - Op = AcpiPsCreateScopeOp (ObjDesc->Method.AmlStart); - 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, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); - if (ACPI_FAILURE(Status)) - { - return (Status); - } - - WalkState->OwnerId = ObjDesc->Method.OwnerId; - - /* Push start scope on scope stack and make it current */ - - Status = AcpiDsScopeStackPush (Method, - Method->Type, WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Parse the entire method AML including deferred operators */ - - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; - - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE(Status)) - { - return (Status); - } - - (void) AcpiDmParseDeferredOps (Op); - - /* Now we can disassemble the method */ - - AcpiGbl_DmOpt_Verbose = FALSE; - AcpiDmDisassemble (NULL, Op, 0); - AcpiGbl_DmOpt_Verbose = TRUE; - - AcpiPsDeleteParseTree (Op); - - /* Method cleanup */ - - AcpiNsDeleteNamespaceSubtree (Method); - AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId); - AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId); - return (AE_OK); -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEvaluateObject - * - * PARAMETERS: Node - Namespace node for the object - * - * RETURN: Status - * - * DESCRIPTION: Main execution function for the Evaluate/Execute/All debugger - * commands. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbEvaluateObject ( - ACPI_NAMESPACE_NODE *Node) -{ - char *Pathname; - UINT32 i; - ACPI_DEVICE_INFO *ObjInfo; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - - - Pathname = AcpiNsGetExternalPathname (Node); - if (!Pathname) - { - return (AE_OK); - } - - /* Get the object info for number of method parameters */ - - Status = AcpiGetObjectInfo (Node, &ObjInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (Pathname); - return (Status); - } - - ParamObjects.Pointer = NULL; - ParamObjects.Count = 0; - - if (ObjInfo->Type == ACPI_TYPE_METHOD) - { - /* Setup default parameters */ - - for (i = 0; i < ObjInfo->ParamCount; i++) - { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = 1; - } - - ParamObjects.Pointer = Params; - ParamObjects.Count = ObjInfo->ParamCount; - } - - ACPI_FREE (ObjInfo); - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - /* Do the actual method execution */ - - AcpiGbl_MethodExecuting = TRUE; - - Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj); - AcpiGbl_MethodExecuting = FALSE; - - AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status)); - if (ReturnObj.Length) - { - AcpiOsPrintf ("Evaluation of %s returned object %p, " - "external buffer length %X\n", - Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); - - AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); - AcpiOsPrintf ("\n"); - } - - ACPI_FREE (Pathname); - - /* Ignore status from method execution */ - - return (AE_OK); - - /* Update count, check if we have executed enough methods */ - -} - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForExecute - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Batch execution function. Evaluates all "predefined" objects -- - * the nameseg begins with an underscore. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForExecute ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; - ACPI_STATUS Status; - const ACPI_PREDEFINED_INFO *Predefined; - - - Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); - if (!Predefined) - { - return (AE_OK); - } - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - return (AE_OK); - } - - AcpiDbEvaluateObject (Node); - - /* Ignore status from object evaluation */ - - Status = AE_OK; - - /* Update count, check if we have executed enough methods */ - - Info->Count++; - if (Info->Count >= Info->MaxCount) - { - Status = AE_CTRL_TERMINATE; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForExecuteAll - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Batch execution function. Evaluates all objects whose path ends - * with the nameseg "Info->NameSeg". Used for the "ALL" command. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForExecuteAll ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; - ACPI_STATUS Status; - - - if (!ACPI_COMPARE_NAMESEG (Node->Name.Ascii, Info->NameSeg)) - { - return (AE_OK); - } - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - return (AE_OK); - } - - /* Now evaluate the input object (node) */ - - AcpiDbEvaluateObject (Node); - - /* Ignore status from method execution */ - - Status = AE_OK; - - /* Update count of executed methods/objects */ - - Info->Count++; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEvaluatePredefinedNames - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Namespace batch execution. Execute predefined names in the - * namespace, up to the max count, if specified. - * - ******************************************************************************/ - -void -AcpiDbEvaluatePredefinedNames ( - void) -{ - ACPI_DB_EXECUTE_WALK Info; - - - Info.Count = 0; - Info.MaxCount = ACPI_UINT32_MAX; - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForExecute, NULL, (void *) &Info, NULL); - - AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEvaluateAll - * - * PARAMETERS: NoneAcpiGbl_DbMethodInfo - * - * RETURN: None - * - * DESCRIPTION: Namespace batch execution. Implements the "ALL" command. - * Execute all namepaths whose final nameseg matches the - * input nameseg. - * - ******************************************************************************/ - -void -AcpiDbEvaluateAll ( - char *NameSeg) -{ - ACPI_DB_EXECUTE_WALK Info; - - - Info.Count = 0; - Info.MaxCount = ACPI_UINT32_MAX; - ACPI_COPY_NAMESEG (Info.NameSeg, NameSeg); - Info.NameSeg[ACPI_NAMESEG_SIZE] = 0; - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForExecuteAll, NULL, (void *) &Info, NULL); - - AcpiOsPrintf ("Evaluated %u names in the namespace\n", Info.Count); -} diff --git a/Private/acpiSDK/source/components/debugger/dbnames.c b/Private/acpiSDK/source/components/debugger/dbnames.c deleted file mode 100644 index 040fed24..00000000 --- a/Private/acpiSDK/source/components/debugger/dbnames.c +++ /dev/null @@ -1,1314 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbnames - Debugger commands for the acpi namespace - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acdebug.h" -#include "acpredef.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbnames") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDbWalkAndMatchName ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbWalkForPredefinedNames ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbWalkForSpecificObjects ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbWalkForObjectCounts ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbIntegrityWalk ( - 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 -AcpiDbBusWalk ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -/* - * Arguments for the Objects command - * These object types map directly to the ACPI_TYPES - */ -static ACPI_DB_ARGUMENT_INFO AcpiDbObjectTypes [] = -{ - {"ANY"}, - {"INTEGERS"}, - {"STRINGS"}, - {"BUFFERS"}, - {"PACKAGES"}, - {"FIELDS"}, - {"DEVICES"}, - {"EVENTS"}, - {"METHODS"}, - {"MUTEXES"}, - {"REGIONS"}, - {"POWERRESOURCES"}, - {"PROCESSORS"}, - {"THERMALZONES"}, - {"BUFFERFIELDS"}, - {"DDBHANDLES"}, - {"DEBUG"}, - {"REGIONFIELDS"}, - {"BANKFIELDS"}, - {"INDEXFIELDS"}, - {"REFERENCES"}, - {"ALIASES"}, - {"METHODALIASES"}, - {"NOTIFY"}, - {"ADDRESSHANDLER"}, - {"RESOURCE"}, - {"RESOURCEFIELD"}, - {"SCOPES"}, - {NULL} /* Must be null terminated */ -}; - - -/******************************************************************************* - * - * 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 (ACPI_IS_ROOT_PREFIX (Name[0])) - { - /* Validate new scope from the root */ - - Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, - ACPI_NS_NO_UPSEARCH, &Node); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - AcpiGbl_DbScopeBuf[0] = 0; - } - else - { - /* Validate new scope relative to old scope */ - - Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, - ACPI_NS_NO_UPSEARCH, &Node); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - } - - /* Build the final pathname */ - - if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf), - Name)) - { - Status = AE_BUFFER_OVERFLOW; - goto ErrorExit; - } - - if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf), - "\\")) - { - Status = AE_BUFFER_OVERFLOW; - goto ErrorExit; - } - - AcpiGbl_DbScopeNode = Node; - AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf); - return; - -ErrorExit: - - AcpiOsPrintf ("Could not attach scope: %s, %s\n", - Name, AcpiFormatException (Status)); -} - - -/******************************************************************************* - * - * 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 = strtoul (DepthArg, NULL, 0); - } - } - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - - if (((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Parent) - { - AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", - ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); - } - else - { - AcpiOsPrintf ("ACPI Namespace (from %s):\n", - ACPI_NAMESPACE_ROOT); - } - - /* 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: AcpiDbDumpNamespacePaths - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump entire namespace with full object pathnames and object - * type information. Alternative to "namespace" command. - * - ******************************************************************************/ - -void -AcpiDbDumpNamespacePaths ( - void) -{ - - AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("ACPI Namespace (from root):\n"); - - /* Display the entire namespace */ - - AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, - ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode); - - 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) strtoul (OwnerArg, NULL, 0); - - /* Now we can check for the depth argument */ - - if (DepthArg) - { - MaxDepth = 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: 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, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could Not get pathname for object %p\n", - ObjHandle); - } - else - { - Info.Count = 0; - 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_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) -{ - char AcpiName[5] = "____"; - char *AcpiNamePtr = AcpiName; - - - if (strlen (NameArg) > ACPI_NAMESEG_SIZE) - { - AcpiOsPrintf ("Name must be no longer than 4 characters\n"); - return (AE_OK); - } - - /* Pad out name with underscores as necessary to create a 4-char name */ - - AcpiUtStrupr (NameArg); - while (*NameArg) - { - *AcpiNamePtr = *NameArg; - AcpiNamePtr++; - NameArg++; - } - - /* Walk the namespace from the root */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbWalkAndMatchName, NULL, AcpiName, NULL); - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForPredefinedNames - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Detect and display predefined ACPI names (names that start with - * an underscore) - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForPredefinedNames ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - UINT32 *Count = (UINT32 *) Context; - const ACPI_PREDEFINED_INFO *Predefined; - const ACPI_PREDEFINED_INFO *Package = NULL; - char *Pathname; - char StringBuffer[48]; - - - Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); - if (!Predefined) - { - return (AE_OK); - } - - Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); - if (!Pathname) - { - return (AE_OK); - } - - /* If method returns a package, the info is in the next table entry */ - - if (Predefined->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) - { - Package = Predefined + 1; - } - - AcpiUtGetExpectedReturnTypes (StringBuffer, - Predefined->Info.ExpectedBtypes); - - AcpiOsPrintf ("%-32s Arguments %X, Return Types: %s", Pathname, - METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList), - StringBuffer); - - if (Package) - { - AcpiOsPrintf (" (PkgType %2.2X, ObjType %2.2X, Count %2.2X)", - Package->RetInfo.Type, Package->RetInfo.ObjectType1, - Package->RetInfo.Count1); - } - - AcpiOsPrintf("\n"); - - /* Check that the declared argument count matches the ACPI spec */ - - AcpiNsCheckAcpiCompliance (Pathname, Node, Predefined); - - ACPI_FREE (Pathname); - (*Count)++; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCheckPredefinedNames - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Validate all predefined names in the namespace - * - ******************************************************************************/ - -void -AcpiDbCheckPredefinedNames ( - void) -{ - UINT32 Count = 0; - - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbWalkForPredefinedNames, - NULL, (void *) &Count, NULL); - - AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForObjectCounts - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Display short info about objects in the namespace - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForObjectCounts ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_OBJECT_INFO *Info = (ACPI_OBJECT_INFO *) Context; - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - - - if (Node->Type > ACPI_TYPE_NS_NODE_MAX) - { - AcpiOsPrintf ("[%4.4s]: Unknown object type %X\n", - Node->Name.Ascii, Node->Type); - } - else - { - Info->Types[Node->Type]++; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWalkForFields - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Display short info about objects in the namespace - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWalkForFields ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_OBJECT *RetValue; - ACPI_REGION_WALK_INFO *Info = (ACPI_REGION_WALK_INFO *) Context; - ACPI_BUFFER Buffer; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node = AcpiNsValidateHandle (ObjHandle); - - - if (!Node) - { - return (AE_OK); - } - if (Node->Object->Field.RegionObj->Region.SpaceId != Info->AddressSpaceId) - { - return (AE_OK); - } - - Info->Count++; - - /* Get and display the full pathname to this object */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); - return (AE_OK); - } - - AcpiOsPrintf ("%s ", (char *) Buffer.Pointer); - ACPI_FREE (Buffer.Pointer); - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - AcpiEvaluateObject (ObjHandle, NULL, NULL, &Buffer); - - /* - * Since this is a field unit, surround the output in braces - */ - AcpiOsPrintf ("{"); - - RetValue = (ACPI_OBJECT *) Buffer.Pointer; - switch (RetValue->Type) - { - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf ("%8.8X%8.8X", ACPI_FORMAT_UINT64 (RetValue->Integer.Value)); - break; - - case ACPI_TYPE_BUFFER: - - AcpiUtDumpBuffer (RetValue->Buffer.Pointer, - RetValue->Buffer.Length, DB_DISPLAY_DATA_ONLY | DB_BYTE_DISPLAY, 0); - break; - - default: - - break; - } - - AcpiOsPrintf ("}\n"); - - ACPI_FREE (Buffer.Pointer); - return (AE_OK); -} - - -/******************************************************************************* - * - * 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, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); - return (AE_OK); - } - - AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); - ACPI_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; - ACPI_OBJECT_INFO *ObjectInfo; - UINT32 i; - UINT32 TotalObjects = 0; - - - /* No argument means display summary/count of all object types */ - - if (!ObjTypeArg) - { - ObjectInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_OBJECT_INFO)); - - if (!ObjectInfo) - return (AE_NO_MEMORY); - - /* Walk the namespace from the root */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbWalkForObjectCounts, NULL, - (void *) ObjectInfo, NULL); - - AcpiOsPrintf ("\nSummary of namespace objects:\n\n"); - - for (i = 0; i < ACPI_TOTAL_TYPES; i++) - { - AcpiOsPrintf ("%8u %s\n", ObjectInfo->Types[i], - AcpiUtGetTypeName (i)); - - TotalObjects += ObjectInfo->Types[i]; - } - - AcpiOsPrintf ("\n%8u Total namespace objects\n\n", - TotalObjects); - - ACPI_FREE (ObjectInfo); - return (AE_OK); - } - - /* 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, NULL, (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: AcpiDbDisplayFields - * - * 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 -AcpiDbDisplayFields ( - UINT32 AddressSpaceId) -{ - ACPI_REGION_WALK_INFO Info; - - - Info.Count = 0; - Info.OwnerId = ACPI_OWNER_ID_MAX; - Info.DebugLevel = ACPI_UINT32_MAX; - Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; - Info.AddressSpaceId = AddressSpaceId; - - /* Walk the namespace from the root */ - - (void) AcpiWalkNamespace (ACPI_TYPE_LOCAL_REGION_FIELD, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbWalkForFields, NULL, - (void *) &Info, NULL); - - return (AE_OK); -} - - -/******************************************************************************* - * - * 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; - BOOLEAN Alias = TRUE; - - - Info->Nodes++; - - /* Verify the NS node, and dereference aliases */ - - while (Alias) - { - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - AcpiOsPrintf ( - "Invalid Descriptor Type for Node %p [%s] - " - "is %2.2X should be %2.2X\n", - Node, AcpiUtGetDescriptorName (Node), - ACPI_GET_DESCRIPTOR_TYPE (Node), ACPI_DESC_TYPE_NAMED); - return (AE_OK); - } - - if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) || - (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) - { - Node = (ACPI_NAMESPACE_NODE *) Node->Object; - } - else - { - Alias = FALSE; - } - } - - if (Node->Type > ACPI_TYPE_LOCAL_MAX) - { - AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", - Node, Node->Type); - return (AE_OK); - } - - if (!AcpiUtValidNameseg (Node->Name.Ascii)) - { - AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); - return (AE_OK); - } - - 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, NULL, (void *) &Info, NULL); - - AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n", - Info.Nodes, Info.Objects); -} - - -/******************************************************************************* - * - * 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; - ACPI_SIZE Address; - - - /* Convert string to object pointer */ - - Address = strtoul (ObjectArg, NULL, 16); - ObjDesc = ACPI_TO_POINTER (Address); - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbWalkForReferences, NULL, - (void *) ObjDesc, NULL); -} - - -/******************************************************************************* - * - * 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_NAMESPACE_NODE *TempNode; - ACPI_DEVICE_INFO *Info; - UINT32 i; - - - if ((Node->Type != ACPI_TYPE_DEVICE) && - (Node->Type != ACPI_TYPE_PROCESSOR)) - { - return (AE_OK); - } - - /* Exit if there is no _PRT under this device */ - - Status = AcpiGetHandle (Node, METHOD_NAME__PRT, - ACPI_CAST_PTR (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, TRUE); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could Not get pathname for object %p\n", - ObjHandle); - return (AE_OK); - } - - Status = AcpiGetObjectInfo (ObjHandle, &Info); - if (ACPI_FAILURE (Status)) - { - return (AE_OK); - } - - /* Display the full path */ - - AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type); - ACPI_FREE (Buffer.Pointer); - - if (Info->Flags & ACPI_PCI_ROOT_BRIDGE) - { - AcpiOsPrintf (" - Is PCI Root Bridge"); - } - AcpiOsPrintf ("\n"); - - /* _PRT info */ - - AcpiOsPrintf ("_PRT: %p\n", TempNode); - - /* Dump _ADR, _HID, _UID, _CID */ - - if (Info->Valid & ACPI_VALID_ADR) - { - AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Info->Address)); - } - else - { - AcpiOsPrintf ("_ADR: <Not Present>\n"); - } - - if (Info->Valid & ACPI_VALID_HID) - { - AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String); - } - else - { - AcpiOsPrintf ("_HID: <Not Present>\n"); - } - - if (Info->Valid & ACPI_VALID_UID) - { - AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String); - } - else - { - AcpiOsPrintf ("_UID: <Not Present>\n"); - } - - if (Info->Valid & ACPI_VALID_CID) - { - for (i = 0; i < Info->CompatibleIdList.Count; i++) - { - AcpiOsPrintf ("_CID: %s\n", - Info->CompatibleIdList.Ids[i].String); - } - } - else - { - AcpiOsPrintf ("_CID: <Not Present>\n"); - } - - ACPI_FREE (Info); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbGetBusInfo - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display info about system buses. - * - ******************************************************************************/ - -void -AcpiDbGetBusInfo ( - void) -{ - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbBusWalk, NULL, NULL, NULL); -} diff --git a/Private/acpiSDK/source/components/debugger/dbobject.c b/Private/acpiSDK/source/components/debugger/dbobject.c deleted file mode 100644 index fe38be90..00000000 --- a/Private/acpiSDK/source/components/debugger/dbobject.c +++ /dev/null @@ -1,710 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbobject - ACPI object decode and display - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acdebug.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbobject") - - -/* Local prototypes */ - -static void -AcpiDbDecodeNode ( - ACPI_NAMESPACE_NODE *Node); - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpMethodInfo - * - * PARAMETERS: Status - Method execution status - * WalkState - Current state of the parse tree walk - * - * RETURN: None - * - * DESCRIPTION: Called when a method has been aborted because of an error. - * Dumps the method execution stack, and the method locals/args, - * and disassembles the AML opcode that failed. - * - ******************************************************************************/ - -void -AcpiDbDumpMethodInfo ( - ACPI_STATUS Status, - ACPI_WALK_STATE *WalkState) -{ - ACPI_THREAD_STATE *Thread; - ACPI_NAMESPACE_NODE *Node; - - - Node = WalkState->MethodNode; - - /* There are no locals or arguments for the module-level code case */ - - if (Node == AcpiGbl_RootNode) - { - return; - } - - /* Ignore control codes, they are not errors */ - - if (ACPI_CNTL_EXCEPTION (Status)) - { - return; - } - - /* We may be executing a deferred opcode */ - - if (WalkState->DeferredNode) - { - AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); - return; - } - - /* - * If there is no Thread, we are not actually executing a method. - * This can happen when the iASL compiler calls the interpreter - * to perform constant folding. - */ - Thread = WalkState->Thread; - if (!Thread) - { - return; - } - - /* Display the method locals and arguments */ - - AcpiOsPrintf ("\n"); - AcpiDbDecodeLocals (WalkState); - AcpiOsPrintf ("\n"); - AcpiDbDecodeArguments (WalkState); - AcpiOsPrintf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDecodeInternalObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * - * RETURN: None - * - * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers. - * - ******************************************************************************/ - -void -AcpiDbDecodeInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - UINT32 i; - - - if (!ObjDesc) - { - AcpiOsPrintf (" Uninitialized"); - return; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) - { - AcpiOsPrintf (" %p [%s]", ObjDesc, - AcpiUtGetDescriptorName (ObjDesc)); - return; - } - - AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf (" %8.8X%8.8X", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("(%u) \"%.60s", - ObjDesc->String.Length, ObjDesc->String.Pointer); - - if (ObjDesc->String.Length > 60) - { - AcpiOsPrintf ("..."); - } - else - { - AcpiOsPrintf ("\""); - } - break; - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length); - for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) - { - AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); - } - break; - - default: - - AcpiOsPrintf (" %p", ObjDesc); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDecodeNode - * - * PARAMETERS: Node - Object to be displayed - * - * RETURN: None - * - * DESCRIPTION: Short display of a namespace node - * - ******************************************************************************/ - -static void -AcpiDbDecodeNode ( - ACPI_NAMESPACE_NODE *Node) -{ - - AcpiOsPrintf ("<Node> Name %4.4s", - AcpiUtGetNodeName (Node)); - - if (Node->Flags & ANOBJ_METHOD_ARG) - { - AcpiOsPrintf (" [Method Arg]"); - } - if (Node->Flags & ANOBJ_METHOD_LOCAL) - { - AcpiOsPrintf (" [Method Local]"); - } - - switch (Node->Type) - { - /* These types have no attached object */ - - case ACPI_TYPE_DEVICE: - - AcpiOsPrintf (" Device"); - break; - - case ACPI_TYPE_THERMAL: - - AcpiOsPrintf (" Thermal Zone"); - break; - - default: - - AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node)); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayInternalObject - * - * PARAMETERS: ObjDesc - Object to be displayed - * WalkState - Current walk state - * - * RETURN: None - * - * DESCRIPTION: Short display of an internal object - * - ******************************************************************************/ - -void -AcpiDbDisplayInternalObject ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - UINT8 Type; - - - AcpiOsPrintf ("%p ", ObjDesc); - - if (!ObjDesc) - { - AcpiOsPrintf ("<Null Object>\n"); - return; - } - - /* Decode the object type */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) - { - case ACPI_DESC_TYPE_PARSER: - - AcpiOsPrintf ("<Parser> "); - break; - - case ACPI_DESC_TYPE_NAMED: - - AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc); - break; - - case ACPI_DESC_TYPE_OPERAND: - - Type = ObjDesc->Common.Type; - if (Type > ACPI_TYPE_LOCAL_MAX) - { - AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type); - return; - } - - /* Decode the ACPI object type */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc)); - - /* Decode the reference */ - - switch (ObjDesc->Reference.Class) - { - case ACPI_REFCLASS_LOCAL: - - AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); - if (WalkState) - { - ObjDesc = WalkState->LocalVariables - [ObjDesc->Reference.Value].Object; - AcpiOsPrintf ("%p", ObjDesc); - AcpiDbDecodeInternalObject (ObjDesc); - } - break; - - case ACPI_REFCLASS_ARG: - - AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); - if (WalkState) - { - ObjDesc = WalkState->Arguments - [ObjDesc->Reference.Value].Object; - AcpiOsPrintf ("%p", ObjDesc); - AcpiDbDecodeInternalObject (ObjDesc); - } - break; - - case ACPI_REFCLASS_INDEX: - - switch (ObjDesc->Reference.TargetType) - { - case ACPI_TYPE_BUFFER_FIELD: - - AcpiOsPrintf ("%p", ObjDesc->Reference.Object); - AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); - break; - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("%p", ObjDesc->Reference.Where); - if (!ObjDesc->Reference.Where) - { - AcpiOsPrintf (" Uninitialized WHERE pointer"); - } - else - { - AcpiDbDecodeInternalObject ( - *(ObjDesc->Reference.Where)); - } - break; - - default: - - AcpiOsPrintf ("Unknown index target type"); - break; - } - break; - - case ACPI_REFCLASS_REFOF: - - if (!ObjDesc->Reference.Object) - { - AcpiOsPrintf ( - "Uninitialized reference subobject pointer"); - break; - } - - /* Reference can be to a Node or an Operand object */ - - switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) - { - case ACPI_DESC_TYPE_NAMED: - - AcpiDbDecodeNode (ObjDesc->Reference.Object); - break; - - case ACPI_DESC_TYPE_OPERAND: - - AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); - break; - - default: - break; - } - break; - - case ACPI_REFCLASS_NAME: - - AcpiDbDecodeNode (ObjDesc->Reference.Node); - break; - - case ACPI_REFCLASS_DEBUG: - case ACPI_REFCLASS_TABLE: - - AcpiOsPrintf ("\n"); - break; - - default: /* Unknown reference class */ - - AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); - break; - } - break; - - default: - - AcpiOsPrintf ("<Obj> "); - AcpiDbDecodeInternalObject (ObjDesc); - break; - } - break; - - default: - - AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]", - AcpiUtGetDescriptorName (ObjDesc)); - break; - } - - AcpiOsPrintf ("\n"); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDecodeLocals - * - * PARAMETERS: WalkState - State for current method - * - * RETURN: None - * - * DESCRIPTION: Display all locals for the currently running control method - * - ******************************************************************************/ - -void -AcpiDbDecodeLocals ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - BOOLEAN DisplayLocals = FALSE; - - - Node = WalkState->MethodNode; - - /* There are no locals for the module-level code case */ - - if (Node == AcpiGbl_RootNode) - { - return; - } - - if (!Node) - { - AcpiOsPrintf ( - "No method node (Executing subtree for buffer or opregion)\n"); - return; - } - - if (Node->Type != ACPI_TYPE_METHOD) - { - AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); - return; - } - - /* Are any locals actually set? */ - - for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) - { - ObjDesc = WalkState->LocalVariables[i].Object; - if (ObjDesc) - { - DisplayLocals = TRUE; - break; - } - } - - /* If any are set, only display the ones that are set */ - - if (DisplayLocals) - { - AcpiOsPrintf ("\nInitialized Local Variables for Method [%4.4s]:\n", - AcpiUtGetNodeName (Node)); - - for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) - { - ObjDesc = WalkState->LocalVariables[i].Object; - if (ObjDesc) - { - AcpiOsPrintf (" Local%X: ", i); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); - } - } - } - else - { - AcpiOsPrintf ( - "No Local Variables are initialized for Method [%4.4s]\n", - AcpiUtGetNodeName (Node)); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDecodeArguments - * - * PARAMETERS: WalkState - State for current method - * - * RETURN: None - * - * DESCRIPTION: Display all arguments for the currently running control method - * - ******************************************************************************/ - -void -AcpiDbDecodeArguments ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - BOOLEAN DisplayArgs = FALSE; - - - Node = WalkState->MethodNode; - - /* There are no arguments for the module-level code case */ - - if (Node == AcpiGbl_RootNode) - { - return; - } - - if (!Node) - { - AcpiOsPrintf ( - "No method node (Executing subtree for buffer or opregion)\n"); - return; - } - - if (Node->Type != ACPI_TYPE_METHOD) - { - AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); - return; - } - - /* Are any arguments actually set? */ - - for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) - { - ObjDesc = WalkState->Arguments[i].Object; - if (ObjDesc) - { - DisplayArgs = TRUE; - break; - } - } - - /* If any are set, only display the ones that are set */ - - if (DisplayArgs) - { - AcpiOsPrintf ( - "Initialized Arguments for Method [%4.4s]: " - "(%X arguments defined for method invocation)\n", - AcpiUtGetNodeName (Node), Node->Object->Method.ParamCount); - - for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) - { - ObjDesc = WalkState->Arguments[i].Object; - if (ObjDesc) - { - AcpiOsPrintf (" Arg%u: ", i); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); - } - } - } - else - { - AcpiOsPrintf ( - "No Arguments are initialized for method [%4.4s]\n", - AcpiUtGetNodeName (Node)); - } -} diff --git a/Private/acpiSDK/source/components/debugger/dbstats.c b/Private/acpiSDK/source/components/debugger/dbstats.c deleted file mode 100644 index a30d9948..00000000 --- a/Private/acpiSDK/source/components/debugger/dbstats.c +++ /dev/null @@ -1,664 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbstats - Generation and display of ACPI table statistics - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbstats") - - -/* Local prototypes */ - -static void -AcpiDbCountNamespaceObjects ( - void); - -static void -AcpiDbEnumerateObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - -static ACPI_STATUS -AcpiDbClassifyOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE -static void -AcpiDbListInfo ( - ACPI_MEMORY_LIST *List); -#endif - - -/* - * Statistics subcommands - */ -static ACPI_DB_ARGUMENT_INFO AcpiDbStatTypes [] = -{ - {"ALLOCATIONS"}, - {"OBJECTS"}, - {"MEMORY"}, - {"MISC"}, - {"TABLES"}, - {"SIZES"}, - {"STACK"}, - {NULL} /* Must be null terminated */ -}; - -#define CMD_STAT_ALLOCATIONS 0 -#define CMD_STAT_OBJECTS 1 -#define CMD_STAT_MEMORY 2 -#define CMD_STAT_MISC 3 -#define CMD_STAT_TABLES 4 -#define CMD_STAT_SIZES 5 -#define CMD_STAT_STACK 6 - - -#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE -/******************************************************************************* - * - * FUNCTION: AcpiDbListInfo - * - * PARAMETERS: List - Memory list/cache to be displayed - * - * RETURN: None - * - * DESCRIPTION: Display information about the input memory list or cache. - * - ******************************************************************************/ - -static void -AcpiDbListInfo ( - ACPI_MEMORY_LIST *List) -{ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - UINT32 Outstanding; -#endif - - AcpiOsPrintf ("\n%s\n", List->ListName); - - /* MaxDepth > 0 indicates a cache object */ - - if (List->MaxDepth > 0) - { - AcpiOsPrintf ( - " Cache: [Depth MaxD Avail Size] " - "%8.2X %8.2X %8.2X %8.2X\n", - List->CurrentDepth, - List->MaxDepth, - List->MaxDepth - List->CurrentDepth, - (List->CurrentDepth * List->ObjectSize)); - } - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - if (List->MaxDepth > 0) - { - AcpiOsPrintf ( - " Cache: [Requests Hits Misses ObjSize] " - "%8.2X %8.2X %8.2X %8.2X\n", - List->Requests, - List->Hits, - List->Requests - List->Hits, - List->ObjectSize); - } - - Outstanding = AcpiDbGetCacheInfo (List); - - if (List->ObjectSize) - { - AcpiOsPrintf ( - " Mem: [Alloc Free Max CurSize Outstanding] " - "%8.2X %8.2X %8.2X %8.2X %8.2X\n", - List->TotalAllocated, - List->TotalFreed, - List->MaxOccupied, - Outstanding * List->ObjectSize, - Outstanding); - } - else - { - AcpiOsPrintf ( - " Mem: [Alloc Free Max CurSize Outstanding Total] " - "%8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n", - List->TotalAllocated, - List->TotalFreed, - List->MaxOccupied, - List->CurrentTotalSize, - Outstanding, - List->TotalSize); - } -#endif -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEnumerateObject - * - * PARAMETERS: ObjDesc - Object to be counted - * - * RETURN: None - * - * DESCRIPTION: Add this object to the global counts, by object type. - * Limited recursion handles subobjects and packages, and this - * is probably acceptable within the AML debugger only. - * - ******************************************************************************/ - -static void -AcpiDbEnumerateObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - UINT32 i; - - - if (!ObjDesc) - { - return; - } - - /* Enumerate this object first */ - - AcpiGbl_NumObjects++; - - if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX) - { - AcpiGbl_ObjTypeCountMisc++; - } - else - { - AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++; - } - - /* Count the sub-objects */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_PACKAGE: - - for (i = 0; i < ObjDesc->Package.Count; i++) - { - AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]); - } - break; - - case ACPI_TYPE_DEVICE: - - AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[0]); - AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[1]); - AcpiDbEnumerateObject (ObjDesc->Device.Handler); - break; - - case ACPI_TYPE_BUFFER_FIELD: - - if (AcpiNsGetSecondaryObject (ObjDesc)) - { - AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++; - } - break; - - case ACPI_TYPE_REGION: - - AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++; - AcpiDbEnumerateObject (ObjDesc->Region.Handler); - break; - - case ACPI_TYPE_POWER: - - AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[0]); - AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[1]); - break; - - case ACPI_TYPE_PROCESSOR: - - AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[0]); - AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[1]); - AcpiDbEnumerateObject (ObjDesc->Processor.Handler); - break; - - case ACPI_TYPE_THERMAL: - - AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[0]); - AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[1]); - AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler); - break; - - default: - - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbClassifyOneObject - * - * PARAMETERS: Callback for WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and - * the parent namespace node. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbClassifyOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 Type; - - - AcpiGbl_NumNodes++; - - Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ObjDesc = AcpiNsGetAttachedObject (Node); - - AcpiDbEnumerateObject (ObjDesc); - - Type = Node->Type; - if (Type > ACPI_TYPE_NS_NODE_MAX) - { - AcpiGbl_NodeTypeCountMisc++; - } - else - { - AcpiGbl_NodeTypeCount [Type]++; - } - - return (AE_OK); - - -#ifdef ACPI_FUTURE_IMPLEMENTATION - - /* TBD: These need to be counted during the initial parsing phase */ - - if (AcpiPsIsNamedOp (Op->Opcode)) - { - NumNodes++; - } - - if (IsMethod) - { - NumMethodElements++; - } - - NumGrammarElements++; - Op = AcpiPsGetDepthNext (Root, Op); - - SizeOfParseTree = (NumGrammarElements - NumMethodElements) * - (UINT32) sizeof (ACPI_PARSE_OBJECT); - SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT); - SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE); - SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT); -#endif -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbCountNamespaceObjects - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Count and classify the entire namespace, including all - * namespace nodes and attached objects. - * - ******************************************************************************/ - -static void -AcpiDbCountNamespaceObjects ( - void) -{ - UINT32 i; - - - AcpiGbl_NumNodes = 0; - AcpiGbl_NumObjects = 0; - - AcpiGbl_ObjTypeCountMisc = 0; - for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++) - { - AcpiGbl_ObjTypeCount [i] = 0; - AcpiGbl_NodeTypeCount [i] = 0; - } - - (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayStatistics - * - * PARAMETERS: TypeArg - Subcommand - * - * RETURN: Status - * - * DESCRIPTION: Display various statistics - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbDisplayStatistics ( - char *TypeArg) -{ - UINT32 i; - UINT32 Temp; - - - AcpiUtStrupr (TypeArg); - Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes); - if (Temp == ACPI_TYPE_NOT_FOUND) - { - AcpiOsPrintf ("Invalid or unsupported argument\n"); - return (AE_OK); - } - - - switch (Temp) - { - case CMD_STAT_ALLOCATIONS: - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiUtDumpAllocationInfo (); -#endif - break; - - case CMD_STAT_TABLES: - - AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n"); - break; - - case CMD_STAT_OBJECTS: - - AcpiDbCountNamespaceObjects (); - - AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n"); - - AcpiOsPrintf ("%16.16s %10.10s %10.10s\n", - "ACPI_TYPE", "NODES", "OBJECTS"); - - for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++) - { - AcpiOsPrintf ("%16.16s %10u %10u\n", AcpiUtGetTypeName (i), - AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]); - } - - AcpiOsPrintf ("%16.16s %10u %10u\n", "Misc/Unknown", - AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc); - - AcpiOsPrintf ("%16.16s %10u %10u\n", "TOTALS:", - AcpiGbl_NumNodes, AcpiGbl_NumObjects); - break; - - case CMD_STAT_MEMORY: - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n"); - - AcpiDbListInfo (AcpiGbl_GlobalList); - AcpiDbListInfo (AcpiGbl_NsNodeList); -#endif - -#ifdef ACPI_USE_LOCAL_CACHE - AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n"); - AcpiDbListInfo (AcpiGbl_OperandCache); - AcpiDbListInfo (AcpiGbl_PsNodeCache); - AcpiDbListInfo (AcpiGbl_PsNodeExtCache); - AcpiDbListInfo (AcpiGbl_StateCache); -#endif - - break; - - case CMD_STAT_MISC: - - AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n"); - AcpiOsPrintf ("%-28s: %7u\n", "Calls to AcpiPsFind", - AcpiGbl_PsFindCount); - AcpiOsPrintf ("%-28s: %7u\n", "Calls to AcpiNsLookup", - AcpiGbl_NsLookupCount); - - AcpiOsPrintf ("\nMutex usage:\n\n"); - for (i = 0; i < ACPI_NUM_MUTEX; i++) - { - AcpiOsPrintf ("%-28s: %7u\n", - AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount); - } - break; - - case CMD_STAT_SIZES: - - AcpiOsPrintf ("\nInternal object sizes:\n\n"); - - AcpiOsPrintf ("Common %3d\n", (UINT32) sizeof (ACPI_OBJECT_COMMON)); - AcpiOsPrintf ("Number %3d\n", (UINT32) sizeof (ACPI_OBJECT_INTEGER)); - AcpiOsPrintf ("String %3d\n", (UINT32) sizeof (ACPI_OBJECT_STRING)); - AcpiOsPrintf ("Buffer %3d\n", (UINT32) sizeof (ACPI_OBJECT_BUFFER)); - AcpiOsPrintf ("Package %3d\n", (UINT32) sizeof (ACPI_OBJECT_PACKAGE)); - AcpiOsPrintf ("BufferField %3d\n", (UINT32) sizeof (ACPI_OBJECT_BUFFER_FIELD)); - AcpiOsPrintf ("Device %3d\n", (UINT32) sizeof (ACPI_OBJECT_DEVICE)); - AcpiOsPrintf ("Event %3d\n", (UINT32) sizeof (ACPI_OBJECT_EVENT)); - AcpiOsPrintf ("Method %3d\n", (UINT32) sizeof (ACPI_OBJECT_METHOD)); - AcpiOsPrintf ("Mutex %3d\n", (UINT32) sizeof (ACPI_OBJECT_MUTEX)); - AcpiOsPrintf ("Region %3d\n", (UINT32) sizeof (ACPI_OBJECT_REGION)); - AcpiOsPrintf ("PowerResource %3d\n", (UINT32) sizeof (ACPI_OBJECT_POWER_RESOURCE)); - AcpiOsPrintf ("Processor %3d\n", (UINT32) sizeof (ACPI_OBJECT_PROCESSOR)); - AcpiOsPrintf ("ThermalZone %3d\n", (UINT32) sizeof (ACPI_OBJECT_THERMAL_ZONE)); - AcpiOsPrintf ("RegionField %3d\n", (UINT32) sizeof (ACPI_OBJECT_REGION_FIELD)); - AcpiOsPrintf ("BankField %3d\n", (UINT32) sizeof (ACPI_OBJECT_BANK_FIELD)); - AcpiOsPrintf ("IndexField %3d\n", (UINT32) sizeof (ACPI_OBJECT_INDEX_FIELD)); - AcpiOsPrintf ("Reference %3d\n", (UINT32) sizeof (ACPI_OBJECT_REFERENCE)); - AcpiOsPrintf ("Notify %3d\n", (UINT32) sizeof (ACPI_OBJECT_NOTIFY_HANDLER)); - AcpiOsPrintf ("AddressSpace %3d\n", (UINT32) sizeof (ACPI_OBJECT_ADDR_HANDLER)); - AcpiOsPrintf ("Extra %3d\n", (UINT32) sizeof (ACPI_OBJECT_EXTRA)); - AcpiOsPrintf ("Data %3d\n", (UINT32) sizeof (ACPI_OBJECT_DATA)); - - AcpiOsPrintf ("\n"); - - AcpiOsPrintf ("ParseObject %3d\n", (UINT32) sizeof (ACPI_PARSE_OBJ_COMMON)); - AcpiOsPrintf ("ParseObjectNamed %3d\n", (UINT32) sizeof (ACPI_PARSE_OBJ_NAMED)); - AcpiOsPrintf ("ParseObjectAsl %3d\n", (UINT32) sizeof (ACPI_PARSE_OBJ_ASL)); - AcpiOsPrintf ("OperandObject %3d\n", (UINT32) sizeof (ACPI_OPERAND_OBJECT)); - AcpiOsPrintf ("NamespaceNode %3d\n", (UINT32) sizeof (ACPI_NAMESPACE_NODE)); - AcpiOsPrintf ("AcpiObject %3d\n", (UINT32) sizeof (ACPI_OBJECT)); - - AcpiOsPrintf ("\n"); - - AcpiOsPrintf ("Generic State %3d\n", (UINT32) sizeof (ACPI_GENERIC_STATE)); - AcpiOsPrintf ("Common State %3d\n", (UINT32) sizeof (ACPI_COMMON_STATE)); - AcpiOsPrintf ("Control State %3d\n", (UINT32) sizeof (ACPI_CONTROL_STATE)); - AcpiOsPrintf ("Update State %3d\n", (UINT32) sizeof (ACPI_UPDATE_STATE)); - AcpiOsPrintf ("Scope State %3d\n", (UINT32) sizeof (ACPI_SCOPE_STATE)); - AcpiOsPrintf ("Parse Scope %3d\n", (UINT32) sizeof (ACPI_PSCOPE_STATE)); - AcpiOsPrintf ("Package State %3d\n", (UINT32) sizeof (ACPI_PKG_STATE)); - AcpiOsPrintf ("Thread State %3d\n", (UINT32) sizeof (ACPI_THREAD_STATE)); - AcpiOsPrintf ("Result Values %3d\n", (UINT32) sizeof (ACPI_RESULT_VALUES)); - AcpiOsPrintf ("Notify Info %3d\n", (UINT32) sizeof (ACPI_NOTIFY_INFO)); - break; - - case CMD_STAT_STACK: -#if defined(ACPI_DEBUG_OUTPUT) - - Temp = (UINT32) ACPI_PTR_DIFF ( - AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer); - - AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n"); - AcpiOsPrintf ("Entry Stack Pointer %p\n", AcpiGbl_EntryStackPointer); - AcpiOsPrintf ("Lowest Stack Pointer %p\n", AcpiGbl_LowestStackPointer); - AcpiOsPrintf ("Stack Use %X (%u)\n", Temp, Temp); - AcpiOsPrintf ("Deepest Procedure Nesting %u\n", AcpiGbl_DeepestNesting); -#endif - break; - - default: - - break; - } - - AcpiOsPrintf ("\n"); - return (AE_OK); -} diff --git a/Private/acpiSDK/source/components/debugger/dbtest.c b/Private/acpiSDK/source/components/debugger/dbtest.c deleted file mode 100644 index a4d48c7a..00000000 --- a/Private/acpiSDK/source/components/debugger/dbtest.c +++ /dev/null @@ -1,1340 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbtest - Various debug-related tests - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acdebug.h" -#include "acnamesp.h" -#include "acpredef.h" -#include "acinterp.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbtest") - - -/* Local prototypes */ - -static void -AcpiDbTestAllObjects ( - void); - -static ACPI_STATUS -AcpiDbTestOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -static ACPI_STATUS -AcpiDbTestIntegerType ( - ACPI_NAMESPACE_NODE *Node, - UINT32 BitLength); - -static ACPI_STATUS -AcpiDbTestBufferType ( - ACPI_NAMESPACE_NODE *Node, - UINT32 BitLength); - -static ACPI_STATUS -AcpiDbTestStringType ( - ACPI_NAMESPACE_NODE *Node, - UINT32 ByteLength); - -static ACPI_STATUS -AcpiDbTestPackageType ( - ACPI_NAMESPACE_NODE *Node); - -static ACPI_STATUS -AcpiDbTestFieldUnitType ( - ACPI_OPERAND_OBJECT *ObjDesc); - -static ACPI_STATUS -AcpiDbReadFromObject ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE ExpectedType, - ACPI_OBJECT **Value); - -static ACPI_STATUS -AcpiDbWriteToObject ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT *Value); - -static void -AcpiDbEvaluateAllPredefinedNames ( - char *CountArg); - -static ACPI_STATUS -AcpiDbEvaluateOnePredefinedName ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue); - -/* - * Test subcommands - */ -static ACPI_DB_ARGUMENT_INFO AcpiDbTestTypes [] = -{ - {"OBJECTS"}, - {"PREDEFINED"}, - {NULL} /* Must be null terminated */ -}; - -#define CMD_TEST_OBJECTS 0 -#define CMD_TEST_PREDEFINED 1 - -#define BUFFER_FILL_VALUE 0xFF - -/* - * Support for the special debugger read/write control methods. - * These methods are installed into the current namespace and are - * used to read and write the various namespace objects. The point - * is to force the AML interpreter do all of the work. - */ -#define ACPI_DB_READ_METHOD "\\_T98" -#define ACPI_DB_WRITE_METHOD "\\_T99" - -static ACPI_HANDLE ReadHandle = NULL; -static ACPI_HANDLE WriteHandle = NULL; - -/* ASL Definitions of the debugger read/write control methods. AML below. */ - -#if 0 -DefinitionBlock ("ssdt.aml", "SSDT", 2, "Intel", "DEBUG", 0x00000001) -{ - Method (_T98, 1, NotSerialized) /* Read */ - { - Return (DeRefOf (Arg0)) - } -} -DefinitionBlock ("ssdt2.aml", "SSDT", 2, "Intel", "DEBUG", 0x00000001) -{ - Method (_T99, 2, NotSerialized) /* Write */ - { - Store (Arg1, Arg0) - } -} -#endif - -static unsigned char ReadMethodCode[] = -{ - 0x53,0x53,0x44,0x54,0x2E,0x00,0x00,0x00, /* 00000000 "SSDT...." */ - 0x02,0xC9,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ - 0x44,0x45,0x42,0x55,0x47,0x00,0x00,0x00, /* 00000010 "DEBUG..." */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x18,0x12,0x13,0x20,0x14,0x09,0x5F,0x54, /* 00000020 "... .._T" */ - 0x39,0x38,0x01,0xA4,0x83,0x68 /* 00000028 "98...h" */ -}; - -static unsigned char WriteMethodCode[] = -{ - 0x53,0x53,0x44,0x54,0x2E,0x00,0x00,0x00, /* 00000000 "SSDT...." */ - 0x02,0x15,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ - 0x44,0x45,0x42,0x55,0x47,0x00,0x00,0x00, /* 00000010 "DEBUG..." */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x18,0x12,0x13,0x20,0x14,0x09,0x5F,0x54, /* 00000020 "... .._T" */ - 0x39,0x39,0x02,0x70,0x69,0x68 /* 00000028 "99.pih" */ -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbExecuteTest - * - * PARAMETERS: TypeArg - Subcommand - * - * RETURN: None - * - * DESCRIPTION: Execute various debug tests. - * - * Note: Code is prepared for future expansion of the TEST command. - * - ******************************************************************************/ - -void -AcpiDbExecuteTest ( - char *TypeArg) -{ - UINT32 Temp; - - - AcpiUtStrupr (TypeArg); - Temp = AcpiDbMatchArgument (TypeArg, AcpiDbTestTypes); - if (Temp == ACPI_TYPE_NOT_FOUND) - { - AcpiOsPrintf ("Invalid or unsupported argument\n"); - return; - } - - switch (Temp) - { - case CMD_TEST_OBJECTS: - - AcpiDbTestAllObjects (); - break; - - case CMD_TEST_PREDEFINED: - - AcpiDbEvaluateAllPredefinedNames (NULL); - break; - - default: - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTestAllObjects - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: This test implements the OBJECTS subcommand. It exercises the - * namespace by reading/writing/comparing all data objects such - * as integers, strings, buffers, fields, buffer fields, etc. - * - ******************************************************************************/ - -static void -AcpiDbTestAllObjects ( - void) -{ - ACPI_STATUS Status; - - - /* Install the debugger read-object control method if necessary */ - - if (!ReadHandle) - { - Status = AcpiInstallMethod (ReadMethodCode); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s, Could not install debugger read method\n", - AcpiFormatException (Status)); - return; - } - - Status = AcpiGetHandle (NULL, ACPI_DB_READ_METHOD, &ReadHandle); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain handle for debug method %s\n", - ACPI_DB_READ_METHOD); - return; - } - } - - /* Install the debugger write-object control method if necessary */ - - if (!WriteHandle) - { - Status = AcpiInstallMethod (WriteMethodCode); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s, Could not install debugger write method\n", - AcpiFormatException (Status)); - return; - } - - Status = AcpiGetHandle (NULL, ACPI_DB_WRITE_METHOD, &WriteHandle); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not obtain handle for debug method %s\n", - ACPI_DB_WRITE_METHOD); - return; - } - } - - /* Walk the entire namespace, testing each supported named data object */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbTestOneObject, NULL, NULL, NULL); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTestOneObject - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Test one namespace object. Supported types are Integer, - * String, Buffer, Package, BufferField, and FieldUnit. - * All other object types are simply ignored. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbTestOneObject ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OBJECT_TYPE LocalType; - UINT32 BitLength = 0; - UINT32 ByteLength = 0; - ACPI_STATUS Status = AE_OK; - - - Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); - ObjDesc = Node->Object; - - /* - * For the supported types, get the actual bit length or - * byte length. Map the type to one of Integer/String/Buffer. - */ - switch (Node->Type) - { - case ACPI_TYPE_INTEGER: - - /* Integer width is either 32 or 64 */ - - LocalType = ACPI_TYPE_INTEGER; - BitLength = AcpiGbl_IntegerBitWidth; - break; - - case ACPI_TYPE_STRING: - - LocalType = ACPI_TYPE_STRING; - ByteLength = ObjDesc->String.Length; - break; - - case ACPI_TYPE_BUFFER: - - LocalType = ACPI_TYPE_BUFFER; - ByteLength = ObjDesc->Buffer.Length; - BitLength = ByteLength * 8; - break; - - case ACPI_TYPE_PACKAGE: - - LocalType = ACPI_TYPE_PACKAGE; - break; - - case ACPI_TYPE_FIELD_UNIT: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - - LocalType = ACPI_TYPE_FIELD_UNIT; - break; - - case ACPI_TYPE_BUFFER_FIELD: - /* - * The returned object will be a Buffer if the field length - * is larger than the size of an Integer (32 or 64 bits - * depending on the DSDT version). - */ - LocalType = ACPI_TYPE_INTEGER; - if (ObjDesc) - { - BitLength = ObjDesc->CommonField.BitLength; - ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength); - if (BitLength > AcpiGbl_IntegerBitWidth) - { - LocalType = ACPI_TYPE_BUFFER; - } - } - break; - -default: - - /* Ignore all non-data types - Methods, Devices, Scopes, etc. */ - - return (AE_OK); - } - - /* Emit the common prefix: Type:Name */ - - AcpiOsPrintf ("%14s: %4.4s", - AcpiUtGetTypeName (Node->Type), Node->Name.Ascii); - - if (!ObjDesc) - { - AcpiOsPrintf (" No attached sub-object, ignoring\n"); - return (AE_OK); - } - - /* At this point, we have resolved the object to one of the major types */ - - switch (LocalType) - { - case ACPI_TYPE_INTEGER: - - Status = AcpiDbTestIntegerType (Node, BitLength); - break; - - case ACPI_TYPE_STRING: - - Status = AcpiDbTestStringType (Node, ByteLength); - break; - - case ACPI_TYPE_BUFFER: - - Status = AcpiDbTestBufferType (Node, BitLength); - break; - - case ACPI_TYPE_PACKAGE: - - Status = AcpiDbTestPackageType (Node); - break; - - case ACPI_TYPE_FIELD_UNIT: - - Status = AcpiDbTestFieldUnitType (ObjDesc); - break; - - default: - - AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)", - LocalType); - break; - } - - /* Exit on error, but don't abort the namespace walk */ - - if (ACPI_FAILURE (Status)) - { - Status = AE_OK; - } - - AcpiOsPrintf ("\n"); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTestIntegerType - * - * PARAMETERS: Node - Parent NS node for the object - * BitLength - Actual length of the object. Used for - * support of arbitrary length FieldUnit - * and BufferField objects. - * - * RETURN: Status - * - * DESCRIPTION: Test read/write for an Integer-valued object. Performs a - * write/read/compare of an arbitrary new value, then performs - * a write/read/compare of the original value. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbTestIntegerType ( - ACPI_NAMESPACE_NODE *Node, - UINT32 BitLength) -{ - ACPI_OBJECT *Temp1 = NULL; - ACPI_OBJECT *Temp2 = NULL; - ACPI_OBJECT *Temp3 = NULL; - ACPI_OBJECT WriteValue; - UINT64 ValueToWrite; - ACPI_STATUS Status; - - - if (BitLength > 64) - { - AcpiOsPrintf (" Invalid length for an Integer: %u", BitLength); - return (AE_OK); - } - - /* Read the original value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " %8.8X%8.8X", - BitLength, ACPI_ROUND_BITS_UP_TO_BYTES (BitLength), - ACPI_FORMAT_UINT64 (Temp1->Integer.Value)); - - ValueToWrite = ACPI_UINT64_MAX >> (64 - BitLength); - if (Temp1->Integer.Value == ValueToWrite) - { - ValueToWrite = 0; - } - /* Write a new value */ - - WriteValue.Type = ACPI_TYPE_INTEGER; - WriteValue.Integer.Value = ValueToWrite; - Status = AcpiDbWriteToObject (Node, &WriteValue); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Ensure that we can read back the new value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp2); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (Temp2->Integer.Value != ValueToWrite) - { - AcpiOsPrintf (" MISMATCH 2: %8.8X%8.8X, expecting %8.8X%8.8X", - ACPI_FORMAT_UINT64 (Temp2->Integer.Value), - ACPI_FORMAT_UINT64 (ValueToWrite)); - } - - /* Write back the original value */ - - WriteValue.Integer.Value = Temp1->Integer.Value; - Status = AcpiDbWriteToObject (Node, &WriteValue); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Ensure that we can read back the original value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp3); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (Temp3->Integer.Value != Temp1->Integer.Value) - { - AcpiOsPrintf (" MISMATCH 3: %8.8X%8.8X, expecting %8.8X%8.8X", - ACPI_FORMAT_UINT64 (Temp3->Integer.Value), - ACPI_FORMAT_UINT64 (Temp1->Integer.Value)); - } - -Exit: - if (Temp1) {AcpiOsFree (Temp1);} - if (Temp2) {AcpiOsFree (Temp2);} - if (Temp3) {AcpiOsFree (Temp3);} - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTestBufferType - * - * PARAMETERS: Node - Parent NS node for the object - * BitLength - Actual length of the object. - * - * RETURN: Status - * - * DESCRIPTION: Test read/write for an Buffer-valued object. Performs a - * write/read/compare of an arbitrary new value, then performs - * a write/read/compare of the original value. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbTestBufferType ( - ACPI_NAMESPACE_NODE *Node, - UINT32 BitLength) -{ - ACPI_OBJECT *Temp1 = NULL; - ACPI_OBJECT *Temp2 = NULL; - ACPI_OBJECT *Temp3 = NULL; - UINT8 *Buffer; - ACPI_OBJECT WriteValue; - ACPI_STATUS Status; - UINT32 ByteLength; - UINT32 i; - UINT8 ExtraBits; - - - ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength); - if (ByteLength == 0) - { - AcpiOsPrintf (" Ignoring zero length buffer"); - return (AE_OK); - } - - /* Allocate a local buffer */ - - Buffer = ACPI_ALLOCATE_ZEROED (ByteLength); - if (!Buffer) - { - return (AE_NO_MEMORY); - } - - /* Read the original value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp1); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Emit a few bytes of the buffer */ - - AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT, BitLength, Temp1->Buffer.Length); - for (i = 0; ((i < 8) && (i < ByteLength)); i++) - { - AcpiOsPrintf (" %2.2X", Temp1->Buffer.Pointer[i]); - } - AcpiOsPrintf ("... "); - - /* - * Write a new value. - * - * Handle possible extra bits at the end of the buffer. Can - * happen for FieldUnits larger than an integer, but the bit - * count is not an integral number of bytes. Zero out the - * unused bits. - */ - memset (Buffer, BUFFER_FILL_VALUE, ByteLength); - ExtraBits = BitLength % 8; - if (ExtraBits) - { - Buffer [ByteLength - 1] = ACPI_MASK_BITS_ABOVE (ExtraBits); - } - - WriteValue.Type = ACPI_TYPE_BUFFER; - WriteValue.Buffer.Length = ByteLength; - WriteValue.Buffer.Pointer = Buffer; - - Status = AcpiDbWriteToObject (Node, &WriteValue); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Ensure that we can read back the new value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp2); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (memcmp (Temp2->Buffer.Pointer, Buffer, ByteLength)) - { - AcpiOsPrintf (" MISMATCH 2: New buffer value"); - } - - /* Write back the original value */ - - WriteValue.Buffer.Length = ByteLength; - WriteValue.Buffer.Pointer = Temp1->Buffer.Pointer; - - Status = AcpiDbWriteToObject (Node, &WriteValue); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Ensure that we can read back the original value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp3); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (memcmp (Temp1->Buffer.Pointer, - Temp3->Buffer.Pointer, ByteLength)) - { - AcpiOsPrintf (" MISMATCH 3: While restoring original buffer"); - } - -Exit: - ACPI_FREE (Buffer); - if (Temp1) {AcpiOsFree (Temp1);} - if (Temp2) {AcpiOsFree (Temp2);} - if (Temp3) {AcpiOsFree (Temp3);} - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTestStringType - * - * PARAMETERS: Node - Parent NS node for the object - * ByteLength - Actual length of the object. - * - * RETURN: Status - * - * DESCRIPTION: Test read/write for an String-valued object. Performs a - * write/read/compare of an arbitrary new value, then performs - * a write/read/compare of the original value. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbTestStringType ( - ACPI_NAMESPACE_NODE *Node, - UINT32 ByteLength) -{ - ACPI_OBJECT *Temp1 = NULL; - ACPI_OBJECT *Temp2 = NULL; - ACPI_OBJECT *Temp3 = NULL; - char *ValueToWrite = "Test String from AML Debugger"; - ACPI_OBJECT WriteValue; - ACPI_STATUS Status; - - - /* Read the original value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " \"%s\"", (Temp1->String.Length * 8), - Temp1->String.Length, Temp1->String.Pointer); - - /* Write a new value */ - - WriteValue.Type = ACPI_TYPE_STRING; - WriteValue.String.Length = strlen (ValueToWrite); - WriteValue.String.Pointer = ValueToWrite; - - Status = AcpiDbWriteToObject (Node, &WriteValue); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Ensure that we can read back the new value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp2); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (strcmp (Temp2->String.Pointer, ValueToWrite)) - { - AcpiOsPrintf (" MISMATCH 2: %s, expecting %s", - Temp2->String.Pointer, ValueToWrite); - } - - /* Write back the original value */ - - WriteValue.String.Length = strlen (Temp1->String.Pointer); - WriteValue.String.Pointer = Temp1->String.Pointer; - - Status = AcpiDbWriteToObject (Node, &WriteValue); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Ensure that we can read back the original value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp3); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - if (strcmp (Temp1->String.Pointer, Temp3->String.Pointer)) - { - AcpiOsPrintf (" MISMATCH 3: %s, expecting %s", - Temp3->String.Pointer, Temp1->String.Pointer); - } - -Exit: - if (Temp1) {AcpiOsFree (Temp1);} - if (Temp2) {AcpiOsFree (Temp2);} - if (Temp3) {AcpiOsFree (Temp3);} - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTestPackageType - * - * PARAMETERS: Node - Parent NS node for the object - * - * RETURN: Status - * - * DESCRIPTION: Test read for a Package object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbTestPackageType ( - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_OBJECT *Temp1 = NULL; - ACPI_STATUS Status; - - - /* Read the original value */ - - Status = AcpiDbReadFromObject (Node, ACPI_TYPE_PACKAGE, &Temp1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiOsPrintf (" %.2X Elements", Temp1->Package.Count); - AcpiOsFree (Temp1); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbTestFieldUnitType - * - * PARAMETERS: ObjDesc - A field unit object - * - * RETURN: Status - * - * DESCRIPTION: Test read/write on a named field unit. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbTestFieldUnitType ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT *RegionObj; - UINT32 BitLength = 0; - UINT32 ByteLength = 0; - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *RetBufferDesc; - - - /* Supported spaces are memory/io/pci_config */ - - RegionObj = ObjDesc->Field.RegionObj; - switch (RegionObj->Region.SpaceId) - { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - case ACPI_ADR_SPACE_SYSTEM_IO: - case ACPI_ADR_SPACE_PCI_CONFIG: - - /* Need the interpreter to execute */ - - AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); - AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - - /* Exercise read-then-write */ - - Status = AcpiExReadDataFromField (NULL, ObjDesc, &RetBufferDesc); - if (Status == AE_OK) - { - AcpiExWriteDataToField (RetBufferDesc, ObjDesc, NULL); - AcpiUtRemoveReference (RetBufferDesc); - } - - AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); - - BitLength = ObjDesc->CommonField.BitLength; - ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength); - - AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " [%s]", BitLength, - ByteLength, AcpiUtGetRegionName (RegionObj->Region.SpaceId)); - return (Status); - - default: - - AcpiOsPrintf ( - " %s address space is not supported in this command [%4.4s]", - AcpiUtGetRegionName (RegionObj->Region.SpaceId), - RegionObj->Region.Node->Name.Ascii); - return (AE_OK); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbReadFromObject - * - * PARAMETERS: Node - Parent NS node for the object - * ExpectedType - Object type expected from the read - * Value - Where the value read is returned - * - * RETURN: Status - * - * DESCRIPTION: Performs a read from the specified object by invoking the - * special debugger control method that reads the object. Thus, - * the AML interpreter is doing all of the work, increasing the - * validity of the test. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbReadFromObject ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT_TYPE ExpectedType, - ACPI_OBJECT **Value) -{ - ACPI_OBJECT *RetValue; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[2]; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - - - Params[0].Type = ACPI_TYPE_LOCAL_REFERENCE; - Params[0].Reference.ActualType = Node->Type; - Params[0].Reference.Handle = ACPI_CAST_PTR (ACPI_HANDLE, Node); - - ParamObjects.Count = 1; - ParamObjects.Pointer = Params; - - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - AcpiGbl_MethodExecuting = TRUE; - Status = AcpiEvaluateObject (ReadHandle, NULL, - &ParamObjects, &ReturnObj); - - AcpiGbl_MethodExecuting = FALSE; - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not read from object, %s", - AcpiFormatException (Status)); - return (Status); - } - - RetValue = (ACPI_OBJECT *) ReturnObj.Pointer; - - switch (RetValue->Type) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_BUFFER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_PACKAGE: - /* - * Did we receive the type we wanted? Most important for the - * Integer/Buffer case (when a field is larger than an Integer, - * it should return a Buffer). - */ - if (RetValue->Type != ExpectedType) - { - AcpiOsPrintf (" Type mismatch: Expected %s, Received %s", - AcpiUtGetTypeName (ExpectedType), - AcpiUtGetTypeName (RetValue->Type)); - - AcpiOsFree (ReturnObj.Pointer); - return (AE_TYPE); - } - - *Value = RetValue; - break; - - default: - - AcpiOsPrintf (" Unsupported return object type, %s", - AcpiUtGetTypeName (RetValue->Type)); - - AcpiOsFree (ReturnObj.Pointer); - return (AE_TYPE); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbWriteToObject - * - * PARAMETERS: Node - Parent NS node for the object - * Value - Value to be written - * - * RETURN: Status - * - * DESCRIPTION: Performs a write to the specified object by invoking the - * special debugger control method that writes the object. Thus, - * the AML interpreter is doing all of the work, increasing the - * validity of the test. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbWriteToObject ( - ACPI_NAMESPACE_NODE *Node, - ACPI_OBJECT *Value) -{ - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[2]; - ACPI_STATUS Status; - - - Params[0].Type = ACPI_TYPE_LOCAL_REFERENCE; - Params[0].Reference.ActualType = Node->Type; - Params[0].Reference.Handle = ACPI_CAST_PTR (ACPI_HANDLE, Node); - - /* Copy the incoming user parameter */ - - memcpy (&Params[1], Value, sizeof (ACPI_OBJECT)); - - ParamObjects.Count = 2; - ParamObjects.Pointer = Params; - - AcpiGbl_MethodExecuting = TRUE; - Status = AcpiEvaluateObject (WriteHandle, NULL, &ParamObjects, NULL); - AcpiGbl_MethodExecuting = FALSE; - - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not write to object, %s", - AcpiFormatException (Status)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEvaluateAllPredefinedNames - * - * PARAMETERS: CountArg - Max number of methods to execute - * - * RETURN: None - * - * DESCRIPTION: Namespace batch execution. Execute predefined names in the - * namespace, up to the max count, if specified. - * - ******************************************************************************/ - -static void -AcpiDbEvaluateAllPredefinedNames ( - char *CountArg) -{ - ACPI_DB_EXECUTE_WALK Info; - - - Info.Count = 0; - Info.MaxCount = ACPI_UINT32_MAX; - - if (CountArg) - { - Info.MaxCount = strtoul (CountArg, NULL, 0); - } - - /* Search all nodes in namespace */ - - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbEvaluateOnePredefinedName, NULL, - (void *) &Info, NULL); - - AcpiOsPrintf ( - "Evaluated %u predefined names in the namespace\n", Info.Count); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbEvaluateOnePredefinedName - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status - * - * DESCRIPTION: Batch execution module. Currently only executes predefined - * ACPI names. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbEvaluateOnePredefinedName ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; - char *Pathname; - const ACPI_PREDEFINED_INFO *Predefined; - ACPI_DEVICE_INFO *ObjInfo; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - ACPI_OBJECT *ThisParam; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - UINT16 ArgTypeList; - UINT8 ArgCount; - UINT8 ArgType; - UINT32 i; - - - /* The name must be a predefined ACPI name */ - - Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); - if (!Predefined) - { - return (AE_OK); - } - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - return (AE_OK); - } - - Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); - if (!Pathname) - { - return (AE_OK); - } - - /* Get the object info for number of method parameters */ - - Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (Pathname); - return (Status); - } - - ParamObjects.Count = 0; - ParamObjects.Pointer = NULL; - - if (ObjInfo->Type == ACPI_TYPE_METHOD) - { - /* Setup default parameters (with proper types) */ - - ArgTypeList = Predefined->Info.ArgumentList; - ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); - - /* - * Setup the ACPI-required number of arguments, regardless of what - * the actual method defines. If there is a difference, then the - * method is wrong and a warning will be issued during execution. - */ - ThisParam = Params; - for (i = 0; i < ArgCount; i++) - { - ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); - ThisParam->Type = ArgType; - - switch (ArgType) - { - case ACPI_TYPE_INTEGER: - - ThisParam->Integer.Value = 1; - break; - - case ACPI_TYPE_STRING: - - ThisParam->String.Pointer = - "This is the default argument string"; - ThisParam->String.Length = - strlen (ThisParam->String.Pointer); - break; - - case ACPI_TYPE_BUFFER: - - ThisParam->Buffer.Pointer = (UINT8 *) Params; /* just a garbage buffer */ - ThisParam->Buffer.Length = 48; - break; - - case ACPI_TYPE_PACKAGE: - - ThisParam->Package.Elements = NULL; - ThisParam->Package.Count = 0; - break; - - default: - - AcpiOsPrintf ("%s: Unsupported argument type: %u\n", - Pathname, ArgType); - break; - } - - ThisParam++; - } - - ParamObjects.Count = ArgCount; - ParamObjects.Pointer = Params; - } - - ACPI_FREE (ObjInfo); - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - /* Do the actual method execution */ - - AcpiGbl_MethodExecuting = TRUE; - - Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj); - - AcpiOsPrintf ("%-32s returned %s\n", - Pathname, AcpiFormatException (Status)); - AcpiGbl_MethodExecuting = FALSE; - ACPI_FREE (Pathname); - - /* Ignore status from method execution */ - - Status = AE_OK; - - /* Update count, check if we have executed enough methods */ - - Info->Count++; - if (Info->Count >= Info->MaxCount) - { - Status = AE_CTRL_TERMINATE; - } - - return (Status); -} diff --git a/Private/acpiSDK/source/components/debugger/dbutils.c b/Private/acpiSDK/source/components/debugger/dbutils.c deleted file mode 100644 index 70664ee2..00000000 --- a/Private/acpiSDK/source/components/debugger/dbutils.c +++ /dev/null @@ -1,621 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbutils - AML debugger utilities - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "acnamesp.h" -#include "acdebug.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbutils") - - -/* Local prototypes */ - -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_STATUS -AcpiDbSecondPassParse ( - ACPI_PARSE_OBJECT *Root); - -void -AcpiDbDumpBuffer ( - UINT32 Address); -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbMatchArgument - * - * PARAMETERS: UserArgument - User command line - * Arguments - Array of commands to match against - * - * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found - * - * DESCRIPTION: Search command array for a command match - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE -AcpiDbMatchArgument ( - char *UserArgument, - ACPI_DB_ARGUMENT_INFO *Arguments) -{ - UINT32 i; - - - if (!UserArgument || UserArgument[0] == 0) - { - return (ACPI_TYPE_NOT_FOUND); - } - - for (i = 0; Arguments[i].Name; i++) - { - if (strstr ( - ACPI_CAST_PTR (char, Arguments[i].Name), - ACPI_CAST_PTR (char, UserArgument)) == Arguments[i].Name) - { - return (i); - } - } - - /* Argument not recognized */ - - return (ACPI_TYPE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSetOutputDestination - * - * PARAMETERS: OutputFlags - Current flags word - * - * RETURN: None - * - * DESCRIPTION: Set the current destination for debugger output. Also sets - * the debug output level accordingly. - * - ******************************************************************************/ - -void -AcpiDbSetOutputDestination ( - UINT32 OutputFlags) -{ - - AcpiGbl_DbOutputFlags = (UINT8) OutputFlags; - - if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && - AcpiGbl_DbOutputToFile) - { - AcpiDbgLevel = AcpiGbl_DbDebugLevel; - } - else - { - AcpiDbgLevel = AcpiGbl_DbConsoleDebugLevel; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpExternalObject - * - * PARAMETERS: ObjDesc - External ACPI object to dump - * Level - Nesting level. - * - * RETURN: None - * - * DESCRIPTION: Dump the contents of an ACPI external object - * - ******************************************************************************/ - -void -AcpiDbDumpExternalObject ( - ACPI_OBJECT *ObjDesc, - UINT32 Level) -{ - UINT32 i; - - - if (!ObjDesc) - { - AcpiOsPrintf ("[Null Object]\n"); - return; - } - - for (i = 0; i < Level; i++) - { - AcpiOsPrintf (" "); - } - - switch (ObjDesc->Type) - { - case ACPI_TYPE_ANY: - - AcpiOsPrintf ("[Null Object] (Type=0)\n"); - break; - - case ACPI_TYPE_INTEGER: - - AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - - case ACPI_TYPE_STRING: - - AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length); - AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); - AcpiOsPrintf ("\n"); - break; - - case ACPI_TYPE_BUFFER: - - AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); - if (ObjDesc->Buffer.Length) - { - if (ObjDesc->Buffer.Length > 16) - { - AcpiOsPrintf ("\n"); - } - - AcpiUtDebugDumpBuffer ( - ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), - ObjDesc->Buffer.Length, DB_BYTE_DISPLAY, _COMPONENT); - } - else - { - AcpiOsPrintf ("\n"); - } - break; - - case ACPI_TYPE_PACKAGE: - - AcpiOsPrintf ("[Package] Contains %u Elements:\n", - ObjDesc->Package.Count); - - for (i = 0; i < ObjDesc->Package.Count; i++) - { - AcpiDbDumpExternalObject ( - &ObjDesc->Package.Elements[i], Level+1); - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - AcpiOsPrintf ("[Object Reference] = "); - AcpiDbDisplayInternalObject (ObjDesc->Reference.Handle, NULL); - break; - - case ACPI_TYPE_PROCESSOR: - - AcpiOsPrintf ("[Processor]\n"); - break; - - case ACPI_TYPE_POWER: - - AcpiOsPrintf ("[Power Resource]\n"); - break; - - default: - - AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Type); - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbPrepNamestring - * - * PARAMETERS: Name - String to prepare - * - * RETURN: None - * - * DESCRIPTION: Translate all forward slashes and dots to backslashes. - * - ******************************************************************************/ - -void -AcpiDbPrepNamestring ( - char *Name) -{ - - if (!Name) - { - return; - } - - AcpiUtStrupr (Name); - - /* Convert a leading forward slash to a backslash */ - - if (*Name == '/') - { - *Name = '\\'; - } - - /* Ignore a leading backslash, this is the root prefix */ - - if (ACPI_IS_ROOT_PREFIX (*Name)) - { - Name++; - } - - /* Convert all slash path separators to dots */ - - while (*Name) - { - if ((*Name == '/') || - (*Name == '\\')) - { - *Name = '.'; - } - - Name++; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbLocalNsLookup - * - * PARAMETERS: Name - Name to lookup - * - * RETURN: Pointer to a namespace node, null on failure - * - * DESCRIPTION: Lookup a name in the ACPI namespace - * - * Note: Currently begins search from the root. Could be enhanced to use - * the current prefix (scope) node as the search beginning point. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiDbLocalNsLookup ( - char *Name) -{ - char *InternalPath; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node = NULL; - - - AcpiDbPrepNamestring (Name); - - /* Build an internal namestring */ - - Status = AcpiNsInternalizeName (Name, &InternalPath); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Invalid namestring: %s\n", Name); - return (NULL); - } - - /* - * Lookup the name. - * (Uses root node as the search starting point) - */ - Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not locate name: %s, %s\n", - Name, AcpiFormatException (Status)); - } - - ACPI_FREE (InternalPath); - return (Node); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbUint32ToHexString - * - * PARAMETERS: Value - The value to be converted to string - * Buffer - Buffer for result (not less than 11 bytes) - * - * RETURN: None - * - * DESCRIPTION: Convert the unsigned 32-bit value to the hexadecimal image - * - * NOTE: It is the caller's responsibility to ensure that the length of buffer - * is sufficient. - * - ******************************************************************************/ - -void -AcpiDbUint32ToHexString ( - UINT32 Value, - char *Buffer) -{ - int i; - - - if (Value == 0) - { - strcpy (Buffer, "0"); - return; - } - - Buffer[8] = '\0'; - - for (i = 7; i >= 0; i--) - { - Buffer[i] = AcpiGbl_UpperHexDigits [Value & 0x0F]; - Value = Value >> 4; - } -} - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiDbSecondPassParse - * - * PARAMETERS: Root - Root of the parse tree - * - * RETURN: Status - * - * DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until - * second pass to parse the control methods - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbSecondPassParse ( - ACPI_PARSE_OBJECT *Root) -{ - ACPI_PARSE_OBJECT *Op = Root; - ACPI_PARSE_OBJECT *Method; - ACPI_PARSE_OBJECT *SearchOp; - ACPI_PARSE_OBJECT *StartOp; - ACPI_STATUS Status = AE_OK; - UINT32 BaseAmlOffset; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("Pass two parse ....\n"); - - while (Op) - { - if (Op->Common.AmlOpcode == AML_METHOD_OP) - { - Method = Op; - - /* Create a new walk state for the parse */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - return (AE_NO_MEMORY); - } - - /* Init the Walk State */ - - WalkState->ParserState.Aml = - WalkState->ParserState.AmlStart = Method->Named.Data; - WalkState->ParserState.AmlEnd = - WalkState->ParserState.PkgEnd = Method->Named.Data + - Method->Named.Length; - WalkState->ParserState.StartScope = Op; - - WalkState->DescendingCallback = AcpiDsLoad1BeginOp; - WalkState->AscendingCallback = AcpiDsLoad1EndOp; - - /* Perform the AML parse */ - - Status = AcpiPsParseAml (WalkState); - - BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1; - StartOp = (Method->Common.Value.Arg)->Common.Next; - SearchOp = StartOp; - - while (SearchOp) - { - SearchOp->Common.AmlOffset += BaseAmlOffset; - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - } - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - /* TBD: [Investigate] this isn't quite the right thing to do! */ - /* - * - * Method = (ACPI_DEFERRED_OP *) Op; - * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength); - */ - } - - if (ACPI_FAILURE (Status)) - { - break; - } - - Op = AcpiPsGetDepthNext (Root, Op); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDumpBuffer - * - * PARAMETERS: Address - Pointer to the buffer - * - * RETURN: None - * - * DESCRIPTION: Print a portion of a buffer - * - ******************************************************************************/ - -void -AcpiDbDumpBuffer ( - UINT32 Address) -{ - - AcpiOsPrintf ("\nLocation %X:\n", Address); - - AcpiDbgLevel |= ACPI_LV_TABLES; - AcpiUtDebugDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY, - ACPI_UINT32_MAX); -} -#endif diff --git a/Private/acpiSDK/source/components/debugger/dbxface.c b/Private/acpiSDK/source/components/debugger/dbxface.c deleted file mode 100644 index 667e90e5..00000000 --- a/Private/acpiSDK/source/components/debugger/dbxface.c +++ /dev/null @@ -1,722 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbxface - AML Debugger external interfaces - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2023, 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. - * - ***************************************************************************** - * - * Alternatively, you may choose to be licensed under the terms of the - * following license: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Alternatively, you may choose to be licensed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - *****************************************************************************/ - -#include "acpi.h" -#include "accommon.h" -#include "amlcode.h" -#include "acdebug.h" -#include "acinterp.h" -#include "acparser.h" - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("dbxface") - - -/* Local prototypes */ - -static ACPI_STATUS -AcpiDbStartCommand ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -#ifdef ACPI_OBSOLETE_FUNCTIONS -void -AcpiDbMethodEnd ( - ACPI_WALK_STATE *WalkState); -#endif - -#ifdef ACPI_DISASSEMBLER -static ACPI_PARSE_OBJECT * -AcpiDbGetDisplayOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiDbStartCommand - * - * PARAMETERS: WalkState - Current walk - * Op - Current executing Op, from AML interpreter - * - * RETURN: Status - * - * DESCRIPTION: Enter debugger command loop - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDbStartCommand ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - - - /* TBD: [Investigate] are there namespace locking issues here? */ - - /* AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); */ - - /* Go into the command loop and await next user command */ - - - AcpiGbl_MethodExecuting = TRUE; - Status = AE_CTRL_TRUE; - - while (Status == AE_CTRL_TRUE) - { - /* Notify the completion of the command */ - - Status = AcpiOsNotifyCommandComplete (); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - /* Wait the readiness of the command */ - - Status = AcpiOsWaitCommandReady (); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op); - } - - /* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */ - -ErrorExit: - if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While parsing/handling command line")); - } - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSignalBreakPoint - * - * PARAMETERS: WalkState - Current walk - * - * RETURN: Status - * - * DESCRIPTION: Called for AML_BREAKPOINT_OP - * - ******************************************************************************/ - -void -AcpiDbSignalBreakPoint ( - ACPI_WALK_STATE *WalkState) -{ - -#ifndef ACPI_APPLICATION - if (AcpiGbl_DbThreadId != AcpiOsGetThreadId ()) - { - return; - } -#endif - - /* - * Set the single-step flag. This will cause the debugger (if present) - * to break to the console within the AML debugger at the start of the - * next AML instruction. - */ - AcpiGbl_CmSingleStep = TRUE; - AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"); -} - - -#ifdef ACPI_DISASSEMBLER -/******************************************************************************* - * - * FUNCTION: AcpiDbGetDisplayOp - * - * PARAMETERS: WalkState - Current walk - * Op - Current executing op (from aml interpreter) - * - * RETURN: Opcode to display - * - * DESCRIPTION: Find the opcode to display during single stepping - * - ******************************************************************************/ - -static ACPI_PARSE_OBJECT * -AcpiDbGetDisplayOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *DisplayOp; - ACPI_PARSE_OBJECT *ParentOp; - - DisplayOp = Op; - ParentOp = Op->Common.Parent; - if (ParentOp) - { - if ((WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_PREDICATE_EXECUTING)) - { - /* - * We are executing the predicate of an IF or WHILE statement - * Search upwards for the containing IF or WHILE so that the - * entire predicate can be displayed. - */ - while (ParentOp) - { - if ((ParentOp->Common.AmlOpcode == AML_IF_OP) || - (ParentOp->Common.AmlOpcode == AML_WHILE_OP)) - { - DisplayOp = ParentOp; - break; - } - ParentOp = ParentOp->Common.Parent; - } - } - else - { - while (ParentOp) - { - if ((ParentOp->Common.AmlOpcode == AML_IF_OP) || - (ParentOp->Common.AmlOpcode == AML_ELSE_OP) || - (ParentOp->Common.AmlOpcode == AML_SCOPE_OP) || - (ParentOp->Common.AmlOpcode == AML_METHOD_OP) || - (ParentOp->Common.AmlOpcode == AML_WHILE_OP)) - { - break; - } - DisplayOp = ParentOp; - ParentOp = ParentOp->Common.Parent; - } - } - } - return DisplayOp; -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbSingleStep - * - * PARAMETERS: WalkState - Current walk - * Op - Current executing op (from aml interpreter) - * OpcodeClass - Class of the current AML Opcode - * - * RETURN: Status - * - * DESCRIPTION: Called just before execution of an AML opcode. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDbSingleStep ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - UINT32 OpcodeClass) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_STATUS Status = AE_OK; - UINT32 OriginalDebugLevel; - UINT32 AmlOffset; - - - ACPI_FUNCTION_ENTRY (); - - -#ifndef ACPI_APPLICATION - if (AcpiGbl_DbThreadId != AcpiOsGetThreadId ()) - { - return (AE_OK); - } -#endif - - /* Check the abort flag */ - - if (AcpiGbl_AbortMethod) - { - AcpiGbl_AbortMethod = FALSE; - return (AE_ABORT_METHOD); - } - - AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, - WalkState->ParserState.AmlStart); - - /* Check for single-step breakpoint */ - - if (WalkState->MethodBreakpoint && - (WalkState->MethodBreakpoint <= AmlOffset)) - { - /* Check if the breakpoint has been reached or passed */ - /* Hit the breakpoint, resume single step, reset breakpoint */ - - AcpiOsPrintf ("***Break*** at AML offset %X\n", AmlOffset); - AcpiGbl_CmSingleStep = TRUE; - AcpiGbl_StepToNextCall = FALSE; - WalkState->MethodBreakpoint = 0; - } - - /* Check for user breakpoint (Must be on exact Aml offset) */ - - else if (WalkState->UserBreakpoint && - (WalkState->UserBreakpoint == AmlOffset)) - { - AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", - AmlOffset); - AcpiGbl_CmSingleStep = TRUE; - AcpiGbl_StepToNextCall = FALSE; - WalkState->MethodBreakpoint = 0; - } - - /* - * Check if this is an opcode that we are interested in -- - * namely, opcodes that have arguments - */ - if (Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) - { - return (AE_OK); - } - - switch (OpcodeClass) - { - case AML_CLASS_UNKNOWN: - case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */ - - return (AE_OK); - - default: - - /* All other opcodes -- continue */ - break; - } - - /* - * Under certain debug conditions, display this opcode and its operands - */ - if ((AcpiGbl_DbOutputToFile) || - (AcpiGbl_CmSingleStep) || - (AcpiDbgLevel & ACPI_LV_PARSE)) - { - if ((AcpiGbl_DbOutputToFile) || - (AcpiDbgLevel & ACPI_LV_PARSE)) - { - AcpiOsPrintf ("\nAML Debug: Next AML Opcode to execute:\n"); - } - - /* - * Display this op (and only this op - zero out the NEXT field - * temporarily, and disable parser trace output for the duration of - * the display because we don't want the extraneous debug output) - */ - OriginalDebugLevel = AcpiDbgLevel; - AcpiDbgLevel &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS); - Next = Op->Common.Next; - Op->Common.Next = NULL; - - /* Now we can disassemble and display it */ - -#ifdef ACPI_DISASSEMBLER - AcpiDmDisassemble (WalkState, AcpiDbGetDisplayOp (WalkState, Op), - ACPI_UINT32_MAX); -#else - /* - * The AML Disassembler is not configured - at least we can - * display the opcode value and name - */ - AcpiOsPrintf ("AML Opcode: %4.4X %s\n", Op->Common.AmlOpcode, - AcpiPsGetOpcodeName (Op->Common.AmlOpcode)); -#endif - - if ((Op->Common.AmlOpcode == AML_IF_OP) || - (Op->Common.AmlOpcode == AML_WHILE_OP)) - { - if (WalkState->ControlState->Common.Value) - { - AcpiOsPrintf ("Predicate = [True], IF block was executed\n"); - } - else - { - AcpiOsPrintf ("Predicate = [False], Skipping IF block\n"); - } - } - else if (Op->Common.AmlOpcode == AML_ELSE_OP) - { - AcpiOsPrintf ("Predicate = [False], ELSE block was executed\n"); - } - - /* Restore everything */ - - Op->Common.Next = Next; - AcpiOsPrintf ("\n"); - if ((AcpiGbl_DbOutputToFile) || - (AcpiDbgLevel & ACPI_LV_PARSE)) - { - AcpiOsPrintf ("\n"); - } - AcpiDbgLevel = OriginalDebugLevel; - } - - /* If we are not single stepping, just continue executing the method */ - - if (!AcpiGbl_CmSingleStep) - { - return (AE_OK); - } - - /* - * If we are executing a step-to-call command, - * Check if this is a method call. - */ - if (AcpiGbl_StepToNextCall) - { - if (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP) - { - /* Not a method call, just keep executing */ - - return (AE_OK); - } - - /* Found a method call, stop executing */ - - AcpiGbl_StepToNextCall = FALSE; - } - - /* - * If the next opcode is a method call, we will "step over" it - * by default. - */ - if (Op->Common.AmlOpcode == AML_INT_METHODCALL_OP) - { - /* Force no more single stepping while executing called method */ - - AcpiGbl_CmSingleStep = FALSE; - - /* - * Set the breakpoint on/before the call, it will stop execution - * as soon as we return - */ - WalkState->MethodBreakpoint = 1; /* Must be non-zero! */ - } - - - AcpiExExitInterpreter (); - Status = AcpiDbStartCommand (WalkState, Op); - AcpiExEnterInterpreter (); - - /* User commands complete, continue execution of the interrupted method */ - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiInitializeDebugger - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Init and start debugger - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInitializeDebugger ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiInitializeDebugger); - - - /* Init globals */ - - AcpiGbl_DbBuffer = NULL; - AcpiGbl_DbFilename = NULL; - AcpiGbl_DbOutputToFile = FALSE; - - AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2; - AcpiGbl_DbConsoleDebugLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES; - AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; - - AcpiGbl_DbOpt_NoIniMethods = FALSE; - AcpiGbl_DbOpt_NoRegionSupport = FALSE; - - AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); - if (!AcpiGbl_DbBuffer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - memset (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE); - - /* Initial scope is the root */ - - AcpiGbl_DbScopeBuf [0] = AML_ROOT_PREFIX; - AcpiGbl_DbScopeBuf [1] = 0; - AcpiGbl_DbScopeNode = AcpiGbl_RootNode; - - /* Initialize user commands loop */ - - AcpiGbl_DbTerminateLoop = FALSE; - - /* - * If configured for multi-thread support, the debug executor runs in - * a separate thread so that the front end can be in another address - * space, environment, or even another machine. - */ - if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) - { - /* These were created with one unit, grab it */ - - Status = AcpiOsInitializeDebugger (); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get debugger mutex\n"); - return_ACPI_STATUS (Status); - } - - /* Create the debug execution thread to execute commands */ - - AcpiGbl_DbThreadsTerminated = FALSE; - Status = AcpiOsExecute (OSL_DEBUGGER_MAIN_THREAD, - AcpiDbExecuteThread, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not start debugger thread")); - AcpiGbl_DbThreadsTerminated = TRUE; - return_ACPI_STATUS (Status); - } - } - else - { - AcpiGbl_DbThreadId = AcpiOsGetThreadId (); - } - - return_ACPI_STATUS (AE_OK); -} - -ACPI_EXPORT_SYMBOL (AcpiInitializeDebugger) - - -/******************************************************************************* - * - * FUNCTION: AcpiTerminateDebugger - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Stop debugger - * - ******************************************************************************/ - -void -AcpiTerminateDebugger ( - void) -{ - - /* Terminate the AML Debugger */ - - AcpiGbl_DbTerminateLoop = TRUE; - - if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) - { - /* Wait the AML Debugger threads */ - - while (!AcpiGbl_DbThreadsTerminated) - { - AcpiOsSleep (100); - } - - AcpiOsTerminateDebugger (); - } - - if (AcpiGbl_DbBuffer) - { - AcpiOsFree (AcpiGbl_DbBuffer); - AcpiGbl_DbBuffer = NULL; - } - - /* Ensure that debug output is now disabled */ - - AcpiGbl_DbOutputFlags = ACPI_DB_DISABLE_OUTPUT; -} - -ACPI_EXPORT_SYMBOL (AcpiTerminateDebugger) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetDebuggerThreadId - * - * PARAMETERS: ThreadId - Debugger thread ID - * - * RETURN: None - * - * DESCRIPTION: Set debugger thread ID - * - ******************************************************************************/ - -void -AcpiSetDebuggerThreadId ( - ACPI_THREAD_ID ThreadId) -{ - AcpiGbl_DbThreadId = ThreadId; -} - -ACPI_EXPORT_SYMBOL (AcpiSetDebuggerThreadId) |
