1 /******************************************************************************* 2 * 3 * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2) 4 * 5 ******************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 ***************************************************************************** 115 * 116 * Alternatively, you may choose to be licensed under the terms of the 117 * following license: 118 * 119 * Redistribution and use in source and binary forms, with or without 120 * modification, are permitted provided that the following conditions 121 * are met: 122 * 1. Redistributions of source code must retain the above copyright 123 * notice, this list of conditions, and the following disclaimer, 124 * without modification. 125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 * substantially similar to the "NO WARRANTY" disclaimer below 127 * ("Disclaimer") and any redistribution must be conditioned upon 128 * including a substantially similar Disclaimer requirement for further 129 * binary redistribution. 130 * 3. Neither the names of the above-listed copyright holders nor the names 131 * of any contributors may be used to endorse or promote products derived 132 * from this software without specific prior written permission. 133 * 134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 * 146 * Alternatively, you may choose to be licensed under the terms of the 147 * GNU General Public License ("GPL") version 2 as published by the Free 148 * Software Foundation. 149 * 150 *****************************************************************************/ 151 152 #include <contrib/dev/acpica/include/acpi.h> 153 #include <contrib/dev/acpica/include/accommon.h> 154 #include <contrib/dev/acpica/include/acdisasm.h> 155 156 157 #define _COMPONENT ACPI_CA_DEBUGGER 158 ACPI_MODULE_NAME ("dbresrcl2") 159 160 /* Local prototypes */ 161 162 static void 163 AcpiDmI2cSerialBusDescriptor ( 164 ACPI_OP_WALK_INFO *Info, 165 AML_RESOURCE *Resource, 166 UINT32 Length, 167 UINT32 Level); 168 169 static void 170 AcpiDmSpiSerialBusDescriptor ( 171 ACPI_OP_WALK_INFO *Info, 172 AML_RESOURCE *Resource, 173 UINT32 Length, 174 UINT32 Level); 175 176 static void 177 AcpiDmUartSerialBusDescriptor ( 178 ACPI_OP_WALK_INFO *Info, 179 AML_RESOURCE *Resource, 180 UINT32 Length, 181 UINT32 Level); 182 183 static void 184 AcpiDmGpioCommon ( 185 ACPI_OP_WALK_INFO *Info, 186 AML_RESOURCE *Resource, 187 UINT32 Level); 188 189 static void 190 AcpiDmDumpRawDataBuffer ( 191 UINT8 *Buffer, 192 UINT32 Length, 193 UINT32 Level); 194 195 196 /* Dispatch table for the serial bus descriptors */ 197 198 static ACPI_RESOURCE_HANDLER SerialBusResourceDispatch [] = 199 { 200 NULL, 201 AcpiDmI2cSerialBusDescriptor, 202 AcpiDmSpiSerialBusDescriptor, 203 AcpiDmUartSerialBusDescriptor 204 }; 205 206 207 /******************************************************************************* 208 * 209 * FUNCTION: AcpiDmDumpRawDataBuffer 210 * 211 * PARAMETERS: Buffer - Pointer to the data bytes 212 * Length - Length of the descriptor in bytes 213 * Level - Current source code indentation level 214 * 215 * RETURN: None 216 * 217 * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for 218 * vendor data bytes. 219 * 220 ******************************************************************************/ 221 222 static void 223 AcpiDmDumpRawDataBuffer ( 224 UINT8 *Buffer, 225 UINT32 Length, 226 UINT32 Level) 227 { 228 UINT32 Index; 229 UINT32 i; 230 UINT32 j; 231 232 233 if (!Length) 234 { 235 return; 236 } 237 238 AcpiOsPrintf ("RawDataBuffer (0x%.2X) // Vendor Data", Length); 239 240 AcpiOsPrintf ("\n"); 241 AcpiDmIndent (Level + 1); 242 AcpiOsPrintf ("{\n"); 243 AcpiDmIndent (Level + 2); 244 245 for (i = 0; i < Length;) 246 { 247 for (j = 0; j < 8; j++) 248 { 249 Index = i + j; 250 if (Index >= Length) 251 { 252 goto Finish; 253 } 254 255 AcpiOsPrintf ("0x%2.2X", Buffer[Index]); 256 if ((Index + 1) >= Length) 257 { 258 goto Finish; 259 } 260 261 AcpiOsPrintf (", "); 262 } 263 264 AcpiOsPrintf ("\n"); 265 AcpiDmIndent (Level + 2); 266 267 i += 8; 268 } 269 270 Finish: 271 AcpiOsPrintf ("\n"); 272 AcpiDmIndent (Level + 1); 273 AcpiOsPrintf ("}"); 274 } 275 276 277 /******************************************************************************* 278 * 279 * FUNCTION: AcpiDmGpioCommon 280 * 281 * PARAMETERS: Info - Extra resource info 282 * Resource - Pointer to the resource descriptor 283 * Level - Current source code indentation level 284 * 285 * RETURN: None 286 * 287 * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor 288 * 289 ******************************************************************************/ 290 291 static void 292 AcpiDmGpioCommon ( 293 ACPI_OP_WALK_INFO *Info, 294 AML_RESOURCE *Resource, 295 UINT32 Level) 296 { 297 UINT16 *PinList; 298 UINT8 *VendorData; 299 char *DeviceName = NULL; 300 UINT32 PinCount; 301 UINT32 i; 302 303 304 /* ResourceSource, ResourceSourceIndex, ResourceType */ 305 306 AcpiDmIndent (Level + 1); 307 if (Resource->Gpio.ResSourceOffset) 308 { 309 DeviceName = ACPI_ADD_PTR (char, 310 Resource, Resource->Gpio.ResSourceOffset), 311 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 312 } 313 314 AcpiOsPrintf (", "); 315 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex); 316 AcpiOsPrintf ("%s, ", 317 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]); 318 319 /* Insert a descriptor name */ 320 321 AcpiDmDescriptorName (); 322 AcpiOsPrintf (","); 323 324 /* Dump the vendor data */ 325 326 if (Resource->Gpio.VendorOffset) 327 { 328 AcpiOsPrintf ("\n"); 329 AcpiDmIndent (Level + 1); 330 VendorData = ACPI_ADD_PTR (UINT8, Resource, 331 Resource->Gpio.VendorOffset); 332 333 AcpiDmDumpRawDataBuffer (VendorData, 334 Resource->Gpio.VendorLength, Level); 335 } 336 337 AcpiOsPrintf (")\n"); 338 339 /* Dump the interrupt list */ 340 341 AcpiDmIndent (Level + 1); 342 AcpiOsPrintf ("{ // Pin list\n"); 343 344 PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset - 345 Resource->Gpio.PinTableOffset)) / 346 sizeof (UINT16); 347 348 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, 349 Resource->Gpio.PinTableOffset); 350 351 for (i = 0; i < PinCount; i++) 352 { 353 AcpiDmIndent (Level + 2); 354 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], 355 ((i + 1) < PinCount) ? "," : ""); 356 } 357 358 AcpiDmIndent (Level + 1); 359 AcpiOsPrintf ("}\n"); 360 361 #ifndef _KERNEL 362 MpSaveGpioInfo (Info->MappingOp, Resource, 363 PinCount, PinList, DeviceName); 364 #endif 365 } 366 367 368 /******************************************************************************* 369 * 370 * FUNCTION: AcpiDmGpioIntDescriptor 371 * 372 * PARAMETERS: Info - Extra resource info 373 * Resource - Pointer to the resource descriptor 374 * Length - Length of the descriptor in bytes 375 * Level - Current source code indentation level 376 * 377 * RETURN: None 378 * 379 * DESCRIPTION: Decode a GPIO Interrupt descriptor 380 * 381 ******************************************************************************/ 382 383 static void 384 AcpiDmGpioIntDescriptor ( 385 ACPI_OP_WALK_INFO *Info, 386 AML_RESOURCE *Resource, 387 UINT32 Length, 388 UINT32 Level) 389 { 390 391 /* Dump the GpioInt-specific portion of the descriptor */ 392 393 /* EdgeLevel, ActiveLevel, Shared */ 394 395 AcpiDmIndent (Level); 396 AcpiOsPrintf ("GpioInt (%s, %s, %s, ", 397 AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)], 398 AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)], 399 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); 400 401 /* PinConfig, DebounceTimeout */ 402 403 if (Resource->Gpio.PinConfig <= 3) 404 { 405 AcpiOsPrintf ("%s, ", 406 AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]); 407 } 408 else 409 { 410 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig); 411 } 412 AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout); 413 414 /* Dump the GpioInt/GpioIo common portion of the descriptor */ 415 416 AcpiDmGpioCommon (Info, Resource, Level); 417 } 418 419 420 /******************************************************************************* 421 * 422 * FUNCTION: AcpiDmGpioIoDescriptor 423 * 424 * PARAMETERS: Info - Extra resource info 425 * Resource - Pointer to the resource descriptor 426 * Length - Length of the descriptor in bytes 427 * Level - Current source code indentation level 428 * 429 * RETURN: None 430 * 431 * DESCRIPTION: Decode a GPIO I/O descriptor 432 * 433 ******************************************************************************/ 434 435 static void 436 AcpiDmGpioIoDescriptor ( 437 ACPI_OP_WALK_INFO *Info, 438 AML_RESOURCE *Resource, 439 UINT32 Length, 440 UINT32 Level) 441 { 442 443 /* Dump the GpioIo-specific portion of the descriptor */ 444 445 /* Shared, PinConfig */ 446 447 AcpiDmIndent (Level); 448 AcpiOsPrintf ("GpioIo (%s, ", 449 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); 450 451 if (Resource->Gpio.PinConfig <= 3) 452 { 453 AcpiOsPrintf ("%s, ", 454 AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]); 455 } 456 else 457 { 458 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig); 459 } 460 461 /* DebounceTimeout, DriveStrength, IoRestriction */ 462 463 AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout); 464 AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength); 465 AcpiOsPrintf ("%s,\n", 466 AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]); 467 468 /* Dump the GpioInt/GpioIo common portion of the descriptor */ 469 470 AcpiDmGpioCommon (Info, Resource, Level); 471 } 472 473 474 /******************************************************************************* 475 * 476 * FUNCTION: AcpiDmGpioDescriptor 477 * 478 * PARAMETERS: Info - Extra resource info 479 * Resource - Pointer to the resource descriptor 480 * Length - Length of the descriptor in bytes 481 * Level - Current source code indentation level 482 * 483 * RETURN: None 484 * 485 * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor 486 * 487 ******************************************************************************/ 488 489 void 490 AcpiDmGpioDescriptor ( 491 ACPI_OP_WALK_INFO *Info, 492 AML_RESOURCE *Resource, 493 UINT32 Length, 494 UINT32 Level) 495 { 496 UINT8 ConnectionType; 497 498 499 ConnectionType = Resource->Gpio.ConnectionType; 500 501 switch (ConnectionType) 502 { 503 case AML_RESOURCE_GPIO_TYPE_INT: 504 505 AcpiDmGpioIntDescriptor (Info, Resource, Length, Level); 506 break; 507 508 case AML_RESOURCE_GPIO_TYPE_IO: 509 510 AcpiDmGpioIoDescriptor (Info, Resource, Length, Level); 511 break; 512 513 default: 514 515 AcpiOsPrintf ("Unknown GPIO type\n"); 516 break; 517 } 518 } 519 520 521 /******************************************************************************* 522 * 523 * FUNCTION: AcpiDmDumpSerialBusVendorData 524 * 525 * PARAMETERS: Resource - Pointer to the resource descriptor 526 * 527 * RETURN: None 528 * 529 * DESCRIPTION: Dump optional serial bus vendor data 530 * 531 ******************************************************************************/ 532 533 static void 534 AcpiDmDumpSerialBusVendorData ( 535 AML_RESOURCE *Resource, 536 UINT32 Level) 537 { 538 UINT8 *VendorData; 539 UINT32 VendorLength; 540 541 542 /* Get the (optional) vendor data and length */ 543 544 switch (Resource->CommonSerialBus.Type) 545 { 546 case AML_RESOURCE_I2C_SERIALBUSTYPE: 547 548 VendorLength = Resource->CommonSerialBus.TypeDataLength - 549 AML_RESOURCE_I2C_MIN_DATA_LEN; 550 551 VendorData = ACPI_ADD_PTR (UINT8, Resource, 552 sizeof (AML_RESOURCE_I2C_SERIALBUS)); 553 break; 554 555 case AML_RESOURCE_SPI_SERIALBUSTYPE: 556 557 VendorLength = Resource->CommonSerialBus.TypeDataLength - 558 AML_RESOURCE_SPI_MIN_DATA_LEN; 559 560 VendorData = ACPI_ADD_PTR (UINT8, Resource, 561 sizeof (AML_RESOURCE_SPI_SERIALBUS)); 562 break; 563 564 case AML_RESOURCE_UART_SERIALBUSTYPE: 565 566 VendorLength = Resource->CommonSerialBus.TypeDataLength - 567 AML_RESOURCE_UART_MIN_DATA_LEN; 568 569 VendorData = ACPI_ADD_PTR (UINT8, Resource, 570 sizeof (AML_RESOURCE_UART_SERIALBUS)); 571 break; 572 573 default: 574 575 return; 576 } 577 578 /* Dump the vendor bytes as a RawDataBuffer object */ 579 580 AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level); 581 } 582 583 584 /******************************************************************************* 585 * 586 * FUNCTION: AcpiDmI2cSerialBusDescriptor 587 * 588 * PARAMETERS: Info - Extra resource info 589 * Resource - Pointer to the resource descriptor 590 * Length - Length of the descriptor in bytes 591 * Level - Current source code indentation level 592 * 593 * RETURN: None 594 * 595 * DESCRIPTION: Decode a I2C serial bus descriptor 596 * 597 ******************************************************************************/ 598 599 static void 600 AcpiDmI2cSerialBusDescriptor ( 601 ACPI_OP_WALK_INFO *Info, 602 AML_RESOURCE *Resource, 603 UINT32 Length, 604 UINT32 Level) 605 { 606 UINT32 ResourceSourceOffset; 607 char *DeviceName; 608 609 610 /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */ 611 612 AcpiDmIndent (Level); 613 AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n", 614 Resource->I2cSerialBus.SlaveAddress, 615 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)], 616 Resource->I2cSerialBus.ConnectionSpeed); 617 618 AcpiDmIndent (Level + 1); 619 AcpiOsPrintf ("%s, ", 620 AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]); 621 622 /* ResourceSource is a required field */ 623 624 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + 625 Resource->CommonSerialBus.TypeDataLength; 626 627 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); 628 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 629 630 /* ResourceSourceIndex, ResourceUsage */ 631 632 AcpiOsPrintf (",\n"); 633 AcpiDmIndent (Level + 1); 634 AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex); 635 636 AcpiOsPrintf ("%s, ", 637 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]); 638 639 /* Insert a descriptor name */ 640 641 AcpiDmDescriptorName (); 642 643 /* Share */ 644 645 AcpiOsPrintf (", %s,\n", 646 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]); 647 648 /* Dump the vendor data */ 649 650 AcpiDmIndent (Level + 1); 651 AcpiDmDumpSerialBusVendorData (Resource, Level); 652 AcpiOsPrintf (")\n"); 653 654 #ifndef _KERNEL 655 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); 656 #endif 657 } 658 659 660 /******************************************************************************* 661 * 662 * FUNCTION: AcpiDmSpiSerialBusDescriptor 663 * 664 * PARAMETERS: Info - Extra resource info 665 * Resource - Pointer to the resource descriptor 666 * Length - Length of the descriptor in bytes 667 * Level - Current source code indentation level 668 * 669 * RETURN: None 670 * 671 * DESCRIPTION: Decode a SPI serial bus descriptor 672 * 673 ******************************************************************************/ 674 675 static void 676 AcpiDmSpiSerialBusDescriptor ( 677 ACPI_OP_WALK_INFO *Info, 678 AML_RESOURCE *Resource, 679 UINT32 Length, 680 UINT32 Level) 681 { 682 UINT32 ResourceSourceOffset; 683 char *DeviceName; 684 685 686 /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */ 687 688 AcpiDmIndent (Level); 689 AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n", 690 Resource->SpiSerialBus.DeviceSelection, 691 AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)], 692 AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)], 693 Resource->SpiSerialBus.DataBitLength); 694 695 /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */ 696 697 AcpiDmIndent (Level + 1); 698 AcpiOsPrintf ("%s, 0x%8.8X, %s,\n", 699 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)], 700 Resource->SpiSerialBus.ConnectionSpeed, 701 AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]); 702 703 AcpiDmIndent (Level + 1); 704 AcpiOsPrintf ("%s, ", 705 AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]); 706 707 /* ResourceSource is a required field */ 708 709 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + 710 Resource->CommonSerialBus.TypeDataLength; 711 712 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); 713 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 714 715 /* ResourceSourceIndex, ResourceUsage */ 716 717 AcpiOsPrintf (",\n"); 718 AcpiDmIndent (Level + 1); 719 AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex); 720 721 AcpiOsPrintf ("%s, ", 722 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]); 723 724 /* Insert a descriptor name */ 725 726 AcpiDmDescriptorName (); 727 728 /* Share */ 729 730 AcpiOsPrintf (", %s,\n", 731 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]); 732 733 /* Dump the vendor data */ 734 735 AcpiDmIndent (Level + 1); 736 AcpiDmDumpSerialBusVendorData (Resource, Level); 737 AcpiOsPrintf (")\n"); 738 739 #ifndef _KERNEL 740 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); 741 #endif 742 } 743 744 745 /******************************************************************************* 746 * 747 * FUNCTION: AcpiDmUartSerialBusDescriptor 748 * 749 * PARAMETERS: Info - Extra resource info 750 * Resource - Pointer to the resource descriptor 751 * Length - Length of the descriptor in bytes 752 * Level - Current source code indentation level 753 * 754 * RETURN: None 755 * 756 * DESCRIPTION: Decode a UART serial bus descriptor 757 * 758 ******************************************************************************/ 759 760 static void 761 AcpiDmUartSerialBusDescriptor ( 762 ACPI_OP_WALK_INFO *Info, 763 AML_RESOURCE *Resource, 764 UINT32 Length, 765 UINT32 Level) 766 { 767 UINT32 ResourceSourceOffset; 768 char *DeviceName; 769 770 771 /* ConnectionSpeed, BitsPerByte, StopBits */ 772 773 AcpiDmIndent (Level); 774 AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n", 775 Resource->UartSerialBus.DefaultBaudRate, 776 AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)], 777 AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]); 778 779 /* LinesInUse, IsBigEndian, Parity, FlowControl */ 780 781 AcpiDmIndent (Level + 1); 782 AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n", 783 Resource->UartSerialBus.LinesEnabled, 784 AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)], 785 AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)], 786 AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]); 787 788 /* ReceiveBufferSize, TransmitBufferSize */ 789 790 AcpiDmIndent (Level + 1); 791 AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ", 792 Resource->UartSerialBus.RxFifoSize, 793 Resource->UartSerialBus.TxFifoSize); 794 795 /* ResourceSource is a required field */ 796 797 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + 798 Resource->CommonSerialBus.TypeDataLength; 799 800 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); 801 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 802 803 /* ResourceSourceIndex, ResourceUsage */ 804 805 AcpiOsPrintf (",\n"); 806 AcpiDmIndent (Level + 1); 807 AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex); 808 809 AcpiOsPrintf ("%s, ", 810 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]); 811 812 /* Insert a descriptor name */ 813 814 AcpiDmDescriptorName (); 815 816 /* Share */ 817 818 AcpiOsPrintf (", %s,\n", 819 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]); 820 821 /* Dump the vendor data */ 822 823 AcpiDmIndent (Level + 1); 824 AcpiDmDumpSerialBusVendorData (Resource, Level); 825 AcpiOsPrintf (")\n"); 826 827 #ifndef _KERNEL 828 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); 829 #endif 830 } 831 832 833 /******************************************************************************* 834 * 835 * FUNCTION: AcpiDmSerialBusDescriptor 836 * 837 * PARAMETERS: Info - Extra resource info 838 * Resource - Pointer to the resource descriptor 839 * Length - Length of the descriptor in bytes 840 * Level - Current source code indentation level 841 * 842 * RETURN: None 843 * 844 * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor 845 * 846 ******************************************************************************/ 847 848 void 849 AcpiDmSerialBusDescriptor ( 850 ACPI_OP_WALK_INFO *Info, 851 AML_RESOURCE *Resource, 852 UINT32 Length, 853 UINT32 Level) 854 { 855 856 SerialBusResourceDispatch [Resource->CommonSerialBus.Type] ( 857 Info, Resource, Length, Level); 858 } 859