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 - 2016, 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#include "acpi.h"
117#include "accommon.h"
118#include "acdisasm.h"
119
120
121#define _COMPONENT          ACPI_CA_DEBUGGER
122        ACPI_MODULE_NAME    ("dbresrcl2")
123
124/* Local prototypes */
125
126static void
127AcpiDmI2cSerialBusDescriptor (
128    ACPI_OP_WALK_INFO       *Info,
129    AML_RESOURCE            *Resource,
130    UINT32                  Length,
131    UINT32                  Level);
132
133static void
134AcpiDmSpiSerialBusDescriptor (
135    ACPI_OP_WALK_INFO       *Info,
136    AML_RESOURCE            *Resource,
137    UINT32                  Length,
138    UINT32                  Level);
139
140static void
141AcpiDmUartSerialBusDescriptor (
142    ACPI_OP_WALK_INFO       *Info,
143    AML_RESOURCE            *Resource,
144    UINT32                  Length,
145    UINT32                  Level);
146
147static void
148AcpiDmGpioCommon (
149    ACPI_OP_WALK_INFO       *Info,
150    AML_RESOURCE            *Resource,
151    UINT32                  Level);
152
153static void
154AcpiDmDumpRawDataBuffer (
155    UINT8                   *Buffer,
156    UINT32                  Length,
157    UINT32                  Level);
158
159
160/* Dispatch table for the serial bus descriptors */
161
162static ACPI_RESOURCE_HANDLER        SerialBusResourceDispatch [] =
163{
164    NULL,
165    AcpiDmI2cSerialBusDescriptor,
166    AcpiDmSpiSerialBusDescriptor,
167    AcpiDmUartSerialBusDescriptor
168};
169
170
171/*******************************************************************************
172 *
173 * FUNCTION:    AcpiDmDumpRawDataBuffer
174 *
175 * PARAMETERS:  Buffer              - Pointer to the data bytes
176 *              Length              - Length of the descriptor in bytes
177 *              Level               - Current source code indentation level
178 *
179 * RETURN:      None
180 *
181 * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
182 *              vendor data bytes.
183 *
184 ******************************************************************************/
185
186static void
187AcpiDmDumpRawDataBuffer (
188    UINT8                   *Buffer,
189    UINT32                  Length,
190    UINT32                  Level)
191{
192    UINT32                  Index;
193    UINT32                  i;
194    UINT32                  j;
195
196
197    if (!Length)
198    {
199        return;
200    }
201
202    AcpiOsPrintf ("RawDataBuffer (0x%.2X)  // Vendor Data", Length);
203
204    AcpiOsPrintf ("\n");
205    AcpiDmIndent (Level + 1);
206    AcpiOsPrintf ("{\n");
207    AcpiDmIndent (Level + 2);
208
209    for (i = 0; i < Length;)
210    {
211        for (j = 0; j < 8; j++)
212        {
213            Index = i + j;
214            if (Index >= Length)
215            {
216                goto Finish;
217            }
218
219            AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
220            if ((Index + 1) >= Length)
221            {
222                goto Finish;
223            }
224
225            AcpiOsPrintf (", ");
226        }
227
228        AcpiOsPrintf ("\n");
229        AcpiDmIndent (Level + 2);
230
231        i += 8;
232    }
233
234Finish:
235    AcpiOsPrintf ("\n");
236    AcpiDmIndent (Level + 1);
237    AcpiOsPrintf ("}");
238}
239
240
241/*******************************************************************************
242 *
243 * FUNCTION:    AcpiDmGpioCommon
244 *
245 * PARAMETERS:  Info                - Extra resource info
246 *              Resource            - Pointer to the resource descriptor
247 *              Level               - Current source code indentation level
248 *
249 * RETURN:      None
250 *
251 * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
252 *
253 ******************************************************************************/
254
255static void
256AcpiDmGpioCommon (
257    ACPI_OP_WALK_INFO       *Info,
258    AML_RESOURCE            *Resource,
259    UINT32                  Level)
260{
261    UINT16                  *PinList;
262    UINT8                   *VendorData;
263    char                    *DeviceName = NULL;
264    UINT32                  PinCount;
265    UINT32                  i;
266
267
268    /* ResourceSource, ResourceSourceIndex, ResourceType */
269
270    AcpiDmIndent (Level + 1);
271    if (Resource->Gpio.ResSourceOffset)
272    {
273        DeviceName = ACPI_ADD_PTR (char,
274            Resource, Resource->Gpio.ResSourceOffset),
275        AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
276    }
277
278    AcpiOsPrintf (", ");
279    AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
280    AcpiOsPrintf ("%s, ",
281        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
282
283    /* Insert a descriptor name */
284
285    AcpiDmDescriptorName ();
286    AcpiOsPrintf (",");
287
288    /* Dump the vendor data */
289
290    if (Resource->Gpio.VendorOffset)
291    {
292        AcpiOsPrintf ("\n");
293        AcpiDmIndent (Level + 1);
294        VendorData = ACPI_ADD_PTR (UINT8, Resource,
295            Resource->Gpio.VendorOffset);
296
297        AcpiDmDumpRawDataBuffer (VendorData,
298            Resource->Gpio.VendorLength, Level);
299    }
300
301    AcpiOsPrintf (")\n");
302
303    /* Dump the interrupt list */
304
305    AcpiDmIndent (Level + 1);
306    AcpiOsPrintf ("{   // Pin list\n");
307
308    PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
309        Resource->Gpio.PinTableOffset)) /
310        sizeof (UINT16);
311
312    PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
313        Resource->Gpio.PinTableOffset);
314
315    for (i = 0; i < PinCount; i++)
316    {
317        AcpiDmIndent (Level + 2);
318        AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
319            ((i + 1) < PinCount) ? "," : "");
320    }
321
322    AcpiDmIndent (Level + 1);
323    AcpiOsPrintf ("}\n");
324
325    MpSaveGpioInfo (Info->MappingOp, Resource,
326        PinCount, PinList, DeviceName);
327}
328
329
330/*******************************************************************************
331 *
332 * FUNCTION:    AcpiDmGpioIntDescriptor
333 *
334 * PARAMETERS:  Info                - Extra resource info
335 *              Resource            - Pointer to the resource descriptor
336 *              Length              - Length of the descriptor in bytes
337 *              Level               - Current source code indentation level
338 *
339 * RETURN:      None
340 *
341 * DESCRIPTION: Decode a GPIO Interrupt descriptor
342 *
343 ******************************************************************************/
344
345static void
346AcpiDmGpioIntDescriptor (
347    ACPI_OP_WALK_INFO       *Info,
348    AML_RESOURCE            *Resource,
349    UINT32                  Length,
350    UINT32                  Level)
351{
352
353    /* Dump the GpioInt-specific portion of the descriptor */
354
355    /* EdgeLevel, ActiveLevel, Shared */
356
357    AcpiDmIndent (Level);
358    AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
359        AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
360        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
361        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
362
363    /* PinConfig, DebounceTimeout */
364
365    if (Resource->Gpio.PinConfig <= 3)
366    {
367        AcpiOsPrintf ("%s, ",
368            AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
369    }
370    else
371    {
372        AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
373    }
374    AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
375
376    /* Dump the GpioInt/GpioIo common portion of the descriptor */
377
378    AcpiDmGpioCommon (Info, Resource, Level);
379}
380
381
382/*******************************************************************************
383 *
384 * FUNCTION:    AcpiDmGpioIoDescriptor
385 *
386 * PARAMETERS:  Info                - Extra resource info
387 *              Resource            - Pointer to the resource descriptor
388 *              Length              - Length of the descriptor in bytes
389 *              Level               - Current source code indentation level
390 *
391 * RETURN:      None
392 *
393 * DESCRIPTION: Decode a GPIO I/O descriptor
394 *
395 ******************************************************************************/
396
397static void
398AcpiDmGpioIoDescriptor (
399    ACPI_OP_WALK_INFO       *Info,
400    AML_RESOURCE            *Resource,
401    UINT32                  Length,
402    UINT32                  Level)
403{
404
405    /* Dump the GpioIo-specific portion of the descriptor */
406
407    /* Shared, PinConfig */
408
409    AcpiDmIndent (Level);
410    AcpiOsPrintf ("GpioIo (%s, ",
411        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
412
413    if (Resource->Gpio.PinConfig <= 3)
414    {
415        AcpiOsPrintf ("%s, ",
416            AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
417    }
418    else
419    {
420        AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
421    }
422
423    /* DebounceTimeout, DriveStrength, IoRestriction */
424
425    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
426    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
427    AcpiOsPrintf ("%s,\n",
428        AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
429
430    /* Dump the GpioInt/GpioIo common portion of the descriptor */
431
432    AcpiDmGpioCommon (Info, Resource, Level);
433}
434
435
436/*******************************************************************************
437 *
438 * FUNCTION:    AcpiDmGpioDescriptor
439 *
440 * PARAMETERS:  Info                - Extra resource info
441 *              Resource            - Pointer to the resource descriptor
442 *              Length              - Length of the descriptor in bytes
443 *              Level               - Current source code indentation level
444 *
445 * RETURN:      None
446 *
447 * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
448 *
449 ******************************************************************************/
450
451void
452AcpiDmGpioDescriptor (
453    ACPI_OP_WALK_INFO       *Info,
454    AML_RESOURCE            *Resource,
455    UINT32                  Length,
456    UINT32                  Level)
457{
458    UINT8                   ConnectionType;
459
460
461    ConnectionType = Resource->Gpio.ConnectionType;
462
463    switch (ConnectionType)
464    {
465    case AML_RESOURCE_GPIO_TYPE_INT:
466
467        AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
468        break;
469
470    case AML_RESOURCE_GPIO_TYPE_IO:
471
472        AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
473        break;
474
475    default:
476
477        AcpiOsPrintf ("Unknown GPIO type\n");
478        break;
479    }
480}
481
482
483/*******************************************************************************
484 *
485 * FUNCTION:    AcpiDmDumpSerialBusVendorData
486 *
487 * PARAMETERS:  Resource            - Pointer to the resource descriptor
488 *
489 * RETURN:      None
490 *
491 * DESCRIPTION: Dump optional serial bus vendor data
492 *
493 ******************************************************************************/
494
495static void
496AcpiDmDumpSerialBusVendorData (
497    AML_RESOURCE            *Resource,
498    UINT32                  Level)
499{
500    UINT8                   *VendorData;
501    UINT32                  VendorLength;
502
503
504    /* Get the (optional) vendor data and length */
505
506    switch (Resource->CommonSerialBus.Type)
507    {
508    case AML_RESOURCE_I2C_SERIALBUSTYPE:
509
510        VendorLength = Resource->CommonSerialBus.TypeDataLength -
511            AML_RESOURCE_I2C_MIN_DATA_LEN;
512
513        VendorData = ACPI_ADD_PTR (UINT8, Resource,
514            sizeof (AML_RESOURCE_I2C_SERIALBUS));
515        break;
516
517    case AML_RESOURCE_SPI_SERIALBUSTYPE:
518
519        VendorLength = Resource->CommonSerialBus.TypeDataLength -
520            AML_RESOURCE_SPI_MIN_DATA_LEN;
521
522        VendorData = ACPI_ADD_PTR (UINT8, Resource,
523            sizeof (AML_RESOURCE_SPI_SERIALBUS));
524        break;
525
526    case AML_RESOURCE_UART_SERIALBUSTYPE:
527
528        VendorLength = Resource->CommonSerialBus.TypeDataLength -
529            AML_RESOURCE_UART_MIN_DATA_LEN;
530
531        VendorData = ACPI_ADD_PTR (UINT8, Resource,
532            sizeof (AML_RESOURCE_UART_SERIALBUS));
533        break;
534
535    default:
536
537        return;
538    }
539
540    /* Dump the vendor bytes as a RawDataBuffer object */
541
542    AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
543}
544
545
546/*******************************************************************************
547 *
548 * FUNCTION:    AcpiDmI2cSerialBusDescriptor
549 *
550 * PARAMETERS:  Info                - Extra resource info
551 *              Resource            - Pointer to the resource descriptor
552 *              Length              - Length of the descriptor in bytes
553 *              Level               - Current source code indentation level
554 *
555 * RETURN:      None
556 *
557 * DESCRIPTION: Decode a I2C serial bus descriptor
558 *
559 ******************************************************************************/
560
561static void
562AcpiDmI2cSerialBusDescriptor (
563    ACPI_OP_WALK_INFO       *Info,
564    AML_RESOURCE            *Resource,
565    UINT32                  Length,
566    UINT32                  Level)
567{
568    UINT32                  ResourceSourceOffset;
569    char                    *DeviceName;
570
571
572    /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
573
574    AcpiDmIndent (Level);
575    AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
576        Resource->I2cSerialBus.SlaveAddress,
577        AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
578        Resource->I2cSerialBus.ConnectionSpeed);
579
580    AcpiDmIndent (Level + 1);
581    AcpiOsPrintf ("%s, ",
582        AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
583
584    /* ResourceSource is a required field */
585
586    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
587        Resource->CommonSerialBus.TypeDataLength;
588
589    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
590    AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
591
592    /* ResourceSourceIndex, ResourceUsage */
593
594    AcpiOsPrintf (",\n");
595    AcpiDmIndent (Level + 1);
596    AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
597
598    AcpiOsPrintf ("%s, ",
599        AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
600
601    /* Insert a descriptor name */
602
603    AcpiDmDescriptorName ();
604
605    /* Share */
606
607    AcpiOsPrintf (", %s,\n",
608        AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
609
610    /* Dump the vendor data */
611
612    AcpiDmIndent (Level + 1);
613    AcpiDmDumpSerialBusVendorData (Resource, Level);
614    AcpiOsPrintf (")\n");
615
616    MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
617}
618
619
620/*******************************************************************************
621 *
622 * FUNCTION:    AcpiDmSpiSerialBusDescriptor
623 *
624 * PARAMETERS:  Info                - Extra resource info
625 *              Resource            - Pointer to the resource descriptor
626 *              Length              - Length of the descriptor in bytes
627 *              Level               - Current source code indentation level
628 *
629 * RETURN:      None
630 *
631 * DESCRIPTION: Decode a SPI serial bus descriptor
632 *
633 ******************************************************************************/
634
635static void
636AcpiDmSpiSerialBusDescriptor (
637    ACPI_OP_WALK_INFO       *Info,
638    AML_RESOURCE            *Resource,
639    UINT32                  Length,
640    UINT32                  Level)
641{
642    UINT32                  ResourceSourceOffset;
643    char                    *DeviceName;
644
645
646    /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
647
648    AcpiDmIndent (Level);
649    AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
650        Resource->SpiSerialBus.DeviceSelection,
651        AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
652        AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
653        Resource->SpiSerialBus.DataBitLength);
654
655    /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
656
657    AcpiDmIndent (Level + 1);
658    AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
659        AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
660        Resource->SpiSerialBus.ConnectionSpeed,
661        AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
662
663    AcpiDmIndent (Level + 1);
664    AcpiOsPrintf ("%s, ",
665        AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
666
667    /* ResourceSource is a required field */
668
669    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
670        Resource->CommonSerialBus.TypeDataLength;
671
672    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
673    AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
674
675    /* ResourceSourceIndex, ResourceUsage */
676
677    AcpiOsPrintf (",\n");
678    AcpiDmIndent (Level + 1);
679    AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
680
681    AcpiOsPrintf ("%s, ",
682        AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
683
684    /* Insert a descriptor name */
685
686    AcpiDmDescriptorName ();
687
688    /* Share */
689
690    AcpiOsPrintf (", %s,\n",
691        AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
692
693    /* Dump the vendor data */
694
695    AcpiDmIndent (Level + 1);
696    AcpiDmDumpSerialBusVendorData (Resource, Level);
697    AcpiOsPrintf (")\n");
698
699    MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
700}
701
702
703/*******************************************************************************
704 *
705 * FUNCTION:    AcpiDmUartSerialBusDescriptor
706 *
707 * PARAMETERS:  Info                - Extra resource info
708 *              Resource            - Pointer to the resource descriptor
709 *              Length              - Length of the descriptor in bytes
710 *              Level               - Current source code indentation level
711 *
712 * RETURN:      None
713 *
714 * DESCRIPTION: Decode a UART serial bus descriptor
715 *
716 ******************************************************************************/
717
718static void
719AcpiDmUartSerialBusDescriptor (
720    ACPI_OP_WALK_INFO       *Info,
721    AML_RESOURCE            *Resource,
722    UINT32                  Length,
723    UINT32                  Level)
724{
725    UINT32                  ResourceSourceOffset;
726    char                    *DeviceName;
727
728
729    /* ConnectionSpeed, BitsPerByte, StopBits */
730
731    AcpiDmIndent (Level);
732    AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
733        Resource->UartSerialBus.DefaultBaudRate,
734        AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
735        AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
736
737    /* LinesInUse, IsBigEndian, Parity, FlowControl */
738
739    AcpiDmIndent (Level + 1);
740    AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
741        Resource->UartSerialBus.LinesEnabled,
742        AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
743        AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
744        AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
745
746    /* ReceiveBufferSize, TransmitBufferSize */
747
748    AcpiDmIndent (Level + 1);
749    AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
750        Resource->UartSerialBus.RxFifoSize,
751        Resource->UartSerialBus.TxFifoSize);
752
753    /* ResourceSource is a required field */
754
755    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
756        Resource->CommonSerialBus.TypeDataLength;
757
758    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
759    AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
760
761    /* ResourceSourceIndex, ResourceUsage */
762
763    AcpiOsPrintf (",\n");
764    AcpiDmIndent (Level + 1);
765    AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
766
767    AcpiOsPrintf ("%s, ",
768        AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
769
770    /* Insert a descriptor name */
771
772    AcpiDmDescriptorName ();
773
774    /* Share */
775
776    AcpiOsPrintf (", %s,\n",
777        AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
778
779    /* Dump the vendor data */
780
781    AcpiDmIndent (Level + 1);
782    AcpiDmDumpSerialBusVendorData (Resource, Level);
783    AcpiOsPrintf (")\n");
784
785    MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
786}
787
788
789/*******************************************************************************
790 *
791 * FUNCTION:    AcpiDmSerialBusDescriptor
792 *
793 * PARAMETERS:  Info                - Extra resource info
794 *              Resource            - Pointer to the resource descriptor
795 *              Length              - Length of the descriptor in bytes
796 *              Level               - Current source code indentation level
797 *
798 * RETURN:      None
799 *
800 * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
801 *
802 ******************************************************************************/
803
804void
805AcpiDmSerialBusDescriptor (
806    ACPI_OP_WALK_INFO       *Info,
807    AML_RESOURCE            *Resource,
808    UINT32                  Length,
809    UINT32                  Level)
810{
811
812    SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
813        Info, Resource, Length, Level);
814}
815