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