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