1 /*******************************************************************************
2  *
3  * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2016, 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 "acpi.h"
45 #include "accommon.h"
46 #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
AcpiDmDumpRawDataBuffer(UINT8 * Buffer,UINT32 Length,UINT32 Level)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
AcpiDmGpioCommon(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Level)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     MpSaveGpioInfo (Info->MappingOp, Resource,
254         PinCount, PinList, DeviceName);
255 }
256 
257 
258 /*******************************************************************************
259  *
260  * FUNCTION:    AcpiDmGpioIntDescriptor
261  *
262  * PARAMETERS:  Info                - Extra resource info
263  *              Resource            - Pointer to the resource descriptor
264  *              Length              - Length of the descriptor in bytes
265  *              Level               - Current source code indentation level
266  *
267  * RETURN:      None
268  *
269  * DESCRIPTION: Decode a GPIO Interrupt descriptor
270  *
271  ******************************************************************************/
272 
273 static void
AcpiDmGpioIntDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)274 AcpiDmGpioIntDescriptor (
275     ACPI_OP_WALK_INFO       *Info,
276     AML_RESOURCE            *Resource,
277     UINT32                  Length,
278     UINT32                  Level)
279 {
280 
281     /* Dump the GpioInt-specific portion of the descriptor */
282 
283     /* EdgeLevel, ActiveLevel, Shared */
284 
285     AcpiDmIndent (Level);
286     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
287         AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
288         AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
289         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
290 
291     /* PinConfig, DebounceTimeout */
292 
293     if (Resource->Gpio.PinConfig <= 3)
294     {
295         AcpiOsPrintf ("%s, ",
296             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
297     }
298     else
299     {
300         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
301     }
302     AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
303 
304     /* Dump the GpioInt/GpioIo common portion of the descriptor */
305 
306     AcpiDmGpioCommon (Info, Resource, Level);
307 }
308 
309 
310 /*******************************************************************************
311  *
312  * FUNCTION:    AcpiDmGpioIoDescriptor
313  *
314  * PARAMETERS:  Info                - Extra resource info
315  *              Resource            - Pointer to the resource descriptor
316  *              Length              - Length of the descriptor in bytes
317  *              Level               - Current source code indentation level
318  *
319  * RETURN:      None
320  *
321  * DESCRIPTION: Decode a GPIO I/O descriptor
322  *
323  ******************************************************************************/
324 
325 static void
AcpiDmGpioIoDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)326 AcpiDmGpioIoDescriptor (
327     ACPI_OP_WALK_INFO       *Info,
328     AML_RESOURCE            *Resource,
329     UINT32                  Length,
330     UINT32                  Level)
331 {
332 
333     /* Dump the GpioIo-specific portion of the descriptor */
334 
335     /* Shared, PinConfig */
336 
337     AcpiDmIndent (Level);
338     AcpiOsPrintf ("GpioIo (%s, ",
339         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
340 
341     if (Resource->Gpio.PinConfig <= 3)
342     {
343         AcpiOsPrintf ("%s, ",
344             AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
345     }
346     else
347     {
348         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
349     }
350 
351     /* DebounceTimeout, DriveStrength, IoRestriction */
352 
353     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
354     AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
355     AcpiOsPrintf ("%s,\n",
356         AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
357 
358     /* Dump the GpioInt/GpioIo common portion of the descriptor */
359 
360     AcpiDmGpioCommon (Info, Resource, Level);
361 }
362 
363 
364 /*******************************************************************************
365  *
366  * FUNCTION:    AcpiDmGpioDescriptor
367  *
368  * PARAMETERS:  Info                - Extra resource info
369  *              Resource            - Pointer to the resource descriptor
370  *              Length              - Length of the descriptor in bytes
371  *              Level               - Current source code indentation level
372  *
373  * RETURN:      None
374  *
375  * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
376  *
377  ******************************************************************************/
378 
379 void
AcpiDmGpioDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)380 AcpiDmGpioDescriptor (
381     ACPI_OP_WALK_INFO       *Info,
382     AML_RESOURCE            *Resource,
383     UINT32                  Length,
384     UINT32                  Level)
385 {
386     UINT8                   ConnectionType;
387 
388 
389     ConnectionType = Resource->Gpio.ConnectionType;
390 
391     switch (ConnectionType)
392     {
393     case AML_RESOURCE_GPIO_TYPE_INT:
394 
395         AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
396         break;
397 
398     case AML_RESOURCE_GPIO_TYPE_IO:
399 
400         AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
401         break;
402 
403     default:
404 
405         AcpiOsPrintf ("Unknown GPIO type\n");
406         break;
407     }
408 }
409 
410 
411 /*******************************************************************************
412  *
413  * FUNCTION:    AcpiDmDumpSerialBusVendorData
414  *
415  * PARAMETERS:  Resource            - Pointer to the resource descriptor
416  *
417  * RETURN:      None
418  *
419  * DESCRIPTION: Dump optional serial bus vendor data
420  *
421  ******************************************************************************/
422 
423 static void
AcpiDmDumpSerialBusVendorData(AML_RESOURCE * Resource,UINT32 Level)424 AcpiDmDumpSerialBusVendorData (
425     AML_RESOURCE            *Resource,
426     UINT32                  Level)
427 {
428     UINT8                   *VendorData;
429     UINT32                  VendorLength;
430 
431 
432     /* Get the (optional) vendor data and length */
433 
434     switch (Resource->CommonSerialBus.Type)
435     {
436     case AML_RESOURCE_I2C_SERIALBUSTYPE:
437 
438         VendorLength = Resource->CommonSerialBus.TypeDataLength -
439             AML_RESOURCE_I2C_MIN_DATA_LEN;
440 
441         VendorData = ACPI_ADD_PTR (UINT8, Resource,
442             sizeof (AML_RESOURCE_I2C_SERIALBUS));
443         break;
444 
445     case AML_RESOURCE_SPI_SERIALBUSTYPE:
446 
447         VendorLength = Resource->CommonSerialBus.TypeDataLength -
448             AML_RESOURCE_SPI_MIN_DATA_LEN;
449 
450         VendorData = ACPI_ADD_PTR (UINT8, Resource,
451             sizeof (AML_RESOURCE_SPI_SERIALBUS));
452         break;
453 
454     case AML_RESOURCE_UART_SERIALBUSTYPE:
455 
456         VendorLength = Resource->CommonSerialBus.TypeDataLength -
457             AML_RESOURCE_UART_MIN_DATA_LEN;
458 
459         VendorData = ACPI_ADD_PTR (UINT8, Resource,
460             sizeof (AML_RESOURCE_UART_SERIALBUS));
461         break;
462 
463     default:
464 
465         return;
466     }
467 
468     /* Dump the vendor bytes as a RawDataBuffer object */
469 
470     AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
471 }
472 
473 
474 /*******************************************************************************
475  *
476  * FUNCTION:    AcpiDmI2cSerialBusDescriptor
477  *
478  * PARAMETERS:  Info                - Extra resource info
479  *              Resource            - Pointer to the resource descriptor
480  *              Length              - Length of the descriptor in bytes
481  *              Level               - Current source code indentation level
482  *
483  * RETURN:      None
484  *
485  * DESCRIPTION: Decode a I2C serial bus descriptor
486  *
487  ******************************************************************************/
488 
489 static void
AcpiDmI2cSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)490 AcpiDmI2cSerialBusDescriptor (
491     ACPI_OP_WALK_INFO       *Info,
492     AML_RESOURCE            *Resource,
493     UINT32                  Length,
494     UINT32                  Level)
495 {
496     UINT32                  ResourceSourceOffset;
497     char                    *DeviceName;
498 
499 
500     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
501 
502     AcpiDmIndent (Level);
503     AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n",
504         Resource->I2cSerialBus.SlaveAddress,
505         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
506         Resource->I2cSerialBus.ConnectionSpeed);
507 
508     AcpiDmIndent (Level + 1);
509     AcpiOsPrintf ("%s, ",
510         AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
511 
512     /* ResourceSource is a required field */
513 
514     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
515         Resource->CommonSerialBus.TypeDataLength;
516 
517     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
518     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
519 
520     /* ResourceSourceIndex, ResourceUsage */
521 
522     AcpiOsPrintf (",\n");
523     AcpiDmIndent (Level + 1);
524     AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
525 
526     AcpiOsPrintf ("%s, ",
527         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
528 
529     /* Insert a descriptor name */
530 
531     AcpiDmDescriptorName ();
532     AcpiOsPrintf (",\n");
533 
534     /* Dump the vendor data */
535 
536     AcpiDmIndent (Level + 1);
537     AcpiDmDumpSerialBusVendorData (Resource, Level);
538     AcpiOsPrintf (")\n");
539 
540     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
541 }
542 
543 
544 /*******************************************************************************
545  *
546  * FUNCTION:    AcpiDmSpiSerialBusDescriptor
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 SPI serial bus descriptor
556  *
557  ******************************************************************************/
558 
559 static void
AcpiDmSpiSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)560 AcpiDmSpiSerialBusDescriptor (
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     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
571 
572     AcpiDmIndent (Level);
573     AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n",
574         Resource->SpiSerialBus.DeviceSelection,
575         AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
576         AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
577         Resource->SpiSerialBus.DataBitLength);
578 
579     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
580 
581     AcpiDmIndent (Level + 1);
582     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
583         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
584         Resource->SpiSerialBus.ConnectionSpeed,
585         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
586 
587     AcpiDmIndent (Level + 1);
588     AcpiOsPrintf ("%s, ",
589         AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
590 
591     /* ResourceSource is a required field */
592 
593     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
594         Resource->CommonSerialBus.TypeDataLength;
595 
596     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
597     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
598 
599     /* ResourceSourceIndex, ResourceUsage */
600 
601     AcpiOsPrintf (",\n");
602     AcpiDmIndent (Level + 1);
603     AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
604 
605     AcpiOsPrintf ("%s, ",
606         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
607 
608     /* Insert a descriptor name */
609 
610     AcpiDmDescriptorName ();
611     AcpiOsPrintf (",\n");
612 
613     /* Dump the vendor data */
614 
615     AcpiDmIndent (Level + 1);
616     AcpiDmDumpSerialBusVendorData (Resource, Level);
617     AcpiOsPrintf (")\n");
618 
619     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
620 }
621 
622 
623 /*******************************************************************************
624  *
625  * FUNCTION:    AcpiDmUartSerialBusDescriptor
626  *
627  * PARAMETERS:  Info                - Extra resource info
628  *              Resource            - Pointer to the resource descriptor
629  *              Length              - Length of the descriptor in bytes
630  *              Level               - Current source code indentation level
631  *
632  * RETURN:      None
633  *
634  * DESCRIPTION: Decode a UART serial bus descriptor
635  *
636  ******************************************************************************/
637 
638 static void
AcpiDmUartSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)639 AcpiDmUartSerialBusDescriptor (
640     ACPI_OP_WALK_INFO       *Info,
641     AML_RESOURCE            *Resource,
642     UINT32                  Length,
643     UINT32                  Level)
644 {
645     UINT32                  ResourceSourceOffset;
646     char                    *DeviceName;
647 
648 
649     /* ConnectionSpeed, BitsPerByte, StopBits */
650 
651     AcpiDmIndent (Level);
652     AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n",
653         Resource->UartSerialBus.DefaultBaudRate,
654         AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
655         AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
656 
657     /* LinesInUse, IsBigEndian, Parity, FlowControl */
658 
659     AcpiDmIndent (Level + 1);
660     AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
661         Resource->UartSerialBus.LinesEnabled,
662         AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
663         AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
664         AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
665 
666     /* ReceiveBufferSize, TransmitBufferSize */
667 
668     AcpiDmIndent (Level + 1);
669     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
670         Resource->UartSerialBus.RxFifoSize,
671         Resource->UartSerialBus.TxFifoSize);
672 
673     /* ResourceSource is a required field */
674 
675     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
676         Resource->CommonSerialBus.TypeDataLength;
677 
678     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
679     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
680 
681     /* ResourceSourceIndex, ResourceUsage */
682 
683     AcpiOsPrintf (",\n");
684     AcpiDmIndent (Level + 1);
685     AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
686 
687     AcpiOsPrintf ("%s, ",
688         AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
689 
690     /* Insert a descriptor name */
691 
692     AcpiDmDescriptorName ();
693     AcpiOsPrintf (",\n");
694 
695     /* Dump the vendor data */
696 
697     AcpiDmIndent (Level + 1);
698     AcpiDmDumpSerialBusVendorData (Resource, Level);
699     AcpiOsPrintf (")\n");
700 
701     MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
702 }
703 
704 
705 /*******************************************************************************
706  *
707  * FUNCTION:    AcpiDmSerialBusDescriptor
708  *
709  * PARAMETERS:  Info                - Extra resource info
710  *              Resource            - Pointer to the resource descriptor
711  *              Length              - Length of the descriptor in bytes
712  *              Level               - Current source code indentation level
713  *
714  * RETURN:      None
715  *
716  * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
717  *
718  ******************************************************************************/
719 
720 void
AcpiDmSerialBusDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)721 AcpiDmSerialBusDescriptor (
722     ACPI_OP_WALK_INFO       *Info,
723     AML_RESOURCE            *Resource,
724     UINT32                  Length,
725     UINT32                  Level)
726 {
727 
728     SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
729         Info, Resource, Length, Level);
730 }
731