xref: /netbsd-src/sys/external/bsd/acpica/dist/disassembler/dmresrcl2.c (revision 2c7d7e3ca2e4f0b675c6c58e614f6aede66c678e)
1 /*******************************************************************************
2  *
3  * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2023, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acdisasm.h"
47 
48 #ifdef _KERNEL
49 #define MpSaveGpioInfo(a, b, c, d, e)
50 #define MpSaveSerialInfo(a, b, c)
51 #endif
52 
53 #define _COMPONENT          ACPI_CA_DEBUGGER
54         ACPI_MODULE_NAME    ("dbresrcl2")
55 
56 /* Local prototypes */
57 
58 static void
59 AcpiDmCsi2SerialBusDescriptor (
60     ACPI_OP_WALK_INFO       *Info,
61     AML_RESOURCE            *Resource,
62     UINT32                  Length,
63     UINT32                  Level);
64 
65 static void
66 AcpiDmI2cSerialBusDescriptor (
67     ACPI_OP_WALK_INFO       *Info,
68     AML_RESOURCE            *Resource,
69     UINT32                  Length,
70     UINT32                  Level);
71 
72 static void
73 AcpiDmSpiSerialBusDescriptor (
74     ACPI_OP_WALK_INFO       *Info,
75     AML_RESOURCE            *Resource,
76     UINT32                  Length,
77     UINT32                  Level);
78 
79 static void
80 AcpiDmUartSerialBusDescriptor (
81     ACPI_OP_WALK_INFO       *Info,
82     AML_RESOURCE            *Resource,
83     UINT32                  Length,
84     UINT32                  Level);
85 
86 static void
87 AcpiDmGpioCommon (
88     ACPI_OP_WALK_INFO       *Info,
89     AML_RESOURCE            *Resource,
90     UINT32                  Level);
91 
92 static void
93 AcpiDmDumpRawDataBuffer (
94     UINT8                   *Buffer,
95     UINT32                  Length,
96     UINT32                  Level);
97 
98 
99 /* Dispatch table for the serial bus descriptors */
100 
101 static ACPI_RESOURCE_HANDLER        SerialBusResourceDispatch [] =
102 {
103     NULL,
104     AcpiDmI2cSerialBusDescriptor,
105     AcpiDmSpiSerialBusDescriptor,
106     AcpiDmUartSerialBusDescriptor,
107     AcpiDmCsi2SerialBusDescriptor
108 };
109 
110 
111 /*******************************************************************************
112  *
113  * FUNCTION:    AcpiDmDumpRawDataBuffer
114  *
115  * PARAMETERS:  Buffer              - Pointer to the data bytes
116  *              Length              - Length of the descriptor in bytes
117  *              Level               - Current source code indentation level
118  *
119  * RETURN:      None
120  *
121  * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
122  *              vendor data bytes.
123  *
124  ******************************************************************************/
125 
126 static void
AcpiDmDumpRawDataBuffer(UINT8 * Buffer,UINT32 Length,UINT32 Level)127 AcpiDmDumpRawDataBuffer (
128     UINT8                   *Buffer,
129     UINT32                  Length,
130     UINT32                  Level)
131 {
132     UINT32                  Index;
133     UINT32                  i;
134     UINT32                  j;
135 
136 
137     if (!Length)
138     {
139         return;
140     }
141 
142     AcpiOsPrintf ("RawDataBuffer (0x%.2X)  // Vendor Data", Length);
143 
144     AcpiOsPrintf ("\n");
145     AcpiDmIndent (Level + 1);
146     AcpiOsPrintf ("{\n");
147     AcpiDmIndent (Level + 2);
148 
149     for (i = 0; i < Length;)
150     {
151         for (j = 0; j < 8; j++)
152         {
153             Index = i + j;
154             if (Index >= Length)
155             {
156                 goto Finish;
157             }
158 
159             AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
160             if ((Index + 1) >= Length)
161             {
162                 goto Finish;
163             }
164 
165             AcpiOsPrintf (", ");
166         }
167 
168         AcpiOsPrintf ("\n");
169         AcpiDmIndent (Level + 2);
170 
171         i += 8;
172     }
173 
174 Finish:
175     AcpiOsPrintf ("\n");
176     AcpiDmIndent (Level + 1);
177     AcpiOsPrintf ("}");
178 }
179 
180 
181 /*******************************************************************************
182  *
183  * FUNCTION:    AcpiDmGpioCommon
184  *
185  * PARAMETERS:  Info                - Extra resource info
186  *              Resource            - Pointer to the resource descriptor
187  *              Level               - Current source code indentation level
188  *
189  * RETURN:      None
190  *
191  * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
192  *
193  ******************************************************************************/
194 
195 static void
AcpiDmGpioCommon(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Level)196 AcpiDmGpioCommon (
197     ACPI_OP_WALK_INFO       *Info,
198     AML_RESOURCE            *Resource,
199     UINT32                  Level)
200 {
201     UINT16                  *PinList;
202     UINT8                   *VendorData;
203     char                    *DeviceName = NULL;
204     UINT32                  PinCount;
205     UINT32                  i;
206 
207 
208     /* ResourceSource, ResourceSourceIndex, ResourceType */
209 
210     AcpiDmIndent (Level + 1);
211     if (Resource->Gpio.ResSourceOffset)
212     {
213         DeviceName = ACPI_ADD_PTR (char,
214             Resource, Resource->Gpio.ResSourceOffset);
215         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
216     }
217 
218     AcpiOsPrintf (", ");
219     AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
220     AcpiOsPrintf ("%s, ",
221         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
222 
223     /* Insert a descriptor name */
224 
225     AcpiDmDescriptorName ();
226     AcpiOsPrintf (",");
227 
228     /* Dump the vendor data */
229 
230     if (Resource->Gpio.VendorOffset)
231     {
232         AcpiOsPrintf ("\n");
233         AcpiDmIndent (Level + 1);
234         VendorData = ACPI_ADD_PTR (UINT8, Resource,
235             Resource->Gpio.VendorOffset);
236 
237         AcpiDmDumpRawDataBuffer (VendorData,
238             Resource->Gpio.VendorLength, Level);
239     }
240 
241     AcpiOsPrintf (")\n");
242 
243     /* Dump the interrupt list */
244 
245     AcpiDmIndent (Level + 1);
246     AcpiOsPrintf ("{   // Pin list\n");
247 
248     PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
249         Resource->Gpio.PinTableOffset)) /
250         sizeof (UINT16);
251 
252     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
253         Resource->Gpio.PinTableOffset);
254 
255     for (i = 0; i < PinCount; i++)
256     {
257         AcpiDmIndent (Level + 2);
258         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
259             ((i + 1) < PinCount) ? "," : "");
260     }
261 
262     AcpiDmIndent (Level + 1);
263     AcpiOsPrintf ("}\n");
264 
265     MpSaveGpioInfo (Info->MappingOp, Resource,
266         PinCount, PinList, DeviceName);
267 }
268 
269 
270 /*******************************************************************************
271  *
272  * FUNCTION:    AcpiDmGpioIntDescriptor
273  *
274  * PARAMETERS:  Info                - Extra resource info
275  *              Resource            - Pointer to the resource descriptor
276  *              Length              - Length of the descriptor in bytes
277  *              Level               - Current source code indentation level
278  *
279  * RETURN:      None
280  *
281  * DESCRIPTION: Decode a GPIO Interrupt descriptor
282  *
283  ******************************************************************************/
284 
285 static void
AcpiDmGpioIntDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)286 AcpiDmGpioIntDescriptor (
287     ACPI_OP_WALK_INFO       *Info,
288     AML_RESOURCE            *Resource,
289     UINT32                  Length,
290     UINT32                  Level)
291 {
292 
293     /* Dump the GpioInt-specific portion of the descriptor */
294 
295     /* EdgeLevel, ActiveLevel, Shared */
296 
297     AcpiDmIndent (Level);
298     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
299         AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
300         AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
301         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
302 
303     /* PinConfig, DebounceTimeout */
304 
305     if (Resource->Gpio.PinConfig <= 3)
306     {
307         AcpiOsPrintf ("%s, ",
308             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
309     }
310     else
311     {
312         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
313     }
314     AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
315 
316     /* Dump the GpioInt/GpioIo common portion of the descriptor */
317 
318     AcpiDmGpioCommon (Info, Resource, Level);
319 }
320 
321 
322 /*******************************************************************************
323  *
324  * FUNCTION:    AcpiDmGpioIoDescriptor
325  *
326  * PARAMETERS:  Info                - Extra resource info
327  *              Resource            - Pointer to the resource descriptor
328  *              Length              - Length of the descriptor in bytes
329  *              Level               - Current source code indentation level
330  *
331  * RETURN:      None
332  *
333  * DESCRIPTION: Decode a GPIO I/O descriptor
334  *
335  ******************************************************************************/
336 
337 static void
AcpiDmGpioIoDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)338 AcpiDmGpioIoDescriptor (
339     ACPI_OP_WALK_INFO       *Info,
340     AML_RESOURCE            *Resource,
341     UINT32                  Length,
342     UINT32                  Level)
343 {
344 
345     /* Dump the GpioIo-specific portion of the descriptor */
346 
347     /* Shared, PinConfig */
348 
349     AcpiDmIndent (Level);
350     AcpiOsPrintf ("GpioIo (%s, ",
351         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
352 
353     if (Resource->Gpio.PinConfig <= 3)
354     {
355         AcpiOsPrintf ("%s, ",
356             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
357     }
358     else
359     {
360         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
361     }
362 
363     /* DebounceTimeout, DriveStrength, IoRestriction */
364 
365     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
366     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
367     AcpiOsPrintf ("%s,\n",
368         AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
369 
370     /* Dump the GpioInt/GpioIo common portion of the descriptor */
371 
372     AcpiDmGpioCommon (Info, Resource, Level);
373 }
374 
375 
376 /*******************************************************************************
377  *
378  * FUNCTION:    AcpiDmGpioDescriptor
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 GpioInt/GpioIo GPIO Interrupt/IO descriptor
388  *
389  ******************************************************************************/
390 
391 void
AcpiDmGpioDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)392 AcpiDmGpioDescriptor (
393     ACPI_OP_WALK_INFO       *Info,
394     AML_RESOURCE            *Resource,
395     UINT32                  Length,
396     UINT32                  Level)
397 {
398     UINT8                   ConnectionType;
399 
400 
401     ConnectionType = Resource->Gpio.ConnectionType;
402 
403     switch (ConnectionType)
404     {
405     case AML_RESOURCE_GPIO_TYPE_INT:
406 
407         AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
408         break;
409 
410     case AML_RESOURCE_GPIO_TYPE_IO:
411 
412         AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
413         break;
414 
415     default:
416 
417         AcpiOsPrintf ("Unknown GPIO type\n");
418         break;
419     }
420 }
421 
422 void
AcpiDmClockInputDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)423 AcpiDmClockInputDescriptor (
424     ACPI_OP_WALK_INFO       *Info,
425     AML_RESOURCE            *Resource,
426     UINT32                  Length,
427     UINT32                  Level)
428 {
429     char                    *DeviceName = NULL;
430     UINT8                   *ResourceIndex = NULL;
431     AcpiDmIndent (Level);
432 
433     AcpiOsPrintf ("ClockInput (");
434 
435     AcpiOsPrintf ("0x%8.8X, ", Resource->ClockInput.FrequencyNumerator);
436 
437     AcpiOsPrintf ("0x%4.4X, ", Resource->ClockInput.FrequencyDivisor);
438 
439     AcpiOsPrintf ("%s, ",
440         AcpiGbl_ClockInputScale [ACPI_EXTRACT_2BIT_FLAG (Resource->ClockInput.Flags, 1)]);
441 
442     AcpiOsPrintf ("%s, ",
443         AcpiGbl_ClockInputMode [ACPI_GET_1BIT_FLAG (Resource->ClockInput.Flags)]);
444 
445     if (Length > sizeof(Resource->ClockInput))
446     {
447         DeviceName = ACPI_ADD_PTR (char,
448             Resource, sizeof(Resource->ClockInput)+1),
449         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
450 
451         AcpiOsPrintf (", ");
452         ResourceIndex = ACPI_ADD_PTR (UINT8,
453             Resource, sizeof(Resource->ClockInput)),
454 
455         AcpiOsPrintf ("0x%2.2X", *ResourceIndex);
456     }
457 
458     AcpiOsPrintf (")\n");
459 
460 }
461 
462 /*******************************************************************************
463  *
464  * FUNCTION:    AcpiDmPinFunctionDescriptor
465  *
466  * PARAMETERS:  Info                - Extra resource info
467  *              Resource            - Pointer to the resource descriptor
468  *              Length              - Length of the descriptor in bytes
469  *              Level               - Current source code indentation level
470  *
471  * RETURN:      None
472  *
473  * DESCRIPTION: Decode a PinFunction descriptor
474  *
475  ******************************************************************************/
476 
477 void
AcpiDmPinFunctionDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)478 AcpiDmPinFunctionDescriptor (
479     ACPI_OP_WALK_INFO       *Info,
480     AML_RESOURCE            *Resource,
481     UINT32                  Length,
482     UINT32                  Level)
483 {
484     UINT16                  *PinList;
485     UINT8                   *VendorData;
486     char                    *DeviceName = NULL;
487     UINT32                  PinCount;
488     UINT32                  i;
489 
490     AcpiDmIndent (Level);
491     AcpiOsPrintf ("PinFunction (%s, ",
492         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]);
493 
494     if (Resource->PinFunction.PinConfig <= 3)
495     {
496         AcpiOsPrintf ("%s, ",
497             AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]);
498     }
499     else
500     {
501         AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig);
502     }
503 
504     /* FunctionNumber */
505 
506     AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
507 
508     if (Resource->PinFunction.ResSourceOffset)
509     {
510         DeviceName = ACPI_ADD_PTR (char,
511             Resource, Resource->PinFunction.ResSourceOffset),
512         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
513     }
514 
515     AcpiOsPrintf (", ");
516     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex);
517 
518     AcpiDmIndent (Level + 1);
519 
520     /* Always ResourceConsumer */
521     AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]);
522 
523     /* Insert a descriptor name */
524 
525     AcpiDmDescriptorName ();
526 
527     AcpiOsPrintf (",");
528 
529     /* Dump the vendor data */
530 
531     if (Resource->PinFunction.VendorLength)
532     {
533         AcpiOsPrintf ("\n");
534         AcpiDmIndent (Level + 1);
535         VendorData = ACPI_ADD_PTR (UINT8, Resource,
536             Resource->PinFunction.VendorOffset);
537 
538         AcpiDmDumpRawDataBuffer (VendorData,
539             Resource->PinFunction.VendorLength, Level);
540     }
541 
542     AcpiOsPrintf (")\n");
543 
544     AcpiDmIndent (Level + 1);
545 
546     /* Dump the interrupt list */
547 
548     AcpiOsPrintf ("{   // Pin list\n");
549 
550     PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
551         Resource->PinFunction.PinTableOffset)) /
552         sizeof (UINT16);
553 
554     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
555         Resource->PinFunction.PinTableOffset);
556 
557     for (i = 0; i < PinCount; i++)
558     {
559         AcpiDmIndent (Level + 2);
560         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
561             ((i + 1) < PinCount) ? "," : "");
562     }
563 
564     AcpiDmIndent (Level + 1);
565     AcpiOsPrintf ("}\n");
566 }
567 
568 
569 /*******************************************************************************
570  *
571  * FUNCTION:    AcpiDmDumpSerialBusVendorData
572  *
573  * PARAMETERS:  Resource            - Pointer to the resource descriptor
574  *
575  * RETURN:      None
576  *
577  * DESCRIPTION: Dump optional serial bus vendor data
578  *
579  ******************************************************************************/
580 
581 static void
AcpiDmDumpSerialBusVendorData(AML_RESOURCE * Resource,UINT32 Level)582 AcpiDmDumpSerialBusVendorData (
583     AML_RESOURCE            *Resource,
584     UINT32                  Level)
585 {
586     UINT8                   *VendorData;
587     UINT32                  VendorLength;
588 
589 
590     /* Get the (optional) vendor data and length */
591 
592     switch (Resource->CommonSerialBus.Type)
593     {
594     case AML_RESOURCE_I2C_SERIALBUSTYPE:
595 
596         VendorLength = Resource->CommonSerialBus.TypeDataLength -
597             AML_RESOURCE_I2C_MIN_DATA_LEN;
598 
599         VendorData = ACPI_ADD_PTR (UINT8, Resource,
600             sizeof (AML_RESOURCE_I2C_SERIALBUS));
601         break;
602 
603     case AML_RESOURCE_SPI_SERIALBUSTYPE:
604 
605         VendorLength = Resource->CommonSerialBus.TypeDataLength -
606             AML_RESOURCE_SPI_MIN_DATA_LEN;
607 
608         VendorData = ACPI_ADD_PTR (UINT8, Resource,
609             sizeof (AML_RESOURCE_SPI_SERIALBUS));
610         break;
611 
612     case AML_RESOURCE_UART_SERIALBUSTYPE:
613 
614         VendorLength = Resource->CommonSerialBus.TypeDataLength -
615             AML_RESOURCE_UART_MIN_DATA_LEN;
616 
617         VendorData = ACPI_ADD_PTR (UINT8, Resource,
618             sizeof (AML_RESOURCE_UART_SERIALBUS));
619         break;
620 
621     case AML_RESOURCE_CSI2_SERIALBUSTYPE:
622 
623         VendorLength = Resource->CommonSerialBus.TypeDataLength -
624             AML_RESOURCE_CSI2_MIN_DATA_LEN;
625 
626         VendorData = ACPI_ADD_PTR (UINT8, Resource,
627             sizeof (AML_RESOURCE_CSI2_SERIALBUS));
628         break;
629 
630     default:
631 
632         return;
633     }
634 
635     /* Dump the vendor bytes as a RawDataBuffer object */
636 
637     AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
638 }
639 
640 
641 /*******************************************************************************
642  *
643  * FUNCTION:    AcpiDmCsi2SerialBusDescriptor
644  *
645  * PARAMETERS:  Info                - Extra resource info
646  *              Resource            - Pointer to the resource descriptor
647  *              Length              - Length of the descriptor in bytes
648  *              Level               - Current source code indentation level
649  *
650  * RETURN:      None
651  *
652  * DESCRIPTION: Decode a CSI2 serial bus descriptor
653  *
654  ******************************************************************************/
655 
656 static void
AcpiDmCsi2SerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)657 AcpiDmCsi2SerialBusDescriptor (
658     ACPI_OP_WALK_INFO       *Info,
659     AML_RESOURCE            *Resource,
660     UINT32                  Length,
661     UINT32                  Level)
662 {
663     UINT32                  ResourceSourceOffset;
664     char                    *DeviceName;
665 
666 
667     /* SlaveMode, PhyType, LocalPortInstance */
668 
669     AcpiDmIndent (Level);
670     AcpiOsPrintf ("Csi2Bus (%s,",
671         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->Csi2SerialBus.Flags)]);
672 
673     AcpiOsPrintf (" 0x%2.2X, 0x%2.2X,\n",
674         Resource->Csi2SerialBus.TypeSpecificFlags & 0x03,
675         Resource->Csi2SerialBus.TypeSpecificFlags & 0xFC);
676 
677     /* ResourceSource is a required field */
678 
679     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
680         Resource->CommonSerialBus.TypeDataLength;
681 
682     AcpiDmIndent (Level + 1);
683     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
684     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
685 
686     /* ResourceSourceIndex, ResourceUsage */
687 
688     AcpiOsPrintf (",\n");
689     AcpiDmIndent (Level + 1);
690     AcpiOsPrintf ("0x%2.2X, ", Resource->Csi2SerialBus.ResSourceIndex);
691 
692     AcpiOsPrintf ("%s, ",
693         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Csi2SerialBus.Flags, 1)]);
694 
695     /* Insert a descriptor name */
696 
697     AcpiDmDescriptorName ();
698 
699     /* Dump the vendor data */
700 
701     AcpiOsPrintf (",\n");
702     AcpiDmIndent (Level + 1);
703     AcpiDmDumpSerialBusVendorData (Resource, Level);
704     AcpiOsPrintf (")\n");
705 
706     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
707 }
708 
709 
710 /*******************************************************************************
711  *
712  * FUNCTION:    AcpiDmI2cSerialBusDescriptor
713  *
714  * PARAMETERS:  Info                - Extra resource info
715  *              Resource            - Pointer to the resource descriptor
716  *              Length              - Length of the descriptor in bytes
717  *              Level               - Current source code indentation level
718  *
719  * RETURN:      None
720  *
721  * DESCRIPTION: Decode a I2C serial bus descriptor
722  *
723  ******************************************************************************/
724 
725 static void
AcpiDmI2cSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)726 AcpiDmI2cSerialBusDescriptor (
727     ACPI_OP_WALK_INFO       *Info,
728     AML_RESOURCE            *Resource,
729     UINT32                  Length,
730     UINT32                  Level)
731 {
732     UINT32                  ResourceSourceOffset;
733     char                    *DeviceName;
734 
735 
736     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
737 
738     AcpiDmIndent (Level);
739     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
740         Resource->I2cSerialBus.SlaveAddress,
741         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
742         Resource->I2cSerialBus.ConnectionSpeed);
743 
744     AcpiDmIndent (Level + 1);
745     AcpiOsPrintf ("%s, ",
746         AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
747 
748     /* ResourceSource is a required field */
749 
750     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
751         Resource->CommonSerialBus.TypeDataLength;
752 
753     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
754     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
755 
756     /* ResourceSourceIndex, ResourceUsage */
757 
758     AcpiOsPrintf (",\n");
759     AcpiDmIndent (Level + 1);
760     AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
761 
762     AcpiOsPrintf ("%s, ",
763         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
764 
765     /* Insert a descriptor name */
766 
767     AcpiDmDescriptorName ();
768 
769     /* Share */
770 
771     AcpiOsPrintf (", %s,\n",
772         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
773 
774     /* Dump the vendor data */
775 
776     AcpiDmIndent (Level + 1);
777     AcpiDmDumpSerialBusVendorData (Resource, Level);
778     AcpiOsPrintf (")\n");
779 
780     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
781 }
782 
783 
784 /*******************************************************************************
785  *
786  * FUNCTION:    AcpiDmSpiSerialBusDescriptor
787  *
788  * PARAMETERS:  Info                - Extra resource info
789  *              Resource            - Pointer to the resource descriptor
790  *              Length              - Length of the descriptor in bytes
791  *              Level               - Current source code indentation level
792  *
793  * RETURN:      None
794  *
795  * DESCRIPTION: Decode a SPI serial bus descriptor
796  *
797  ******************************************************************************/
798 
799 static void
AcpiDmSpiSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)800 AcpiDmSpiSerialBusDescriptor (
801     ACPI_OP_WALK_INFO       *Info,
802     AML_RESOURCE            *Resource,
803     UINT32                  Length,
804     UINT32                  Level)
805 {
806     UINT32                  ResourceSourceOffset;
807     char                    *DeviceName;
808 
809 
810     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
811 
812     AcpiDmIndent (Level);
813     AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
814         Resource->SpiSerialBus.DeviceSelection,
815         AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
816         AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
817         Resource->SpiSerialBus.DataBitLength);
818 
819     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
820 
821     AcpiDmIndent (Level + 1);
822     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
823         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
824         Resource->SpiSerialBus.ConnectionSpeed,
825         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
826 
827     AcpiDmIndent (Level + 1);
828     AcpiOsPrintf ("%s, ",
829         AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
830 
831     /* ResourceSource is a required field */
832 
833     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
834         Resource->CommonSerialBus.TypeDataLength;
835 
836     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
837     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
838 
839     /* ResourceSourceIndex, ResourceUsage */
840 
841     AcpiOsPrintf (",\n");
842     AcpiDmIndent (Level + 1);
843     AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
844 
845     AcpiOsPrintf ("%s, ",
846         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
847 
848     /* Insert a descriptor name */
849 
850     AcpiDmDescriptorName ();
851 
852     /* Share */
853 
854     AcpiOsPrintf (", %s,\n",
855         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
856 
857     /* Dump the vendor data */
858 
859     AcpiDmIndent (Level + 1);
860     AcpiDmDumpSerialBusVendorData (Resource, Level);
861     AcpiOsPrintf (")\n");
862 
863     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
864 }
865 
866 
867 /*******************************************************************************
868  *
869  * FUNCTION:    AcpiDmUartSerialBusDescriptor
870  *
871  * PARAMETERS:  Info                - Extra resource info
872  *              Resource            - Pointer to the resource descriptor
873  *              Length              - Length of the descriptor in bytes
874  *              Level               - Current source code indentation level
875  *
876  * RETURN:      None
877  *
878  * DESCRIPTION: Decode a UART serial bus descriptor
879  *
880  ******************************************************************************/
881 
882 static void
AcpiDmUartSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)883 AcpiDmUartSerialBusDescriptor (
884     ACPI_OP_WALK_INFO       *Info,
885     AML_RESOURCE            *Resource,
886     UINT32                  Length,
887     UINT32                  Level)
888 {
889     UINT32                  ResourceSourceOffset;
890     char                    *DeviceName;
891 
892 
893     /* ConnectionSpeed, BitsPerByte, StopBits */
894 
895     AcpiDmIndent (Level);
896     AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
897         Resource->UartSerialBus.DefaultBaudRate,
898         AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
899         AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
900 
901     /* LinesInUse, IsBigEndian, Parity, FlowControl */
902 
903     AcpiDmIndent (Level + 1);
904     AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
905         Resource->UartSerialBus.LinesEnabled,
906         AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
907         AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
908         AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
909 
910     /* ReceiveBufferSize, TransmitBufferSize */
911 
912     AcpiDmIndent (Level + 1);
913     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
914         Resource->UartSerialBus.RxFifoSize,
915         Resource->UartSerialBus.TxFifoSize);
916 
917     /* ResourceSource is a required field */
918 
919     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
920         Resource->CommonSerialBus.TypeDataLength;
921 
922     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
923     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
924 
925     /* ResourceSourceIndex, ResourceUsage */
926 
927     AcpiOsPrintf (",\n");
928     AcpiDmIndent (Level + 1);
929     AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
930 
931     AcpiOsPrintf ("%s, ",
932         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
933 
934     /* Insert a descriptor name */
935 
936     AcpiDmDescriptorName ();
937 
938     /* Share */
939 
940     AcpiOsPrintf (", %s,\n",
941         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
942 
943     /* Dump the vendor data */
944 
945     AcpiDmIndent (Level + 1);
946     AcpiDmDumpSerialBusVendorData (Resource, Level);
947     AcpiOsPrintf (")\n");
948 
949     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
950 }
951 
952 
953 /*******************************************************************************
954  *
955  * FUNCTION:    AcpiDmSerialBusDescriptor
956  *
957  * PARAMETERS:  Info                - Extra resource info
958  *              Resource            - Pointer to the resource descriptor
959  *              Length              - Length of the descriptor in bytes
960  *              Level               - Current source code indentation level
961  *
962  * RETURN:      None
963  *
964  * DESCRIPTION: Decode a I2C/SPI/UART/CSI2 serial bus descriptor
965  *
966  ******************************************************************************/
967 
968 void
AcpiDmSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)969 AcpiDmSerialBusDescriptor (
970     ACPI_OP_WALK_INFO       *Info,
971     AML_RESOURCE            *Resource,
972     UINT32                  Length,
973     UINT32                  Level)
974 {
975 
976     SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
977         Info, Resource, Length, Level);
978 }
979 
980 /*******************************************************************************
981  *
982  * FUNCTION:    AcpiDmPinConfig
983  *
984  * PARAMETERS:  PinConfigType       - Pin configuration type
985  *              PinConfigValue      - Pin configuration value
986  *
987  * RETURN:      None
988  *
989  * DESCRIPTION: Pretty prints PinConfig type and value.
990  *
991  ******************************************************************************/
992 
993 static void
AcpiDmPinConfig(UINT8 PinConfigType,UINT32 PinConfigValue)994 AcpiDmPinConfig(
995     UINT8                   PinConfigType,
996     UINT32                  PinConfigValue)
997 {
998     if (PinConfigType <= 13)
999     {
1000         AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType,
1001             AcpiGbl_PtypDecode[PinConfigType]);
1002     }
1003     else
1004     {
1005         AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType);
1006     }
1007 
1008     /* PinConfigValue */
1009 
1010     AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue);
1011 }
1012 
1013 /*******************************************************************************
1014  *
1015  * FUNCTION:    AcpiDmPinConfigDescriptor
1016  *
1017  * PARAMETERS:  Info                - Extra resource info
1018  *              Resource            - Pointer to the resource descriptor
1019  *              Length              - Length of the descriptor in bytes
1020  *              Level               - Current source code indentation level
1021  *
1022  * RETURN:      None
1023  *
1024  * DESCRIPTION: Decode a PinConfig descriptor
1025  *
1026  ******************************************************************************/
1027 
1028 void
AcpiDmPinConfigDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)1029 AcpiDmPinConfigDescriptor (
1030     ACPI_OP_WALK_INFO       *Info,
1031     AML_RESOURCE            *Resource,
1032     UINT32                  Length,
1033     UINT32                  Level)
1034 {
1035     UINT16                  *PinList;
1036     UINT8                   *VendorData;
1037     char                    *DeviceName = NULL;
1038     UINT32                  PinCount;
1039     UINT32                  i;
1040 
1041     AcpiDmIndent (Level);
1042     AcpiOsPrintf ("PinConfig (%s, ",
1043         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]);
1044 
1045     AcpiDmPinConfig (Resource->PinConfig.PinConfigType,
1046         Resource->PinConfig.PinConfigValue);
1047 
1048     AcpiDmIndent (Level + 1);
1049 
1050     if (Resource->PinConfig.ResSourceOffset)
1051     {
1052         DeviceName = ACPI_ADD_PTR (char,
1053             Resource, Resource->PinConfig.ResSourceOffset),
1054         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1055     }
1056 
1057     AcpiOsPrintf (", ");
1058     AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex);
1059 
1060     AcpiOsPrintf ("%s, ",
1061         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]);
1062 
1063     /* Insert a descriptor name */
1064 
1065     AcpiDmDescriptorName ();
1066 
1067     AcpiOsPrintf (",");
1068 
1069     /* Dump the vendor data */
1070 
1071     if (Resource->PinConfig.VendorLength)
1072     {
1073         AcpiOsPrintf ("\n");
1074         AcpiDmIndent (Level + 1);
1075         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1076             Resource->PinConfig.VendorOffset);
1077 
1078         AcpiDmDumpRawDataBuffer (VendorData,
1079             Resource->PinConfig.VendorLength, Level);
1080     }
1081 
1082     AcpiOsPrintf (")\n");
1083 
1084     AcpiDmIndent (Level + 1);
1085 
1086     /* Dump the interrupt list */
1087 
1088     AcpiOsPrintf ("{   // Pin list\n");
1089 
1090     PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset -
1091         Resource->PinConfig.PinTableOffset)) /
1092         sizeof (UINT16);
1093 
1094     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1095         Resource->PinConfig.PinTableOffset);
1096 
1097     for (i = 0; i < PinCount; i++)
1098     {
1099         AcpiDmIndent (Level + 2);
1100         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1101             ((i + 1) < PinCount) ? "," : "");
1102     }
1103 
1104     AcpiDmIndent (Level + 1);
1105     AcpiOsPrintf ("}\n");
1106 }
1107 
1108 /*******************************************************************************
1109  *
1110  * FUNCTION:    AcpiDmPinGroupDescriptor
1111  *
1112  * PARAMETERS:  Info                - Extra resource info
1113  *              Resource            - Pointer to the resource descriptor
1114  *              Length              - Length of the descriptor in bytes
1115  *              Level               - Current source code indentation level
1116  *
1117  * RETURN:      None
1118  *
1119  * DESCRIPTION: Decode a PinGroup descriptor
1120  *
1121  ******************************************************************************/
1122 
1123 void
AcpiDmPinGroupDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)1124 AcpiDmPinGroupDescriptor (
1125     ACPI_OP_WALK_INFO       *Info,
1126     AML_RESOURCE            *Resource,
1127     UINT32                  Length,
1128     UINT32                  Level)
1129 {
1130     char                    *Label;
1131     UINT16                  *PinList;
1132     UINT8                   *VendorData;
1133     UINT32                  PinCount;
1134     UINT32                  i;
1135 
1136     AcpiDmIndent (Level);
1137     /* Always producer */
1138     AcpiOsPrintf ("PinGroup (");
1139 
1140     Label = ACPI_ADD_PTR (char,
1141         Resource, Resource->PinGroup.LabelOffset),
1142     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1143 
1144     AcpiOsPrintf (", ");
1145 
1146     AcpiOsPrintf ("%s, ",
1147         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]);
1148 
1149     /* Insert a descriptor name */
1150 
1151     AcpiDmDescriptorName ();
1152 
1153     AcpiOsPrintf (",");
1154 
1155     /* Dump the vendor data */
1156 
1157     if (Resource->PinGroup.VendorLength)
1158     {
1159         AcpiOsPrintf ("\n");
1160         AcpiDmIndent (Level + 1);
1161         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1162             Resource->PinGroup.VendorOffset);
1163 
1164         AcpiDmDumpRawDataBuffer (VendorData,
1165             Resource->PinGroup.VendorLength, Level);
1166     }
1167 
1168     AcpiOsPrintf (")\n");
1169 
1170     AcpiDmIndent (Level + 1);
1171 
1172     /* Dump the interrupt list */
1173 
1174     AcpiOsPrintf ("{   // Pin list\n");
1175 
1176     PinCount = (Resource->PinGroup.LabelOffset -
1177         Resource->PinGroup.PinTableOffset) / sizeof (UINT16);
1178 
1179     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1180         Resource->PinGroup.PinTableOffset);
1181 
1182     for (i = 0; i < PinCount; i++)
1183     {
1184         AcpiDmIndent (Level + 2);
1185         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1186             ((i + 1) < PinCount) ? "," : "");
1187     }
1188 
1189     AcpiDmIndent (Level + 1);
1190     AcpiOsPrintf ("}\n");
1191 }
1192 
1193 /*******************************************************************************
1194  *
1195  * FUNCTION:    AcpiDmPinGroupFunctionDescriptor
1196  *
1197  * PARAMETERS:  Info                - Extra resource info
1198  *              Resource            - Pointer to the resource descriptor
1199  *              Length              - Length of the descriptor in bytes
1200  *              Level               - Current source code indentation level
1201  *
1202  * RETURN:      None
1203  *
1204  * DESCRIPTION: Decode a PinGroupFunction descriptor
1205  *
1206  ******************************************************************************/
1207 
1208 void
AcpiDmPinGroupFunctionDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)1209 AcpiDmPinGroupFunctionDescriptor (
1210     ACPI_OP_WALK_INFO       *Info,
1211     AML_RESOURCE            *Resource,
1212     UINT32                  Length,
1213     UINT32                  Level)
1214 {
1215     UINT8                   *VendorData;
1216     char                    *DeviceName = NULL;
1217     char                    *Label = NULL;
1218 
1219     AcpiDmIndent (Level);
1220     AcpiOsPrintf ("PinGroupFunction (%s, ",
1221         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]);
1222 
1223     /* FunctionNumber */
1224 
1225     AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber);
1226 
1227     DeviceName = ACPI_ADD_PTR (char,
1228         Resource, Resource->PinGroupFunction.ResSourceOffset),
1229     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1230 
1231     AcpiOsPrintf (", ");
1232     AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex);
1233 
1234     AcpiDmIndent (Level + 1);
1235 
1236     Label = ACPI_ADD_PTR (char, Resource,
1237         Resource->PinGroupFunction.ResSourceLabelOffset);
1238     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1239 
1240     AcpiOsPrintf (", ");
1241 
1242     AcpiOsPrintf ("%s, ",
1243         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]);
1244 
1245     /* Insert a descriptor name */
1246 
1247     AcpiDmDescriptorName ();
1248 
1249     AcpiOsPrintf (",");
1250 
1251     /* Dump the vendor data */
1252 
1253     if (Resource->PinGroupFunction.VendorLength)
1254     {
1255         AcpiOsPrintf ("\n");
1256         AcpiDmIndent (Level + 1);
1257         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1258             Resource->PinGroupFunction.VendorOffset);
1259 
1260         AcpiDmDumpRawDataBuffer (VendorData,
1261             Resource->PinGroupFunction.VendorLength, Level);
1262     }
1263 
1264     AcpiOsPrintf (")\n");
1265 }
1266 
1267 /*******************************************************************************
1268  *
1269  * FUNCTION:    AcpiDmPinGroupConfigDescriptor
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 PinGroupConfig descriptor
1279  *
1280  ******************************************************************************/
1281 
1282 void
AcpiDmPinGroupConfigDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)1283 AcpiDmPinGroupConfigDescriptor (
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 ("PinGroupConfig (%s, ",
1295         AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]);
1296 
1297     AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType,
1298         Resource->PinGroupConfig.PinConfigValue);
1299 
1300     AcpiDmIndent (Level + 1);
1301 
1302     DeviceName = ACPI_ADD_PTR (char,
1303         Resource, Resource->PinGroupConfig.ResSourceOffset),
1304     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1305 
1306     AcpiOsPrintf (", ");
1307     AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex);
1308 
1309     Label = ACPI_ADD_PTR (char, Resource,
1310         Resource->PinGroupConfig.ResSourceLabelOffset);
1311     AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1312 
1313     AcpiOsPrintf (", ");
1314 
1315     AcpiOsPrintf ("%s, ",
1316         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]);
1317 
1318     /* Insert a descriptor name */
1319 
1320     AcpiDmDescriptorName ();
1321 
1322     AcpiOsPrintf (",");
1323 
1324     /* Dump the vendor data */
1325 
1326     if (Resource->PinGroupConfig.VendorLength)
1327     {
1328         AcpiOsPrintf ("\n");
1329         AcpiDmIndent (Level + 1);
1330         VendorData = ACPI_ADD_PTR (UINT8, Resource,
1331             Resource->PinGroupConfig.VendorOffset);
1332 
1333         AcpiDmDumpRawDataBuffer (VendorData,
1334             Resource->PinGroupConfig.VendorLength, Level);
1335     }
1336 
1337     AcpiOsPrintf (")\n");
1338 }
1339