| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
#include "acpi.h" |
| 45 |
#include "accommon.h" |
| 46 |
#include "acutils.h" |
| 47 |
#include "acdisasm.h" |
| 48 |
#include "acparser.h" |
| 49 |
#include "amlcode.h" |
| 50 |
#include "acinterp.h" |
| 51 |
|
| 52 |
|
| 53 |
#define _COMPONENT ACPI_CA_DEBUGGER |
| 54 |
ACPI_MODULE_NAME ("dmbuffer") |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
static void |
| 59 |
AcpiDmUuid ( |
| 60 |
ACPI_PARSE_OBJECT *Op); |
| 61 |
|
| 62 |
static void |
| 63 |
AcpiDmUnicode ( |
| 64 |
ACPI_PARSE_OBJECT *Op); |
| 65 |
|
| 66 |
static void |
| 67 |
AcpiDmGetHardwareIdType ( |
| 68 |
ACPI_PARSE_OBJECT *Op); |
| 69 |
|
| 70 |
static void |
| 71 |
AcpiDmPldBuffer ( |
| 72 |
UINT32 Level, |
| 73 |
UINT8 *ByteData, |
| 74 |
UINT32 ByteCount); |
| 75 |
|
| 76 |
static const char * |
| 77 |
AcpiDmFindNameByIndex ( |
| 78 |
UINT64 Index, |
| 79 |
const char **List); |
| 80 |
|
| 81 |
|
| 82 |
#define ACPI_BUFFER_BYTES_PER_LINE 8 |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
void |
| 101 |
AcpiDmDisasmByteList ( |
| 102 |
UINT32 Level, |
| 103 |
UINT8 *ByteData, |
| 104 |
UINT32 ByteCount) |
| 105 |
{ |
| 106 |
UINT32 i; |
| 107 |
UINT32 j; |
| 108 |
UINT32 CurrentIndex; |
| 109 |
UINT8 BufChar; |
| 110 |
|
| 111 |
|
| 112 |
if (!ByteCount) |
| 113 |
{ |
| 114 |
return; |
| 115 |
} |
| 116 |
|
| 117 |
for (i = 0; i < ByteCount; i += ACPI_BUFFER_BYTES_PER_LINE) |
| 118 |
{ |
| 119 |
|
| 120 |
|
| 121 |
AcpiDmIndent (Level); |
| 122 |
if (ByteCount > ACPI_BUFFER_BYTES_PER_LINE) |
| 123 |
{ |
| 124 |
AcpiOsPrintf ("/* %04X */ ", i); |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++) |
| 130 |
{ |
| 131 |
CurrentIndex = i + j; |
| 132 |
if (CurrentIndex >= ByteCount) |
| 133 |
{ |
| 134 |
|
| 135 |
|
| 136 |
AcpiOsPrintf (" "); |
| 137 |
continue; |
| 138 |
} |
| 139 |
|
| 140 |
AcpiOsPrintf (" 0x%2.2X", ByteData[CurrentIndex]); |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
if (CurrentIndex < (ByteCount - 1)) |
| 145 |
{ |
| 146 |
AcpiOsPrintf (","); |
| 147 |
} |
| 148 |
else |
| 149 |
{ |
| 150 |
AcpiOsPrintf (" "); |
| 151 |
} |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
AcpiOsPrintf (" // "); |
| 157 |
for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++) |
| 158 |
{ |
| 159 |
CurrentIndex = i + j; |
| 160 |
if (CurrentIndex >= ByteCount) |
| 161 |
{ |
| 162 |
break; |
| 163 |
} |
| 164 |
|
| 165 |
BufChar = ByteData[CurrentIndex]; |
| 166 |
if (isprint (BufChar)) |
| 167 |
{ |
| 168 |
AcpiOsPrintf ("%c", BufChar); |
| 169 |
} |
| 170 |
else |
| 171 |
{ |
| 172 |
AcpiOsPrintf ("."); |
| 173 |
} |
| 174 |
} |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
AcpiOsPrintf ("\n"); |
| 179 |
} |
| 180 |
} |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
void |
| 198 |
AcpiDmByteList ( |
| 199 |
ACPI_OP_WALK_INFO *Info, |
| 200 |
ACPI_PARSE_OBJECT *Op) |
| 201 |
{ |
| 202 |
UINT8 *ByteData; |
| 203 |
UINT32 ByteCount; |
| 204 |
|
| 205 |
|
| 206 |
ByteData = Op->Named.Data; |
| 207 |
ByteCount = (UINT32) Op->Common.Value.Integer; |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
switch (Op->Common.Parent->Common.DisasmOpcode) |
| 214 |
{ |
| 215 |
case ACPI_DASM_RESOURCE: |
| 216 |
|
| 217 |
AcpiDmResourceTemplate ( |
| 218 |
Info, Op->Common.Parent, ByteData, ByteCount); |
| 219 |
break; |
| 220 |
|
| 221 |
case ACPI_DASM_STRING: |
| 222 |
|
| 223 |
AcpiDmIndent (Info->Level); |
| 224 |
AcpiUtPrintString ((char *) ByteData, ACPI_UINT16_MAX); |
| 225 |
AcpiOsPrintf ("\n"); |
| 226 |
break; |
| 227 |
|
| 228 |
case ACPI_DASM_UUID: |
| 229 |
|
| 230 |
AcpiDmUuid (Op); |
| 231 |
break; |
| 232 |
|
| 233 |
case ACPI_DASM_UNICODE: |
| 234 |
|
| 235 |
AcpiDmUnicode (Op); |
| 236 |
break; |
| 237 |
|
| 238 |
case ACPI_DASM_PLD_METHOD: |
| 239 |
#if 0 |
| 240 |
AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount); |
| 241 |
#endif |
| 242 |
AcpiDmPldBuffer (Info->Level, ByteData, ByteCount); |
| 243 |
break; |
| 244 |
|
| 245 |
case ACPI_DASM_BUFFER: |
| 246 |
default: |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount); |
| 252 |
break; |
| 253 |
} |
| 254 |
} |
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
BOOLEAN |
| 283 |
AcpiDmIsUuidBuffer ( |
| 284 |
ACPI_PARSE_OBJECT *Op) |
| 285 |
{ |
| 286 |
UINT8 *ByteData; |
| 287 |
UINT32 ByteCount; |
| 288 |
ACPI_PARSE_OBJECT *SizeOp; |
| 289 |
ACPI_PARSE_OBJECT *NextOp; |
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
SizeOp = Op->Common.Value.Arg; |
| 295 |
if (!SizeOp) |
| 296 |
{ |
| 297 |
return (FALSE); |
| 298 |
} |
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
NextOp = SizeOp->Common.Next; |
| 303 |
if (!NextOp) |
| 304 |
{ |
| 305 |
return (FALSE); |
| 306 |
} |
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
ByteData = NextOp->Named.Data; |
| 311 |
ByteCount = (UINT32) NextOp->Common.Value.Integer; |
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
if (ByteCount != UUID_BUFFER_LENGTH) |
| 316 |
{ |
| 317 |
return (FALSE); |
| 318 |
} |
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
if (((ByteData[7] & 0xF0) == 0x00) || |
| 323 |
((ByteData[7] & 0xF0) > 0x50) || |
| 324 |
((ByteData[8] & 0xF0) < 0x80) || |
| 325 |
((ByteData[8] & 0xF0) > 0xB0)) |
| 326 |
{ |
| 327 |
return (FALSE); |
| 328 |
} |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; |
| 333 |
return (TRUE); |
| 334 |
} |
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
static void |
| 359 |
AcpiDmUuid ( |
| 360 |
ACPI_PARSE_OBJECT *Op) |
| 361 |
{ |
| 362 |
UINT8 *Data; |
| 363 |
const char *Description; |
| 364 |
|
| 365 |
|
| 366 |
Data = ACPI_CAST_PTR (UINT8, Op->Named.Data); |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
AcpiOsPrintf ( |
| 371 |
"\"%2.2x%2.2x%2.2x%2.2x-" |
| 372 |
"%2.2x%2.2x-" |
| 373 |
"%2.2x%2.2x-" |
| 374 |
"%2.2x%2.2x-" |
| 375 |
"%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\")", |
| 376 |
Data[3], Data[2], Data[1], Data[0], |
| 377 |
Data[5], Data[4], |
| 378 |
Data[7], Data[6], |
| 379 |
Data[8], Data[9], |
| 380 |
Data[10], Data[11], Data[12], Data[13], Data[14], Data[15]); |
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
Description = AcpiAhMatchUuid (Data); |
| 385 |
if (Description) |
| 386 |
{ |
| 387 |
AcpiOsPrintf (" /* %s */", Description); |
| 388 |
} |
| 389 |
else |
| 390 |
{ |
| 391 |
AcpiOsPrintf (" /* Unknown UUID */"); |
| 392 |
} |
| 393 |
} |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
BOOLEAN |
| 409 |
AcpiDmIsUnicodeBuffer ( |
| 410 |
ACPI_PARSE_OBJECT *Op) |
| 411 |
{ |
| 412 |
UINT8 *ByteData; |
| 413 |
UINT32 ByteCount; |
| 414 |
UINT32 WordCount; |
| 415 |
ACPI_PARSE_OBJECT *SizeOp; |
| 416 |
ACPI_PARSE_OBJECT *NextOp; |
| 417 |
UINT32 i; |
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
SizeOp = Op->Common.Value.Arg; |
| 423 |
if (!SizeOp) |
| 424 |
{ |
| 425 |
return (FALSE); |
| 426 |
} |
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
NextOp = SizeOp->Common.Next; |
| 431 |
if (!NextOp) |
| 432 |
{ |
| 433 |
return (FALSE); |
| 434 |
} |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
ByteData = NextOp->Named.Data; |
| 439 |
ByteCount = (UINT32) NextOp->Common.Value.Integer; |
| 440 |
WordCount = ACPI_DIV_2 (ByteCount); |
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
if ((!ByteCount) || |
| 447 |
(ByteCount < 4) || |
| 448 |
(ByteCount & 1) || |
| 449 |
((UINT16 *) (void *) ByteData)[WordCount - 1] != 0) |
| 450 |
{ |
| 451 |
return (FALSE); |
| 452 |
} |
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
for (i = 0; i < (ByteCount - 2); i += 2) |
| 461 |
{ |
| 462 |
if ((ByteData[i] == 0) || |
| 463 |
!(isprint (ByteData[i])) || |
| 464 |
(ByteData[(ACPI_SIZE) i + 1] != 0)) |
| 465 |
{ |
| 466 |
return (FALSE); |
| 467 |
} |
| 468 |
} |
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; |
| 473 |
return (TRUE); |
| 474 |
} |
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
BOOLEAN |
| 490 |
AcpiDmIsStringBuffer ( |
| 491 |
ACPI_PARSE_OBJECT *Op) |
| 492 |
{ |
| 493 |
UINT8 *ByteData; |
| 494 |
UINT32 ByteCount; |
| 495 |
ACPI_PARSE_OBJECT *SizeOp; |
| 496 |
ACPI_PARSE_OBJECT *NextOp; |
| 497 |
UINT32 i; |
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
SizeOp = Op->Common.Value.Arg; |
| 503 |
if (!SizeOp) |
| 504 |
{ |
| 505 |
return (FALSE); |
| 506 |
} |
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
NextOp = SizeOp->Common.Next; |
| 511 |
if (!NextOp) |
| 512 |
{ |
| 513 |
return (FALSE); |
| 514 |
} |
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
ByteData = NextOp->Named.Data; |
| 519 |
ByteCount = (UINT32) NextOp->Common.Value.Integer; |
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
if ((!ByteCount) || |
| 524 |
(ByteCount < 2) || |
| 525 |
(ByteData[ByteCount-1] != 0)) |
| 526 |
{ |
| 527 |
return (FALSE); |
| 528 |
} |
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
if ((ByteCount == 2) && (ByteData[0] == 0x79)) |
| 536 |
{ |
| 537 |
return (FALSE); |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
for (i = 0; i < (ByteCount - 1); i++) |
| 543 |
{ |
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
if (!isprint (ByteData[i])) |
| 552 |
{ |
| 553 |
return (FALSE); |
| 554 |
} |
| 555 |
} |
| 556 |
|
| 557 |
return (TRUE); |
| 558 |
} |
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
BOOLEAN |
| 575 |
AcpiDmIsPldBuffer ( |
| 576 |
ACPI_PARSE_OBJECT *Op) |
| 577 |
{ |
| 578 |
ACPI_NAMESPACE_NODE *Node; |
| 579 |
ACPI_PARSE_OBJECT *SizeOp; |
| 580 |
ACPI_PARSE_OBJECT *ByteListOp; |
| 581 |
ACPI_PARSE_OBJECT *ParentOp; |
| 582 |
UINT64 BufferSize; |
| 583 |
UINT64 InitializerSize; |
| 584 |
|
| 585 |
|
| 586 |
if (!Op) |
| 587 |
{ |
| 588 |
return (FALSE); |
| 589 |
} |
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
SizeOp = Op->Common.Value.Arg; |
| 597 |
if (!SizeOp || SizeOp->Common.AmlOpcode != AML_BYTE_OP) |
| 598 |
{ |
| 599 |
return (FALSE); |
| 600 |
} |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
BufferSize = SizeOp->Common.Value.Integer; |
| 605 |
if ((BufferSize != ACPI_PLD_REV1_BUFFER_SIZE) && |
| 606 |
(BufferSize != ACPI_PLD_REV2_BUFFER_SIZE)) |
| 607 |
{ |
| 608 |
return (FALSE); |
| 609 |
} |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
ByteListOp = SizeOp->Common.Next; |
| 619 |
if (!ByteListOp) |
| 620 |
{ |
| 621 |
return (FALSE); |
| 622 |
} |
| 623 |
|
| 624 |
InitializerSize = ByteListOp->Common.Value.Integer; |
| 625 |
if ((InitializerSize != ACPI_PLD_REV1_BUFFER_SIZE) && |
| 626 |
(InitializerSize != ACPI_PLD_REV2_BUFFER_SIZE)) |
| 627 |
{ |
| 628 |
return (FALSE); |
| 629 |
} |
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
if (BufferSize != InitializerSize) |
| 634 |
{ |
| 635 |
return (FALSE); |
| 636 |
} |
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
ParentOp = Op->Common.Parent; |
| 641 |
if (!ParentOp) |
| 642 |
{ |
| 643 |
return (FALSE); |
| 644 |
} |
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
if (ParentOp->Common.AmlOpcode == AML_NAME_OP) |
| 649 |
{ |
| 650 |
Node = ParentOp->Common.Node; |
| 651 |
|
| 652 |
if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, METHOD_NAME__PLD)) |
| 653 |
{ |
| 654 |
|
| 655 |
|
| 656 |
SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; |
| 657 |
return (TRUE); |
| 658 |
} |
| 659 |
|
| 660 |
return (FALSE); |
| 661 |
} |
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP) |
| 675 |
{ |
| 676 |
ParentOp = ParentOp->Common.Parent; |
| 677 |
if (!ParentOp) |
| 678 |
{ |
| 679 |
return (FALSE); |
| 680 |
} |
| 681 |
|
| 682 |
if (ParentOp->Common.AmlOpcode == AML_NAME_OP) |
| 683 |
{ |
| 684 |
Node = ParentOp->Common.Node; |
| 685 |
|
| 686 |
if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, METHOD_NAME__PLD)) |
| 687 |
{ |
| 688 |
|
| 689 |
|
| 690 |
SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; |
| 691 |
return (TRUE); |
| 692 |
} |
| 693 |
} |
| 694 |
} |
| 695 |
|
| 696 |
return (FALSE); |
| 697 |
} |
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
static const char * |
| 715 |
AcpiDmFindNameByIndex ( |
| 716 |
UINT64 Index, |
| 717 |
const char **List) |
| 718 |
{ |
| 719 |
const char *NameString; |
| 720 |
UINT32 i; |
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
NameString = List[0]; |
| 726 |
i = 0; |
| 727 |
|
| 728 |
while (NameString) |
| 729 |
{ |
| 730 |
i++; |
| 731 |
NameString = List[i]; |
| 732 |
} |
| 733 |
|
| 734 |
if (Index >= i) |
| 735 |
{ |
| 736 |
|
| 737 |
|
| 738 |
return (""); |
| 739 |
} |
| 740 |
|
| 741 |
return (List[Index]); |
| 742 |
} |
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
#define ACPI_PLD_OUTPUT08 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " " |
| 760 |
#define ACPI_PLD_OUTPUT08P "%*.s%-22s = 0x%X)\n", ACPI_MUL_4 (Level), " " |
| 761 |
#define ACPI_PLD_OUTPUT16 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " " |
| 762 |
#define ACPI_PLD_OUTPUT16P "%*.s%-22s = 0x%X)\n", ACPI_MUL_4 (Level), " " |
| 763 |
#define ACPI_PLD_OUTPUT24 "%*.s%-22s = 0x%X,\n", ACPI_MUL_4 (Level), " " |
| 764 |
#define ACPI_PLD_OUTPUTSTR "%*.s%-22s = \"%s\",\n", ACPI_MUL_4 (Level), " " |
| 765 |
|
| 766 |
static void |
| 767 |
AcpiDmPldBuffer ( |
| 768 |
UINT32 Level, |
| 769 |
UINT8 *ByteData, |
| 770 |
UINT32 ByteCount) |
| 771 |
{ |
| 772 |
ACPI_PLD_INFO *PldInfo; |
| 773 |
ACPI_STATUS Status; |
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE) |
| 779 |
{ |
| 780 |
return; |
| 781 |
} |
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
Status = AcpiDecodePldBuffer (ByteData, ByteCount, &PldInfo); |
| 786 |
if (ACPI_FAILURE (Status)) |
| 787 |
{ |
| 788 |
return; |
| 789 |
} |
| 790 |
|
| 791 |
AcpiOsPrintf ("\n"); |
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Revision", PldInfo->Revision); |
| 796 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_IgnoreColor", PldInfo->IgnoreColor); |
| 797 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Red", PldInfo->Red); |
| 798 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Green", PldInfo->Green); |
| 799 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Blue", PldInfo->Blue); |
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Width", PldInfo->Width); |
| 804 |
AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Height", PldInfo->Height); |
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_UserVisible", PldInfo->UserVisible); |
| 809 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Dock", PldInfo->Dock); |
| 810 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Lid", PldInfo->Lid); |
| 811 |
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Panel", |
| 812 |
AcpiDmFindNameByIndex(PldInfo->Panel, AcpiGbl_PldPanelList)); |
| 813 |
|
| 814 |
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_VerticalPosition", |
| 815 |
AcpiDmFindNameByIndex(PldInfo->VerticalPosition, AcpiGbl_PldVerticalPositionList)); |
| 816 |
|
| 817 |
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_HorizontalPosition", |
| 818 |
AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, AcpiGbl_PldHorizontalPositionList)); |
| 819 |
|
| 820 |
AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Shape", |
| 821 |
AcpiDmFindNameByIndex(PldInfo->Shape, AcpiGbl_PldShapeList)); |
| 822 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupOrientation", PldInfo->GroupOrientation); |
| 823 |
|
| 824 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupToken", PldInfo->GroupToken); |
| 825 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupPosition", PldInfo->GroupPosition); |
| 826 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Bay", PldInfo->Bay); |
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Ejectable", PldInfo->Ejectable); |
| 831 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_EjectRequired", PldInfo->OspmEjectRequired); |
| 832 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CabinetNumber", PldInfo->CabinetNumber); |
| 833 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CardCageNumber", PldInfo->CardCageNumber); |
| 834 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Reference", PldInfo->Reference); |
| 835 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Rotation", PldInfo->Rotation); |
| 836 |
|
| 837 |
if (ByteCount >= ACPI_PLD_REV2_BUFFER_SIZE) |
| 838 |
{ |
| 839 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Order", PldInfo->Order); |
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset); |
| 844 |
AcpiOsPrintf (ACPI_PLD_OUTPUT16P, "PLD_HorizontalOffset", PldInfo->HorizontalOffset); |
| 845 |
} |
| 846 |
else |
| 847 |
{ |
| 848 |
AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order); |
| 849 |
} |
| 850 |
|
| 851 |
ACPI_FREE (PldInfo); |
| 852 |
} |
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
static void |
| 869 |
AcpiDmUnicode ( |
| 870 |
ACPI_PARSE_OBJECT *Op) |
| 871 |
{ |
| 872 |
UINT16 *WordData; |
| 873 |
UINT32 WordCount; |
| 874 |
UINT32 i; |
| 875 |
int OutputValue; |
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data); |
| 881 |
WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer)); |
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
AcpiOsPrintf ("\""); |
| 886 |
for (i = 0; i < (WordCount - 1); i++) |
| 887 |
{ |
| 888 |
OutputValue = (int) WordData[i]; |
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
if ((OutputValue == '\"') || |
| 893 |
(OutputValue == '\\')) |
| 894 |
{ |
| 895 |
AcpiOsPrintf ("\\%c", OutputValue); |
| 896 |
} |
| 897 |
else if (!isprint (OutputValue)) |
| 898 |
{ |
| 899 |
AcpiOsPrintf ("\\x%2.2X", OutputValue); |
| 900 |
} |
| 901 |
else |
| 902 |
{ |
| 903 |
AcpiOsPrintf ("%c", OutputValue); |
| 904 |
} |
| 905 |
} |
| 906 |
|
| 907 |
AcpiOsPrintf ("\")"); |
| 908 |
} |
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
|
| 925 |
static void |
| 926 |
AcpiDmGetHardwareIdType ( |
| 927 |
ACPI_PARSE_OBJECT *Op) |
| 928 |
{ |
| 929 |
UINT32 BigEndianId; |
| 930 |
UINT32 Prefix[3]; |
| 931 |
UINT32 i; |
| 932 |
|
| 933 |
|
| 934 |
switch (Op->Common.AmlOpcode) |
| 935 |
{ |
| 936 |
case AML_STRING_OP: |
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
Op->Common.DisasmOpcode = ACPI_DASM_HID_STRING; |
| 941 |
break; |
| 942 |
|
| 943 |
case AML_WORD_OP: |
| 944 |
case AML_DWORD_OP: |
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer); |
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40; |
| 955 |
Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40; |
| 956 |
Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40; |
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
for (i = 0; i < 3; i++) |
| 961 |
{ |
| 962 |
if (!ACPI_IS_ASCII (Prefix[i]) || |
| 963 |
!isalpha (Prefix[i])) |
| 964 |
{ |
| 965 |
return; |
| 966 |
} |
| 967 |
} |
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
Op->Common.DisasmOpcode = ACPI_DASM_EISAID; |
| 972 |
break; |
| 973 |
|
| 974 |
default: |
| 975 |
break; |
| 976 |
} |
| 977 |
} |
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
void |
| 993 |
AcpiDmCheckForHardwareId ( |
| 994 |
ACPI_PARSE_OBJECT *Op) |
| 995 |
{ |
| 996 |
UINT32 Name; |
| 997 |
ACPI_PARSE_OBJECT *NextOp; |
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
Name = AcpiPsGetName (Op); |
| 1003 |
if (!Name) |
| 1004 |
{ |
| 1005 |
return; |
| 1006 |
} |
| 1007 |
|
| 1008 |
NextOp = AcpiPsGetDepthNext (NULL, Op); |
| 1009 |
if (!NextOp) |
| 1010 |
{ |
| 1011 |
return; |
| 1012 |
} |
| 1013 |
|
| 1014 |
|
| 1015 |
|
| 1016 |
if (ACPI_COMPARE_NAMESEG (&Name, METHOD_NAME__HID)) |
| 1017 |
{ |
| 1018 |
AcpiDmGetHardwareIdType (NextOp); |
| 1019 |
return; |
| 1020 |
} |
| 1021 |
|
| 1022 |
|
| 1023 |
|
| 1024 |
if (!ACPI_COMPARE_NAMESEG (&Name, METHOD_NAME__CID)) |
| 1025 |
{ |
| 1026 |
return; |
| 1027 |
} |
| 1028 |
|
| 1029 |
|
| 1030 |
|
| 1031 |
if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP) |
| 1032 |
{ |
| 1033 |
AcpiDmGetHardwareIdType (NextOp); |
| 1034 |
return; |
| 1035 |
} |
| 1036 |
|
| 1037 |
|
| 1038 |
|
| 1039 |
NextOp = AcpiPsGetDepthNext (NULL, NextOp); |
| 1040 |
if (!NextOp) |
| 1041 |
{ |
| 1042 |
return; |
| 1043 |
} |
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
NextOp = NextOp->Common.Next; |
| 1048 |
while (NextOp) |
| 1049 |
{ |
| 1050 |
AcpiDmGetHardwareIdType (NextOp); |
| 1051 |
NextOp = NextOp->Common.Next; |
| 1052 |
} |
| 1053 |
} |
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
void |
| 1071 |
AcpiDmDecompressEisaId ( |
| 1072 |
UINT32 EncodedId) |
| 1073 |
{ |
| 1074 |
char IdBuffer[ACPI_EISAID_STRING_SIZE]; |
| 1075 |
const AH_DEVICE_ID *Info; |
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
|
| 1080 |
AcpiExEisaIdToString (IdBuffer, EncodedId); |
| 1081 |
AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer); |
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
Info = AcpiAhMatchHardwareId (IdBuffer); |
| 1086 |
if (Info) |
| 1087 |
{ |
| 1088 |
AcpiOsPrintf (" /* %s */", Info->Description); |
| 1089 |
} |
| 1090 |
} |