dbcmds.c revision 218590
1129198Scognet/******************************************************************************* 2129198Scognet * 3129198Scognet * Module Name: dbcmds - Miscellaneous debug commands and output routines 4129198Scognet * 5129198Scognet ******************************************************************************/ 6129198Scognet 7129198Scognet/* 8129198Scognet * Copyright (C) 2000 - 2011, Intel Corp. 9129198Scognet * All rights reserved. 10129198Scognet * 11129198Scognet * Redistribution and use in source and binary forms, with or without 12129198Scognet * modification, are permitted provided that the following conditions 13129198Scognet * are met: 14129198Scognet * 1. Redistributions of source code must retain the above copyright 15129198Scognet * notice, this list of conditions, and the following disclaimer, 16129198Scognet * without modification. 17129198Scognet * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18129198Scognet * substantially similar to the "NO WARRANTY" disclaimer below 19129198Scognet * ("Disclaimer") and any redistribution must be conditioned upon 20129198Scognet * including a substantially similar Disclaimer requirement for further 21129198Scognet * binary redistribution. 22129198Scognet * 3. Neither the names of the above-listed copyright holders nor the names 23129198Scognet * of any contributors may be used to endorse or promote products derived 24129198Scognet * from this software without specific prior written permission. 25129198Scognet * 26129198Scognet * Alternatively, this software may be distributed under the terms of the 27129198Scognet * GNU General Public License ("GPL") version 2 as published by the Free 28129198Scognet * Software Foundation. 29129198Scognet * 30129198Scognet * NO WARRANTY 31129198Scognet * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32129198Scognet * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33129198Scognet * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34129198Scognet * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35129198Scognet * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36261252Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37129198Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38239268Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39129198Scognet * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40239268Sgonzo * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41129198Scognet * POSSIBILITY OF SUCH DAMAGES. 42129198Scognet */ 43257200Sian 44129198Scognet 45129198Scognet#include <contrib/dev/acpica/include/acpi.h> 46129198Scognet#include <contrib/dev/acpica/include/accommon.h> 47129198Scognet#include <contrib/dev/acpica/include/acevents.h> 48129198Scognet#include <contrib/dev/acpica/include/acdebug.h> 49137629Scognet#include <contrib/dev/acpica/include/acresrc.h> 50142570Scognet#include <contrib/dev/acpica/include/actables.h> 51142570Scognet 52129198Scognet#ifdef ACPI_DEBUGGER 53129198Scognet 54129198Scognet#define _COMPONENT ACPI_CA_DEBUGGER 55129198Scognet ACPI_MODULE_NAME ("dbcmds") 56129198Scognet 57129198Scognet 58129198Scognet/* Local prototypes */ 59129198Scognet 60129198Scognetstatic void 61129198ScognetAcpiDmCompareAmlResources ( 62129198Scognet UINT8 *Aml1Buffer, 63129198Scognet ACPI_RSDESC_SIZE Aml1BufferLength, 64129198Scognet UINT8 *Aml2Buffer, 65129198Scognet ACPI_RSDESC_SIZE Aml2BufferLength); 66129198Scognet 67129198Scognetstatic ACPI_STATUS 68129198ScognetAcpiDmTestResourceConversion ( 69129198Scognet ACPI_NAMESPACE_NODE *Node, 70129198Scognet char *Name); 71129198Scognet 72129198Scognet 73129198Scognet/******************************************************************************* 74129198Scognet * 75129198Scognet * FUNCTION: AcpiDbConvertToNode 76129198Scognet * 77129198Scognet * PARAMETERS: InString - String to convert 78129198Scognet * 79129198Scognet * RETURN: Pointer to a NS node 80129198Scognet * 81129198Scognet * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or 82129198Scognet * alpha strings. 83129198Scognet * 84129198Scognet ******************************************************************************/ 85129198Scognet 86183838SrajACPI_NAMESPACE_NODE * 87129198ScognetAcpiDbConvertToNode ( 88183838Sraj char *InString) 89129198Scognet{ 90135651Scognet ACPI_NAMESPACE_NODE *Node; 91129198Scognet 92129198Scognet 93129198Scognet if ((*InString >= 0x30) && (*InString <= 0x39)) 94129198Scognet { 95129198Scognet /* Numeric argument, convert */ 96129198Scognet 97129198Scognet Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16)); 98129198Scognet if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 99129198Scognet { 100142570Scognet AcpiOsPrintf ("Address %p is invalid in this address space\n", 101171788Scognet Node); 102142570Scognet return (NULL); 103188540Scognet } 104188540Scognet 105129198Scognet /* Make sure pointer is valid NS node */ 106129198Scognet 107129198Scognet if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) 108129198Scognet { 109129198Scognet AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n", 110129198Scognet Node, AcpiUtGetDescriptorName (Node)); 111129198Scognet return (NULL); 112262903Sian } 113262903Sian } 114239268Sgonzo else 115142570Scognet { 116175982Sraj /* Alpha argument */ 117175982Sraj /* The parameter is a name string that must be resolved to a 118239268Sgonzo * Named obj 119239268Sgonzo */ 120254461Sandrew Node = AcpiDbLocalNsLookup (InString); 121239268Sgonzo if (!Node) 122239268Sgonzo { 123239268Sgonzo Node = AcpiGbl_RootNode; 124239268Sgonzo } 125239268Sgonzo } 126239268Sgonzo 127239268Sgonzo return (Node); 128239268Sgonzo} 129239268Sgonzo 130150996Scognet 131129198Scognet/******************************************************************************* 132129198Scognet * 133135651Scognet * FUNCTION: AcpiDbSleep 134135651Scognet * 135135651Scognet * PARAMETERS: ObjectArg - Desired sleep state (0-5) 136129198Scognet * 137135651Scognet * RETURN: Status 138129198Scognet * 139129198Scognet * DESCRIPTION: Simulate a sleep/wake sequence 140129198Scognet * 141129198Scognet ******************************************************************************/ 142137629Scognet 143137629ScognetACPI_STATUS 144137629ScognetAcpiDbSleep ( 145261415Scognet char *ObjectArg) 146{ 147 ACPI_STATUS Status; 148 UINT8 SleepState; 149 150 151 SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0); 152 153 AcpiOsPrintf ("**** Prepare to sleep ****\n"); 154 Status = AcpiEnterSleepStatePrep (SleepState); 155 if (ACPI_FAILURE (Status)) 156 { 157 return (Status); 158 } 159 160 AcpiOsPrintf ("**** Going to sleep ****\n"); 161 Status = AcpiEnterSleepState (SleepState); 162 if (ACPI_FAILURE (Status)) 163 { 164 return (Status); 165 } 166 167 AcpiOsPrintf ("**** returning from sleep ****\n"); 168 Status = AcpiLeaveSleepState (SleepState); 169 170 return (Status); 171} 172 173/******************************************************************************* 174 * 175 * FUNCTION: AcpiDbDisplayLocks 176 * 177 * PARAMETERS: None 178 * 179 * RETURN: None 180 * 181 * DESCRIPTION: Display information about internal mutexes. 182 * 183 ******************************************************************************/ 184 185void 186AcpiDbDisplayLocks ( 187 void) 188{ 189 UINT32 i; 190 191 192 for (i = 0; i < ACPI_MAX_MUTEX; i++) 193 { 194 AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i), 195 AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED 196 ? "Locked" : "Unlocked"); 197 } 198} 199 200 201/******************************************************************************* 202 * 203 * FUNCTION: AcpiDbDisplayTableInfo 204 * 205 * PARAMETERS: TableArg - String with name of table to be displayed 206 * 207 * RETURN: None 208 * 209 * DESCRIPTION: Display information about loaded tables. Current 210 * implementation displays all loaded tables. 211 * 212 ******************************************************************************/ 213 214void 215AcpiDbDisplayTableInfo ( 216 char *TableArg) 217{ 218 UINT32 i; 219 ACPI_TABLE_DESC *TableDesc; 220 ACPI_STATUS Status; 221 222 223 /* Walk the entire root table list */ 224 225 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) 226 { 227 TableDesc = &AcpiGbl_RootTableList.Tables[i]; 228 AcpiOsPrintf ("%u ", i); 229 230 /* Make sure that the table is mapped */ 231 232 Status = AcpiTbVerifyTable (TableDesc); 233 if (ACPI_FAILURE (Status)) 234 { 235 return; 236 } 237 238 /* Dump the table header */ 239 240 if (TableDesc->Pointer) 241 { 242 AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); 243 } 244 else 245 { 246 /* If the pointer is null, the table has been unloaded */ 247 248 ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded", 249 TableDesc->Signature.Ascii)); 250 } 251 } 252} 253 254 255/******************************************************************************* 256 * 257 * FUNCTION: AcpiDbUnloadAcpiTable 258 * 259 * PARAMETERS: TableArg - Name of the table to be unloaded 260 * InstanceArg - Which instance of the table to unload (if 261 * there are multiple tables of the same type) 262 * 263 * RETURN: Nonde 264 * 265 * DESCRIPTION: Unload an ACPI table. 266 * Instance is not implemented 267 * 268 ******************************************************************************/ 269 270void 271AcpiDbUnloadAcpiTable ( 272 char *TableArg, 273 char *InstanceArg) 274{ 275/* TBD: Need to reimplement for new data structures */ 276 277#if 0 278 UINT32 i; 279 ACPI_STATUS Status; 280 281 282 /* Search all tables for the target type */ 283 284 for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++) 285 { 286 if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature, 287 AcpiGbl_TableData[i].SigLength)) 288 { 289 /* Found the table, unload it */ 290 291 Status = AcpiUnloadTable (i); 292 if (ACPI_SUCCESS (Status)) 293 { 294 AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg); 295 } 296 else 297 { 298 AcpiOsPrintf ("%s, while unloading [%s]\n", 299 AcpiFormatException (Status), TableArg); 300 } 301 302 return; 303 } 304 } 305 306 AcpiOsPrintf ("Unknown table type [%s]\n", TableArg); 307#endif 308} 309 310 311/******************************************************************************* 312 * 313 * FUNCTION: AcpiDbSendNotify 314 * 315 * PARAMETERS: Name - Name of ACPI object to send the notify to 316 * Value - Value of the notify to send. 317 * 318 * RETURN: None 319 * 320 * DESCRIPTION: Send an ACPI notification. The value specified is sent to the 321 * named object as an ACPI notify. 322 * 323 ******************************************************************************/ 324 325void 326AcpiDbSendNotify ( 327 char *Name, 328 UINT32 Value) 329{ 330 ACPI_NAMESPACE_NODE *Node; 331 ACPI_STATUS Status; 332 333 334 /* Translate name to an Named object */ 335 336 Node = AcpiDbConvertToNode (Name); 337 if (!Node) 338 { 339 return; 340 } 341 342 /* Decode Named object type */ 343 344 switch (Node->Type) 345 { 346 case ACPI_TYPE_DEVICE: 347 case ACPI_TYPE_THERMAL: 348 349 /* Send the notify */ 350 351 Status = AcpiEvQueueNotifyRequest (Node, Value); 352 if (ACPI_FAILURE (Status)) 353 { 354 AcpiOsPrintf ("Could not queue notify\n"); 355 } 356 break; 357 358 default: 359 AcpiOsPrintf ("Named object is not a device or a thermal object\n"); 360 break; 361 } 362} 363 364 365/******************************************************************************* 366 * 367 * FUNCTION: AcpiDbDisplayInterfaces 368 * 369 * PARAMETERS: ActionArg - Null, "install", or "remove" 370 * InterfaceNameArg - Name for install/remove options 371 * 372 * RETURN: None 373 * 374 * DESCRIPTION: Display or modify the global _OSI interface list 375 * 376 ******************************************************************************/ 377 378void 379AcpiDbDisplayInterfaces ( 380 char *ActionArg, 381 char *InterfaceNameArg) 382{ 383 ACPI_INTERFACE_INFO *NextInterface; 384 char *SubString; 385 ACPI_STATUS Status; 386 387 388 /* If no arguments, just display current interface list */ 389 390 if (!ActionArg) 391 { 392 (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, 393 ACPI_WAIT_FOREVER); 394 395 NextInterface = AcpiGbl_SupportedInterfaces; 396 397 while (NextInterface) 398 { 399 if (!(NextInterface->Flags & ACPI_OSI_INVALID)) 400 { 401 AcpiOsPrintf ("%s\n", NextInterface->Name); 402 } 403 NextInterface = NextInterface->Next; 404 } 405 406 AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 407 return; 408 } 409 410 /* If ActionArg exists, so must InterfaceNameArg */ 411 412 if (!InterfaceNameArg) 413 { 414 AcpiOsPrintf ("Missing Interface Name argument\n"); 415 return; 416 } 417 418 /* Uppercase the action for match below */ 419 420 AcpiUtStrupr (ActionArg); 421 422 /* Install - install an interface */ 423 424 SubString = ACPI_STRSTR ("INSTALL", ActionArg); 425 if (SubString) 426 { 427 Status = AcpiInstallInterface (InterfaceNameArg); 428 if (ACPI_FAILURE (Status)) 429 { 430 AcpiOsPrintf ("%s, while installing \"%s\"\n", 431 AcpiFormatException (Status), InterfaceNameArg); 432 } 433 return; 434 } 435 436 /* Remove - remove an interface */ 437 438 SubString = ACPI_STRSTR ("REMOVE", ActionArg); 439 if (SubString) 440 { 441 Status = AcpiRemoveInterface (InterfaceNameArg); 442 if (ACPI_FAILURE (Status)) 443 { 444 AcpiOsPrintf ("%s, while removing \"%s\"\n", 445 AcpiFormatException (Status), InterfaceNameArg); 446 } 447 return; 448 } 449 450 /* Invalid ActionArg */ 451 452 AcpiOsPrintf ("Invalid action argument: %s\n", ActionArg); 453 return; 454} 455 456 457/******************************************************************************* 458 * 459 * FUNCTION: AcpiDmCompareAmlResources 460 * 461 * PARAMETERS: Aml1Buffer - Contains first resource list 462 * Aml1BufferLength - Length of first resource list 463 * Aml2Buffer - Contains second resource list 464 * Aml2BufferLength - Length of second resource list 465 * 466 * RETURN: None 467 * 468 * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in 469 * order to isolate a miscompare to an individual resource) 470 * 471 ******************************************************************************/ 472 473static void 474AcpiDmCompareAmlResources ( 475 UINT8 *Aml1Buffer, 476 ACPI_RSDESC_SIZE Aml1BufferLength, 477 UINT8 *Aml2Buffer, 478 ACPI_RSDESC_SIZE Aml2BufferLength) 479{ 480 UINT8 *Aml1; 481 UINT8 *Aml2; 482 ACPI_RSDESC_SIZE Aml1Length; 483 ACPI_RSDESC_SIZE Aml2Length; 484 ACPI_RSDESC_SIZE Offset = 0; 485 UINT8 ResourceType; 486 UINT32 Count = 0; 487 488 489 /* Compare overall buffer sizes (may be different due to size rounding) */ 490 491 if (Aml1BufferLength != Aml2BufferLength) 492 { 493 AcpiOsPrintf ( 494 "**** Buffer length mismatch in converted AML: original %X new %X ****\n", 495 Aml1BufferLength, Aml2BufferLength); 496 } 497 498 Aml1 = Aml1Buffer; 499 Aml2 = Aml2Buffer; 500 501 /* Walk the descriptor lists, comparing each descriptor */ 502 503 while (Aml1 < (Aml1Buffer + Aml1BufferLength)) 504 { 505 /* Get the lengths of each descriptor */ 506 507 Aml1Length = AcpiUtGetDescriptorLength (Aml1); 508 Aml2Length = AcpiUtGetDescriptorLength (Aml2); 509 ResourceType = AcpiUtGetResourceType (Aml1); 510 511 /* Check for descriptor length match */ 512 513 if (Aml1Length != Aml2Length) 514 { 515 AcpiOsPrintf ( 516 "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n", 517 Count, ResourceType, Offset, Aml1Length, Aml2Length); 518 } 519 520 /* Check for descriptor byte match */ 521 522 else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length)) 523 { 524 AcpiOsPrintf ( 525 "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", 526 Count, ResourceType, Offset); 527 } 528 529 /* Exit on EndTag descriptor */ 530 531 if (ResourceType == ACPI_RESOURCE_NAME_END_TAG) 532 { 533 return; 534 } 535 536 /* Point to next descriptor in each buffer */ 537 538 Count++; 539 Offset += Aml1Length; 540 Aml1 += Aml1Length; 541 Aml2 += Aml2Length; 542 } 543} 544 545 546/******************************************************************************* 547 * 548 * FUNCTION: AcpiDmTestResourceConversion 549 * 550 * PARAMETERS: Node - Parent device node 551 * Name - resource method name (_CRS) 552 * 553 * RETURN: Status 554 * 555 * DESCRIPTION: Compare the original AML with a conversion of the AML to 556 * internal resource list, then back to AML. 557 * 558 ******************************************************************************/ 559 560static ACPI_STATUS 561AcpiDmTestResourceConversion ( 562 ACPI_NAMESPACE_NODE *Node, 563 char *Name) 564{ 565 ACPI_STATUS Status; 566 ACPI_BUFFER ReturnObj; 567 ACPI_BUFFER ResourceObj; 568 ACPI_BUFFER NewAml; 569 ACPI_OBJECT *OriginalAml; 570 571 572 AcpiOsPrintf ("Resource Conversion Comparison:\n"); 573 574 NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 575 ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 576 ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 577 578 /* Get the original _CRS AML resource template */ 579 580 Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj); 581 if (ACPI_FAILURE (Status)) 582 { 583 AcpiOsPrintf ("Could not obtain %s: %s\n", 584 Name, AcpiFormatException (Status)); 585 return (Status); 586 } 587 588 /* Get the AML resource template, converted to internal resource structs */ 589 590 Status = AcpiGetCurrentResources (Node, &ResourceObj); 591 if (ACPI_FAILURE (Status)) 592 { 593 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", 594 AcpiFormatException (Status)); 595 goto Exit1; 596 } 597 598 /* Convert internal resource list to external AML resource template */ 599 600 Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml); 601 if (ACPI_FAILURE (Status)) 602 { 603 AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n", 604 AcpiFormatException (Status)); 605 goto Exit2; 606 } 607 608 /* Compare original AML to the newly created AML resource list */ 609 610 OriginalAml = ReturnObj.Pointer; 611 612 AcpiDmCompareAmlResources ( 613 OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, 614 NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length); 615 616 /* Cleanup and exit */ 617 618 ACPI_FREE (NewAml.Pointer); 619Exit2: 620 ACPI_FREE (ResourceObj.Pointer); 621Exit1: 622 ACPI_FREE (ReturnObj.Pointer); 623 return (Status); 624} 625 626 627/******************************************************************************* 628 * 629 * FUNCTION: AcpiDbDisplayResources 630 * 631 * PARAMETERS: ObjectArg - String with hex value of the object 632 * 633 * RETURN: None 634 * 635 * DESCRIPTION: Display the resource objects associated with a device. 636 * 637 ******************************************************************************/ 638 639void 640AcpiDbDisplayResources ( 641 char *ObjectArg) 642{ 643 ACPI_NAMESPACE_NODE *Node; 644 ACPI_STATUS Status; 645 ACPI_BUFFER ReturnObj; 646 647 648 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); 649 AcpiDbgLevel |= ACPI_LV_RESOURCES; 650 651 /* Convert string to object pointer */ 652 653 Node = AcpiDbConvertToNode (ObjectArg); 654 if (!Node) 655 { 656 return; 657 } 658 659 /* Prepare for a return object of arbitrary size */ 660 661 ReturnObj.Pointer = AcpiGbl_DbBuffer; 662 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 663 664 /* _PRT */ 665 666 AcpiOsPrintf ("Evaluating _PRT\n"); 667 668 /* Check if _PRT exists */ 669 670 Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj); 671 if (ACPI_FAILURE (Status)) 672 { 673 AcpiOsPrintf ("Could not obtain _PRT: %s\n", 674 AcpiFormatException (Status)); 675 goto GetCrs; 676 } 677 678 ReturnObj.Pointer = AcpiGbl_DbBuffer; 679 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 680 681 Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); 682 if (ACPI_FAILURE (Status)) 683 { 684 AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", 685 AcpiFormatException (Status)); 686 goto GetCrs; 687 } 688 689 AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer)); 690 691 692 /* _CRS */ 693 694GetCrs: 695 AcpiOsPrintf ("Evaluating _CRS\n"); 696 697 ReturnObj.Pointer = AcpiGbl_DbBuffer; 698 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 699 700 /* Check if _CRS exists */ 701 702 Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj); 703 if (ACPI_FAILURE (Status)) 704 { 705 AcpiOsPrintf ("Could not obtain _CRS: %s\n", 706 AcpiFormatException (Status)); 707 goto GetPrs; 708 } 709 710 /* Get the _CRS resource list */ 711 712 ReturnObj.Pointer = AcpiGbl_DbBuffer; 713 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 714 715 Status = AcpiGetCurrentResources (Node, &ReturnObj); 716 if (ACPI_FAILURE (Status)) 717 { 718 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", 719 AcpiFormatException (Status)); 720 goto GetPrs; 721 } 722 723 /* Dump the _CRS resource list */ 724 725 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, 726 ReturnObj.Pointer)); 727 728 /* 729 * Perform comparison of original AML to newly created AML. This tests both 730 * the AML->Resource conversion and the Resource->Aml conversion. 731 */ 732 Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); 733 734 /* Execute _SRS with the resource list */ 735 736 Status = AcpiSetCurrentResources (Node, &ReturnObj); 737 if (ACPI_FAILURE (Status)) 738 { 739 AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", 740 AcpiFormatException (Status)); 741 goto GetPrs; 742 } 743 744 745 /* _PRS */ 746 747GetPrs: 748 AcpiOsPrintf ("Evaluating _PRS\n"); 749 750 ReturnObj.Pointer = AcpiGbl_DbBuffer; 751 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 752 753 /* Check if _PRS exists */ 754 755 Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj); 756 if (ACPI_FAILURE (Status)) 757 { 758 AcpiOsPrintf ("Could not obtain _PRS: %s\n", 759 AcpiFormatException (Status)); 760 goto Cleanup; 761 } 762 763 ReturnObj.Pointer = AcpiGbl_DbBuffer; 764 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 765 766 Status = AcpiGetPossibleResources (Node, &ReturnObj); 767 if (ACPI_FAILURE (Status)) 768 { 769 AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", 770 AcpiFormatException (Status)); 771 goto Cleanup; 772 } 773 774 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); 775 776Cleanup: 777 778 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); 779 return; 780} 781 782 783/******************************************************************************* 784 * 785 * FUNCTION: AcpiDbGenerateGpe 786 * 787 * PARAMETERS: GpeArg - Raw GPE number, ascii string 788 * BlockArg - GPE block number, ascii string 789 * 0 or 1 for FADT GPE blocks 790 * 791 * RETURN: None 792 * 793 * DESCRIPTION: Generate a GPE 794 * 795 ******************************************************************************/ 796 797void 798AcpiDbGenerateGpe ( 799 char *GpeArg, 800 char *BlockArg) 801{ 802 UINT32 BlockNumber; 803 UINT32 GpeNumber; 804 ACPI_GPE_EVENT_INFO *GpeEventInfo; 805 806 807 GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0); 808 BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); 809 810 811 GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), 812 GpeNumber); 813 if (!GpeEventInfo) 814 { 815 AcpiOsPrintf ("Invalid GPE\n"); 816 return; 817 } 818 819 (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber); 820} 821 822#endif /* ACPI_DEBUGGER */ 823