xref: /freebsd/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c (revision af6a5351a1fdb1130f18be6c782c4d48916eb971)
1 /*******************************************************************************
2  *
3  * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2017, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acdisasm.h>
47 
48 
49 #define _COMPONENT          ACPI_CA_DEBUGGER
50         ACPI_MODULE_NAME    ("dbresrcl2")
51 
52 /* Local prototypes */
53 
54 static void
55 AcpiDmI2cSerialBusDescriptor (
56     ACPI_OP_WALK_INFO       *Info,
57     AML_RESOURCE            *Resource,
58     UINT32                  Length,
59     UINT32                  Level);
60 
61 static void
62 AcpiDmSpiSerialBusDescriptor (
63     ACPI_OP_WALK_INFO       *Info,
64     AML_RESOURCE            *Resource,
65     UINT32                  Length,
66     UINT32                  Level);
67 
68 static void
69 AcpiDmUartSerialBusDescriptor (
70     ACPI_OP_WALK_INFO       *Info,
71     AML_RESOURCE            *Resource,
72     UINT32                  Length,
73     UINT32                  Level);
74 
75 static void
76 AcpiDmGpioCommon (
77     ACPI_OP_WALK_INFO       *Info,
78     AML_RESOURCE            *Resource,
79     UINT32                  Level);
80 
81 static void
82 AcpiDmDumpRawDataBuffer (
83     UINT8                   *Buffer,
84     UINT32                  Length,
85     UINT32                  Level);
86 
87 
88 /* Dispatch table for the serial bus descriptors */
89 
90 static ACPI_RESOURCE_HANDLER        SerialBusResourceDispatch [] =
91 {
92     NULL,
93     AcpiDmI2cSerialBusDescriptor,
94     AcpiDmSpiSerialBusDescriptor,
95     AcpiDmUartSerialBusDescriptor
96 };
97 
98 
99 /*******************************************************************************
100  *
101  * FUNCTION:    AcpiDmDumpRawDataBuffer
102  *
103  * PARAMETERS:  Buffer              - Pointer to the data bytes
104  *              Length              - Length of the descriptor in bytes
105  *              Level               - Current source code indentation level
106  *
107  * RETURN:      None
108  *
109  * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
110  *              vendor data bytes.
111  *
112  ******************************************************************************/
113 
114 static void
115 AcpiDmDumpRawDataBuffer (
116     UINT8                   *Buffer,
117     UINT32                  Length,
118     UINT32                  Level)
119 {
120     UINT32                  Index;
121     UINT32                  i;
122     UINT32                  j;
123 
124 
125     if (!Length)
126     {
127         return;
128     }
129 
130     AcpiOsPrintf ("RawDataBuffer (0x%.2X)  // Vendor Data", Length);
131 
132     AcpiOsPrintf ("\n");
133     AcpiDmIndent (Level + 1);
134     AcpiOsPrintf ("{\n");
135     AcpiDmIndent (Level + 2);
136 
137     for (i = 0; i < Length;)
138     {
139         for (j = 0; j < 8; j++)
140         {
141             Index = i + j;
142             if (Index >= Length)
143             {
144                 goto Finish;
145             }
146 
147             AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
148             if ((Index + 1) >= Length)
149             {
150                 goto Finish;
151             }
152 
153             AcpiOsPrintf (", ");
154         }
155 
156         AcpiOsPrintf ("\n");
157         AcpiDmIndent (Level + 2);
158 
159         i += 8;
160     }
161 
162 Finish:
163     AcpiOsPrintf ("\n");
164     AcpiDmIndent (Level + 1);
165     AcpiOsPrintf ("}");
166 }
167 
168 
169 /*******************************************************************************
170  *
171  * FUNCTION:    AcpiDmGpioCommon
172  *
173  * PARAMETERS:  Info                - Extra resource info
174  *              Resource            - Pointer to the resource descriptor
175  *              Level               - Current source code indentation level
176  *
177  * RETURN:      None
178  *
179  * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
180  *
181  ******************************************************************************/
182 
183 static void
184 AcpiDmGpioCommon (
185     ACPI_OP_WALK_INFO       *Info,
186     AML_RESOURCE            *Resource,
187     UINT32                  Level)
188 {
189     UINT16                  *PinList;
190     UINT8                   *VendorData;
191     char                    *DeviceName = NULL;
192     UINT32                  PinCount;
193     UINT32                  i;
194 
195 
196     /* ResourceSource, ResourceSourceIndex, ResourceType */
197 
198     AcpiDmIndent (Level + 1);
199     if (Resource->Gpio.ResSourceOffset)
200     {
201         DeviceName = ACPI_ADD_PTR (char,
202             Resource, Resource->Gpio.ResSourceOffset),
203         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
204     }
205 
206     AcpiOsPrintf (", ");
207     AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
208     AcpiOsPrintf ("%s, ",
209         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
210 
211     /* Insert a descriptor name */
212 
213     AcpiDmDescriptorName ();
214     AcpiOsPrintf (",");
215 
216     /* Dump the vendor data */
217 
218     if (Resource->Gpio.VendorOffset)
219     {
220         AcpiOsPrintf ("\n");
221         AcpiDmIndent (Level + 1);
222         VendorData = ACPI_ADD_PTR (UINT8, Resource,
223             Resource->Gpio.VendorOffset);
224 
225         AcpiDmDumpRawDataBuffer (VendorData,
226             Resource->Gpio.VendorLength, Level);
227     }
228 
229     AcpiOsPrintf (")\n");
230 
231     /* Dump the interrupt list */
232 
233     AcpiDmIndent (Level + 1);
234     AcpiOsPrintf ("{   // Pin list\n");
235 
236     PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
237         Resource->Gpio.PinTableOffset)) /
238         sizeof (UINT16);
239 
240     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
241         Resource->Gpio.PinTableOffset);
242 
243     for (i = 0; i < PinCount; i++)
244     {
245         AcpiDmIndent (Level + 2);
246         AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
247             ((i + 1) < PinCount) ? "," : "");
248     }
249 
250     AcpiDmIndent (Level + 1);
251     AcpiOsPrintf ("}\n");
252 
253 #ifndef _KERNEL
254     MpSaveGpioInfo (Info->MappingOp, Resource,
255         PinCount, PinList, DeviceName);
256 #endif
257 }
258 
259 
260 /*******************************************************************************
261  *
262  * FUNCTION:    AcpiDmGpioIntDescriptor
263  *
264  * PARAMETERS:  Info                - Extra resource info
265  *              Resource            - Pointer to the resource descriptor
266  *              Length              - Length of the descriptor in bytes
267  *              Level               - Current source code indentation level
268  *
269  * RETURN:      None
270  *
271  * DESCRIPTION: Decode a GPIO Interrupt descriptor
272  *
273  ******************************************************************************/
274 
275 static void
276 AcpiDmGpioIntDescriptor (
277     ACPI_OP_WALK_INFO       *Info,
278     AML_RESOURCE            *Resource,
279     UINT32                  Length,
280     UINT32                  Level)
281 {
282 
283     /* Dump the GpioInt-specific portion of the descriptor */
284 
285     /* EdgeLevel, ActiveLevel, Shared */
286 
287     AcpiDmIndent (Level);
288     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
289         AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
290         AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
291         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
292 
293     /* PinConfig, DebounceTimeout */
294 
295     if (Resource->Gpio.PinConfig <= 3)
296     {
297         AcpiOsPrintf ("%s, ",
298             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
299     }
300     else
301     {
302         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
303     }
304     AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
305 
306     /* Dump the GpioInt/GpioIo common portion of the descriptor */
307 
308     AcpiDmGpioCommon (Info, Resource, Level);
309 }
310 
311 
312 /*******************************************************************************
313  *
314  * FUNCTION:    AcpiDmGpioIoDescriptor
315  *
316  * PARAMETERS:  Info                - Extra resource info
317  *              Resource            - Pointer to the resource descriptor
318  *              Length              - Length of the descriptor in bytes
319  *              Level               - Current source code indentation level
320  *
321  * RETURN:      None
322  *
323  * DESCRIPTION: Decode a GPIO I/O descriptor
324  *
325  ******************************************************************************/
326 
327 static void
328 AcpiDmGpioIoDescriptor (
329     ACPI_OP_WALK_INFO       *Info,
330     AML_RESOURCE            *Resource,
331     UINT32                  Length,
332     UINT32                  Level)
333 {
334 
335     /* Dump the GpioIo-specific portion of the descriptor */
336 
337     /* Shared, PinConfig */
338 
339     AcpiDmIndent (Level);
340     AcpiOsPrintf ("GpioIo (%s, ",
341         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
342 
343     if (Resource->Gpio.PinConfig <= 3)
344     {
345         AcpiOsPrintf ("%s, ",
346             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
347     }
348     else
349     {
350         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
351     }
352 
353     /* DebounceTimeout, DriveStrength, IoRestriction */
354 
355     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
356     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
357     AcpiOsPrintf ("%s,\n",
358         AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
359 
360     /* Dump the GpioInt/GpioIo common portion of the descriptor */
361 
362     AcpiDmGpioCommon (Info, Resource, Level);
363 }
364 
365 
366 /*******************************************************************************
367  *
368  * FUNCTION:    AcpiDmGpioDescriptor
369  *
370  * PARAMETERS:  Info                - Extra resource info
371  *              Resource            - Pointer to the resource descriptor
372  *              Length              - Length of the descriptor in bytes
373  *              Level               - Current source code indentation level
374  *
375  * RETURN:      None
376  *
377  * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
378  *
379  ******************************************************************************/
380 
381 void
382 AcpiDmGpioDescriptor (
383     ACPI_OP_WALK_INFO       *Info,
384     AML_RESOURCE            *Resource,
385     UINT32                  Length,
386     UINT32                  Level)
387 {
388     UINT8                   ConnectionType;
389 
390 
391     ConnectionType = Resource->Gpio.ConnectionType;
392 
393     switch (ConnectionType)
394     {
395     case AML_RESOURCE_GPIO_TYPE_INT:
396 
397         AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
398         break;
399 
400     case AML_RESOURCE_GPIO_TYPE_IO:
401 
402         AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
403         break;
404 
405     default:
406 
407         AcpiOsPrintf ("Unknown GPIO type\n");
408         break;
409     }
410 }
411 
412 
413 /*******************************************************************************
414  *
415  * FUNCTION:    AcpiDmDumpSerialBusVendorData
416  *
417  * PARAMETERS:  Resource            - Pointer to the resource descriptor
418  *
419  * RETURN:      None
420  *
421  * DESCRIPTION: Dump optional serial bus vendor data
422  *
423  ******************************************************************************/
424 
425 static void
426 AcpiDmDumpSerialBusVendorData (
427     AML_RESOURCE            *Resource,
428     UINT32                  Level)
429 {
430     UINT8                   *VendorData;
431     UINT32                  VendorLength;
432 
433 
434     /* Get the (optional) vendor data and length */
435 
436     switch (Resource->CommonSerialBus.Type)
437     {
438     case AML_RESOURCE_I2C_SERIALBUSTYPE:
439 
440         VendorLength = Resource->CommonSerialBus.TypeDataLength -
441             AML_RESOURCE_I2C_MIN_DATA_LEN;
442 
443         VendorData = ACPI_ADD_PTR (UINT8, Resource,
444             sizeof (AML_RESOURCE_I2C_SERIALBUS));
445         break;
446 
447     case AML_RESOURCE_SPI_SERIALBUSTYPE:
448 
449         VendorLength = Resource->CommonSerialBus.TypeDataLength -
450             AML_RESOURCE_SPI_MIN_DATA_LEN;
451 
452         VendorData = ACPI_ADD_PTR (UINT8, Resource,
453             sizeof (AML_RESOURCE_SPI_SERIALBUS));
454         break;
455 
456     case AML_RESOURCE_UART_SERIALBUSTYPE:
457 
458         VendorLength = Resource->CommonSerialBus.TypeDataLength -
459             AML_RESOURCE_UART_MIN_DATA_LEN;
460 
461         VendorData = ACPI_ADD_PTR (UINT8, Resource,
462             sizeof (AML_RESOURCE_UART_SERIALBUS));
463         break;
464 
465     default:
466 
467         return;
468     }
469 
470     /* Dump the vendor bytes as a RawDataBuffer object */
471 
472     AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
473 }
474 
475 
476 /*******************************************************************************
477  *
478  * FUNCTION:    AcpiDmI2cSerialBusDescriptor
479  *
480  * PARAMETERS:  Info                - Extra resource info
481  *              Resource            - Pointer to the resource descriptor
482  *              Length              - Length of the descriptor in bytes
483  *              Level               - Current source code indentation level
484  *
485  * RETURN:      None
486  *
487  * DESCRIPTION: Decode a I2C serial bus descriptor
488  *
489  ******************************************************************************/
490 
491 static void
492 AcpiDmI2cSerialBusDescriptor (
493     ACPI_OP_WALK_INFO       *Info,
494     AML_RESOURCE            *Resource,
495     UINT32                  Length,
496     UINT32                  Level)
497 {
498     UINT32                  ResourceSourceOffset;
499     char                    *DeviceName;
500 
501 
502     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
503 
504     AcpiDmIndent (Level);
505     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
506         Resource->I2cSerialBus.SlaveAddress,
507         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
508         Resource->I2cSerialBus.ConnectionSpeed);
509 
510     AcpiDmIndent (Level + 1);
511     AcpiOsPrintf ("%s, ",
512         AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
513 
514     /* ResourceSource is a required field */
515 
516     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
517         Resource->CommonSerialBus.TypeDataLength;
518 
519     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
520     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
521 
522     /* ResourceSourceIndex, ResourceUsage */
523 
524     AcpiOsPrintf (",\n");
525     AcpiDmIndent (Level + 1);
526     AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
527 
528     AcpiOsPrintf ("%s, ",
529         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
530 
531     /* Insert a descriptor name */
532 
533     AcpiDmDescriptorName ();
534 
535     /* Share */
536 
537     AcpiOsPrintf (", %s,\n",
538         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
539 
540     /* Dump the vendor data */
541 
542     AcpiDmIndent (Level + 1);
543     AcpiDmDumpSerialBusVendorData (Resource, Level);
544     AcpiOsPrintf (")\n");
545 
546 #ifndef _KERNEL
547     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
548 #endif
549 }
550 
551 
552 /*******************************************************************************
553  *
554  * FUNCTION:    AcpiDmSpiSerialBusDescriptor
555  *
556  * PARAMETERS:  Info                - Extra resource info
557  *              Resource            - Pointer to the resource descriptor
558  *              Length              - Length of the descriptor in bytes
559  *              Level               - Current source code indentation level
560  *
561  * RETURN:      None
562  *
563  * DESCRIPTION: Decode a SPI serial bus descriptor
564  *
565  ******************************************************************************/
566 
567 static void
568 AcpiDmSpiSerialBusDescriptor (
569     ACPI_OP_WALK_INFO       *Info,
570     AML_RESOURCE            *Resource,
571     UINT32                  Length,
572     UINT32                  Level)
573 {
574     UINT32                  ResourceSourceOffset;
575     char                    *DeviceName;
576 
577 
578     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
579 
580     AcpiDmIndent (Level);
581     AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
582         Resource->SpiSerialBus.DeviceSelection,
583         AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
584         AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
585         Resource->SpiSerialBus.DataBitLength);
586 
587     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
588 
589     AcpiDmIndent (Level + 1);
590     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
591         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
592         Resource->SpiSerialBus.ConnectionSpeed,
593         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
594 
595     AcpiDmIndent (Level + 1);
596     AcpiOsPrintf ("%s, ",
597         AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
598 
599     /* ResourceSource is a required field */
600 
601     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
602         Resource->CommonSerialBus.TypeDataLength;
603 
604     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
605     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
606 
607     /* ResourceSourceIndex, ResourceUsage */
608 
609     AcpiOsPrintf (",\n");
610     AcpiDmIndent (Level + 1);
611     AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
612 
613     AcpiOsPrintf ("%s, ",
614         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
615 
616     /* Insert a descriptor name */
617 
618     AcpiDmDescriptorName ();
619 
620     /* Share */
621 
622     AcpiOsPrintf (", %s,\n",
623         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
624 
625     /* Dump the vendor data */
626 
627     AcpiDmIndent (Level + 1);
628     AcpiDmDumpSerialBusVendorData (Resource, Level);
629     AcpiOsPrintf (")\n");
630 
631 #ifndef _KERNEL
632     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
633 #endif
634 }
635 
636 
637 /*******************************************************************************
638  *
639  * FUNCTION:    AcpiDmUartSerialBusDescriptor
640  *
641  * PARAMETERS:  Info                - Extra resource info
642  *              Resource            - Pointer to the resource descriptor
643  *              Length              - Length of the descriptor in bytes
644  *              Level               - Current source code indentation level
645  *
646  * RETURN:      None
647  *
648  * DESCRIPTION: Decode a UART serial bus descriptor
649  *
650  ******************************************************************************/
651 
652 static void
653 AcpiDmUartSerialBusDescriptor (
654     ACPI_OP_WALK_INFO       *Info,
655     AML_RESOURCE            *Resource,
656     UINT32                  Length,
657     UINT32                  Level)
658 {
659     UINT32                  ResourceSourceOffset;
660     char                    *DeviceName;
661 
662 
663     /* ConnectionSpeed, BitsPerByte, StopBits */
664 
665     AcpiDmIndent (Level);
666     AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
667         Resource->UartSerialBus.DefaultBaudRate,
668         AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
669         AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
670 
671     /* LinesInUse, IsBigEndian, Parity, FlowControl */
672 
673     AcpiDmIndent (Level + 1);
674     AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
675         Resource->UartSerialBus.LinesEnabled,
676         AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
677         AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
678         AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
679 
680     /* ReceiveBufferSize, TransmitBufferSize */
681 
682     AcpiDmIndent (Level + 1);
683     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
684         Resource->UartSerialBus.RxFifoSize,
685         Resource->UartSerialBus.TxFifoSize);
686 
687     /* ResourceSource is a required field */
688 
689     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
690         Resource->CommonSerialBus.TypeDataLength;
691 
692     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
693     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
694 
695     /* ResourceSourceIndex, ResourceUsage */
696 
697     AcpiOsPrintf (",\n");
698     AcpiDmIndent (Level + 1);
699     AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
700 
701     AcpiOsPrintf ("%s, ",
702         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
703 
704     /* Insert a descriptor name */
705 
706     AcpiDmDescriptorName ();
707 
708     /* Share */
709 
710     AcpiOsPrintf (", %s,\n",
711         AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
712 
713     /* Dump the vendor data */
714 
715     AcpiDmIndent (Level + 1);
716     AcpiDmDumpSerialBusVendorData (Resource, Level);
717     AcpiOsPrintf (")\n");
718 
719 #ifndef _KERNEL
720     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
721 #endif
722 }
723 
724 
725 /*******************************************************************************
726  *
727  * FUNCTION:    AcpiDmSerialBusDescriptor
728  *
729  * PARAMETERS:  Info                - Extra resource info
730  *              Resource            - Pointer to the resource descriptor
731  *              Length              - Length of the descriptor in bytes
732  *              Level               - Current source code indentation level
733  *
734  * RETURN:      None
735  *
736  * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
737  *
738  ******************************************************************************/
739 
740 void
741 AcpiDmSerialBusDescriptor (
742     ACPI_OP_WALK_INFO       *Info,
743     AML_RESOURCE            *Resource,
744     UINT32                  Length,
745     UINT32                  Level)
746 {
747 
748     SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
749         Info, Resource, Length, Level);
750 }
751