1 /*******************************************************************************
3 * Module Name: dbcmds - Miscellaneous debug commands and output routines
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
45 #include <contrib/dev/acpica/include/acpi.h>
46 #include <contrib/dev/acpica/include/accommon.h>
47 #include <contrib/dev/acpica/include/acevents.h>
48 #include <contrib/dev/acpica/include/acdebug.h>
49 #include <contrib/dev/acpica/include/acnamesp.h>
50 #include <contrib/dev/acpica/include/acresrc.h>
51 #include <contrib/dev/acpica/include/actables.h>
55 #define _COMPONENT ACPI_CA_DEBUGGER
56 ACPI_MODULE_NAME ("dbcmds")
59 /* Local prototypes */
62 AcpiDmCompareAmlResources (
64 ACPI_RSDESC_SIZE Aml1BufferLength,
66 ACPI_RSDESC_SIZE Aml2BufferLength);
69 AcpiDmTestResourceConversion (
70 ACPI_NAMESPACE_NODE *Node,
74 AcpiDbResourceCallback (
75 ACPI_RESOURCE *Resource,
79 AcpiDbDeviceResources (
80 ACPI_HANDLE ObjHandle,
86 AcpiDbDoOneSleepState (
90 /*******************************************************************************
92 * FUNCTION: AcpiDbConvertToNode
94 * PARAMETERS: InString - String to convert
96 * RETURN: Pointer to a NS node
98 * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
99 * alphanumeric strings.
101 ******************************************************************************/
103 ACPI_NAMESPACE_NODE *
104 AcpiDbConvertToNode (
107 ACPI_NAMESPACE_NODE *Node;
111 if ((*InString >= 0x30) && (*InString <= 0x39))
113 /* Numeric argument, convert */
115 Address = ACPI_STRTOUL (InString, NULL, 16);
116 Node = ACPI_TO_POINTER (Address);
117 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
119 AcpiOsPrintf ("Address %p is invalid in this address space\n",
124 /* Make sure pointer is valid NS node */
126 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
128 AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
129 Node, AcpiUtGetDescriptorName (Node));
136 * Alpha argument: The parameter is a name string that must be
137 * resolved to a Namespace object.
139 Node = AcpiDbLocalNsLookup (InString);
142 Node = AcpiGbl_RootNode;
150 /*******************************************************************************
152 * FUNCTION: AcpiDbSleep
154 * PARAMETERS: ObjectArg - Desired sleep state (0-5). NULL means
155 * invoke all possible sleep states.
159 * DESCRIPTION: Simulate sleep/wake sequences
161 ******************************************************************************/
171 ACPI_FUNCTION_TRACE (AcpiDbSleep);
174 /* Null input (no arguments) means to invoke all sleep states */
178 AcpiOsPrintf ("Invoking all possible sleep states, 0-%d\n",
181 for (i = 0; i <= ACPI_S_STATES_MAX; i++)
183 AcpiDbDoOneSleepState ((UINT8) i);
186 return_ACPI_STATUS (AE_OK);
189 /* Convert argument to binary and invoke the sleep state */
191 SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
192 AcpiDbDoOneSleepState (SleepState);
193 return_ACPI_STATUS (AE_OK);
197 /*******************************************************************************
199 * FUNCTION: AcpiDbDoOneSleepState
201 * PARAMETERS: SleepState - Desired sleep state (0-5)
205 * DESCRIPTION: Simulate a sleep/wake sequence
207 ******************************************************************************/
210 AcpiDbDoOneSleepState (
218 /* Validate parameter */
220 if (SleepState > ACPI_S_STATES_MAX)
222 AcpiOsPrintf ("Sleep state %d out of range (%d max)\n",
223 SleepState, ACPI_S_STATES_MAX);
227 AcpiOsPrintf ("\n---- Invoking sleep state S%d (%s):\n",
228 SleepState, AcpiGbl_SleepStateNames[SleepState]);
230 /* Get the values for the sleep type registers (for display only) */
232 Status = AcpiGetSleepTypeData (SleepState, &SleepTypeA, &SleepTypeB);
233 if (ACPI_FAILURE (Status))
235 AcpiOsPrintf ("Could not evaluate [%s] method, %s\n",
236 AcpiGbl_SleepStateNames[SleepState],
237 AcpiFormatException (Status));
242 "Register values for sleep state S%d: Sleep-A: %.2X, Sleep-B: %.2X\n",
243 SleepState, SleepTypeA, SleepTypeB);
245 /* Invoke the various sleep/wake interfaces */
247 AcpiOsPrintf ("**** Sleep: Prepare to sleep (S%d) ****\n",
249 Status = AcpiEnterSleepStatePrep (SleepState);
250 if (ACPI_FAILURE (Status))
255 AcpiOsPrintf ("**** Sleep: Going to sleep (S%d) ****\n",
257 Status = AcpiEnterSleepState (SleepState);
258 if (ACPI_FAILURE (Status))
263 AcpiOsPrintf ("**** Wake: Prepare to return from sleep (S%d) ****\n",
265 Status = AcpiLeaveSleepStatePrep (SleepState);
266 if (ACPI_FAILURE (Status))
271 AcpiOsPrintf ("**** Wake: Return from sleep (S%d) ****\n",
273 Status = AcpiLeaveSleepState (SleepState);
274 if (ACPI_FAILURE (Status))
283 ACPI_EXCEPTION ((AE_INFO, Status, "During invocation of sleep state S%d",
288 /*******************************************************************************
290 * FUNCTION: AcpiDbDisplayLocks
296 * DESCRIPTION: Display information about internal mutexes.
298 ******************************************************************************/
307 for (i = 0; i < ACPI_MAX_MUTEX; i++)
309 AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
310 AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
311 ? "Locked" : "Unlocked");
316 /*******************************************************************************
318 * FUNCTION: AcpiDbDisplayTableInfo
320 * PARAMETERS: TableArg - Name of table to be displayed
324 * DESCRIPTION: Display information about loaded tables. Current
325 * implementation displays all loaded tables.
327 ******************************************************************************/
330 AcpiDbDisplayTableInfo (
334 ACPI_TABLE_DESC *TableDesc;
340 AcpiOsPrintf ("Idx ID Status Type Sig Address Len Header\n");
342 /* Walk the entire root table list */
344 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
346 TableDesc = &AcpiGbl_RootTableList.Tables[i];
348 /* Index and Table ID */
350 AcpiOsPrintf ("%3u %.2u ", i, TableDesc->OwnerId);
352 /* Decode the table flags */
354 if (!(TableDesc->Flags & ACPI_TABLE_IS_LOADED))
356 AcpiOsPrintf ("NotLoaded ");
360 AcpiOsPrintf (" Loaded ");
363 switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
365 case ACPI_TABLE_ORIGIN_UNKNOWN:
367 AcpiOsPrintf ("Unknown ");
370 case ACPI_TABLE_ORIGIN_MAPPED:
372 AcpiOsPrintf ("Mapped ");
375 case ACPI_TABLE_ORIGIN_ALLOCATED:
377 AcpiOsPrintf ("Allocated ");
380 case ACPI_TABLE_ORIGIN_OVERRIDE:
382 AcpiOsPrintf ("Override ");
387 AcpiOsPrintf ("INVALID ");
391 /* Make sure that the table is mapped */
393 Status = AcpiTbVerifyTable (TableDesc);
394 if (ACPI_FAILURE (Status))
399 /* Dump the table header */
401 if (TableDesc->Pointer)
403 AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
407 /* If the pointer is null, the table has been unloaded */
409 ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded",
410 TableDesc->Signature.Ascii));
416 /*******************************************************************************
418 * FUNCTION: AcpiDbUnloadAcpiTable
420 * PARAMETERS: ObjectName - Namespace pathname for an object that
421 * is owned by the table to be unloaded
425 * DESCRIPTION: Unload an ACPI table, via any namespace node that is owned
428 ******************************************************************************/
431 AcpiDbUnloadAcpiTable (
434 ACPI_NAMESPACE_NODE *Node;
438 /* Translate name to an Named object */
440 Node = AcpiDbConvertToNode (ObjectName);
443 AcpiOsPrintf ("Could not find [%s] in namespace\n",
448 Status = AcpiUnloadParentTable (ACPI_CAST_PTR (ACPI_HANDLE, Node));
449 if (ACPI_SUCCESS (Status))
451 AcpiOsPrintf ("Parent of [%s] (%p) unloaded and uninstalled\n",
456 AcpiOsPrintf ("%s, while unloading parent table of [%s]\n",
457 AcpiFormatException (Status), ObjectName);
462 /*******************************************************************************
464 * FUNCTION: AcpiDbSendNotify
466 * PARAMETERS: Name - Name of ACPI object where to send notify
467 * Value - Value of the notify to send.
471 * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
472 * named object as an ACPI notify.
474 ******************************************************************************/
481 ACPI_NAMESPACE_NODE *Node;
485 /* Translate name to an Named object */
487 Node = AcpiDbConvertToNode (Name);
493 /* Dispatch the notify if legal */
495 if (AcpiEvIsNotifyObject (Node))
497 Status = AcpiEvQueueNotifyRequest (Node, Value);
498 if (ACPI_FAILURE (Status))
500 AcpiOsPrintf ("Could not queue notify\n");
506 "Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n",
507 AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type));
512 /*******************************************************************************
514 * FUNCTION: AcpiDbDisplayInterfaces
516 * PARAMETERS: ActionArg - Null, "install", or "remove"
517 * InterfaceNameArg - Name for install/remove options
521 * DESCRIPTION: Display or modify the global _OSI interface list
523 ******************************************************************************/
526 AcpiDbDisplayInterfaces (
528 char *InterfaceNameArg)
530 ACPI_INTERFACE_INFO *NextInterface;
535 /* If no arguments, just display current interface list */
539 (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex,
542 NextInterface = AcpiGbl_SupportedInterfaces;
543 while (NextInterface)
545 if (!(NextInterface->Flags & ACPI_OSI_INVALID))
547 AcpiOsPrintf ("%s\n", NextInterface->Name);
549 NextInterface = NextInterface->Next;
552 AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
556 /* If ActionArg exists, so must InterfaceNameArg */
558 if (!InterfaceNameArg)
560 AcpiOsPrintf ("Missing Interface Name argument\n");
564 /* Uppercase the action for match below */
566 AcpiUtStrupr (ActionArg);
568 /* Install - install an interface */
570 SubString = ACPI_STRSTR ("INSTALL", ActionArg);
573 Status = AcpiInstallInterface (InterfaceNameArg);
574 if (ACPI_FAILURE (Status))
576 AcpiOsPrintf ("%s, while installing \"%s\"\n",
577 AcpiFormatException (Status), InterfaceNameArg);
582 /* Remove - remove an interface */
584 SubString = ACPI_STRSTR ("REMOVE", ActionArg);
587 Status = AcpiRemoveInterface (InterfaceNameArg);
588 if (ACPI_FAILURE (Status))
590 AcpiOsPrintf ("%s, while removing \"%s\"\n",
591 AcpiFormatException (Status), InterfaceNameArg);
596 /* Invalid ActionArg */
598 AcpiOsPrintf ("Invalid action argument: %s\n", ActionArg);
603 /*******************************************************************************
605 * FUNCTION: AcpiDbDisplayTemplate
607 * PARAMETERS: BufferArg - Buffer name or address
611 * DESCRIPTION: Dump a buffer that contains a resource template
613 ******************************************************************************/
616 AcpiDbDisplayTemplate (
619 ACPI_NAMESPACE_NODE *Node;
621 ACPI_BUFFER ReturnBuffer;
624 /* Translate BufferArg to an Named object */
626 Node = AcpiDbConvertToNode (BufferArg);
627 if (!Node || (Node == AcpiGbl_RootNode))
629 AcpiOsPrintf ("Invalid argument: %s\n", BufferArg);
633 /* We must have a buffer object */
635 if (Node->Type != ACPI_TYPE_BUFFER)
637 AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n",
642 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
643 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
645 /* Attempt to convert the raw buffer to a resource list */
647 Status = AcpiRsCreateResourceList (Node->Object, &ReturnBuffer);
649 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
650 AcpiDbgLevel |= ACPI_LV_RESOURCES;
652 if (ACPI_FAILURE (Status))
654 AcpiOsPrintf ("Could not convert Buffer to a resource list: %s, %s\n",
655 BufferArg, AcpiFormatException (Status));
659 /* Now we can dump the resource list */
661 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
662 ReturnBuffer.Pointer));
665 AcpiOsPrintf ("\nRaw data buffer:\n");
666 AcpiUtDebugDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer,
667 Node->Object->Buffer.Length,
668 DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
670 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
675 /*******************************************************************************
677 * FUNCTION: AcpiDmCompareAmlResources
679 * PARAMETERS: Aml1Buffer - Contains first resource list
680 * Aml1BufferLength - Length of first resource list
681 * Aml2Buffer - Contains second resource list
682 * Aml2BufferLength - Length of second resource list
686 * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in
687 * order to isolate a miscompare to an individual resource)
689 ******************************************************************************/
692 AcpiDmCompareAmlResources (
694 ACPI_RSDESC_SIZE Aml1BufferLength,
696 ACPI_RSDESC_SIZE Aml2BufferLength)
702 ACPI_RSDESC_SIZE Aml1Length;
703 ACPI_RSDESC_SIZE Aml2Length;
704 ACPI_RSDESC_SIZE Offset = 0;
710 /* Compare overall buffer sizes (may be different due to size rounding) */
712 if (Aml1BufferLength != Aml2BufferLength)
715 "**** Buffer length mismatch in converted AML: Original %X, New %X ****\n",
716 Aml1BufferLength, Aml2BufferLength);
721 Aml1End = Aml1Buffer + Aml1BufferLength;
722 Aml2End = Aml2Buffer + Aml2BufferLength;
724 /* Walk the descriptor lists, comparing each descriptor */
726 while ((Aml1 < Aml1End) && (Aml2 < Aml2End))
728 /* Get the lengths of each descriptor */
730 Aml1Length = AcpiUtGetDescriptorLength (Aml1);
731 Aml2Length = AcpiUtGetDescriptorLength (Aml2);
732 ResourceType = AcpiUtGetResourceType (Aml1);
734 /* Check for descriptor length match */
736 if (Aml1Length != Aml2Length)
739 "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X Len1 %X, Len2 %X ****\n",
740 Count, ResourceType, Offset, Aml1Length, Aml2Length);
743 /* Check for descriptor byte match */
745 else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length))
748 "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
749 Count, ResourceType, Offset);
751 for (i = 0; i < Aml1Length; i++)
753 if (Aml1[i] != Aml2[i])
756 "Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n",
757 i, Aml2[i], Aml1[i]);
762 /* Exit on EndTag descriptor */
764 if (ResourceType == ACPI_RESOURCE_NAME_END_TAG)
769 /* Point to next descriptor in each buffer */
772 Offset += Aml1Length;
779 /*******************************************************************************
781 * FUNCTION: AcpiDmTestResourceConversion
783 * PARAMETERS: Node - Parent device node
784 * Name - resource method name (_CRS)
788 * DESCRIPTION: Compare the original AML with a conversion of the AML to
789 * internal resource list, then back to AML.
791 ******************************************************************************/
794 AcpiDmTestResourceConversion (
795 ACPI_NAMESPACE_NODE *Node,
799 ACPI_BUFFER ReturnBuffer;
800 ACPI_BUFFER ResourceBuffer;
802 ACPI_OBJECT *OriginalAml;
805 AcpiOsPrintf ("Resource Conversion Comparison:\n");
807 NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
808 ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
809 ResourceBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
811 /* Get the original _CRS AML resource template */
813 Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnBuffer);
814 if (ACPI_FAILURE (Status))
816 AcpiOsPrintf ("Could not obtain %s: %s\n",
817 Name, AcpiFormatException (Status));
821 /* Get the AML resource template, converted to internal resource structs */
823 Status = AcpiGetCurrentResources (Node, &ResourceBuffer);
824 if (ACPI_FAILURE (Status))
826 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
827 AcpiFormatException (Status));
831 /* Convert internal resource list to external AML resource template */
833 Status = AcpiRsCreateAmlResources (ResourceBuffer.Pointer, &NewAml);
834 if (ACPI_FAILURE (Status))
836 AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n",
837 AcpiFormatException (Status));
841 /* Compare original AML to the newly created AML resource list */
843 OriginalAml = ReturnBuffer.Pointer;
845 AcpiDmCompareAmlResources (
846 OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length,
847 NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length);
849 /* Cleanup and exit */
851 ACPI_FREE (NewAml.Pointer);
853 ACPI_FREE (ResourceBuffer.Pointer);
855 ACPI_FREE (ReturnBuffer.Pointer);
860 /*******************************************************************************
862 * FUNCTION: AcpiDbResourceCallback
864 * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK
868 * DESCRIPTION: Simple callback to exercise AcpiWalkResources and
869 * AcpiWalkResourceBuffer.
871 ******************************************************************************/
874 AcpiDbResourceCallback (
875 ACPI_RESOURCE *Resource,
883 /*******************************************************************************
885 * FUNCTION: AcpiDbDeviceResources
887 * PARAMETERS: ACPI_WALK_CALLBACK
891 * DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object.
893 ******************************************************************************/
896 AcpiDbDeviceResources (
897 ACPI_HANDLE ObjHandle,
902 ACPI_NAMESPACE_NODE *Node;
903 ACPI_NAMESPACE_NODE *PrtNode = NULL;
904 ACPI_NAMESPACE_NODE *CrsNode = NULL;
905 ACPI_NAMESPACE_NODE *PrsNode = NULL;
906 ACPI_NAMESPACE_NODE *AeiNode = NULL;
908 ACPI_BUFFER ReturnBuffer;
912 Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
913 ParentPath = AcpiNsGetExternalPathname (Node);
916 return (AE_NO_MEMORY);
919 /* Get handles to the resource methods for this device */
921 (void) AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode));
922 (void) AcpiGetHandle (Node, METHOD_NAME__CRS, ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode));
923 (void) AcpiGetHandle (Node, METHOD_NAME__PRS, ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode));
924 (void) AcpiGetHandle (Node, METHOD_NAME__AEI, ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode));
925 if (!PrtNode && !CrsNode && !PrsNode && !AeiNode)
927 goto Cleanup; /* Nothing to do */
930 AcpiOsPrintf ("\nDevice: %s\n", ParentPath);
932 /* Prepare for a return object of arbitrary size */
934 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
935 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
942 AcpiOsPrintf ("Evaluating _PRT\n");
944 Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnBuffer);
945 if (ACPI_FAILURE (Status))
947 AcpiOsPrintf ("Could not evaluate _PRT: %s\n",
948 AcpiFormatException (Status));
952 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
953 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
955 Status = AcpiGetIrqRoutingTable (Node, &ReturnBuffer);
956 if (ACPI_FAILURE (Status))
958 AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
959 AcpiFormatException (Status));
963 AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
972 AcpiOsPrintf ("Evaluating _CRS\n");
974 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
975 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
977 Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnBuffer);
978 if (ACPI_FAILURE (Status))
980 AcpiOsPrintf ("Could not evaluate _CRS: %s\n",
981 AcpiFormatException (Status));
985 /* This code exercises the AcpiWalkResources interface */
987 Status = AcpiWalkResources (Node, METHOD_NAME__CRS,
988 AcpiDbResourceCallback, NULL);
989 if (ACPI_FAILURE (Status))
991 AcpiOsPrintf ("AcpiWalkResources failed: %s\n",
992 AcpiFormatException (Status));
996 /* Get the _CRS resource list (test ALLOCATE buffer) */
998 ReturnBuffer.Pointer = NULL;
999 ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1001 Status = AcpiGetCurrentResources (Node, &ReturnBuffer);
1002 if (ACPI_FAILURE (Status))
1004 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
1005 AcpiFormatException (Status));
1009 /* This code exercises the AcpiWalkResourceBuffer interface */
1011 Status = AcpiWalkResourceBuffer (&ReturnBuffer,
1012 AcpiDbResourceCallback, NULL);
1013 if (ACPI_FAILURE (Status))
1015 AcpiOsPrintf ("AcpiWalkResourceBuffer failed: %s\n",
1016 AcpiFormatException (Status));
1020 /* Dump the _CRS resource list */
1022 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
1023 ReturnBuffer.Pointer));
1026 * Perform comparison of original AML to newly created AML. This
1027 * tests both the AML->Resource conversion and the Resource->AML
1030 (void) AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
1032 /* Execute _SRS with the resource list */
1034 AcpiOsPrintf ("Evaluating _SRS\n");
1036 Status = AcpiSetCurrentResources (Node, &ReturnBuffer);
1037 if (ACPI_FAILURE (Status))
1039 AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
1040 AcpiFormatException (Status));
1045 ACPI_FREE_BUFFER (ReturnBuffer);
1054 AcpiOsPrintf ("Evaluating _PRS\n");
1056 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
1057 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
1059 Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnBuffer);
1060 if (ACPI_FAILURE (Status))
1062 AcpiOsPrintf ("Could not evaluate _PRS: %s\n",
1063 AcpiFormatException (Status));
1067 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
1068 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
1070 Status = AcpiGetPossibleResources (Node, &ReturnBuffer);
1071 if (ACPI_FAILURE (Status))
1073 AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
1074 AcpiFormatException (Status));
1078 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
1087 AcpiOsPrintf ("Evaluating _AEI\n");
1089 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
1090 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
1092 Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnBuffer);
1093 if (ACPI_FAILURE (Status))
1095 AcpiOsPrintf ("Could not evaluate _AEI: %s\n",
1096 AcpiFormatException (Status));
1100 ReturnBuffer.Pointer = AcpiGbl_DbBuffer;
1101 ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
1103 Status = AcpiGetEventResources (Node, &ReturnBuffer);
1104 if (ACPI_FAILURE (Status))
1106 AcpiOsPrintf ("AcpiGetEventResources failed: %s\n",
1107 AcpiFormatException (Status));
1111 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
1116 ACPI_FREE (ParentPath);
1121 /*******************************************************************************
1123 * FUNCTION: AcpiDbDisplayResources
1125 * PARAMETERS: ObjectArg - String object name or object pointer.
1126 * NULL or "*" means "display resources for
1131 * DESCRIPTION: Display the resource objects associated with a device.
1133 ******************************************************************************/
1136 AcpiDbDisplayResources (
1139 ACPI_NAMESPACE_NODE *Node;
1142 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1143 AcpiDbgLevel |= ACPI_LV_RESOURCES;
1145 /* Asterisk means "display resources for all devices" */
1147 if (!ObjectArg || (!ACPI_STRCMP (ObjectArg, "*")))
1149 (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1150 ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL);
1154 /* Convert string to object pointer */
1156 Node = AcpiDbConvertToNode (ObjectArg);
1159 if (Node->Type != ACPI_TYPE_DEVICE)
1161 AcpiOsPrintf ("%4.4s: Name is not a device object (%s)\n",
1162 Node->Name.Ascii, AcpiUtGetTypeName (Node->Type));
1166 (void) AcpiDbDeviceResources (Node, 0, NULL, NULL);
1171 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1175 #if (!ACPI_REDUCED_HARDWARE)
1176 /*******************************************************************************
1178 * FUNCTION: AcpiDbGenerateGpe
1180 * PARAMETERS: GpeArg - Raw GPE number, ascii string
1181 * BlockArg - GPE block number, ascii string
1182 * 0 or 1 for FADT GPE blocks
1186 * DESCRIPTION: Simulate firing of a GPE
1188 ******************************************************************************/
1197 ACPI_GPE_EVENT_INFO *GpeEventInfo;
1200 GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0);
1201 BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
1204 GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber),
1208 AcpiOsPrintf ("Invalid GPE\n");
1212 (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
1219 AcpiEvSciDispatch ();
1222 #endif /* !ACPI_REDUCED_HARDWARE */
1224 #endif /* ACPI_DEBUGGER */