1 /*******************************************************************************
3 * Module Name: dbcmds - Miscellaneous debug commands and output routines
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2011, 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 /*******************************************************************************
88 * FUNCTION: AcpiDbConvertToNode
90 * PARAMETERS: InString - String to convert
92 * RETURN: Pointer to a NS node
94 * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
97 ******************************************************************************/
100 AcpiDbConvertToNode (
103 ACPI_NAMESPACE_NODE *Node;
106 if ((*InString >= 0x30) && (*InString <= 0x39))
108 /* Numeric argument, convert */
110 Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16));
111 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
113 AcpiOsPrintf ("Address %p is invalid in this address space\n",
118 /* Make sure pointer is valid NS node */
120 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
122 AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
123 Node, AcpiUtGetDescriptorName (Node));
130 /* The parameter is a name string that must be resolved to a
133 Node = AcpiDbLocalNsLookup (InString);
136 Node = AcpiGbl_RootNode;
144 /*******************************************************************************
146 * FUNCTION: AcpiDbSleep
148 * PARAMETERS: ObjectArg - Desired sleep state (0-5)
152 * DESCRIPTION: Simulate a sleep/wake sequence
154 ******************************************************************************/
164 SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
166 AcpiOsPrintf ("**** Prepare to sleep ****\n");
167 Status = AcpiEnterSleepStatePrep (SleepState);
168 if (ACPI_FAILURE (Status))
173 AcpiOsPrintf ("**** Going to sleep ****\n");
174 Status = AcpiEnterSleepState (SleepState);
175 if (ACPI_FAILURE (Status))
180 AcpiOsPrintf ("**** returning from sleep ****\n");
181 Status = AcpiLeaveSleepState (SleepState);
186 /*******************************************************************************
188 * FUNCTION: AcpiDbDisplayLocks
194 * DESCRIPTION: Display information about internal mutexes.
196 ******************************************************************************/
205 for (i = 0; i < ACPI_MAX_MUTEX; i++)
207 AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
208 AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
209 ? "Locked" : "Unlocked");
214 /*******************************************************************************
216 * FUNCTION: AcpiDbDisplayTableInfo
218 * PARAMETERS: TableArg - String with name of table to be displayed
222 * DESCRIPTION: Display information about loaded tables. Current
223 * implementation displays all loaded tables.
225 ******************************************************************************/
228 AcpiDbDisplayTableInfo (
232 ACPI_TABLE_DESC *TableDesc;
236 /* Walk the entire root table list */
238 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
240 TableDesc = &AcpiGbl_RootTableList.Tables[i];
241 AcpiOsPrintf ("%u ", i);
243 /* Make sure that the table is mapped */
245 Status = AcpiTbVerifyTable (TableDesc);
246 if (ACPI_FAILURE (Status))
251 /* Dump the table header */
253 if (TableDesc->Pointer)
255 AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
259 /* If the pointer is null, the table has been unloaded */
261 ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded",
262 TableDesc->Signature.Ascii));
268 /*******************************************************************************
270 * FUNCTION: AcpiDbUnloadAcpiTable
272 * PARAMETERS: TableArg - Name of the table to be unloaded
273 * InstanceArg - Which instance of the table to unload (if
274 * there are multiple tables of the same type)
278 * DESCRIPTION: Unload an ACPI table.
279 * Instance is not implemented
281 ******************************************************************************/
284 AcpiDbUnloadAcpiTable (
288 /* TBD: Need to reimplement for new data structures */
295 /* Search all tables for the target type */
297 for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++)
299 if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
300 AcpiGbl_TableData[i].SigLength))
302 /* Found the table, unload it */
304 Status = AcpiUnloadTable (i);
305 if (ACPI_SUCCESS (Status))
307 AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg);
311 AcpiOsPrintf ("%s, while unloading [%s]\n",
312 AcpiFormatException (Status), TableArg);
319 AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);
324 /*******************************************************************************
326 * FUNCTION: AcpiDbSendNotify
328 * PARAMETERS: Name - Name of ACPI object to send the notify to
329 * Value - Value of the notify to send.
333 * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
334 * named object as an ACPI notify.
336 ******************************************************************************/
343 ACPI_NAMESPACE_NODE *Node;
347 /* Translate name to an Named object */
349 Node = AcpiDbConvertToNode (Name);
355 /* Decode Named object type */
359 case ACPI_TYPE_DEVICE:
360 case ACPI_TYPE_THERMAL:
362 /* Send the notify */
364 Status = AcpiEvQueueNotifyRequest (Node, Value);
365 if (ACPI_FAILURE (Status))
367 AcpiOsPrintf ("Could not queue notify\n");
372 AcpiOsPrintf ("Named object is not a device or a thermal object\n");
378 /*******************************************************************************
380 * FUNCTION: AcpiDbDisplayInterfaces
382 * PARAMETERS: ActionArg - Null, "install", or "remove"
383 * InterfaceNameArg - Name for install/remove options
387 * DESCRIPTION: Display or modify the global _OSI interface list
389 ******************************************************************************/
392 AcpiDbDisplayInterfaces (
394 char *InterfaceNameArg)
396 ACPI_INTERFACE_INFO *NextInterface;
401 /* If no arguments, just display current interface list */
405 (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex,
408 NextInterface = AcpiGbl_SupportedInterfaces;
410 while (NextInterface)
412 if (!(NextInterface->Flags & ACPI_OSI_INVALID))
414 AcpiOsPrintf ("%s\n", NextInterface->Name);
416 NextInterface = NextInterface->Next;
419 AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
423 /* If ActionArg exists, so must InterfaceNameArg */
425 if (!InterfaceNameArg)
427 AcpiOsPrintf ("Missing Interface Name argument\n");
431 /* Uppercase the action for match below */
433 AcpiUtStrupr (ActionArg);
435 /* Install - install an interface */
437 SubString = ACPI_STRSTR ("INSTALL", ActionArg);
440 Status = AcpiInstallInterface (InterfaceNameArg);
441 if (ACPI_FAILURE (Status))
443 AcpiOsPrintf ("%s, while installing \"%s\"\n",
444 AcpiFormatException (Status), InterfaceNameArg);
449 /* Remove - remove an interface */
451 SubString = ACPI_STRSTR ("REMOVE", ActionArg);
454 Status = AcpiRemoveInterface (InterfaceNameArg);
455 if (ACPI_FAILURE (Status))
457 AcpiOsPrintf ("%s, while removing \"%s\"\n",
458 AcpiFormatException (Status), InterfaceNameArg);
463 /* Invalid ActionArg */
465 AcpiOsPrintf ("Invalid action argument: %s\n", ActionArg);
470 /*******************************************************************************
472 * FUNCTION: AcpiDbDisplayTemplate
474 * PARAMETERS: BufferArg - Buffer name or addrss
478 * DESCRIPTION: Dump a buffer that contains a resource template
480 ******************************************************************************/
483 AcpiDbDisplayTemplate (
486 ACPI_NAMESPACE_NODE *Node;
488 ACPI_BUFFER ReturnObj;
491 /* Translate BufferArg to an Named object */
493 Node = AcpiDbConvertToNode (BufferArg);
494 if (!Node || (Node == AcpiGbl_RootNode))
496 AcpiOsPrintf ("Invalid argument: %s\n", BufferArg);
500 /* We must have a buffer object */
502 if (Node->Type != ACPI_TYPE_BUFFER)
504 AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n",
509 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
510 ReturnObj.Pointer = AcpiGbl_DbBuffer;
512 /* Attempt to convert the raw buffer to a resource list */
514 Status = AcpiRsCreateResourceList (Node->Object, &ReturnObj);
516 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
517 AcpiDbgLevel |= ACPI_LV_RESOURCES;
519 if (ACPI_FAILURE (Status))
521 AcpiOsPrintf ("Could not convert Buffer to a resource list: %s, %s\n",
522 BufferArg, AcpiFormatException (Status));
526 /* Now we can dump the resource list */
528 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
532 AcpiOsPrintf ("\nRaw data buffer:\n");
533 AcpiUtDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer,
534 Node->Object->Buffer.Length,
535 DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
537 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
542 /*******************************************************************************
544 * FUNCTION: AcpiDmCompareAmlResources
546 * PARAMETERS: Aml1Buffer - Contains first resource list
547 * Aml1BufferLength - Length of first resource list
548 * Aml2Buffer - Contains second resource list
549 * Aml2BufferLength - Length of second resource list
553 * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in
554 * order to isolate a miscompare to an individual resource)
556 ******************************************************************************/
559 AcpiDmCompareAmlResources (
561 ACPI_RSDESC_SIZE Aml1BufferLength,
563 ACPI_RSDESC_SIZE Aml2BufferLength)
569 ACPI_RSDESC_SIZE Aml1Length;
570 ACPI_RSDESC_SIZE Aml2Length;
571 ACPI_RSDESC_SIZE Offset = 0;
577 /* Compare overall buffer sizes (may be different due to size rounding) */
579 if (Aml1BufferLength != Aml2BufferLength)
582 "**** Buffer length mismatch in converted AML: Original %X, New %X ****\n",
583 Aml1BufferLength, Aml2BufferLength);
588 Aml1End = Aml1Buffer + Aml1BufferLength;
589 Aml2End = Aml2Buffer + Aml2BufferLength;
591 /* Walk the descriptor lists, comparing each descriptor */
593 while ((Aml1 < Aml1End) && (Aml2 < Aml2End))
595 /* Get the lengths of each descriptor */
597 Aml1Length = AcpiUtGetDescriptorLength (Aml1);
598 Aml2Length = AcpiUtGetDescriptorLength (Aml2);
599 ResourceType = AcpiUtGetResourceType (Aml1);
601 /* Check for descriptor length match */
603 if (Aml1Length != Aml2Length)
606 "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X Len1 %X, Len2 %X ****\n",
607 Count, ResourceType, Offset, Aml1Length, Aml2Length);
610 /* Check for descriptor byte match */
612 else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length))
615 "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
616 Count, ResourceType, Offset);
618 for (i = 0; i < Aml1Length; i++)
620 if (Aml1[i] != Aml2[i])
622 AcpiOsPrintf ("Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n",
623 i, Aml2[i], Aml1[i]);
628 /* Exit on EndTag descriptor */
630 if (ResourceType == ACPI_RESOURCE_NAME_END_TAG)
635 /* Point to next descriptor in each buffer */
638 Offset += Aml1Length;
645 /*******************************************************************************
647 * FUNCTION: AcpiDmTestResourceConversion
649 * PARAMETERS: Node - Parent device node
650 * Name - resource method name (_CRS)
654 * DESCRIPTION: Compare the original AML with a conversion of the AML to
655 * internal resource list, then back to AML.
657 ******************************************************************************/
660 AcpiDmTestResourceConversion (
661 ACPI_NAMESPACE_NODE *Node,
665 ACPI_BUFFER ReturnObj;
666 ACPI_BUFFER ResourceObj;
668 ACPI_OBJECT *OriginalAml;
671 AcpiOsPrintf ("Resource Conversion Comparison:\n");
673 NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
674 ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
675 ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
677 /* Get the original _CRS AML resource template */
679 Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj);
680 if (ACPI_FAILURE (Status))
682 AcpiOsPrintf ("Could not obtain %s: %s\n",
683 Name, AcpiFormatException (Status));
687 /* Get the AML resource template, converted to internal resource structs */
689 Status = AcpiGetCurrentResources (Node, &ResourceObj);
690 if (ACPI_FAILURE (Status))
692 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
693 AcpiFormatException (Status));
697 /* Convert internal resource list to external AML resource template */
699 Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml);
700 if (ACPI_FAILURE (Status))
702 AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n",
703 AcpiFormatException (Status));
707 /* Compare original AML to the newly created AML resource list */
709 OriginalAml = ReturnObj.Pointer;
711 AcpiDmCompareAmlResources (
712 OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length,
713 NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length);
715 /* Cleanup and exit */
717 ACPI_FREE (NewAml.Pointer);
719 ACPI_FREE (ResourceObj.Pointer);
721 ACPI_FREE (ReturnObj.Pointer);
726 /*******************************************************************************
728 * FUNCTION: AcpiDbResourceCallback
730 * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK
734 * DESCRIPTION: Simple callback to exercise AcpiWalkResources
736 ******************************************************************************/
739 AcpiDbResourceCallback (
740 ACPI_RESOURCE *Resource,
748 /*******************************************************************************
750 * FUNCTION: AcpiDbDeviceResources
752 * PARAMETERS: ACPI_WALK_CALLBACK
756 * DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object.
758 ******************************************************************************/
761 AcpiDbDeviceResources (
762 ACPI_HANDLE ObjHandle,
767 ACPI_NAMESPACE_NODE *Node;
768 ACPI_NAMESPACE_NODE *PrtNode = NULL;
769 ACPI_NAMESPACE_NODE *CrsNode = NULL;
770 ACPI_NAMESPACE_NODE *PrsNode = NULL;
771 ACPI_NAMESPACE_NODE *AeiNode = NULL;
773 ACPI_BUFFER ReturnObj;
777 Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
778 ParentPath = AcpiNsGetExternalPathname (Node);
781 return (AE_NO_MEMORY);
784 /* Get handles to the resource methods for this device */
786 (void) AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode));
787 (void) AcpiGetHandle (Node, METHOD_NAME__CRS, ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode));
788 (void) AcpiGetHandle (Node, METHOD_NAME__PRS, ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode));
789 (void) AcpiGetHandle (Node, METHOD_NAME__AEI, ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode));
790 if (!PrtNode && !CrsNode && !PrsNode && !AeiNode)
792 goto Cleanup; /* Nothing to do */
795 AcpiOsPrintf ("\nDevice: %s\n", ParentPath);
797 /* Prepare for a return object of arbitrary size */
799 ReturnObj.Pointer = AcpiGbl_DbBuffer;
800 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
807 AcpiOsPrintf ("Evaluating _PRT\n");
809 Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnObj);
810 if (ACPI_FAILURE (Status))
812 AcpiOsPrintf ("Could not evaluate _PRT: %s\n",
813 AcpiFormatException (Status));
817 ReturnObj.Pointer = AcpiGbl_DbBuffer;
818 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
820 Status = AcpiGetIrqRoutingTable (Node, &ReturnObj);
821 if (ACPI_FAILURE (Status))
823 AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
824 AcpiFormatException (Status));
828 AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
837 AcpiOsPrintf ("Evaluating _CRS\n");
839 ReturnObj.Pointer = AcpiGbl_DbBuffer;
840 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
842 Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnObj);
843 if (ACPI_FAILURE (Status))
845 AcpiOsPrintf ("Could not evaluate _CRS: %s\n",
846 AcpiFormatException (Status));
850 /* This code is here to exercise the AcpiWalkResources interface */
852 Status = AcpiWalkResources (Node, METHOD_NAME__CRS,
853 AcpiDbResourceCallback, NULL);
854 if (ACPI_FAILURE (Status))
856 AcpiOsPrintf ("AcpiWalkResources failed: %s\n",
857 AcpiFormatException (Status));
861 /* Get the _CRS resource list */
863 ReturnObj.Pointer = AcpiGbl_DbBuffer;
864 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
866 Status = AcpiGetCurrentResources (Node, &ReturnObj);
867 if (ACPI_FAILURE (Status))
869 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
870 AcpiFormatException (Status));
874 /* Dump the _CRS resource list */
876 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
880 * Perform comparison of original AML to newly created AML. This tests both
881 * the AML->Resource conversion and the Resource->Aml conversion.
883 Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
885 /* Execute _SRS with the resource list */
887 Status = AcpiSetCurrentResources (Node, &ReturnObj);
888 if (ACPI_FAILURE (Status))
890 AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
891 AcpiFormatException (Status));
902 AcpiOsPrintf ("Evaluating _PRS\n");
904 ReturnObj.Pointer = AcpiGbl_DbBuffer;
905 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
907 Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnObj);
908 if (ACPI_FAILURE (Status))
910 AcpiOsPrintf ("Could not evaluate _PRS: %s\n",
911 AcpiFormatException (Status));
915 ReturnObj.Pointer = AcpiGbl_DbBuffer;
916 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
918 Status = AcpiGetPossibleResources (Node, &ReturnObj);
919 if (ACPI_FAILURE (Status))
921 AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
922 AcpiFormatException (Status));
926 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
935 AcpiOsPrintf ("Evaluating _AEI\n");
937 ReturnObj.Pointer = AcpiGbl_DbBuffer;
938 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
940 Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnObj);
941 if (ACPI_FAILURE (Status))
943 AcpiOsPrintf ("Could not evaluate _AEI: %s\n",
944 AcpiFormatException (Status));
948 ReturnObj.Pointer = AcpiGbl_DbBuffer;
949 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
951 Status = AcpiGetEventResources (Node, &ReturnObj);
952 if (ACPI_FAILURE (Status))
954 AcpiOsPrintf ("AcpiGetEventResources failed: %s\n",
955 AcpiFormatException (Status));
959 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
964 ACPI_FREE (ParentPath);
969 /*******************************************************************************
971 * FUNCTION: AcpiDbDisplayResources
973 * PARAMETERS: ObjectArg - String object name or object pointer.
974 * "*" means "display resources for all devices"
978 * DESCRIPTION: Display the resource objects associated with a device.
980 ******************************************************************************/
983 AcpiDbDisplayResources (
986 ACPI_NAMESPACE_NODE *Node;
989 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
990 AcpiDbgLevel |= ACPI_LV_RESOURCES;
992 /* Asterisk means "display resources for all devices" */
994 if (!ACPI_STRCMP (ObjectArg, "*"))
996 (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
997 ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL);
1001 /* Convert string to object pointer */
1003 Node = AcpiDbConvertToNode (ObjectArg);
1006 if (Node->Type != ACPI_TYPE_DEVICE)
1008 AcpiOsPrintf ("%4.4s: Name is not a device object (%s)\n",
1009 Node->Name.Ascii, AcpiUtGetTypeName (Node->Type));
1013 (void) AcpiDbDeviceResources (Node, 0, NULL, NULL);
1018 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1022 /*******************************************************************************
1024 * FUNCTION: AcpiDbGenerateGpe
1026 * PARAMETERS: GpeArg - Raw GPE number, ascii string
1027 * BlockArg - GPE block number, ascii string
1028 * 0 or 1 for FADT GPE blocks
1032 * DESCRIPTION: Generate a GPE
1034 ******************************************************************************/
1043 ACPI_GPE_EVENT_INFO *GpeEventInfo;
1046 GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0);
1047 BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
1050 GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber),
1054 AcpiOsPrintf ("Invalid GPE\n");
1058 (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
1061 #endif /* ACPI_DEBUGGER */