dmresrcl2.c revision 1.1.1.12 1 /*******************************************************************************
2 *
3 * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
4 *
5 ******************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2021, 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 MERCHANTABILITY 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 AcpiDmCsi2SerialBusDescriptor (
56 ACPI_OP_WALK_INFO *Info,
57 AML_RESOURCE *Resource,
58 UINT32 Length,
59 UINT32 Level);
60
61 static void
62 AcpiDmI2cSerialBusDescriptor (
63 ACPI_OP_WALK_INFO *Info,
64 AML_RESOURCE *Resource,
65 UINT32 Length,
66 UINT32 Level);
67
68 static void
69 AcpiDmSpiSerialBusDescriptor (
70 ACPI_OP_WALK_INFO *Info,
71 AML_RESOURCE *Resource,
72 UINT32 Length,
73 UINT32 Level);
74
75 static void
76 AcpiDmUartSerialBusDescriptor (
77 ACPI_OP_WALK_INFO *Info,
78 AML_RESOURCE *Resource,
79 UINT32 Length,
80 UINT32 Level);
81
82 static void
83 AcpiDmGpioCommon (
84 ACPI_OP_WALK_INFO *Info,
85 AML_RESOURCE *Resource,
86 UINT32 Level);
87
88 static void
89 AcpiDmDumpRawDataBuffer (
90 UINT8 *Buffer,
91 UINT32 Length,
92 UINT32 Level);
93
94
95 /* Dispatch table for the serial bus descriptors */
96
97 static ACPI_RESOURCE_HANDLER SerialBusResourceDispatch [] =
98 {
99 NULL,
100 AcpiDmI2cSerialBusDescriptor,
101 AcpiDmSpiSerialBusDescriptor,
102 AcpiDmUartSerialBusDescriptor,
103 AcpiDmCsi2SerialBusDescriptor
104 };
105
106
107 /*******************************************************************************
108 *
109 * FUNCTION: AcpiDmDumpRawDataBuffer
110 *
111 * PARAMETERS: Buffer - Pointer to the data bytes
112 * Length - Length of the descriptor in bytes
113 * Level - Current source code indentation level
114 *
115 * RETURN: None
116 *
117 * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
118 * vendor data bytes.
119 *
120 ******************************************************************************/
121
122 static void
123 AcpiDmDumpRawDataBuffer (
124 UINT8 *Buffer,
125 UINT32 Length,
126 UINT32 Level)
127 {
128 UINT32 Index;
129 UINT32 i;
130 UINT32 j;
131
132
133 if (!Length)
134 {
135 return;
136 }
137
138 AcpiOsPrintf ("RawDataBuffer (0x%.2X) // Vendor Data", Length);
139
140 AcpiOsPrintf ("\n");
141 AcpiDmIndent (Level + 1);
142 AcpiOsPrintf ("{\n");
143 AcpiDmIndent (Level + 2);
144
145 for (i = 0; i < Length;)
146 {
147 for (j = 0; j < 8; j++)
148 {
149 Index = i + j;
150 if (Index >= Length)
151 {
152 goto Finish;
153 }
154
155 AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
156 if ((Index + 1) >= Length)
157 {
158 goto Finish;
159 }
160
161 AcpiOsPrintf (", ");
162 }
163
164 AcpiOsPrintf ("\n");
165 AcpiDmIndent (Level + 2);
166
167 i += 8;
168 }
169
170 Finish:
171 AcpiOsPrintf ("\n");
172 AcpiDmIndent (Level + 1);
173 AcpiOsPrintf ("}");
174 }
175
176
177 /*******************************************************************************
178 *
179 * FUNCTION: AcpiDmGpioCommon
180 *
181 * PARAMETERS: Info - Extra resource info
182 * Resource - Pointer to the resource descriptor
183 * Level - Current source code indentation level
184 *
185 * RETURN: None
186 *
187 * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
188 *
189 ******************************************************************************/
190
191 static void
192 AcpiDmGpioCommon (
193 ACPI_OP_WALK_INFO *Info,
194 AML_RESOURCE *Resource,
195 UINT32 Level)
196 {
197 UINT16 *PinList;
198 UINT8 *VendorData;
199 char *DeviceName = NULL;
200 UINT32 PinCount;
201 UINT32 i;
202
203
204 /* ResourceSource, ResourceSourceIndex, ResourceType */
205
206 AcpiDmIndent (Level + 1);
207 if (Resource->Gpio.ResSourceOffset)
208 {
209 DeviceName = ACPI_ADD_PTR (char,
210 Resource, Resource->Gpio.ResSourceOffset),
211 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
212 }
213
214 AcpiOsPrintf (", ");
215 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
216 AcpiOsPrintf ("%s, ",
217 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
218
219 /* Insert a descriptor name */
220
221 AcpiDmDescriptorName ();
222 AcpiOsPrintf (",");
223
224 /* Dump the vendor data */
225
226 if (Resource->Gpio.VendorOffset)
227 {
228 AcpiOsPrintf ("\n");
229 AcpiDmIndent (Level + 1);
230 VendorData = ACPI_ADD_PTR (UINT8, Resource,
231 Resource->Gpio.VendorOffset);
232
233 AcpiDmDumpRawDataBuffer (VendorData,
234 Resource->Gpio.VendorLength, Level);
235 }
236
237 AcpiOsPrintf (")\n");
238
239 /* Dump the interrupt list */
240
241 AcpiDmIndent (Level + 1);
242 AcpiOsPrintf ("{ // Pin list\n");
243
244 PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
245 Resource->Gpio.PinTableOffset)) /
246 sizeof (UINT16);
247
248 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
249 Resource->Gpio.PinTableOffset);
250
251 for (i = 0; i < PinCount; i++)
252 {
253 AcpiDmIndent (Level + 2);
254 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
255 ((i + 1) < PinCount) ? "," : "");
256 }
257
258 AcpiDmIndent (Level + 1);
259 AcpiOsPrintf ("}\n");
260
261 MpSaveGpioInfo (Info->MappingOp, Resource,
262 PinCount, PinList, DeviceName);
263 }
264
265
266 /*******************************************************************************
267 *
268 * FUNCTION: AcpiDmGpioIntDescriptor
269 *
270 * PARAMETERS: Info - Extra resource info
271 * Resource - Pointer to the resource descriptor
272 * Length - Length of the descriptor in bytes
273 * Level - Current source code indentation level
274 *
275 * RETURN: None
276 *
277 * DESCRIPTION: Decode a GPIO Interrupt descriptor
278 *
279 ******************************************************************************/
280
281 static void
282 AcpiDmGpioIntDescriptor (
283 ACPI_OP_WALK_INFO *Info,
284 AML_RESOURCE *Resource,
285 UINT32 Length,
286 UINT32 Level)
287 {
288
289 /* Dump the GpioInt-specific portion of the descriptor */
290
291 /* EdgeLevel, ActiveLevel, Shared */
292
293 AcpiDmIndent (Level);
294 AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
295 AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
296 AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
297 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
298
299 /* PinConfig, DebounceTimeout */
300
301 if (Resource->Gpio.PinConfig <= 3)
302 {
303 AcpiOsPrintf ("%s, ",
304 AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
305 }
306 else
307 {
308 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
309 }
310 AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
311
312 /* Dump the GpioInt/GpioIo common portion of the descriptor */
313
314 AcpiDmGpioCommon (Info, Resource, Level);
315 }
316
317
318 /*******************************************************************************
319 *
320 * FUNCTION: AcpiDmGpioIoDescriptor
321 *
322 * PARAMETERS: Info - Extra resource info
323 * Resource - Pointer to the resource descriptor
324 * Length - Length of the descriptor in bytes
325 * Level - Current source code indentation level
326 *
327 * RETURN: None
328 *
329 * DESCRIPTION: Decode a GPIO I/O descriptor
330 *
331 ******************************************************************************/
332
333 static void
334 AcpiDmGpioIoDescriptor (
335 ACPI_OP_WALK_INFO *Info,
336 AML_RESOURCE *Resource,
337 UINT32 Length,
338 UINT32 Level)
339 {
340
341 /* Dump the GpioIo-specific portion of the descriptor */
342
343 /* Shared, PinConfig */
344
345 AcpiDmIndent (Level);
346 AcpiOsPrintf ("GpioIo (%s, ",
347 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
348
349 if (Resource->Gpio.PinConfig <= 3)
350 {
351 AcpiOsPrintf ("%s, ",
352 AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
353 }
354 else
355 {
356 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
357 }
358
359 /* DebounceTimeout, DriveStrength, IoRestriction */
360
361 AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
362 AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
363 AcpiOsPrintf ("%s,\n",
364 AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
365
366 /* Dump the GpioInt/GpioIo common portion of the descriptor */
367
368 AcpiDmGpioCommon (Info, Resource, Level);
369 }
370
371
372 /*******************************************************************************
373 *
374 * FUNCTION: AcpiDmGpioDescriptor
375 *
376 * PARAMETERS: Info - Extra resource info
377 * Resource - Pointer to the resource descriptor
378 * Length - Length of the descriptor in bytes
379 * Level - Current source code indentation level
380 *
381 * RETURN: None
382 *
383 * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
384 *
385 ******************************************************************************/
386
387 void
388 AcpiDmGpioDescriptor (
389 ACPI_OP_WALK_INFO *Info,
390 AML_RESOURCE *Resource,
391 UINT32 Length,
392 UINT32 Level)
393 {
394 UINT8 ConnectionType;
395
396
397 ConnectionType = Resource->Gpio.ConnectionType;
398
399 switch (ConnectionType)
400 {
401 case AML_RESOURCE_GPIO_TYPE_INT:
402
403 AcpiDmGpioIntDescriptor (Info, Resource, Length, Level);
404 break;
405
406 case AML_RESOURCE_GPIO_TYPE_IO:
407
408 AcpiDmGpioIoDescriptor (Info, Resource, Length, Level);
409 break;
410
411 default:
412
413 AcpiOsPrintf ("Unknown GPIO type\n");
414 break;
415 }
416 }
417
418 /*******************************************************************************
419 *
420 * FUNCTION: AcpiDmPinFunctionDescriptor
421 *
422 * PARAMETERS: Info - Extra resource info
423 * Resource - Pointer to the resource descriptor
424 * Length - Length of the descriptor in bytes
425 * Level - Current source code indentation level
426 *
427 * RETURN: None
428 *
429 * DESCRIPTION: Decode a PinFunction descriptor
430 *
431 ******************************************************************************/
432
433 void
434 AcpiDmPinFunctionDescriptor (
435 ACPI_OP_WALK_INFO *Info,
436 AML_RESOURCE *Resource,
437 UINT32 Length,
438 UINT32 Level)
439 {
440 UINT16 *PinList;
441 UINT8 *VendorData;
442 char *DeviceName = NULL;
443 UINT32 PinCount;
444 UINT32 i;
445
446 AcpiDmIndent (Level);
447 AcpiOsPrintf ("PinFunction (%s, ",
448 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]);
449
450 if (Resource->PinFunction.PinConfig <= 3)
451 {
452 AcpiOsPrintf ("%s, ",
453 AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]);
454 }
455 else
456 {
457 AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig);
458 }
459
460 /* FunctionNumber */
461
462 AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
463
464 if (Resource->PinFunction.ResSourceOffset)
465 {
466 DeviceName = ACPI_ADD_PTR (char,
467 Resource, Resource->PinFunction.ResSourceOffset),
468 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
469 }
470
471 AcpiOsPrintf (", ");
472 AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex);
473
474 AcpiDmIndent (Level + 1);
475
476 /* Always ResourceConsumer */
477 AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]);
478
479 /* Insert a descriptor name */
480
481 AcpiDmDescriptorName ();
482
483 AcpiOsPrintf (",");
484
485 /* Dump the vendor data */
486
487 if (Resource->PinFunction.VendorLength)
488 {
489 AcpiOsPrintf ("\n");
490 AcpiDmIndent (Level + 1);
491 VendorData = ACPI_ADD_PTR (UINT8, Resource,
492 Resource->PinFunction.VendorOffset);
493
494 AcpiDmDumpRawDataBuffer (VendorData,
495 Resource->PinFunction.VendorLength, Level);
496 }
497
498 AcpiOsPrintf (")\n");
499
500 AcpiDmIndent (Level + 1);
501
502 /* Dump the interrupt list */
503
504 AcpiOsPrintf ("{ // Pin list\n");
505
506 PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
507 Resource->PinFunction.PinTableOffset)) /
508 sizeof (UINT16);
509
510 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
511 Resource->PinFunction.PinTableOffset);
512
513 for (i = 0; i < PinCount; i++)
514 {
515 AcpiDmIndent (Level + 2);
516 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
517 ((i + 1) < PinCount) ? "," : "");
518 }
519
520 AcpiDmIndent (Level + 1);
521 AcpiOsPrintf ("}\n");
522 }
523
524
525 /*******************************************************************************
526 *
527 * FUNCTION: AcpiDmDumpSerialBusVendorData
528 *
529 * PARAMETERS: Resource - Pointer to the resource descriptor
530 *
531 * RETURN: None
532 *
533 * DESCRIPTION: Dump optional serial bus vendor data
534 *
535 ******************************************************************************/
536
537 static void
538 AcpiDmDumpSerialBusVendorData (
539 AML_RESOURCE *Resource,
540 UINT32 Level)
541 {
542 UINT8 *VendorData;
543 UINT32 VendorLength;
544
545
546 /* Get the (optional) vendor data and length */
547
548 switch (Resource->CommonSerialBus.Type)
549 {
550 case AML_RESOURCE_I2C_SERIALBUSTYPE:
551
552 VendorLength = Resource->CommonSerialBus.TypeDataLength -
553 AML_RESOURCE_I2C_MIN_DATA_LEN;
554
555 VendorData = ACPI_ADD_PTR (UINT8, Resource,
556 sizeof (AML_RESOURCE_I2C_SERIALBUS));
557 break;
558
559 case AML_RESOURCE_SPI_SERIALBUSTYPE:
560
561 VendorLength = Resource->CommonSerialBus.TypeDataLength -
562 AML_RESOURCE_SPI_MIN_DATA_LEN;
563
564 VendorData = ACPI_ADD_PTR (UINT8, Resource,
565 sizeof (AML_RESOURCE_SPI_SERIALBUS));
566 break;
567
568 case AML_RESOURCE_UART_SERIALBUSTYPE:
569
570 VendorLength = Resource->CommonSerialBus.TypeDataLength -
571 AML_RESOURCE_UART_MIN_DATA_LEN;
572
573 VendorData = ACPI_ADD_PTR (UINT8, Resource,
574 sizeof (AML_RESOURCE_UART_SERIALBUS));
575 break;
576
577 case AML_RESOURCE_CSI2_SERIALBUSTYPE:
578
579 VendorLength = Resource->CommonSerialBus.TypeDataLength -
580 AML_RESOURCE_CSI2_MIN_DATA_LEN;
581
582 VendorData = ACPI_ADD_PTR (UINT8, Resource,
583 sizeof (AML_RESOURCE_CSI2_SERIALBUS));
584 break;
585
586 default:
587
588 return;
589 }
590
591 /* Dump the vendor bytes as a RawDataBuffer object */
592
593 AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
594 }
595
596
597 /*******************************************************************************
598 *
599 * FUNCTION: AcpiDmCsi2SerialBusDescriptor
600 *
601 * PARAMETERS: Info - Extra resource info
602 * Resource - Pointer to the resource descriptor
603 * Length - Length of the descriptor in bytes
604 * Level - Current source code indentation level
605 *
606 * RETURN: None
607 *
608 * DESCRIPTION: Decode a CSI2 serial bus descriptor
609 *
610 ******************************************************************************/
611
612 static void
613 AcpiDmCsi2SerialBusDescriptor (
614 ACPI_OP_WALK_INFO *Info,
615 AML_RESOURCE *Resource,
616 UINT32 Length,
617 UINT32 Level)
618 {
619 UINT32 ResourceSourceOffset;
620 char *DeviceName;
621
622
623 /* SlaveMode, PhyType, LocalPortInstance */
624
625 AcpiDmIndent (Level);
626 AcpiOsPrintf ("Csi2Bus (%s,",
627 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->Csi2SerialBus.Flags)]);
628
629 AcpiOsPrintf (" 0x%2.2X, 0x%2.2X,\n",
630 Resource->Csi2SerialBus.TypeSpecificFlags & 0x03,
631 Resource->Csi2SerialBus.TypeSpecificFlags & 0xFC);
632
633 /* ResourceSource is a required field */
634
635 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
636 Resource->CommonSerialBus.TypeDataLength;
637
638 AcpiDmIndent (Level + 1);
639 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
640 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
641
642 /* ResourceSourceIndex, ResourceUsage */
643
644 AcpiOsPrintf (",\n");
645 AcpiDmIndent (Level + 1);
646 AcpiOsPrintf ("0x%2.2X, ", Resource->Csi2SerialBus.ResSourceIndex);
647
648 AcpiOsPrintf ("%s, ",
649 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Csi2SerialBus.Flags, 1)]);
650
651 /* Insert a descriptor name */
652
653 AcpiDmDescriptorName ();
654
655 /* Dump the vendor data */
656
657 AcpiOsPrintf (",\n");
658 AcpiDmIndent (Level + 1);
659 AcpiDmDumpSerialBusVendorData (Resource, Level);
660 AcpiOsPrintf (")\n");
661
662 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
663 }
664
665
666 /*******************************************************************************
667 *
668 * FUNCTION: AcpiDmI2cSerialBusDescriptor
669 *
670 * PARAMETERS: Info - Extra resource info
671 * Resource - Pointer to the resource descriptor
672 * Length - Length of the descriptor in bytes
673 * Level - Current source code indentation level
674 *
675 * RETURN: None
676 *
677 * DESCRIPTION: Decode a I2C serial bus descriptor
678 *
679 ******************************************************************************/
680
681 static void
682 AcpiDmI2cSerialBusDescriptor (
683 ACPI_OP_WALK_INFO *Info,
684 AML_RESOURCE *Resource,
685 UINT32 Length,
686 UINT32 Level)
687 {
688 UINT32 ResourceSourceOffset;
689 char *DeviceName;
690
691
692 /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
693
694 AcpiDmIndent (Level);
695 AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
696 Resource->I2cSerialBus.SlaveAddress,
697 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
698 Resource->I2cSerialBus.ConnectionSpeed);
699
700 AcpiDmIndent (Level + 1);
701 AcpiOsPrintf ("%s, ",
702 AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
703
704 /* ResourceSource is a required field */
705
706 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
707 Resource->CommonSerialBus.TypeDataLength;
708
709 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
710 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
711
712 /* ResourceSourceIndex, ResourceUsage */
713
714 AcpiOsPrintf (",\n");
715 AcpiDmIndent (Level + 1);
716 AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
717
718 AcpiOsPrintf ("%s, ",
719 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]);
720
721 /* Insert a descriptor name */
722
723 AcpiDmDescriptorName ();
724
725 /* Share */
726
727 AcpiOsPrintf (", %s,\n",
728 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]);
729
730 /* Dump the vendor data */
731
732 AcpiDmIndent (Level + 1);
733 AcpiDmDumpSerialBusVendorData (Resource, Level);
734 AcpiOsPrintf (")\n");
735
736 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
737 }
738
739
740 /*******************************************************************************
741 *
742 * FUNCTION: AcpiDmSpiSerialBusDescriptor
743 *
744 * PARAMETERS: Info - Extra resource info
745 * Resource - Pointer to the resource descriptor
746 * Length - Length of the descriptor in bytes
747 * Level - Current source code indentation level
748 *
749 * RETURN: None
750 *
751 * DESCRIPTION: Decode a SPI serial bus descriptor
752 *
753 ******************************************************************************/
754
755 static void
756 AcpiDmSpiSerialBusDescriptor (
757 ACPI_OP_WALK_INFO *Info,
758 AML_RESOURCE *Resource,
759 UINT32 Length,
760 UINT32 Level)
761 {
762 UINT32 ResourceSourceOffset;
763 char *DeviceName;
764
765
766 /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
767
768 AcpiDmIndent (Level);
769 AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
770 Resource->SpiSerialBus.DeviceSelection,
771 AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
772 AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
773 Resource->SpiSerialBus.DataBitLength);
774
775 /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
776
777 AcpiDmIndent (Level + 1);
778 AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
779 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
780 Resource->SpiSerialBus.ConnectionSpeed,
781 AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
782
783 AcpiDmIndent (Level + 1);
784 AcpiOsPrintf ("%s, ",
785 AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]);
786
787 /* ResourceSource is a required field */
788
789 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
790 Resource->CommonSerialBus.TypeDataLength;
791
792 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
793 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
794
795 /* ResourceSourceIndex, ResourceUsage */
796
797 AcpiOsPrintf (",\n");
798 AcpiDmIndent (Level + 1);
799 AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
800
801 AcpiOsPrintf ("%s, ",
802 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]);
803
804 /* Insert a descriptor name */
805
806 AcpiDmDescriptorName ();
807
808 /* Share */
809
810 AcpiOsPrintf (", %s,\n",
811 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]);
812
813 /* Dump the vendor data */
814
815 AcpiDmIndent (Level + 1);
816 AcpiDmDumpSerialBusVendorData (Resource, Level);
817 AcpiOsPrintf (")\n");
818
819 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
820 }
821
822
823 /*******************************************************************************
824 *
825 * FUNCTION: AcpiDmUartSerialBusDescriptor
826 *
827 * PARAMETERS: Info - Extra resource info
828 * Resource - Pointer to the resource descriptor
829 * Length - Length of the descriptor in bytes
830 * Level - Current source code indentation level
831 *
832 * RETURN: None
833 *
834 * DESCRIPTION: Decode a UART serial bus descriptor
835 *
836 ******************************************************************************/
837
838 static void
839 AcpiDmUartSerialBusDescriptor (
840 ACPI_OP_WALK_INFO *Info,
841 AML_RESOURCE *Resource,
842 UINT32 Length,
843 UINT32 Level)
844 {
845 UINT32 ResourceSourceOffset;
846 char *DeviceName;
847
848
849 /* ConnectionSpeed, BitsPerByte, StopBits */
850
851 AcpiDmIndent (Level);
852 AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
853 Resource->UartSerialBus.DefaultBaudRate,
854 AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
855 AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
856
857 /* LinesInUse, IsBigEndian, Parity, FlowControl */
858
859 AcpiDmIndent (Level + 1);
860 AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
861 Resource->UartSerialBus.LinesEnabled,
862 AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)],
863 AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)],
864 AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]);
865
866 /* ReceiveBufferSize, TransmitBufferSize */
867
868 AcpiDmIndent (Level + 1);
869 AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
870 Resource->UartSerialBus.RxFifoSize,
871 Resource->UartSerialBus.TxFifoSize);
872
873 /* ResourceSource is a required field */
874
875 ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
876 Resource->CommonSerialBus.TypeDataLength;
877
878 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
879 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
880
881 /* ResourceSourceIndex, ResourceUsage */
882
883 AcpiOsPrintf (",\n");
884 AcpiDmIndent (Level + 1);
885 AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
886
887 AcpiOsPrintf ("%s, ",
888 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]);
889
890 /* Insert a descriptor name */
891
892 AcpiDmDescriptorName ();
893
894 /* Share */
895
896 AcpiOsPrintf (", %s,\n",
897 AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]);
898
899 /* Dump the vendor data */
900
901 AcpiDmIndent (Level + 1);
902 AcpiDmDumpSerialBusVendorData (Resource, Level);
903 AcpiOsPrintf (")\n");
904
905 MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName);
906 }
907
908
909 /*******************************************************************************
910 *
911 * FUNCTION: AcpiDmSerialBusDescriptor
912 *
913 * PARAMETERS: Info - Extra resource info
914 * Resource - Pointer to the resource descriptor
915 * Length - Length of the descriptor in bytes
916 * Level - Current source code indentation level
917 *
918 * RETURN: None
919 *
920 * DESCRIPTION: Decode a I2C/SPI/UART/CSI2 serial bus descriptor
921 *
922 ******************************************************************************/
923
924 void
925 AcpiDmSerialBusDescriptor (
926 ACPI_OP_WALK_INFO *Info,
927 AML_RESOURCE *Resource,
928 UINT32 Length,
929 UINT32 Level)
930 {
931
932 SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
933 Info, Resource, Length, Level);
934 }
935
936 /*******************************************************************************
937 *
938 * FUNCTION: AcpiDmPinConfig
939 *
940 * PARAMETERS: PinConfigType - Pin configuration type
941 * PinConfigValue - Pin configuration value
942 *
943 * RETURN: None
944 *
945 * DESCRIPTION: Pretty prints PinConfig type and value.
946 *
947 ******************************************************************************/
948
949 static void
950 AcpiDmPinConfig(
951 UINT8 PinConfigType,
952 UINT32 PinConfigValue)
953 {
954 if (PinConfigType <= 13)
955 {
956 AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType,
957 AcpiGbl_PtypDecode[PinConfigType]);
958 }
959 else
960 {
961 AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType);
962 }
963
964 /* PinConfigValue */
965
966 AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue);
967 }
968
969 /*******************************************************************************
970 *
971 * FUNCTION: AcpiDmPinConfigDescriptor
972 *
973 * PARAMETERS: Info - Extra resource info
974 * Resource - Pointer to the resource descriptor
975 * Length - Length of the descriptor in bytes
976 * Level - Current source code indentation level
977 *
978 * RETURN: None
979 *
980 * DESCRIPTION: Decode a PinConfig descriptor
981 *
982 ******************************************************************************/
983
984 void
985 AcpiDmPinConfigDescriptor (
986 ACPI_OP_WALK_INFO *Info,
987 AML_RESOURCE *Resource,
988 UINT32 Length,
989 UINT32 Level)
990 {
991 UINT16 *PinList;
992 UINT8 *VendorData;
993 char *DeviceName = NULL;
994 UINT32 PinCount;
995 UINT32 i;
996
997 AcpiDmIndent (Level);
998 AcpiOsPrintf ("PinConfig (%s, ",
999 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]);
1000
1001 AcpiDmPinConfig (Resource->PinConfig.PinConfigType,
1002 Resource->PinConfig.PinConfigValue);
1003
1004 AcpiDmIndent (Level + 1);
1005
1006 if (Resource->PinConfig.ResSourceOffset)
1007 {
1008 DeviceName = ACPI_ADD_PTR (char,
1009 Resource, Resource->PinConfig.ResSourceOffset),
1010 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1011 }
1012
1013 AcpiOsPrintf (", ");
1014 AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex);
1015
1016 AcpiOsPrintf ("%s, ",
1017 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]);
1018
1019 /* Insert a descriptor name */
1020
1021 AcpiDmDescriptorName ();
1022
1023 AcpiOsPrintf (",");
1024
1025 /* Dump the vendor data */
1026
1027 if (Resource->PinConfig.VendorLength)
1028 {
1029 AcpiOsPrintf ("\n");
1030 AcpiDmIndent (Level + 1);
1031 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1032 Resource->PinConfig.VendorOffset);
1033
1034 AcpiDmDumpRawDataBuffer (VendorData,
1035 Resource->PinConfig.VendorLength, Level);
1036 }
1037
1038 AcpiOsPrintf (")\n");
1039
1040 AcpiDmIndent (Level + 1);
1041
1042 /* Dump the interrupt list */
1043
1044 AcpiOsPrintf ("{ // Pin list\n");
1045
1046 PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset -
1047 Resource->PinConfig.PinTableOffset)) /
1048 sizeof (UINT16);
1049
1050 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1051 Resource->PinConfig.PinTableOffset);
1052
1053 for (i = 0; i < PinCount; i++)
1054 {
1055 AcpiDmIndent (Level + 2);
1056 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1057 ((i + 1) < PinCount) ? "," : "");
1058 }
1059
1060 AcpiDmIndent (Level + 1);
1061 AcpiOsPrintf ("}\n");
1062 }
1063
1064 /*******************************************************************************
1065 *
1066 * FUNCTION: AcpiDmPinGroupDescriptor
1067 *
1068 * PARAMETERS: Info - Extra resource info
1069 * Resource - Pointer to the resource descriptor
1070 * Length - Length of the descriptor in bytes
1071 * Level - Current source code indentation level
1072 *
1073 * RETURN: None
1074 *
1075 * DESCRIPTION: Decode a PinGroup descriptor
1076 *
1077 ******************************************************************************/
1078
1079 void
1080 AcpiDmPinGroupDescriptor (
1081 ACPI_OP_WALK_INFO *Info,
1082 AML_RESOURCE *Resource,
1083 UINT32 Length,
1084 UINT32 Level)
1085 {
1086 char *Label;
1087 UINT16 *PinList;
1088 UINT8 *VendorData;
1089 UINT32 PinCount;
1090 UINT32 i;
1091
1092 AcpiDmIndent (Level);
1093 /* Always producer */
1094 AcpiOsPrintf ("PinGroup (");
1095
1096 Label = ACPI_ADD_PTR (char,
1097 Resource, Resource->PinGroup.LabelOffset),
1098 AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1099
1100 AcpiOsPrintf (", ");
1101
1102 AcpiOsPrintf ("%s, ",
1103 AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]);
1104
1105 /* Insert a descriptor name */
1106
1107 AcpiDmDescriptorName ();
1108
1109 AcpiOsPrintf (",");
1110
1111 /* Dump the vendor data */
1112
1113 if (Resource->PinGroup.VendorLength)
1114 {
1115 AcpiOsPrintf ("\n");
1116 AcpiDmIndent (Level + 1);
1117 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1118 Resource->PinGroup.VendorOffset);
1119
1120 AcpiDmDumpRawDataBuffer (VendorData,
1121 Resource->PinGroup.VendorLength, Level);
1122 }
1123
1124 AcpiOsPrintf (")\n");
1125
1126 AcpiDmIndent (Level + 1);
1127
1128 /* Dump the interrupt list */
1129
1130 AcpiOsPrintf ("{ // Pin list\n");
1131
1132 PinCount = (Resource->PinGroup.LabelOffset -
1133 Resource->PinGroup.PinTableOffset) / sizeof (UINT16);
1134
1135 PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1136 Resource->PinGroup.PinTableOffset);
1137
1138 for (i = 0; i < PinCount; i++)
1139 {
1140 AcpiDmIndent (Level + 2);
1141 AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1142 ((i + 1) < PinCount) ? "," : "");
1143 }
1144
1145 AcpiDmIndent (Level + 1);
1146 AcpiOsPrintf ("}\n");
1147 }
1148
1149 /*******************************************************************************
1150 *
1151 * FUNCTION: AcpiDmPinGroupFunctionDescriptor
1152 *
1153 * PARAMETERS: Info - Extra resource info
1154 * Resource - Pointer to the resource descriptor
1155 * Length - Length of the descriptor in bytes
1156 * Level - Current source code indentation level
1157 *
1158 * RETURN: None
1159 *
1160 * DESCRIPTION: Decode a PinGroupFunction descriptor
1161 *
1162 ******************************************************************************/
1163
1164 void
1165 AcpiDmPinGroupFunctionDescriptor (
1166 ACPI_OP_WALK_INFO *Info,
1167 AML_RESOURCE *Resource,
1168 UINT32 Length,
1169 UINT32 Level)
1170 {
1171 UINT8 *VendorData;
1172 char *DeviceName = NULL;
1173 char *Label = NULL;
1174
1175 AcpiDmIndent (Level);
1176 AcpiOsPrintf ("PinGroupFunction (%s, ",
1177 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]);
1178
1179 /* FunctionNumber */
1180
1181 AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber);
1182
1183 DeviceName = ACPI_ADD_PTR (char,
1184 Resource, Resource->PinGroupFunction.ResSourceOffset),
1185 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1186
1187 AcpiOsPrintf (", ");
1188 AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex);
1189
1190 AcpiDmIndent (Level + 1);
1191
1192 Label = ACPI_ADD_PTR (char, Resource,
1193 Resource->PinGroupFunction.ResSourceLabelOffset);
1194 AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1195
1196 AcpiOsPrintf (", ");
1197
1198 AcpiOsPrintf ("%s, ",
1199 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]);
1200
1201 /* Insert a descriptor name */
1202
1203 AcpiDmDescriptorName ();
1204
1205 AcpiOsPrintf (",");
1206
1207 /* Dump the vendor data */
1208
1209 if (Resource->PinGroupFunction.VendorLength)
1210 {
1211 AcpiOsPrintf ("\n");
1212 AcpiDmIndent (Level + 1);
1213 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1214 Resource->PinGroupFunction.VendorOffset);
1215
1216 AcpiDmDumpRawDataBuffer (VendorData,
1217 Resource->PinGroupFunction.VendorLength, Level);
1218 }
1219
1220 AcpiOsPrintf (")\n");
1221 }
1222
1223 /*******************************************************************************
1224 *
1225 * FUNCTION: AcpiDmPinGroupConfigDescriptor
1226 *
1227 * PARAMETERS: Info - Extra resource info
1228 * Resource - Pointer to the resource descriptor
1229 * Length - Length of the descriptor in bytes
1230 * Level - Current source code indentation level
1231 *
1232 * RETURN: None
1233 *
1234 * DESCRIPTION: Decode a PinGroupConfig descriptor
1235 *
1236 ******************************************************************************/
1237
1238 void
1239 AcpiDmPinGroupConfigDescriptor (
1240 ACPI_OP_WALK_INFO *Info,
1241 AML_RESOURCE *Resource,
1242 UINT32 Length,
1243 UINT32 Level)
1244 {
1245 UINT8 *VendorData;
1246 char *DeviceName = NULL;
1247 char *Label = NULL;
1248
1249 AcpiDmIndent (Level);
1250 AcpiOsPrintf ("PinGroupConfig (%s, ",
1251 AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]);
1252
1253 AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType,
1254 Resource->PinGroupConfig.PinConfigValue);
1255
1256 AcpiDmIndent (Level + 1);
1257
1258 DeviceName = ACPI_ADD_PTR (char,
1259 Resource, Resource->PinGroupConfig.ResSourceOffset),
1260 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1261
1262 AcpiOsPrintf (", ");
1263 AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex);
1264
1265 Label = ACPI_ADD_PTR (char, Resource,
1266 Resource->PinGroupConfig.ResSourceLabelOffset);
1267 AcpiUtPrintString (Label, ACPI_UINT16_MAX);
1268
1269 AcpiOsPrintf (", ");
1270
1271 AcpiOsPrintf ("%s, ",
1272 AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]);
1273
1274 /* Insert a descriptor name */
1275
1276 AcpiDmDescriptorName ();
1277
1278 AcpiOsPrintf (",");
1279
1280 /* Dump the vendor data */
1281
1282 if (Resource->PinGroupConfig.VendorLength)
1283 {
1284 AcpiOsPrintf ("\n");
1285 AcpiDmIndent (Level + 1);
1286 VendorData = ACPI_ADD_PTR (UINT8, Resource,
1287 Resource->PinGroupConfig.VendorOffset);
1288
1289 AcpiDmDumpRawDataBuffer (VendorData,
1290 Resource->PinGroupConfig.VendorLength, Level);
1291 }
1292
1293 AcpiOsPrintf (")\n");
1294 }
1295