dmresrcl2.c revision 231844
1132451Sroberto/*******************************************************************************
2132451Sroberto *
3132451Sroberto * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
4132451Sroberto *
5132451Sroberto ******************************************************************************/
6132451Sroberto
7132451Sroberto/*
8132451Sroberto * Copyright (C) 2000 - 2012, Intel Corp.
9132451Sroberto * All rights reserved.
10132451Sroberto *
11132451Sroberto * Redistribution and use in source and binary forms, with or without
12132451Sroberto * modification, are permitted provided that the following conditions
13132451Sroberto * are met:
14132451Sroberto * 1. Redistributions of source code must retain the above copyright
15132451Sroberto *    notice, this list of conditions, and the following disclaimer,
16132451Sroberto *    without modification.
17132451Sroberto * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18132451Sroberto *    substantially similar to the "NO WARRANTY" disclaimer below
19132451Sroberto *    ("Disclaimer") and any redistribution must be conditioned upon
20132451Sroberto *    including a substantially similar Disclaimer requirement for further
21132451Sroberto *    binary redistribution.
22132451Sroberto * 3. Neither the names of the above-listed copyright holders nor the names
23132451Sroberto *    of any contributors may be used to endorse or promote products derived
24132451Sroberto *    from this software without specific prior written permission.
25132451Sroberto *
26132451Sroberto * Alternatively, this software may be distributed under the terms of the
27132451Sroberto * GNU General Public License ("GPL") version 2 as published by the Free
28132451Sroberto * Software Foundation.
29132451Sroberto *
30132451Sroberto * NO WARRANTY
31132451Sroberto * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32132451Sroberto * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33132451Sroberto * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34132451Sroberto * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35132451Sroberto * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36132451Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37132451Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38132451Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39132451Sroberto * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40132451Sroberto * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41132451Sroberto * POSSIBILITY OF SUCH DAMAGES.
42132451Sroberto */
43132451Sroberto
44132451Sroberto
45132451Sroberto#include <contrib/dev/acpica/include/acpi.h>
46132451Sroberto#include <contrib/dev/acpica/include/accommon.h>
47132451Sroberto#include <contrib/dev/acpica/include/acdisasm.h>
48132451Sroberto
49132451Sroberto
50132451Sroberto#ifdef ACPI_DISASSEMBLER
51132451Sroberto
52132451Sroberto#define _COMPONENT          ACPI_CA_DEBUGGER
53132451Sroberto        ACPI_MODULE_NAME    ("dbresrcl2")
54132451Sroberto
55132451Sroberto/* Local prototypes */
56132451Sroberto
57132451Srobertostatic void
58132451SrobertoAcpiDmI2cSerialBusDescriptor (
59132451Sroberto    AML_RESOURCE            *Resource,
60132451Sroberto    UINT32                  Length,
61132451Sroberto    UINT32                  Level);
62132451Sroberto
63132451Srobertostatic void
64132451SrobertoAcpiDmSpiSerialBusDescriptor (
65132451Sroberto    AML_RESOURCE            *Resource,
66132451Sroberto    UINT32                  Length,
67132451Sroberto    UINT32                  Level);
68132451Sroberto
69132451Srobertostatic void
70132451SrobertoAcpiDmUartSerialBusDescriptor (
71132451Sroberto    AML_RESOURCE            *Resource,
72132451Sroberto    UINT32                  Length,
73132451Sroberto    UINT32                  Level);
74132451Sroberto
75132451Srobertostatic void
76132451SrobertoAcpiDmGpioCommon (
77132451Sroberto    AML_RESOURCE            *Resource,
78132451Sroberto    UINT32                  Level);
79132451Sroberto
80132451Srobertostatic void
81132451SrobertoAcpiDmDumpRawDataBuffer (
82132451Sroberto    UINT8                   *Buffer,
83132451Sroberto    UINT32                  Length,
84132451Sroberto    UINT32                  Level);
85132451Sroberto
86132451Sroberto
87132451Sroberto/* Dispatch table for the serial bus descriptors */
88132451Sroberto
89132451Srobertostatic ACPI_RESOURCE_HANDLER        SerialBusResourceDispatch [] =
90132451Sroberto{
91132451Sroberto    NULL,
92132451Sroberto    AcpiDmI2cSerialBusDescriptor,
93132451Sroberto    AcpiDmSpiSerialBusDescriptor,
94132451Sroberto    AcpiDmUartSerialBusDescriptor
95132451Sroberto};
96132451Sroberto
97132451Sroberto
98132451Sroberto/*******************************************************************************
99132451Sroberto *
100132451Sroberto * FUNCTION:    AcpiDmDumpRawDataBuffer
101132451Sroberto *
102132451Sroberto * PARAMETERS:  Buffer              - Pointer to the data bytes
103132451Sroberto *              Length              - Length of the descriptor in bytes
104132451Sroberto *              Level               - Current source code indentation level
105132451Sroberto *
106132451Sroberto * RETURN:      None
107132451Sroberto *
108132451Sroberto * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
109132451Sroberto *              vendor data bytes.
110132451Sroberto *
111132451Sroberto ******************************************************************************/
112132451Sroberto
113132451Srobertostatic void
114132451SrobertoAcpiDmDumpRawDataBuffer (
115132451Sroberto    UINT8                   *Buffer,
116132451Sroberto    UINT32                  Length,
117132451Sroberto    UINT32                  Level)
118132451Sroberto{
119132451Sroberto    UINT32                  Index;
120132451Sroberto    UINT32                  i;
121132451Sroberto    UINT32                  j;
122132451Sroberto
123132451Sroberto
124132451Sroberto    if (!Length)
125132451Sroberto    {
126132451Sroberto        return;
127132451Sroberto    }
128132451Sroberto
129132451Sroberto    AcpiOsPrintf ("RawDataBuffer (0x%.2X)  // Vendor Data", Length);
130132451Sroberto
131132451Sroberto    AcpiOsPrintf ("\n");
132132451Sroberto    AcpiDmIndent (Level + 1);
133132451Sroberto    AcpiOsPrintf ("{\n");
134132451Sroberto    AcpiDmIndent (Level + 2);
135132451Sroberto
136132451Sroberto    for (i = 0; i < Length;)
137132451Sroberto    {
138132451Sroberto        for (j = 0; j < 8; j++)
139132451Sroberto        {
140132451Sroberto            Index = i + j;
141132451Sroberto            if (Index >= Length)
142132451Sroberto            {
143132451Sroberto                goto Finish;
144132451Sroberto            }
145132451Sroberto
146132451Sroberto            AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
147132451Sroberto            if ((Index + 1) >= Length)
148132451Sroberto            {
149132451Sroberto                goto Finish;
150132451Sroberto            }
151132451Sroberto
152132451Sroberto            AcpiOsPrintf (", ");
153132451Sroberto        }
154132451Sroberto        AcpiOsPrintf ("\n");
155132451Sroberto        AcpiDmIndent (Level + 2);
156132451Sroberto
157132451Sroberto        i += 8;
158132451Sroberto    }
159132451Sroberto
160132451SrobertoFinish:
161132451Sroberto    AcpiOsPrintf ("\n");
162132451Sroberto    AcpiDmIndent (Level + 1);
163132451Sroberto    AcpiOsPrintf ("}");
164132451Sroberto}
165132451Sroberto
166132451Sroberto
167132451Sroberto/*******************************************************************************
168132451Sroberto *
169132451Sroberto * FUNCTION:    AcpiDmGpioCommon
170132451Sroberto *
171132451Sroberto * PARAMETERS:  Resource            - Pointer to the resource descriptor
172132451Sroberto *              Level               - Current source code indentation level
173132451Sroberto *
174132451Sroberto * RETURN:      None
175132451Sroberto *
176132451Sroberto * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
177132451Sroberto *
178132451Sroberto ******************************************************************************/
179132451Sroberto
180132451Srobertostatic void
181132451SrobertoAcpiDmGpioCommon (
182132451Sroberto    AML_RESOURCE            *Resource,
183132451Sroberto    UINT32                  Level)
184132451Sroberto{
185132451Sroberto    UINT32                  PinCount;
186132451Sroberto    UINT16                  *PinList;
187132451Sroberto    UINT8                   *VendorData;
188132451Sroberto    UINT32                  i;
189132451Sroberto
190132451Sroberto
191132451Sroberto    /* ResourceSource, ResourceSourceIndex, ResourceType */
192132451Sroberto
193132451Sroberto    AcpiDmIndent (Level + 1);
194132451Sroberto    if (Resource->Gpio.ResSourceOffset)
195132451Sroberto    {
196132451Sroberto        AcpiUtPrintString (
197132451Sroberto            ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset),
198132451Sroberto            ACPI_UINT8_MAX);
199132451Sroberto    }
200132451Sroberto
201132451Sroberto    AcpiOsPrintf (", ");
202132451Sroberto    AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
203132451Sroberto    AcpiOsPrintf ("%s, ",
204132451Sroberto        AcpiGbl_ConsumeDecode [(Resource->Gpio.Flags & 1)]);
205132451Sroberto
206132451Sroberto    /* Insert a descriptor name */
207132451Sroberto
208132451Sroberto    AcpiDmDescriptorName ();
209132451Sroberto    AcpiOsPrintf (",");
210132451Sroberto
211132451Sroberto    /* Dump the vendor data */
212132451Sroberto
213132451Sroberto    if (Resource->Gpio.VendorOffset)
214132451Sroberto    {
215132451Sroberto        AcpiOsPrintf ("\n");
216132451Sroberto        AcpiDmIndent (Level + 1);
217132451Sroberto        VendorData = ACPI_ADD_PTR (UINT8, Resource,
218132451Sroberto            Resource->Gpio.VendorOffset);
219132451Sroberto
220132451Sroberto        AcpiDmDumpRawDataBuffer (VendorData,
221132451Sroberto            Resource->Gpio.VendorLength, Level);
222132451Sroberto    }
223132451Sroberto
224132451Sroberto    AcpiOsPrintf (")\n");
225132451Sroberto
226132451Sroberto    /* Dump the interrupt list */
227132451Sroberto
228132451Sroberto    AcpiDmIndent (Level + 1);
229132451Sroberto    AcpiOsPrintf ("{   // Pin list\n");
230132451Sroberto
231132451Sroberto    PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
232132451Sroberto        Resource->Gpio.PinTableOffset)) /
233132451Sroberto        sizeof (UINT16);
234132451Sroberto
235132451Sroberto    PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
236132451Sroberto        Resource->Gpio.PinTableOffset);
237132451Sroberto
238132451Sroberto    for (i = 0; i < PinCount; i++)
239132451Sroberto    {
240132451Sroberto        AcpiDmIndent (Level + 2);
241132451Sroberto        AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], ((i + 1) < PinCount) ? "," : "");
242132451Sroberto    }
243132451Sroberto
244132451Sroberto    AcpiDmIndent (Level + 1);
245132451Sroberto    AcpiOsPrintf ("}\n");
246132451Sroberto}
247132451Sroberto
248132451Sroberto
249132451Sroberto/*******************************************************************************
250132451Sroberto *
251132451Sroberto * FUNCTION:    AcpiDmGpioIntDescriptor
252132451Sroberto *
253132451Sroberto * PARAMETERS:  Resource            - Pointer to the resource descriptor
254132451Sroberto *              Length              - Length of the descriptor in bytes
255132451Sroberto *              Level               - Current source code indentation level
256132451Sroberto *
257132451Sroberto * RETURN:      None
258132451Sroberto *
259132451Sroberto * DESCRIPTION: Decode a GPIO Interrupt descriptor
260132451Sroberto *
261132451Sroberto ******************************************************************************/
262132451Sroberto
263132451Srobertostatic void
264132451SrobertoAcpiDmGpioIntDescriptor (
265132451Sroberto    AML_RESOURCE            *Resource,
266132451Sroberto    UINT32                  Length,
267132451Sroberto    UINT32                  Level)
268132451Sroberto{
269132451Sroberto
270132451Sroberto    /* Dump the GpioInt-specific portion of the descriptor */
271132451Sroberto
272132451Sroberto    /* EdgeLevel, ActiveLevel, Shared */
273132451Sroberto
274132451Sroberto    AcpiDmIndent (Level);
275132451Sroberto    AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
276132451Sroberto        AcpiGbl_HeDecode [(Resource->Gpio.IntFlags & 1)],
277132451Sroberto        AcpiGbl_LlDecode [(Resource->Gpio.IntFlags >> 1) & 1],
278132451Sroberto        AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]);
279132451Sroberto
280132451Sroberto    /* PinConfig, DebounceTimeout */
281132451Sroberto
282132451Sroberto    if (Resource->Gpio.PinConfig <= 3)
283132451Sroberto    {
284132451Sroberto        AcpiOsPrintf ("%s, ",
285132451Sroberto            AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
286132451Sroberto    }
287132451Sroberto    else
288132451Sroberto    {
289132451Sroberto        AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
290132451Sroberto    }
291132451Sroberto    AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
292132451Sroberto
293132451Sroberto    /* Dump the GpioInt/GpioIo common portion of the descriptor */
294132451Sroberto
295132451Sroberto    AcpiDmGpioCommon (Resource, Level);
296132451Sroberto}
297132451Sroberto
298132451Sroberto
299132451Sroberto/*******************************************************************************
300132451Sroberto *
301132451Sroberto * FUNCTION:    AcpiDmGpioIoDescriptor
302132451Sroberto *
303132451Sroberto * PARAMETERS:  Resource            - Pointer to the resource descriptor
304132451Sroberto *              Length              - Length of the descriptor in bytes
305132451Sroberto *              Level               - Current source code indentation level
306132451Sroberto *
307132451Sroberto * RETURN:      None
308132451Sroberto *
309132451Sroberto * DESCRIPTION: Decode a GPIO Interrupt descriptor
310132451Sroberto *
311132451Sroberto ******************************************************************************/
312132451Sroberto
313132451Srobertostatic void
314132451SrobertoAcpiDmGpioIoDescriptor (
315132451Sroberto    AML_RESOURCE            *Resource,
316132451Sroberto    UINT32                  Length,
317132451Sroberto    UINT32                  Level)
318132451Sroberto{
319132451Sroberto
320132451Sroberto    /* Dump the GpioIo-specific portion of the descriptor */
321132451Sroberto
322132451Sroberto    /* Shared, PinConfig */
323132451Sroberto
324132451Sroberto    AcpiDmIndent (Level);
325132451Sroberto    AcpiOsPrintf ("GpioIo (%s, ",
326132451Sroberto        AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]);
327132451Sroberto
328132451Sroberto    if (Resource->Gpio.PinConfig <= 3)
329132451Sroberto    {
330132451Sroberto        AcpiOsPrintf ("%s, ",
331132451Sroberto            AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
332132451Sroberto    }
333132451Sroberto    else
334132451Sroberto    {
335132451Sroberto        AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
336132451Sroberto    }
337132451Sroberto
338132451Sroberto    /* DebounceTimeout, DriveStrength, IoRestriction */
339132451Sroberto
340132451Sroberto    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
341132451Sroberto    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
342132451Sroberto    AcpiOsPrintf ("%s,\n",
343132451Sroberto        AcpiGbl_IorDecode [Resource->Gpio.IntFlags & 3]);
344132451Sroberto
345132451Sroberto    /* Dump the GpioInt/GpioIo common portion of the descriptor */
346132451Sroberto
347132451Sroberto    AcpiDmGpioCommon (Resource, Level);
348132451Sroberto}
349132451Sroberto
350132451Sroberto
351132451Sroberto/*******************************************************************************
352132451Sroberto *
353132451Sroberto * FUNCTION:    AcpiDmGpioDescriptor
354132451Sroberto *
355132451Sroberto * PARAMETERS:  Resource            - Pointer to the resource descriptor
356132451Sroberto *              Length              - Length of the descriptor in bytes
357132451Sroberto *              Level               - Current source code indentation level
358132451Sroberto *
359132451Sroberto * RETURN:      None
360132451Sroberto *
361132451Sroberto * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
362132451Sroberto *
363132451Sroberto ******************************************************************************/
364132451Sroberto
365132451Srobertovoid
366132451SrobertoAcpiDmGpioDescriptor (
367132451Sroberto    AML_RESOURCE            *Resource,
368132451Sroberto    UINT32                  Length,
369132451Sroberto    UINT32                  Level)
370132451Sroberto{
371132451Sroberto    UINT8                   ConnectionType;
372132451Sroberto
373132451Sroberto
374132451Sroberto    ConnectionType = Resource->Gpio.ConnectionType;
375132451Sroberto
376132451Sroberto    switch (ConnectionType)
377132451Sroberto    {
378132451Sroberto    case AML_RESOURCE_GPIO_TYPE_INT:
379132451Sroberto        AcpiDmGpioIntDescriptor (Resource, Length, Level);
380132451Sroberto        break;
381
382    case AML_RESOURCE_GPIO_TYPE_IO:
383        AcpiDmGpioIoDescriptor (Resource, Length, Level);
384        break;
385
386    default:
387        AcpiOsPrintf ("Unknown GPIO type\n");
388        break;
389    }
390}
391
392
393/*******************************************************************************
394 *
395 * FUNCTION:    AcpiDmDumpSerialBusVendorData
396 *
397 * PARAMETERS:  Resource            - Pointer to the resource descriptor
398 *
399 * RETURN:      None
400 *
401 * DESCRIPTION: Dump optional serial bus vendor data
402 *
403 ******************************************************************************/
404
405static void
406AcpiDmDumpSerialBusVendorData (
407    AML_RESOURCE            *Resource,
408    UINT32                  Level)
409{
410    UINT8                   *VendorData;
411    UINT32                  VendorLength;
412
413
414    /* Get the (optional) vendor data and length */
415
416    switch (Resource->CommonSerialBus.Type)
417    {
418    case AML_RESOURCE_I2C_SERIALBUSTYPE:
419
420        VendorLength = Resource->CommonSerialBus.TypeDataLength -
421            AML_RESOURCE_I2C_MIN_DATA_LEN;
422
423        VendorData = ACPI_ADD_PTR (UINT8, Resource,
424            sizeof (AML_RESOURCE_I2C_SERIALBUS));
425        break;
426
427    case AML_RESOURCE_SPI_SERIALBUSTYPE:
428
429        VendorLength = Resource->CommonSerialBus.TypeDataLength -
430            AML_RESOURCE_SPI_MIN_DATA_LEN;
431
432        VendorData = ACPI_ADD_PTR (UINT8, Resource,
433            sizeof (AML_RESOURCE_SPI_SERIALBUS));
434        break;
435
436    case AML_RESOURCE_UART_SERIALBUSTYPE:
437
438        VendorLength = Resource->CommonSerialBus.TypeDataLength -
439            AML_RESOURCE_UART_MIN_DATA_LEN;
440
441        VendorData = ACPI_ADD_PTR (UINT8, Resource,
442            sizeof (AML_RESOURCE_UART_SERIALBUS));
443        break;
444
445    default:
446        return;
447    }
448
449    /* Dump the vendor bytes as a RawDataBuffer object */
450
451    AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
452}
453
454
455/*******************************************************************************
456 *
457 * FUNCTION:    AcpiDmI2cSerialBusDescriptor
458 *
459 * PARAMETERS:  Resource            - Pointer to the resource descriptor
460 *              Length              - Length of the descriptor in bytes
461 *              Level               - Current source code indentation level
462 *
463 * RETURN:      None
464 *
465 * DESCRIPTION: Decode a I2C serial bus descriptor
466 *
467 ******************************************************************************/
468
469static void
470AcpiDmI2cSerialBusDescriptor (
471    AML_RESOURCE            *Resource,
472    UINT32                  Length,
473    UINT32                  Level)
474{
475    UINT32                  ResourceSourceOffset;
476
477
478    /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
479
480    AcpiDmIndent (Level);
481    AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n",
482        Resource->I2cSerialBus.SlaveAddress,
483        AcpiGbl_SmDecode [(Resource->I2cSerialBus.Flags & 1)],
484        Resource->I2cSerialBus.ConnectionSpeed);
485
486    AcpiDmIndent (Level + 1);
487    AcpiOsPrintf ("%s, ",
488        AcpiGbl_AmDecode [(Resource->I2cSerialBus.TypeSpecificFlags & 1)]);
489
490    /* ResourceSource is a required field */
491
492    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
493        Resource->CommonSerialBus.TypeDataLength;
494
495    AcpiUtPrintString (
496        ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
497        ACPI_UINT8_MAX);
498
499    /* ResourceSourceIndex, ResourceUsage */
500
501    AcpiOsPrintf (",\n");
502    AcpiDmIndent (Level + 1);
503    AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
504
505    AcpiOsPrintf ("%s, ",
506        AcpiGbl_ConsumeDecode [(Resource->I2cSerialBus.Flags >> 1) & 1]);
507
508    /* Insert a descriptor name */
509
510    AcpiDmDescriptorName ();
511    AcpiOsPrintf (",\n");
512
513    /* Dump the vendor data */
514
515    AcpiDmIndent (Level + 1);
516    AcpiDmDumpSerialBusVendorData (Resource, Level);
517    AcpiOsPrintf (")\n");
518}
519
520
521/*******************************************************************************
522 *
523 * FUNCTION:    AcpiDmSpiSerialBusDescriptor
524 *
525 * PARAMETERS:  Resource            - Pointer to the resource descriptor
526 *              Length              - Length of the descriptor in bytes
527 *              Level               - Current source code indentation level
528 *
529 * RETURN:      None
530 *
531 * DESCRIPTION: Decode a SPI serial bus descriptor
532 *
533 ******************************************************************************/
534
535static void
536AcpiDmSpiSerialBusDescriptor (
537    AML_RESOURCE            *Resource,
538    UINT32                  Length,
539    UINT32                  Level)
540{
541    UINT32                  ResourceSourceOffset;
542
543
544    /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
545
546    AcpiDmIndent (Level);
547    AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n",
548        Resource->SpiSerialBus.DeviceSelection,
549        AcpiGbl_DpDecode [(Resource->SpiSerialBus.TypeSpecificFlags >> 1) & 1],
550        AcpiGbl_WmDecode [(Resource->SpiSerialBus.TypeSpecificFlags & 1)],
551        Resource->SpiSerialBus.DataBitLength);
552
553    /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
554
555    AcpiDmIndent (Level + 1);
556    AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
557        AcpiGbl_SmDecode [(Resource->SpiSerialBus.Flags & 1)],
558        Resource->SpiSerialBus.ConnectionSpeed,
559        AcpiGbl_CpoDecode [(Resource->SpiSerialBus.ClockPolarity & 1)]);
560
561    AcpiDmIndent (Level + 1);
562    AcpiOsPrintf ("%s, ",
563        AcpiGbl_CphDecode [(Resource->SpiSerialBus.ClockPhase & 1)]);
564
565    /* ResourceSource is a required field */
566
567    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
568        Resource->CommonSerialBus.TypeDataLength;
569
570    AcpiUtPrintString (
571        ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
572        ACPI_UINT8_MAX);
573
574    /* ResourceSourceIndex, ResourceUsage */
575
576    AcpiOsPrintf (",\n");
577    AcpiDmIndent (Level + 1);
578    AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
579
580    AcpiOsPrintf ("%s, ",
581        AcpiGbl_ConsumeDecode [(Resource->SpiSerialBus.Flags >> 1) & 1]);
582
583    /* Insert a descriptor name */
584
585    AcpiDmDescriptorName ();
586    AcpiOsPrintf (",\n");
587
588    /* Dump the vendor data */
589
590    AcpiDmIndent (Level + 1);
591    AcpiDmDumpSerialBusVendorData (Resource, Level);
592    AcpiOsPrintf (")\n");
593}
594
595
596/*******************************************************************************
597 *
598 * FUNCTION:    AcpiDmUartSerialBusDescriptor
599 *
600 * PARAMETERS:  Resource            - Pointer to the resource descriptor
601 *              Length              - Length of the descriptor in bytes
602 *              Level               - Current source code indentation level
603 *
604 * RETURN:      None
605 *
606 * DESCRIPTION: Decode a UART serial bus descriptor
607 *
608 ******************************************************************************/
609
610static void
611AcpiDmUartSerialBusDescriptor (
612    AML_RESOURCE            *Resource,
613    UINT32                  Length,
614    UINT32                  Level)
615{
616    UINT32                  ResourceSourceOffset;
617
618
619    /* ConnectionSpeed, BitsPerByte, StopBits */
620
621    AcpiDmIndent (Level);
622    AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n",
623        Resource->UartSerialBus.DefaultBaudRate,
624        AcpiGbl_BpbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 4) & 3],
625        AcpiGbl_SbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 2) & 3]);
626
627    /* LinesInUse, IsBigEndian, Parity, FlowControl */
628
629    AcpiDmIndent (Level + 1);
630    AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
631        Resource->UartSerialBus.LinesEnabled,
632        AcpiGbl_EdDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 7) & 1],
633        AcpiGbl_PtDecode [Resource->UartSerialBus.Parity & 7],
634        AcpiGbl_FcDecode [Resource->UartSerialBus.TypeSpecificFlags & 3]);
635
636    /* ReceiveBufferSize, TransmitBufferSize */
637
638    AcpiDmIndent (Level + 1);
639    AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
640        Resource->UartSerialBus.RxFifoSize,
641        Resource->UartSerialBus.TxFifoSize);
642
643    /* ResourceSource is a required field */
644
645    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
646        Resource->CommonSerialBus.TypeDataLength;
647
648    AcpiUtPrintString (
649        ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
650        ACPI_UINT8_MAX);
651
652    /* ResourceSourceIndex, ResourceUsage */
653
654    AcpiOsPrintf (",\n");
655    AcpiDmIndent (Level + 1);
656    AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
657
658    AcpiOsPrintf ("%s, ",
659        AcpiGbl_ConsumeDecode [(Resource->UartSerialBus.Flags >> 1) & 1]);
660
661    /* Insert a descriptor name */
662
663    AcpiDmDescriptorName ();
664    AcpiOsPrintf (",\n");
665
666    /* Dump the vendor data */
667
668    AcpiDmIndent (Level + 1);
669    AcpiDmDumpSerialBusVendorData (Resource, Level);
670    AcpiOsPrintf (")\n");
671}
672
673
674/*******************************************************************************
675 *
676 * FUNCTION:    AcpiDmSerialBusDescriptor
677 *
678 * PARAMETERS:  Resource            - Pointer to the resource descriptor
679 *              Length              - Length of the descriptor in bytes
680 *              Level               - Current source code indentation level
681 *
682 * RETURN:      None
683 *
684 * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
685 *
686 ******************************************************************************/
687
688void
689AcpiDmSerialBusDescriptor (
690    AML_RESOURCE            *Resource,
691    UINT32                  Length,
692    UINT32                  Level)
693{
694
695    SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
696        Resource, Length, Level);
697}
698
699#endif
700
701