OSDN Git Service

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