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