1 /*******************************************************************************
3 * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12 * All rights reserved.
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
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
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;
37 * The above copyright and patent license is granted only if the following
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.
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
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
72 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
80 * 4. Disclaimer and Export Compliance
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
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
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.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
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.
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.
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.
150 *****************************************************************************/
152 #include <contrib/dev/acpica/include/acpi.h>
153 #include <contrib/dev/acpica/include/accommon.h>
154 #include <contrib/dev/acpica/include/acdisasm.h>
157 #define _COMPONENT ACPI_CA_DEBUGGER
158 ACPI_MODULE_NAME ("dbresrcl2")
160 /* Local prototypes */
163 AcpiDmI2cSerialBusDescriptor (
164 ACPI_OP_WALK_INFO *Info,
165 AML_RESOURCE *Resource,
170 AcpiDmSpiSerialBusDescriptor (
171 ACPI_OP_WALK_INFO *Info,
172 AML_RESOURCE *Resource,
177 AcpiDmUartSerialBusDescriptor (
178 ACPI_OP_WALK_INFO *Info,
179 AML_RESOURCE *Resource,
185 ACPI_OP_WALK_INFO *Info,
186 AML_RESOURCE *Resource,
190 AcpiDmDumpRawDataBuffer (
196 /* Dispatch table for the serial bus descriptors */
198 static ACPI_RESOURCE_HANDLER SerialBusResourceDispatch [] =
201 AcpiDmI2cSerialBusDescriptor,
202 AcpiDmSpiSerialBusDescriptor,
203 AcpiDmUartSerialBusDescriptor
207 /*******************************************************************************
209 * FUNCTION: AcpiDmDumpRawDataBuffer
211 * PARAMETERS: Buffer - Pointer to the data bytes
212 * Length - Length of the descriptor in bytes
213 * Level - Current source code indentation level
217 * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
220 ******************************************************************************/
223 AcpiDmDumpRawDataBuffer (
238 AcpiOsPrintf ("RawDataBuffer (0x%.2X) // Vendor Data", Length);
241 AcpiDmIndent (Level + 1);
242 AcpiOsPrintf ("{\n");
243 AcpiDmIndent (Level + 2);
245 for (i = 0; i < Length;)
247 for (j = 0; j < 8; j++)
255 AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
256 if ((Index + 1) >= Length)
265 AcpiDmIndent (Level + 2);
272 AcpiDmIndent (Level + 1);
277 /*******************************************************************************
279 * FUNCTION: AcpiDmGpioCommon
281 * PARAMETERS: Info - Extra resource info
282 * Resource - Pointer to the resource descriptor
283 * Level - Current source code indentation level
287 * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
289 ******************************************************************************/
293 ACPI_OP_WALK_INFO *Info,
294 AML_RESOURCE *Resource,
299 char *DeviceName = NULL;
304 /* ResourceSource, ResourceSourceIndex, ResourceType */
306 AcpiDmIndent (Level + 1);
307 if (Resource->Gpio.ResSourceOffset)
309 DeviceName = ACPI_ADD_PTR (char,
310 Resource, Resource->Gpio.ResSourceOffset),
311 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
315 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
316 AcpiOsPrintf ("%s, ",
317 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
319 /* Insert a descriptor name */
321 AcpiDmDescriptorName ();
324 /* Dump the vendor data */
326 if (Resource->Gpio.VendorOffset)
329 AcpiDmIndent (Level + 1);
330 VendorData = ACPI_ADD_PTR (UINT8, Resource,
331 Resource->Gpio.VendorOffset);
333 AcpiDmDumpRawDataBuffer (VendorData,
334 Resource->Gpio.VendorLength, Level);
337 AcpiOsPrintf (")\n");
339 /* Dump the interrupt list */
341 AcpiDmIndent (Level + 1);
342 AcpiOsPrintf ("{ // Pin list\n");
344 PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
345 Resource->Gpio.PinTableOffset)) /
348 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
349 Resource->Gpio.PinTableOffset);
351 for (i = 0; i < PinCount; i++)
353 AcpiDmIndent (Level + 2);
354 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
355 ((i + 1) < PinCount) ? "," : "");
358 AcpiDmIndent (Level + 1);
359 AcpiOsPrintf ("}\n");
362 MpSaveGpioInfo (Info->MappingOp, Resource,
363 PinCount, PinList, DeviceName);
368 /*******************************************************************************
370 * FUNCTION: AcpiDmGpioIntDescriptor
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
379 * DESCRIPTION: Decode a GPIO Interrupt descriptor
381 ******************************************************************************/
384 AcpiDmGpioIntDescriptor (
385 ACPI_OP_WALK_INFO *Info,
386 AML_RESOURCE *Resource,
391 /* Dump the GpioInt-specific portion of the descriptor */
393 /* EdgeLevel, ActiveLevel, Shared */
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)]);
401 /* PinConfig, DebounceTimeout */
403 if (Resource->Gpio.PinConfig <= 3)
405 AcpiOsPrintf ("%s, ",
406 AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
410 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
412 AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
414 /* Dump the GpioInt/GpioIo common portion of the descriptor */
416 AcpiDmGpioCommon (Info, Resource, Level);
420 /*******************************************************************************
422 * FUNCTION: AcpiDmGpioIoDescriptor
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
431 * DESCRIPTION: Decode a GPIO I/O descriptor
433 ******************************************************************************/
436 AcpiDmGpioIoDescriptor (
437 ACPI_OP_WALK_INFO *Info,
438 AML_RESOURCE *Resource,
443 /* Dump the GpioIo-specific portion of the descriptor */
445 /* Shared, PinConfig */
447 AcpiDmIndent (Level);
448 AcpiOsPrintf ("GpioIo (%s, ",
449 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
451 if (Resource->Gpio.PinConfig <= 3)
453 AcpiOsPrintf ("%s, ",
454 AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
458 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
461 /* DebounceTimeout, DriveStrength, IoRestriction */
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)]);
468 /* Dump the GpioInt/GpioIo common portion of the descriptor */
470 AcpiDmGpioCommon (Info, Resource, Level);
474 /*******************************************************************************
476 * FUNCTION: AcpiDmGpioDescriptor
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
485 * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
487 ******************************************************************************/
490 AcpiDmGpioDescriptor (
491 ACPI_OP_WALK_INFO *Info,
492 AML_RESOURCE *Resource,
496 UINT8 ConnectionType;
499 ConnectionType = Resource->Gpio.ConnectionType;
501 switch (ConnectionType)
503 case AML_RESOURCE_GPIO_TYPE_INT:
505 AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
508 case AML_RESOURCE_GPIO_TYPE_IO:
510 AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
515 AcpiOsPrintf ("Unknown GPIO type\n");
520 /*******************************************************************************
522 * FUNCTION: AcpiDmPinFunctionDescriptor
524 * PARAMETERS: Info - Extra resource info
525 * Resource - Pointer to the resource descriptor
526 * Length - Length of the descriptor in bytes
527 * Level - Current source code indentation level
531 * DESCRIPTION: Decode a PinFunction descriptor
533 ******************************************************************************/
536 AcpiDmPinFunctionDescriptor (
537 ACPI_OP_WALK_INFO *Info,
538 AML_RESOURCE *Resource,
544 char *DeviceName = NULL;
548 AcpiDmIndent (Level);
549 AcpiOsPrintf ("PinFunction (%s, ",
550 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]);
552 if (Resource->PinFunction.PinConfig <= 3)
554 AcpiOsPrintf ("%s, ",
555 AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]);
559 AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig);
564 AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
566 if (Resource->PinFunction.ResSourceOffset)
568 DeviceName = ACPI_ADD_PTR (char,
569 Resource, Resource->PinFunction.ResSourceOffset),
570 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
574 AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex);
576 AcpiDmIndent (Level + 1);
578 /* Always ResourceConsumer */
579 AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]);
581 /* Insert a descriptor name */
583 AcpiDmDescriptorName ();
587 /* Dump the vendor data */
589 if (Resource->PinFunction.VendorLength)
592 AcpiDmIndent (Level + 1);
593 VendorData = ACPI_ADD_PTR (UINT8, Resource,
594 Resource->PinFunction.VendorOffset);
596 AcpiDmDumpRawDataBuffer (VendorData,
597 Resource->PinFunction.VendorLength, Level);
600 AcpiOsPrintf (")\n");
602 AcpiDmIndent (Level + 1);
604 /* Dump the interrupt list */
606 AcpiOsPrintf ("{ // Pin list\n");
608 PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
609 Resource->PinFunction.PinTableOffset)) /
612 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
613 Resource->PinFunction.PinTableOffset);
615 for (i = 0; i < PinCount; i++)
617 AcpiDmIndent (Level + 2);
618 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
619 ((i + 1) < PinCount) ? "," : "");
622 AcpiDmIndent (Level + 1);
623 AcpiOsPrintf ("}\n");
627 /*******************************************************************************
629 * FUNCTION: AcpiDmDumpSerialBusVendorData
631 * PARAMETERS: Resource - Pointer to the resource descriptor
635 * DESCRIPTION: Dump optional serial bus vendor data
637 ******************************************************************************/
640 AcpiDmDumpSerialBusVendorData (
641 AML_RESOURCE *Resource,
648 /* Get the (optional) vendor data and length */
650 switch (Resource->CommonSerialBus.Type)
652 case AML_RESOURCE_I2C_SERIALBUSTYPE:
654 VendorLength = Resource->CommonSerialBus.TypeDataLength -
655 AML_RESOURCE_I2C_MIN_DATA_LEN;
657 VendorData = ACPI_ADD_PTR (UINT8, Resource,
658 sizeof (AML_RESOURCE_I2C_SERIALBUS));
661 case AML_RESOURCE_SPI_SERIALBUSTYPE:
663 VendorLength = Resource->CommonSerialBus.TypeDataLength -
664 AML_RESOURCE_SPI_MIN_DATA_LEN;
666 VendorData = ACPI_ADD_PTR (UINT8, Resource,
667 sizeof (AML_RESOURCE_SPI_SERIALBUS));
670 case AML_RESOURCE_UART_SERIALBUSTYPE:
672 VendorLength = Resource->CommonSerialBus.TypeDataLength -
673 AML_RESOURCE_UART_MIN_DATA_LEN;
675 VendorData = ACPI_ADD_PTR (UINT8, Resource,
676 sizeof (AML_RESOURCE_UART_SERIALBUS));
684 /* Dump the vendor bytes as a RawDataBuffer object */
686 AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
690 /*******************************************************************************
692 * FUNCTION: AcpiDmI2cSerialBusDescriptor
694 * PARAMETERS: Info - Extra resource info
695 * Resource - Pointer to the resource descriptor
696 * Length - Length of the descriptor in bytes
697 * Level - Current source code indentation level
701 * DESCRIPTION: Decode a I2C serial bus descriptor
703 ******************************************************************************/
706 AcpiDmI2cSerialBusDescriptor (
707 ACPI_OP_WALK_INFO *Info,
708 AML_RESOURCE *Resource,
712 UINT32 ResourceSourceOffset;
716 /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
718 AcpiDmIndent (Level);
719 AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
720 Resource->I2cSerialBus.SlaveAddress,
721 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
722 Resource->I2cSerialBus.ConnectionSpeed);
724 AcpiDmIndent (Level + 1);
725 AcpiOsPrintf ("%s, ",
726 AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
728 /* ResourceSource is a required field */
730 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
731 Resource->CommonSerialBus.TypeDataLength;
733 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
734 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
736 /* ResourceSourceIndex, ResourceUsage */
738 AcpiOsPrintf (",\n");
739 AcpiDmIndent (Level + 1);
740 AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
742 AcpiOsPrintf ("%s, ",
743 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
745 /* Insert a descriptor name */
747 AcpiDmDescriptorName ();
751 AcpiOsPrintf (", %s,\n",
752 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
754 /* Dump the vendor data */
756 AcpiDmIndent (Level + 1);
757 AcpiDmDumpSerialBusVendorData (Resource, Level);
758 AcpiOsPrintf (")\n");
761 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
766 /*******************************************************************************
768 * FUNCTION: AcpiDmSpiSerialBusDescriptor
770 * PARAMETERS: Info - Extra resource info
771 * Resource - Pointer to the resource descriptor
772 * Length - Length of the descriptor in bytes
773 * Level - Current source code indentation level
777 * DESCRIPTION: Decode a SPI serial bus descriptor
779 ******************************************************************************/
782 AcpiDmSpiSerialBusDescriptor (
783 ACPI_OP_WALK_INFO *Info,
784 AML_RESOURCE *Resource,
788 UINT32 ResourceSourceOffset;
792 /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
794 AcpiDmIndent (Level);
795 AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
796 Resource->SpiSerialBus.DeviceSelection,
797 AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
798 AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
799 Resource->SpiSerialBus.DataBitLength);
801 /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
803 AcpiDmIndent (Level + 1);
804 AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
805 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
806 Resource->SpiSerialBus.ConnectionSpeed,
807 AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
809 AcpiDmIndent (Level + 1);
810 AcpiOsPrintf ("%s, ",
811 AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
813 /* ResourceSource is a required field */
815 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
816 Resource->CommonSerialBus.TypeDataLength;
818 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
819 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
821 /* ResourceSourceIndex, ResourceUsage */
823 AcpiOsPrintf (",\n");
824 AcpiDmIndent (Level + 1);
825 AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
827 AcpiOsPrintf ("%s, ",
828 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
830 /* Insert a descriptor name */
832 AcpiDmDescriptorName ();
836 AcpiOsPrintf (", %s,\n",
837 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
839 /* Dump the vendor data */
841 AcpiDmIndent (Level + 1);
842 AcpiDmDumpSerialBusVendorData (Resource, Level);
843 AcpiOsPrintf (")\n");
846 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
851 /*******************************************************************************
853 * FUNCTION: AcpiDmUartSerialBusDescriptor
855 * PARAMETERS: Info - Extra resource info
856 * Resource - Pointer to the resource descriptor
857 * Length - Length of the descriptor in bytes
858 * Level - Current source code indentation level
862 * DESCRIPTION: Decode a UART serial bus descriptor
864 ******************************************************************************/
867 AcpiDmUartSerialBusDescriptor (
868 ACPI_OP_WALK_INFO *Info,
869 AML_RESOURCE *Resource,
873 UINT32 ResourceSourceOffset;
877 /* ConnectionSpeed, BitsPerByte, StopBits */
879 AcpiDmIndent (Level);
880 AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
881 Resource->UartSerialBus.DefaultBaudRate,
882 AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
883 AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
885 /* LinesInUse, IsBigEndian, Parity, FlowControl */
887 AcpiDmIndent (Level + 1);
888 AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
889 Resource->UartSerialBus.LinesEnabled,
890 AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
891 AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
892 AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
894 /* ReceiveBufferSize, TransmitBufferSize */
896 AcpiDmIndent (Level + 1);
897 AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
898 Resource->UartSerialBus.RxFifoSize,
899 Resource->UartSerialBus.TxFifoSize);
901 /* ResourceSource is a required field */
903 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
904 Resource->CommonSerialBus.TypeDataLength;
906 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
907 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
909 /* ResourceSourceIndex, ResourceUsage */
911 AcpiOsPrintf (",\n");
912 AcpiDmIndent (Level + 1);
913 AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
915 AcpiOsPrintf ("%s, ",
916 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
918 /* Insert a descriptor name */
920 AcpiDmDescriptorName ();
924 AcpiOsPrintf (", %s,\n",
925 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
927 /* Dump the vendor data */
929 AcpiDmIndent (Level + 1);
930 AcpiDmDumpSerialBusVendorData (Resource, Level);
931 AcpiOsPrintf (")\n");
934 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
939 /*******************************************************************************
941 * FUNCTION: AcpiDmSerialBusDescriptor
943 * PARAMETERS: Info - Extra resource info
944 * Resource - Pointer to the resource descriptor
945 * Length - Length of the descriptor in bytes
946 * Level - Current source code indentation level
950 * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
952 ******************************************************************************/
955 AcpiDmSerialBusDescriptor (
956 ACPI_OP_WALK_INFO *Info,
957 AML_RESOURCE *Resource,
962 SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
963 Info, Resource, Length, Level);
966 /*******************************************************************************
968 * FUNCTION: AcpiDmPinConfig
970 * PARAMETERS: PinConfigType - Pin configuration type
971 * PinConfigValue - Pin configuration value
975 * DESCRIPTION: Pretty prints PinConfig type and value.
977 ******************************************************************************/
982 UINT32 PinConfigValue)
984 if (PinConfigType <= 13)
986 AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType,
987 AcpiGbl_PtypDecode[PinConfigType]);
991 AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType);
996 AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue);
999 /*******************************************************************************
1001 * FUNCTION: AcpiDmPinConfigDescriptor
1003 * PARAMETERS: Info - Extra resource info
1004 * Resource - Pointer to the resource descriptor
1005 * Length - Length of the descriptor in bytes
1006 * Level - Current source code indentation level
1010 * DESCRIPTION: Decode a PinConfig descriptor
1012 ******************************************************************************/
1015 AcpiDmPinConfigDescriptor (
1016 ACPI_OP_WALK_INFO *Info,
1017 AML_RESOURCE *Resource,
1023 char *DeviceName = NULL;
1027 AcpiDmIndent (Level);
1028 AcpiOsPrintf ("PinConfig (%s, ",
1029 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]);
1031 AcpiDmPinConfig (Resource->PinConfig.PinConfigType,
1032 Resource->PinConfig.PinConfigValue);
1034 AcpiDmIndent (Level + 1);
1036 if (Resource->PinConfig.ResSourceOffset)
1038 DeviceName = ACPI_ADD_PTR (char,
1039 Resource, Resource->PinConfig.ResSourceOffset),
1040 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1043 AcpiOsPrintf (", ");
1044 AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex);
1046 AcpiOsPrintf ("%s, ",
1047 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]);
1049 /* Insert a descriptor name */
1051 AcpiDmDescriptorName ();
1055 /* Dump the vendor data */
1057 if (Resource->PinConfig.VendorLength)
1059 AcpiOsPrintf ("\n");
1060 AcpiDmIndent (Level + 1);
1061 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1062 Resource->PinConfig.VendorOffset);
1064 AcpiDmDumpRawDataBuffer (VendorData,
1065 Resource->PinConfig.VendorLength, Level);
1068 AcpiOsPrintf (")\n");
1070 AcpiDmIndent (Level + 1);
1072 /* Dump the interrupt list */
1074 AcpiOsPrintf ("{ // Pin list\n");
1076 PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset -
1077 Resource->PinConfig.PinTableOffset)) /
1080 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1081 Resource->PinConfig.PinTableOffset);
1083 for (i = 0; i < PinCount; i++)
1085 AcpiDmIndent (Level + 2);
1086 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1087 ((i + 1) < PinCount) ? "," : "");
1090 AcpiDmIndent (Level + 1);
1091 AcpiOsPrintf ("}\n");
1094 /*******************************************************************************
1096 * FUNCTION: AcpiDmPinGroupDescriptor
1098 * PARAMETERS: Info - Extra resource info
1099 * Resource - Pointer to the resource descriptor
1100 * Length - Length of the descriptor in bytes
1101 * Level - Current source code indentation level
1105 * DESCRIPTION: Decode a PinGroup descriptor
1107 ******************************************************************************/
1110 AcpiDmPinGroupDescriptor (
1111 ACPI_OP_WALK_INFO *Info,
1112 AML_RESOURCE *Resource,
1122 AcpiDmIndent (Level);
1123 /* Always producer */
1124 AcpiOsPrintf ("PinGroup (");
1126 Label = ACPI_ADD_PTR (char,
1127 Resource, Resource->PinGroup.LabelOffset),
1128 AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1130 AcpiOsPrintf (", ");
1132 AcpiOsPrintf ("%s, ",
1133 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]);
1135 /* Insert a descriptor name */
1137 AcpiDmDescriptorName ();
1141 /* Dump the vendor data */
1143 if (Resource->PinGroup.VendorLength)
1145 AcpiOsPrintf ("\n");
1146 AcpiDmIndent (Level + 1);
1147 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1148 Resource->PinGroup.VendorOffset);
1150 AcpiDmDumpRawDataBuffer (VendorData,
1151 Resource->PinGroup.VendorLength, Level);
1154 AcpiOsPrintf (")\n");
1156 AcpiDmIndent (Level + 1);
1158 /* Dump the interrupt list */
1160 AcpiOsPrintf ("{ // Pin list\n");
1162 PinCount = (Resource->PinGroup.LabelOffset -
1163 Resource->PinGroup.PinTableOffset) / sizeof (UINT16);
1165 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1166 Resource->PinGroup.PinTableOffset);
1168 for (i = 0; i < PinCount; i++)
1170 AcpiDmIndent (Level + 2);
1171 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1172 ((i + 1) < PinCount) ? "," : "");
1175 AcpiDmIndent (Level + 1);
1176 AcpiOsPrintf ("}\n");
1179 /*******************************************************************************
1181 * FUNCTION: AcpiDmPinGroupFunctionDescriptor
1183 * PARAMETERS: Info - Extra resource info
1184 * Resource - Pointer to the resource descriptor
1185 * Length - Length of the descriptor in bytes
1186 * Level - Current source code indentation level
1190 * DESCRIPTION: Decode a PinGroupFunction descriptor
1192 ******************************************************************************/
1195 AcpiDmPinGroupFunctionDescriptor (
1196 ACPI_OP_WALK_INFO *Info,
1197 AML_RESOURCE *Resource,
1202 char *DeviceName = NULL;
1205 AcpiDmIndent (Level);
1206 AcpiOsPrintf ("PinGroupFunction (%s, ",
1207 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]);
1209 /* FunctionNumber */
1211 AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber);
1213 DeviceName = ACPI_ADD_PTR (char,
1214 Resource, Resource->PinGroupFunction.ResSourceOffset),
1215 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1217 AcpiOsPrintf (", ");
1218 AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex);
1220 AcpiDmIndent (Level + 1);
1222 Label = ACPI_ADD_PTR (char, Resource,
1223 Resource->PinGroupFunction.ResSourceLabelOffset);
1224 AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1226 AcpiOsPrintf (", ");
1228 AcpiOsPrintf ("%s, ",
1229 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]);
1231 /* Insert a descriptor name */
1233 AcpiDmDescriptorName ();
1237 /* Dump the vendor data */
1239 if (Resource->PinGroupFunction.VendorLength)
1241 AcpiOsPrintf ("\n");
1242 AcpiDmIndent (Level + 1);
1243 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1244 Resource->PinGroupFunction.VendorOffset);
1246 AcpiDmDumpRawDataBuffer (VendorData,
1247 Resource->PinGroupFunction.VendorLength, Level);
1250 AcpiOsPrintf (")\n");
1253 /*******************************************************************************
1255 * FUNCTION: AcpiDmPinGroupConfigDescriptor
1257 * PARAMETERS: Info - Extra resource info
1258 * Resource - Pointer to the resource descriptor
1259 * Length - Length of the descriptor in bytes
1260 * Level - Current source code indentation level
1264 * DESCRIPTION: Decode a PinGroupConfig descriptor
1266 ******************************************************************************/
1269 AcpiDmPinGroupConfigDescriptor (
1270 ACPI_OP_WALK_INFO *Info,
1271 AML_RESOURCE *Resource,
1276 char *DeviceName = NULL;
1279 AcpiDmIndent (Level);
1280 AcpiOsPrintf ("PinGroupConfig (%s, ",
1281 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]);
1283 AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType,
1284 Resource->PinGroupConfig.PinConfigValue);
1286 AcpiDmIndent (Level + 1);
1288 DeviceName = ACPI_ADD_PTR (char,
1289 Resource, Resource->PinGroupConfig.ResSourceOffset),
1290 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1292 AcpiOsPrintf (", ");
1293 AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex);
1295 Label = ACPI_ADD_PTR (char, Resource,
1296 Resource->PinGroupConfig.ResSourceLabelOffset);
1297 AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1299 AcpiOsPrintf (", ");
1301 AcpiOsPrintf ("%s, ",
1302 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]);
1304 /* Insert a descriptor name */
1306 AcpiDmDescriptorName ();
1310 /* Dump the vendor data */
1312 if (Resource->PinGroupConfig.VendorLength)
1314 AcpiOsPrintf ("\n");
1315 AcpiDmIndent (Level + 1);
1316 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1317 Resource->PinGroupConfig.VendorOffset);
1319 AcpiDmDumpRawDataBuffer (VendorData,
1320 Resource->PinGroupConfig.VendorLength, Level);
1323 AcpiOsPrintf (")\n");