xref: /freebsd/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c (revision 19fae0f66023a97a9b464b3beeeabb2081f575b3)
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 - 2022, 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 AcpiDmCsi2SerialBusDescriptor (
164     ACPI_OP_WALK_INFO       *Info,
165     AML_RESOURCE            *Resource,
166     UINT32                  Length,
167     UINT32                  Level);
168 
169 static void
170 AcpiDmI2cSerialBusDescriptor (
171     ACPI_OP_WALK_INFO       *Info,
172     AML_RESOURCE            *Resource,
173     UINT32                  Length,
174     UINT32                  Level);
175 
176 static void
177 AcpiDmSpiSerialBusDescriptor (
178     ACPI_OP_WALK_INFO       *Info,
179     AML_RESOURCE            *Resource,
180     UINT32                  Length,
181     UINT32                  Level);
182 
183 static void
184 AcpiDmUartSerialBusDescriptor (
185     ACPI_OP_WALK_INFO       *Info,
186     AML_RESOURCE            *Resource,
187     UINT32                  Length,
188     UINT32                  Level);
189 
190 static void
191 AcpiDmGpioCommon (
192     ACPI_OP_WALK_INFO       *Info,
193     AML_RESOURCE            *Resource,
194     UINT32                  Level);
195 
196 static void
197 AcpiDmDumpRawDataBuffer (
198     UINT8                   *Buffer,
199     UINT32                  Length,
200     UINT32                  Level);
201 
202 
203 /* Dispatch table for the serial bus descriptors */
204 
205 static ACPI_RESOURCE_HANDLER        SerialBusResourceDispatch [] =
206 {
207     NULL,
208     AcpiDmI2cSerialBusDescriptor,
209     AcpiDmSpiSerialBusDescriptor,
210     AcpiDmUartSerialBusDescriptor,
211     AcpiDmCsi2SerialBusDescriptor
212 };
213 
214 
215 /*******************************************************************************
216  *
217  * FUNCTION:    AcpiDmDumpRawDataBuffer
218  *
219  * PARAMETERS:  Buffer              - Pointer to the data bytes
220  *              Length              - Length of the descriptor in bytes
221  *              Level               - Current source code indentation level
222  *
223  * RETURN:      None
224  *
225  * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
226  *              vendor data bytes.
227  *
228  ******************************************************************************/
229 
230 static void
231 AcpiDmDumpRawDataBuffer (
232     UINT8                   *Buffer,
233     UINT32                  Length,
234     UINT32                  Level)
235 {
236     UINT32                  Index;
237     UINT32                  i;
238     UINT32                  j;
239 
240 
241     if (!Length)
242     {
243         return;
244     }
245 
246     AcpiOsPrintf ("RawDataBuffer (0x%.2X)  // Vendor Data", Length);
247 
248     AcpiOsPrintf ("\n");
249     AcpiDmIndent (Level + 1);
250     AcpiOsPrintf ("{\n");
251     AcpiDmIndent (Level + 2);
252 
253     for (i = 0; i < Length;)
254     {
255         for (j = 0; j < 8; j++)
256         {
257             Index = i + j;
258             if (Index >= Length)
259             {
260                 goto Finish;
261             }
262 
263             AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
264             if ((Index + 1) >= Length)
265             {
266                 goto Finish;
267             }
268 
269             AcpiOsPrintf (", ");
270         }
271 
272         AcpiOsPrintf ("\n");
273         AcpiDmIndent (Level + 2);
274 
275         i += 8;
276     }
277 
278 Finish:
279     AcpiOsPrintf ("\n");
280     AcpiDmIndent (Level + 1);
281     AcpiOsPrintf ("}");
282 }
283 
284 
285 /*******************************************************************************
286  *
287  * FUNCTION:    AcpiDmGpioCommon
288  *
289  * PARAMETERS:  Info                - Extra resource info
290  *              Resource            - Pointer to the resource descriptor
291  *              Level               - Current source code indentation level
292  *
293  * RETURN:      None
294  *
295  * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
296  *
297  ******************************************************************************/
298 
299 static void
300 AcpiDmGpioCommon (
301     ACPI_OP_WALK_INFO       *Info,
302     AML_RESOURCE            *Resource,
303     UINT32                  Level)
304 {
305     UINT16                  *PinList;
306     UINT8                   *VendorData;
307     char                    *DeviceName = NULL;
308     UINT32                  PinCount;
309     UINT32                  i;
310 
311 
312     /* ResourceSource, ResourceSourceIndex, ResourceType */
313 
314     AcpiDmIndent (Level + 1);
315     if (Resource->Gpio.ResSourceOffset)
316     {
317         DeviceName = ACPI_ADD_PTR (char,
318             Resource, Resource->Gpio.ResSourceOffset),
319         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
320     }
321 
322     AcpiOsPrintf (", ");
323     AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
324     AcpiOsPrintf ("%s, ",
325         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
326 
327     /* Insert a descriptor name */
328 
329     AcpiDmDescriptorName ();
330     AcpiOsPrintf (",");
331 
332     /* Dump the vendor data */
333 
334     if (Resource->Gpio.VendorOffset)
335     {
336         AcpiOsPrintf ("\n");
337         AcpiDmIndent (Level + 1);
338         VendorData = ACPI_ADD_PTR (UINT8, Resource,
339             Resource->Gpio.VendorOffset);
340 
341         AcpiDmDumpRawDataBuffer (VendorData,
342             Resource->Gpio.VendorLength, Level);
343     }
344 
345     AcpiOsPrintf (")\n");
346 
347     /* Dump the interrupt list */
348 
349     AcpiDmIndent (Level + 1);
350     AcpiOsPrintf ("{   // Pin list\n");
351 
352     PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
353         Resource->Gpio.PinTableOffset)) /
354         sizeof (UINT16);
355 
356     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
357         Resource->Gpio.PinTableOffset);
358 
359     for (i = 0; i < PinCount; i++)
360     {
361         AcpiDmIndent (Level + 2);
362         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
363             ((i + 1) < PinCount) ? "," : "");
364     }
365 
366     AcpiDmIndent (Level + 1);
367     AcpiOsPrintf ("}\n");
368 
369 #ifndef _KERNEL
370     MpSaveGpioInfo (Info->MappingOp, Resource,
371         PinCount, PinList, DeviceName);
372 #endif
373 }
374 
375 
376 /*******************************************************************************
377  *
378  * FUNCTION:    AcpiDmGpioIntDescriptor
379  *
380  * PARAMETERS:  Info                - Extra resource info
381  *              Resource            - Pointer to the resource descriptor
382  *              Length              - Length of the descriptor in bytes
383  *              Level               - Current source code indentation level
384  *
385  * RETURN:      None
386  *
387  * DESCRIPTION: Decode a GPIO Interrupt descriptor
388  *
389  ******************************************************************************/
390 
391 static void
392 AcpiDmGpioIntDescriptor (
393     ACPI_OP_WALK_INFO       *Info,
394     AML_RESOURCE            *Resource,
395     UINT32                  Length,
396     UINT32                  Level)
397 {
398 
399     /* Dump the GpioInt-specific portion of the descriptor */
400 
401     /* EdgeLevel, ActiveLevel, Shared */
402 
403     AcpiDmIndent (Level);
404     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
405         AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
406         AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
407         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
408 
409     /* PinConfig, DebounceTimeout */
410 
411     if (Resource->Gpio.PinConfig <= 3)
412     {
413         AcpiOsPrintf ("%s, ",
414             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
415     }
416     else
417     {
418         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
419     }
420     AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
421 
422     /* Dump the GpioInt/GpioIo common portion of the descriptor */
423 
424     AcpiDmGpioCommon (Info, Resource, Level);
425 }
426 
427 
428 /*******************************************************************************
429  *
430  * FUNCTION:    AcpiDmGpioIoDescriptor
431  *
432  * PARAMETERS:  Info                - Extra resource info
433  *              Resource            - Pointer to the resource descriptor
434  *              Length              - Length of the descriptor in bytes
435  *              Level               - Current source code indentation level
436  *
437  * RETURN:      None
438  *
439  * DESCRIPTION: Decode a GPIO I/O descriptor
440  *
441  ******************************************************************************/
442 
443 static void
444 AcpiDmGpioIoDescriptor (
445     ACPI_OP_WALK_INFO       *Info,
446     AML_RESOURCE            *Resource,
447     UINT32                  Length,
448     UINT32                  Level)
449 {
450 
451     /* Dump the GpioIo-specific portion of the descriptor */
452 
453     /* Shared, PinConfig */
454 
455     AcpiDmIndent (Level);
456     AcpiOsPrintf ("GpioIo (%s, ",
457         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
458 
459     if (Resource->Gpio.PinConfig <= 3)
460     {
461         AcpiOsPrintf ("%s, ",
462             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
463     }
464     else
465     {
466         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
467     }
468 
469     /* DebounceTimeout, DriveStrength, IoRestriction */
470 
471     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
472     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
473     AcpiOsPrintf ("%s,\n",
474         AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
475 
476     /* Dump the GpioInt/GpioIo common portion of the descriptor */
477 
478     AcpiDmGpioCommon (Info, Resource, Level);
479 }
480 
481 
482 /*******************************************************************************
483  *
484  * FUNCTION:    AcpiDmGpioDescriptor
485  *
486  * PARAMETERS:  Info                - Extra resource info
487  *              Resource            - Pointer to the resource descriptor
488  *              Length              - Length of the descriptor in bytes
489  *              Level               - Current source code indentation level
490  *
491  * RETURN:      None
492  *
493  * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
494  *
495  ******************************************************************************/
496 
497 void
498 AcpiDmGpioDescriptor (
499     ACPI_OP_WALK_INFO       *Info,
500     AML_RESOURCE            *Resource,
501     UINT32                  Length,
502     UINT32                  Level)
503 {
504     UINT8                   ConnectionType;
505 
506 
507     ConnectionType = Resource->Gpio.ConnectionType;
508 
509     switch (ConnectionType)
510     {
511     case AML_RESOURCE_GPIO_TYPE_INT:
512 
513         AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
514         break;
515 
516     case AML_RESOURCE_GPIO_TYPE_IO:
517 
518         AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
519         break;
520 
521     default:
522 
523         AcpiOsPrintf ("Unknown GPIO type\n");
524         break;
525     }
526 }
527 
528 /*******************************************************************************
529  *
530  * FUNCTION:    AcpiDmPinFunctionDescriptor
531  *
532  * PARAMETERS:  Info                - Extra resource info
533  *              Resource            - Pointer to the resource descriptor
534  *              Length              - Length of the descriptor in bytes
535  *              Level               - Current source code indentation level
536  *
537  * RETURN:      None
538  *
539  * DESCRIPTION: Decode a PinFunction descriptor
540  *
541  ******************************************************************************/
542 
543 void
544 AcpiDmPinFunctionDescriptor (
545     ACPI_OP_WALK_INFO       *Info,
546     AML_RESOURCE            *Resource,
547     UINT32                  Length,
548     UINT32                  Level)
549 {
550     UINT16                  *PinList;
551     UINT8                   *VendorData;
552     char                    *DeviceName = NULL;
553     UINT32                  PinCount;
554     UINT32                  i;
555 
556     AcpiDmIndent (Level);
557     AcpiOsPrintf ("PinFunction (%s, ",
558         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]);
559 
560     if (Resource->PinFunction.PinConfig <= 3)
561     {
562         AcpiOsPrintf ("%s, ",
563             AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]);
564     }
565     else
566     {
567         AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig);
568     }
569 
570     /* FunctionNumber */
571 
572     AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
573 
574     if (Resource->PinFunction.ResSourceOffset)
575     {
576         DeviceName = ACPI_ADD_PTR (char,
577             Resource, Resource->PinFunction.ResSourceOffset),
578         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
579     }
580 
581     AcpiOsPrintf (", ");
582     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex);
583 
584     AcpiDmIndent (Level + 1);
585 
586     /* Always ResourceConsumer */
587     AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]);
588 
589     /* Insert a descriptor name */
590 
591     AcpiDmDescriptorName ();
592 
593     AcpiOsPrintf (",");
594 
595     /* Dump the vendor data */
596 
597     if (Resource->PinFunction.VendorLength)
598     {
599         AcpiOsPrintf ("\n");
600         AcpiDmIndent (Level + 1);
601         VendorData = ACPI_ADD_PTR (UINT8, Resource,
602             Resource->PinFunction.VendorOffset);
603 
604         AcpiDmDumpRawDataBuffer (VendorData,
605             Resource->PinFunction.VendorLength, Level);
606     }
607 
608     AcpiOsPrintf (")\n");
609 
610     AcpiDmIndent (Level + 1);
611 
612     /* Dump the interrupt list */
613 
614     AcpiOsPrintf ("{   // Pin list\n");
615 
616     PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
617         Resource->PinFunction.PinTableOffset)) /
618         sizeof (UINT16);
619 
620     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
621         Resource->PinFunction.PinTableOffset);
622 
623     for (i = 0; i < PinCount; i++)
624     {
625         AcpiDmIndent (Level + 2);
626         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
627             ((i + 1) < PinCount) ? "," : "");
628     }
629 
630     AcpiDmIndent (Level + 1);
631     AcpiOsPrintf ("}\n");
632 }
633 
634 
635 /*******************************************************************************
636  *
637  * FUNCTION:    AcpiDmDumpSerialBusVendorData
638  *
639  * PARAMETERS:  Resource            - Pointer to the resource descriptor
640  *
641  * RETURN:      None
642  *
643  * DESCRIPTION: Dump optional serial bus vendor data
644  *
645  ******************************************************************************/
646 
647 static void
648 AcpiDmDumpSerialBusVendorData (
649     AML_RESOURCE            *Resource,
650     UINT32                  Level)
651 {
652     UINT8                   *VendorData;
653     UINT32                  VendorLength;
654 
655 
656     /* Get the (optional) vendor data and length */
657 
658     switch (Resource->CommonSerialBus.Type)
659     {
660     case AML_RESOURCE_I2C_SERIALBUSTYPE:
661 
662         VendorLength = Resource->CommonSerialBus.TypeDataLength -
663             AML_RESOURCE_I2C_MIN_DATA_LEN;
664 
665         VendorData = ACPI_ADD_PTR (UINT8, Resource,
666             sizeof (AML_RESOURCE_I2C_SERIALBUS));
667         break;
668 
669     case AML_RESOURCE_SPI_SERIALBUSTYPE:
670 
671         VendorLength = Resource->CommonSerialBus.TypeDataLength -
672             AML_RESOURCE_SPI_MIN_DATA_LEN;
673 
674         VendorData = ACPI_ADD_PTR (UINT8, Resource,
675             sizeof (AML_RESOURCE_SPI_SERIALBUS));
676         break;
677 
678     case AML_RESOURCE_UART_SERIALBUSTYPE:
679 
680         VendorLength = Resource->CommonSerialBus.TypeDataLength -
681             AML_RESOURCE_UART_MIN_DATA_LEN;
682 
683         VendorData = ACPI_ADD_PTR (UINT8, Resource,
684             sizeof (AML_RESOURCE_UART_SERIALBUS));
685         break;
686 
687     case AML_RESOURCE_CSI2_SERIALBUSTYPE:
688 
689         VendorLength = Resource->CommonSerialBus.TypeDataLength -
690             AML_RESOURCE_CSI2_MIN_DATA_LEN;
691 
692         VendorData = ACPI_ADD_PTR (UINT8, Resource,
693             sizeof (AML_RESOURCE_CSI2_SERIALBUS));
694         break;
695 
696     default:
697 
698         return;
699     }
700 
701     /* Dump the vendor bytes as a RawDataBuffer object */
702 
703     AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
704 }
705 
706 
707 /*******************************************************************************
708  *
709  * FUNCTION:    AcpiDmCsi2SerialBusDescriptor
710  *
711  * PARAMETERS:  Info                - Extra resource info
712  *              Resource            - Pointer to the resource descriptor
713  *              Length              - Length of the descriptor in bytes
714  *              Level               - Current source code indentation level
715  *
716  * RETURN:      None
717  *
718  * DESCRIPTION: Decode a CSI2 serial bus descriptor
719  *
720  ******************************************************************************/
721 
722 static void
723 AcpiDmCsi2SerialBusDescriptor (
724     ACPI_OP_WALK_INFO       *Info,
725     AML_RESOURCE            *Resource,
726     UINT32                  Length,
727     UINT32                  Level)
728 {
729     UINT32                  ResourceSourceOffset;
730     char                    *DeviceName;
731 
732 
733     /* SlaveMode, PhyType, LocalPortInstance */
734 
735     AcpiDmIndent (Level);
736     AcpiOsPrintf ("Csi2Bus (%s,",
737         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->Csi2SerialBus.Flags)]);
738 
739     AcpiOsPrintf (" 0x%2.2X, 0x%2.2X,\n",
740         Resource->Csi2SerialBus.TypeSpecificFlags & 0x03,
741         Resource->Csi2SerialBus.TypeSpecificFlags & 0xFC);
742 
743     /* ResourceSource is a required field */
744 
745     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
746         Resource->CommonSerialBus.TypeDataLength;
747 
748     AcpiDmIndent (Level + 1);
749     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
750     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
751 
752     /* ResourceSourceIndex, ResourceUsage */
753 
754     AcpiOsPrintf (",\n");
755     AcpiDmIndent (Level + 1);
756     AcpiOsPrintf ("0x%2.2X, ", Resource->Csi2SerialBus.ResSourceIndex);
757 
758     AcpiOsPrintf ("%s, ",
759         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Csi2SerialBus.Flags, 1)]);
760 
761     /* Insert a descriptor name */
762 
763     AcpiDmDescriptorName ();
764 
765     /* Dump the vendor data */
766 
767     AcpiOsPrintf (",\n");
768     AcpiDmIndent (Level + 1);
769     AcpiDmDumpSerialBusVendorData (Resource, Level);
770     AcpiOsPrintf (")\n");
771 
772 #ifndef _KERNEL
773     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
774 #endif
775 }
776 
777 
778 /*******************************************************************************
779  *
780  * FUNCTION:    AcpiDmI2cSerialBusDescriptor
781  *
782  * PARAMETERS:  Info                - Extra resource info
783  *              Resource            - Pointer to the resource descriptor
784  *              Length              - Length of the descriptor in bytes
785  *              Level               - Current source code indentation level
786  *
787  * RETURN:      None
788  *
789  * DESCRIPTION: Decode a I2C serial bus descriptor
790  *
791  ******************************************************************************/
792 
793 static void
794 AcpiDmI2cSerialBusDescriptor (
795     ACPI_OP_WALK_INFO       *Info,
796     AML_RESOURCE            *Resource,
797     UINT32                  Length,
798     UINT32                  Level)
799 {
800     UINT32                  ResourceSourceOffset;
801     char                    *DeviceName;
802 
803 
804     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
805 
806     AcpiDmIndent (Level);
807     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
808         Resource->I2cSerialBus.SlaveAddress,
809         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
810         Resource->I2cSerialBus.ConnectionSpeed);
811 
812     AcpiDmIndent (Level + 1);
813     AcpiOsPrintf ("%s, ",
814         AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
815 
816     /* ResourceSource is a required field */
817 
818     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
819         Resource->CommonSerialBus.TypeDataLength;
820 
821     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
822     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
823 
824     /* ResourceSourceIndex, ResourceUsage */
825 
826     AcpiOsPrintf (",\n");
827     AcpiDmIndent (Level + 1);
828     AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
829 
830     AcpiOsPrintf ("%s, ",
831         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
832 
833     /* Insert a descriptor name */
834 
835     AcpiDmDescriptorName ();
836 
837     /* Share */
838 
839     AcpiOsPrintf (", %s,\n",
840         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
841 
842     /* Dump the vendor data */
843 
844     AcpiDmIndent (Level + 1);
845     AcpiDmDumpSerialBusVendorData (Resource, Level);
846     AcpiOsPrintf (")\n");
847 
848 #ifndef _KERNEL
849     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
850 #endif
851 }
852 
853 
854 /*******************************************************************************
855  *
856  * FUNCTION:    AcpiDmSpiSerialBusDescriptor
857  *
858  * PARAMETERS:  Info                - Extra resource info
859  *              Resource            - Pointer to the resource descriptor
860  *              Length              - Length of the descriptor in bytes
861  *              Level               - Current source code indentation level
862  *
863  * RETURN:      None
864  *
865  * DESCRIPTION: Decode a SPI serial bus descriptor
866  *
867  ******************************************************************************/
868 
869 static void
870 AcpiDmSpiSerialBusDescriptor (
871     ACPI_OP_WALK_INFO       *Info,
872     AML_RESOURCE            *Resource,
873     UINT32                  Length,
874     UINT32                  Level)
875 {
876     UINT32                  ResourceSourceOffset;
877     char                    *DeviceName;
878 
879 
880     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
881 
882     AcpiDmIndent (Level);
883     AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
884         Resource->SpiSerialBus.DeviceSelection,
885         AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
886         AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
887         Resource->SpiSerialBus.DataBitLength);
888 
889     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
890 
891     AcpiDmIndent (Level + 1);
892     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
893         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
894         Resource->SpiSerialBus.ConnectionSpeed,
895         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
896 
897     AcpiDmIndent (Level + 1);
898     AcpiOsPrintf ("%s, ",
899         AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
900 
901     /* ResourceSource is a required field */
902 
903     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
904         Resource->CommonSerialBus.TypeDataLength;
905 
906     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
907     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
908 
909     /* ResourceSourceIndex, ResourceUsage */
910 
911     AcpiOsPrintf (",\n");
912     AcpiDmIndent (Level + 1);
913     AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
914 
915     AcpiOsPrintf ("%s, ",
916         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
917 
918     /* Insert a descriptor name */
919 
920     AcpiDmDescriptorName ();
921 
922     /* Share */
923 
924     AcpiOsPrintf (", %s,\n",
925         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
926 
927     /* Dump the vendor data */
928 
929     AcpiDmIndent (Level + 1);
930     AcpiDmDumpSerialBusVendorData (Resource, Level);
931     AcpiOsPrintf (")\n");
932 
933 #ifndef _KERNEL
934     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
935 #endif
936 }
937 
938 
939 /*******************************************************************************
940  *
941  * FUNCTION:    AcpiDmUartSerialBusDescriptor
942  *
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
947  *
948  * RETURN:      None
949  *
950  * DESCRIPTION: Decode a UART serial bus descriptor
951  *
952  ******************************************************************************/
953 
954 static void
955 AcpiDmUartSerialBusDescriptor (
956     ACPI_OP_WALK_INFO       *Info,
957     AML_RESOURCE            *Resource,
958     UINT32                  Length,
959     UINT32                  Level)
960 {
961     UINT32                  ResourceSourceOffset;
962     char                    *DeviceName;
963 
964 
965     /* ConnectionSpeed, BitsPerByte, StopBits */
966 
967     AcpiDmIndent (Level);
968     AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
969         Resource->UartSerialBus.DefaultBaudRate,
970         AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
971         AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
972 
973     /* LinesInUse, IsBigEndian, Parity, FlowControl */
974 
975     AcpiDmIndent (Level + 1);
976     AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
977         Resource->UartSerialBus.LinesEnabled,
978         AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
979         AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
980         AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
981 
982     /* ReceiveBufferSize, TransmitBufferSize */
983 
984     AcpiDmIndent (Level + 1);
985     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
986         Resource->UartSerialBus.RxFifoSize,
987         Resource->UartSerialBus.TxFifoSize);
988 
989     /* ResourceSource is a required field */
990 
991     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
992         Resource->CommonSerialBus.TypeDataLength;
993 
994     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
995     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
996 
997     /* ResourceSourceIndex, ResourceUsage */
998 
999     AcpiOsPrintf (",\n");
1000     AcpiDmIndent (Level + 1);
1001     AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
1002 
1003     AcpiOsPrintf ("%s, ",
1004         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
1005 
1006     /* Insert a descriptor name */
1007 
1008     AcpiDmDescriptorName ();
1009 
1010     /* Share */
1011 
1012     AcpiOsPrintf (", %s,\n",
1013         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
1014 
1015     /* Dump the vendor data */
1016 
1017     AcpiDmIndent (Level + 1);
1018     AcpiDmDumpSerialBusVendorData (Resource, Level);
1019     AcpiOsPrintf (")\n");
1020 
1021 #ifndef _KERNEL
1022     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
1023 #endif
1024 }
1025 
1026 
1027 /*******************************************************************************
1028  *
1029  * FUNCTION:    AcpiDmSerialBusDescriptor
1030  *
1031  * PARAMETERS:  Info                - Extra resource info
1032  *              Resource            - Pointer to the resource descriptor
1033  *              Length              - Length of the descriptor in bytes
1034  *              Level               - Current source code indentation level
1035  *
1036  * RETURN:      None
1037  *
1038  * DESCRIPTION: Decode a I2C/SPI/UART/CSI2 serial bus descriptor
1039  *
1040  ******************************************************************************/
1041 
1042 void
1043 AcpiDmSerialBusDescriptor (
1044     ACPI_OP_WALK_INFO       *Info,
1045     AML_RESOURCE            *Resource,
1046     UINT32                  Length,
1047     UINT32                  Level)
1048 {
1049 
1050     SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
1051         Info, Resource, Length, Level);
1052 }
1053 
1054 /*******************************************************************************
1055  *
1056  * FUNCTION:    AcpiDmPinConfig
1057  *
1058  * PARAMETERS:  PinConfigType       - Pin configuration type
1059  *              PinConfigValue      - Pin configuration value
1060  *
1061  * RETURN:      None
1062  *
1063  * DESCRIPTION: Pretty prints PinConfig type and value.
1064  *
1065  ******************************************************************************/
1066 
1067 static void
1068 AcpiDmPinConfig(
1069     UINT8                   PinConfigType,
1070     UINT32                  PinConfigValue)
1071 {
1072     if (PinConfigType <= 13)
1073     {
1074         AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType,
1075             AcpiGbl_PtypDecode[PinConfigType]);
1076     }
1077     else
1078     {
1079         AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType);
1080     }
1081 
1082     /* PinConfigValue */
1083 
1084     AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue);
1085 }
1086 
1087 /*******************************************************************************
1088  *
1089  * FUNCTION:    AcpiDmPinConfigDescriptor
1090  *
1091  * PARAMETERS:  Info                - Extra resource info
1092  *              Resource            - Pointer to the resource descriptor
1093  *              Length              - Length of the descriptor in bytes
1094  *              Level               - Current source code indentation level
1095  *
1096  * RETURN:      None
1097  *
1098  * DESCRIPTION: Decode a PinConfig descriptor
1099  *
1100  ******************************************************************************/
1101 
1102 void
1103 AcpiDmPinConfigDescriptor (
1104     ACPI_OP_WALK_INFO       *Info,
1105     AML_RESOURCE            *Resource,
1106     UINT32                  Length,
1107     UINT32                  Level)
1108 {
1109     UINT16                  *PinList;
1110     UINT8                   *VendorData;
1111     char                    *DeviceName = NULL;
1112     UINT32                  PinCount;
1113     UINT32                  i;
1114 
1115     AcpiDmIndent (Level);
1116     AcpiOsPrintf ("PinConfig (%s, ",
1117         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]);
1118 
1119     AcpiDmPinConfig (Resource->PinConfig.PinConfigType,
1120         Resource->PinConfig.PinConfigValue);
1121 
1122     AcpiDmIndent (Level + 1);
1123 
1124     if (Resource->PinConfig.ResSourceOffset)
1125     {
1126         DeviceName = ACPI_ADD_PTR (char,
1127             Resource, Resource->PinConfig.ResSourceOffset),
1128         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1129     }
1130 
1131     AcpiOsPrintf (", ");
1132     AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex);
1133 
1134     AcpiOsPrintf ("%s, ",
1135         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]);
1136 
1137     /* Insert a descriptor name */
1138 
1139     AcpiDmDescriptorName ();
1140 
1141     AcpiOsPrintf (",");
1142 
1143     /* Dump the vendor data */
1144 
1145     if (Resource->PinConfig.VendorLength)
1146     {
1147         AcpiOsPrintf ("\n");
1148         AcpiDmIndent (Level + 1);
1149         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1150             Resource->PinConfig.VendorOffset);
1151 
1152         AcpiDmDumpRawDataBuffer (VendorData,
1153             Resource->PinConfig.VendorLength, Level);
1154     }
1155 
1156     AcpiOsPrintf (")\n");
1157 
1158     AcpiDmIndent (Level + 1);
1159 
1160     /* Dump the interrupt list */
1161 
1162     AcpiOsPrintf ("{   // Pin list\n");
1163 
1164     PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset -
1165         Resource->PinConfig.PinTableOffset)) /
1166         sizeof (UINT16);
1167 
1168     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1169         Resource->PinConfig.PinTableOffset);
1170 
1171     for (i = 0; i < PinCount; i++)
1172     {
1173         AcpiDmIndent (Level + 2);
1174         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1175             ((i + 1) < PinCount) ? "," : "");
1176     }
1177 
1178     AcpiDmIndent (Level + 1);
1179     AcpiOsPrintf ("}\n");
1180 }
1181 
1182 /*******************************************************************************
1183  *
1184  * FUNCTION:    AcpiDmPinGroupDescriptor
1185  *
1186  * PARAMETERS:  Info                - Extra resource info
1187  *              Resource            - Pointer to the resource descriptor
1188  *              Length              - Length of the descriptor in bytes
1189  *              Level               - Current source code indentation level
1190  *
1191  * RETURN:      None
1192  *
1193  * DESCRIPTION: Decode a PinGroup descriptor
1194  *
1195  ******************************************************************************/
1196 
1197 void
1198 AcpiDmPinGroupDescriptor (
1199     ACPI_OP_WALK_INFO       *Info,
1200     AML_RESOURCE            *Resource,
1201     UINT32                  Length,
1202     UINT32                  Level)
1203 {
1204     char                    *Label;
1205     UINT16                  *PinList;
1206     UINT8                   *VendorData;
1207     UINT32                  PinCount;
1208     UINT32                  i;
1209 
1210     AcpiDmIndent (Level);
1211     /* Always producer */
1212     AcpiOsPrintf ("PinGroup (");
1213 
1214     Label = ACPI_ADD_PTR (char,
1215         Resource, Resource->PinGroup.LabelOffset),
1216     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1217 
1218     AcpiOsPrintf (", ");
1219 
1220     AcpiOsPrintf ("%s, ",
1221         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]);
1222 
1223     /* Insert a descriptor name */
1224 
1225     AcpiDmDescriptorName ();
1226 
1227     AcpiOsPrintf (",");
1228 
1229     /* Dump the vendor data */
1230 
1231     if (Resource->PinGroup.VendorLength)
1232     {
1233         AcpiOsPrintf ("\n");
1234         AcpiDmIndent (Level + 1);
1235         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1236             Resource->PinGroup.VendorOffset);
1237 
1238         AcpiDmDumpRawDataBuffer (VendorData,
1239             Resource->PinGroup.VendorLength, Level);
1240     }
1241 
1242     AcpiOsPrintf (")\n");
1243 
1244     AcpiDmIndent (Level + 1);
1245 
1246     /* Dump the interrupt list */
1247 
1248     AcpiOsPrintf ("{   // Pin list\n");
1249 
1250     PinCount = (Resource->PinGroup.LabelOffset -
1251         Resource->PinGroup.PinTableOffset) / sizeof (UINT16);
1252 
1253     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1254         Resource->PinGroup.PinTableOffset);
1255 
1256     for (i = 0; i < PinCount; i++)
1257     {
1258         AcpiDmIndent (Level + 2);
1259         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1260             ((i + 1) < PinCount) ? "," : "");
1261     }
1262 
1263     AcpiDmIndent (Level + 1);
1264     AcpiOsPrintf ("}\n");
1265 }
1266 
1267 /*******************************************************************************
1268  *
1269  * FUNCTION:    AcpiDmPinGroupFunctionDescriptor
1270  *
1271  * PARAMETERS:  Info                - Extra resource info
1272  *              Resource            - Pointer to the resource descriptor
1273  *              Length              - Length of the descriptor in bytes
1274  *              Level               - Current source code indentation level
1275  *
1276  * RETURN:      None
1277  *
1278  * DESCRIPTION: Decode a PinGroupFunction descriptor
1279  *
1280  ******************************************************************************/
1281 
1282 void
1283 AcpiDmPinGroupFunctionDescriptor (
1284     ACPI_OP_WALK_INFO       *Info,
1285     AML_RESOURCE            *Resource,
1286     UINT32                  Length,
1287     UINT32                  Level)
1288 {
1289     UINT8                   *VendorData;
1290     char                    *DeviceName = NULL;
1291     char                    *Label = NULL;
1292 
1293     AcpiDmIndent (Level);
1294     AcpiOsPrintf ("PinGroupFunction (%s, ",
1295         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]);
1296 
1297     /* FunctionNumber */
1298 
1299     AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber);
1300 
1301     DeviceName = ACPI_ADD_PTR (char,
1302         Resource, Resource->PinGroupFunction.ResSourceOffset),
1303     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1304 
1305     AcpiOsPrintf (", ");
1306     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex);
1307 
1308     AcpiDmIndent (Level + 1);
1309 
1310     Label = ACPI_ADD_PTR (char, Resource,
1311         Resource->PinGroupFunction.ResSourceLabelOffset);
1312     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1313 
1314     AcpiOsPrintf (", ");
1315 
1316     AcpiOsPrintf ("%s, ",
1317         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]);
1318 
1319     /* Insert a descriptor name */
1320 
1321     AcpiDmDescriptorName ();
1322 
1323     AcpiOsPrintf (",");
1324 
1325     /* Dump the vendor data */
1326 
1327     if (Resource->PinGroupFunction.VendorLength)
1328     {
1329         AcpiOsPrintf ("\n");
1330         AcpiDmIndent (Level + 1);
1331         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1332             Resource->PinGroupFunction.VendorOffset);
1333 
1334         AcpiDmDumpRawDataBuffer (VendorData,
1335             Resource->PinGroupFunction.VendorLength, Level);
1336     }
1337 
1338     AcpiOsPrintf (")\n");
1339 }
1340 
1341 /*******************************************************************************
1342  *
1343  * FUNCTION:    AcpiDmPinGroupConfigDescriptor
1344  *
1345  * PARAMETERS:  Info                - Extra resource info
1346  *              Resource            - Pointer to the resource descriptor
1347  *              Length              - Length of the descriptor in bytes
1348  *              Level               - Current source code indentation level
1349  *
1350  * RETURN:      None
1351  *
1352  * DESCRIPTION: Decode a PinGroupConfig descriptor
1353  *
1354  ******************************************************************************/
1355 
1356 void
1357 AcpiDmPinGroupConfigDescriptor (
1358     ACPI_OP_WALK_INFO       *Info,
1359     AML_RESOURCE            *Resource,
1360     UINT32                  Length,
1361     UINT32                  Level)
1362 {
1363     UINT8                   *VendorData;
1364     char                    *DeviceName = NULL;
1365     char                    *Label = NULL;
1366 
1367     AcpiDmIndent (Level);
1368     AcpiOsPrintf ("PinGroupConfig (%s, ",
1369         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]);
1370 
1371     AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType,
1372         Resource->PinGroupConfig.PinConfigValue);
1373 
1374     AcpiDmIndent (Level + 1);
1375 
1376     DeviceName = ACPI_ADD_PTR (char,
1377         Resource, Resource->PinGroupConfig.ResSourceOffset),
1378     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1379 
1380     AcpiOsPrintf (", ");
1381     AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex);
1382 
1383     Label = ACPI_ADD_PTR (char, Resource,
1384         Resource->PinGroupConfig.ResSourceLabelOffset);
1385     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1386 
1387     AcpiOsPrintf (", ");
1388 
1389     AcpiOsPrintf ("%s, ",
1390         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]);
1391 
1392     /* Insert a descriptor name */
1393 
1394     AcpiDmDescriptorName ();
1395 
1396     AcpiOsPrintf (",");
1397 
1398     /* Dump the vendor data */
1399 
1400     if (Resource->PinGroupConfig.VendorLength)
1401     {
1402         AcpiOsPrintf ("\n");
1403         AcpiDmIndent (Level + 1);
1404         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1405             Resource->PinGroupConfig.VendorOffset);
1406 
1407         AcpiDmDumpRawDataBuffer (VendorData,
1408             Resource->PinGroupConfig.VendorLength, Level);
1409     }
1410 
1411     AcpiOsPrintf (")\n");
1412 }
1413