1ae115bc7Smrj /*******************************************************************************
2ae115bc7Smrj *
3*de5d74c2SJerry Jelinek * Module Name: rsdump - AML debugger support for resource structures.
4ae115bc7Smrj *
5ae115bc7Smrj ******************************************************************************/
6ae115bc7Smrj
726f3cdf0SGordon Ross /*
8*de5d74c2SJerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp.
9ae115bc7Smrj * All rights reserved.
10ae115bc7Smrj *
1126f3cdf0SGordon Ross * Redistribution and use in source and binary forms, with or without
1226f3cdf0SGordon Ross * modification, are permitted provided that the following conditions
1326f3cdf0SGordon Ross * are met:
1426f3cdf0SGordon Ross * 1. Redistributions of source code must retain the above copyright
1526f3cdf0SGordon Ross * notice, this list of conditions, and the following disclaimer,
1626f3cdf0SGordon Ross * without modification.
1726f3cdf0SGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1826f3cdf0SGordon Ross * substantially similar to the "NO WARRANTY" disclaimer below
1926f3cdf0SGordon Ross * ("Disclaimer") and any redistribution must be conditioned upon
2026f3cdf0SGordon Ross * including a substantially similar Disclaimer requirement for further
2126f3cdf0SGordon Ross * binary redistribution.
2226f3cdf0SGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
2326f3cdf0SGordon Ross * of any contributors may be used to endorse or promote products derived
2426f3cdf0SGordon Ross * from this software without specific prior written permission.
25ae115bc7Smrj *
2626f3cdf0SGordon Ross * Alternatively, this software may be distributed under the terms of the
2726f3cdf0SGordon Ross * GNU General Public License ("GPL") version 2 as published by the Free
2826f3cdf0SGordon Ross * Software Foundation.
29ae115bc7Smrj *
3026f3cdf0SGordon Ross * NO WARRANTY
3126f3cdf0SGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3226f3cdf0SGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3326f3cdf0SGordon Ross * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3426f3cdf0SGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3526f3cdf0SGordon Ross * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3626f3cdf0SGordon Ross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3726f3cdf0SGordon Ross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3826f3cdf0SGordon Ross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3926f3cdf0SGordon Ross * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4026f3cdf0SGordon Ross * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4126f3cdf0SGordon Ross * POSSIBILITY OF SUCH DAMAGES.
4226f3cdf0SGordon Ross */
43ae115bc7Smrj
44ae115bc7Smrj #include "acpi.h"
45aa2aa9a6SDana Myers #include "accommon.h"
46ae115bc7Smrj #include "acresrc.h"
47ae115bc7Smrj
48ae115bc7Smrj #define _COMPONENT ACPI_RESOURCES
49ae115bc7Smrj ACPI_MODULE_NAME ("rsdump")
50ae115bc7Smrj
51*de5d74c2SJerry Jelinek /*
52*de5d74c2SJerry Jelinek * All functions in this module are used by the AML Debugger only
53*de5d74c2SJerry Jelinek */
54ae115bc7Smrj
55ae115bc7Smrj /* Local prototypes */
56ae115bc7Smrj
57ae115bc7Smrj static void
58ae115bc7Smrj AcpiRsOutString (
59*de5d74c2SJerry Jelinek const char *Title,
60*de5d74c2SJerry Jelinek const char *Value);
61ae115bc7Smrj
62ae115bc7Smrj static void
63ae115bc7Smrj AcpiRsOutInteger8 (
64*de5d74c2SJerry Jelinek const char *Title,
65ae115bc7Smrj UINT8 Value);
66ae115bc7Smrj
67ae115bc7Smrj static void
68ae115bc7Smrj AcpiRsOutInteger16 (
69*de5d74c2SJerry Jelinek const char *Title,
70ae115bc7Smrj UINT16 Value);
71ae115bc7Smrj
72ae115bc7Smrj static void
73ae115bc7Smrj AcpiRsOutInteger32 (
74*de5d74c2SJerry Jelinek const char *Title,
75ae115bc7Smrj UINT32 Value);
76ae115bc7Smrj
77ae115bc7Smrj static void
78ae115bc7Smrj AcpiRsOutInteger64 (
79*de5d74c2SJerry Jelinek const char *Title,
80ae115bc7Smrj UINT64 Value);
81ae115bc7Smrj
82ae115bc7Smrj static void
83ae115bc7Smrj AcpiRsOutTitle (
84*de5d74c2SJerry Jelinek const char *Title);
85ae115bc7Smrj
86ae115bc7Smrj static void
87ae115bc7Smrj AcpiRsDumpByteList (
88ae115bc7Smrj UINT16 Length,
89ae115bc7Smrj UINT8 *Data);
90ae115bc7Smrj
91ae115bc7Smrj static void
92*de5d74c2SJerry Jelinek AcpiRsDumpWordList (
93*de5d74c2SJerry Jelinek UINT16 Length,
94*de5d74c2SJerry Jelinek UINT16 *Data);
95*de5d74c2SJerry Jelinek
96*de5d74c2SJerry Jelinek static void
97ae115bc7Smrj AcpiRsDumpDwordList (
98ae115bc7Smrj UINT8 Length,
99ae115bc7Smrj UINT32 *Data);
100ae115bc7Smrj
101ae115bc7Smrj static void
102ae115bc7Smrj AcpiRsDumpShortByteList (
103ae115bc7Smrj UINT8 Length,
104ae115bc7Smrj UINT8 *Data);
105ae115bc7Smrj
106ae115bc7Smrj static void
107ae115bc7Smrj AcpiRsDumpResourceSource (
108ae115bc7Smrj ACPI_RESOURCE_SOURCE *ResourceSource);
109ae115bc7Smrj
110ae115bc7Smrj static void
111ae115bc7Smrj AcpiRsDumpAddressCommon (
112ae115bc7Smrj ACPI_RESOURCE_DATA *Resource);
113ae115bc7Smrj
114ae115bc7Smrj static void
115ae115bc7Smrj AcpiRsDumpDescriptor (
116ae115bc7Smrj void *Resource,
117ae115bc7Smrj ACPI_RSDUMP_INFO *Table);
118ae115bc7Smrj
119ae115bc7Smrj
120*de5d74c2SJerry Jelinek /*******************************************************************************
121*de5d74c2SJerry Jelinek *
122*de5d74c2SJerry Jelinek * FUNCTION: AcpiRsDumpResourceList
123*de5d74c2SJerry Jelinek *
124*de5d74c2SJerry Jelinek * PARAMETERS: ResourceList - Pointer to a resource descriptor list
125*de5d74c2SJerry Jelinek *
126*de5d74c2SJerry Jelinek * RETURN: None
127*de5d74c2SJerry Jelinek *
128*de5d74c2SJerry Jelinek * DESCRIPTION: Dispatches the structure to the correct dump routine.
129*de5d74c2SJerry Jelinek *
130*de5d74c2SJerry Jelinek ******************************************************************************/
131*de5d74c2SJerry Jelinek
132*de5d74c2SJerry Jelinek void
AcpiRsDumpResourceList(ACPI_RESOURCE * ResourceList)133*de5d74c2SJerry Jelinek AcpiRsDumpResourceList (
134*de5d74c2SJerry Jelinek ACPI_RESOURCE *ResourceList)
135*de5d74c2SJerry Jelinek {
136*de5d74c2SJerry Jelinek UINT32 Count = 0;
137*de5d74c2SJerry Jelinek UINT32 Type;
138*de5d74c2SJerry Jelinek
139*de5d74c2SJerry Jelinek
140*de5d74c2SJerry Jelinek ACPI_FUNCTION_ENTRY ();
141*de5d74c2SJerry Jelinek
142*de5d74c2SJerry Jelinek
143*de5d74c2SJerry Jelinek /* Check if debug output enabled */
144*de5d74c2SJerry Jelinek
145*de5d74c2SJerry Jelinek if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT))
146*de5d74c2SJerry Jelinek {
147*de5d74c2SJerry Jelinek return;
148*de5d74c2SJerry Jelinek }
149*de5d74c2SJerry Jelinek
150*de5d74c2SJerry Jelinek /* Walk list and dump all resource descriptors (END_TAG terminates) */
151*de5d74c2SJerry Jelinek
152*de5d74c2SJerry Jelinek do
153*de5d74c2SJerry Jelinek {
154*de5d74c2SJerry Jelinek AcpiOsPrintf ("\n[%02X] ", Count);
155*de5d74c2SJerry Jelinek Count++;
156*de5d74c2SJerry Jelinek
157*de5d74c2SJerry Jelinek /* Validate Type before dispatch */
158*de5d74c2SJerry Jelinek
159*de5d74c2SJerry Jelinek Type = ResourceList->Type;
160*de5d74c2SJerry Jelinek if (Type > ACPI_RESOURCE_TYPE_MAX)
161*de5d74c2SJerry Jelinek {
162*de5d74c2SJerry Jelinek AcpiOsPrintf (
163*de5d74c2SJerry Jelinek "Invalid descriptor type (%X) in resource list\n",
164*de5d74c2SJerry Jelinek ResourceList->Type);
165*de5d74c2SJerry Jelinek return;
166*de5d74c2SJerry Jelinek }
167*de5d74c2SJerry Jelinek
168*de5d74c2SJerry Jelinek /* Sanity check the length. It must not be zero, or we loop forever */
169*de5d74c2SJerry Jelinek
170*de5d74c2SJerry Jelinek if (!ResourceList->Length)
171*de5d74c2SJerry Jelinek {
172*de5d74c2SJerry Jelinek AcpiOsPrintf (
173*de5d74c2SJerry Jelinek "Invalid zero length descriptor in resource list\n");
174*de5d74c2SJerry Jelinek return;
175*de5d74c2SJerry Jelinek }
176*de5d74c2SJerry Jelinek
177*de5d74c2SJerry Jelinek /* Dump the resource descriptor */
178*de5d74c2SJerry Jelinek
179*de5d74c2SJerry Jelinek if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS)
180*de5d74c2SJerry Jelinek {
181*de5d74c2SJerry Jelinek AcpiRsDumpDescriptor (&ResourceList->Data,
182*de5d74c2SJerry Jelinek AcpiGbl_DumpSerialBusDispatch[
183*de5d74c2SJerry Jelinek ResourceList->Data.CommonSerialBus.Type]);
184*de5d74c2SJerry Jelinek }
185*de5d74c2SJerry Jelinek else
186*de5d74c2SJerry Jelinek {
187*de5d74c2SJerry Jelinek AcpiRsDumpDescriptor (&ResourceList->Data,
188*de5d74c2SJerry Jelinek AcpiGbl_DumpResourceDispatch[Type]);
189*de5d74c2SJerry Jelinek }
190*de5d74c2SJerry Jelinek
191*de5d74c2SJerry Jelinek /* Point to the next resource structure */
192*de5d74c2SJerry Jelinek
193*de5d74c2SJerry Jelinek ResourceList = ACPI_NEXT_RESOURCE (ResourceList);
194*de5d74c2SJerry Jelinek
195*de5d74c2SJerry Jelinek /* Exit when END_TAG descriptor is reached */
196*de5d74c2SJerry Jelinek
197*de5d74c2SJerry Jelinek } while (Type != ACPI_RESOURCE_TYPE_END_TAG);
198*de5d74c2SJerry Jelinek }
199ae115bc7Smrj
200ae115bc7Smrj
201ae115bc7Smrj /*******************************************************************************
202ae115bc7Smrj *
203*de5d74c2SJerry Jelinek * FUNCTION: AcpiRsDumpIrqList
204ae115bc7Smrj *
205*de5d74c2SJerry Jelinek * PARAMETERS: RouteTable - Pointer to the routing table to dump.
206*de5d74c2SJerry Jelinek *
207*de5d74c2SJerry Jelinek * RETURN: None
208*de5d74c2SJerry Jelinek *
209*de5d74c2SJerry Jelinek * DESCRIPTION: Print IRQ routing table
210ae115bc7Smrj *
211ae115bc7Smrj ******************************************************************************/
212ae115bc7Smrj
213*de5d74c2SJerry Jelinek void
AcpiRsDumpIrqList(UINT8 * RouteTable)214*de5d74c2SJerry Jelinek AcpiRsDumpIrqList (
215*de5d74c2SJerry Jelinek UINT8 *RouteTable)
216ae115bc7Smrj {
217*de5d74c2SJerry Jelinek ACPI_PCI_ROUTING_TABLE *PrtElement;
218*de5d74c2SJerry Jelinek UINT8 Count;
219ae115bc7Smrj
220*de5d74c2SJerry Jelinek
221*de5d74c2SJerry Jelinek ACPI_FUNCTION_ENTRY ();
222*de5d74c2SJerry Jelinek
223*de5d74c2SJerry Jelinek
224*de5d74c2SJerry Jelinek /* Check if debug output enabled */
225*de5d74c2SJerry Jelinek
226*de5d74c2SJerry Jelinek if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_RESOURCES, _COMPONENT))
227ae115bc7Smrj {
228*de5d74c2SJerry Jelinek return;
229*de5d74c2SJerry Jelinek }
230ae115bc7Smrj
231*de5d74c2SJerry Jelinek PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);
232*de5d74c2SJerry Jelinek
233*de5d74c2SJerry Jelinek /* Dump all table elements, Exit on zero length element */
234*de5d74c2SJerry Jelinek
235*de5d74c2SJerry Jelinek for (Count = 0; PrtElement->Length; Count++)
236ae115bc7Smrj {
237*de5d74c2SJerry Jelinek AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
238*de5d74c2SJerry Jelinek AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
239ae115bc7Smrj
240*de5d74c2SJerry Jelinek PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
241*de5d74c2SJerry Jelinek PrtElement, PrtElement->Length);
242*de5d74c2SJerry Jelinek }
243*de5d74c2SJerry Jelinek }
244ae115bc7Smrj
245ae115bc7Smrj
246ae115bc7Smrj /*******************************************************************************
247ae115bc7Smrj *
248ae115bc7Smrj * FUNCTION: AcpiRsDumpDescriptor
249ae115bc7Smrj *
250*de5d74c2SJerry Jelinek * PARAMETERS: Resource - Buffer containing the resource
251*de5d74c2SJerry Jelinek * Table - Table entry to decode the resource
252ae115bc7Smrj *
253ae115bc7Smrj * RETURN: None
254ae115bc7Smrj *
255*de5d74c2SJerry Jelinek * DESCRIPTION: Dump a resource descriptor based on a dump table entry.
256ae115bc7Smrj *
257ae115bc7Smrj ******************************************************************************/
258ae115bc7Smrj
259ae115bc7Smrj static void
AcpiRsDumpDescriptor(void * Resource,ACPI_RSDUMP_INFO * Table)260ae115bc7Smrj AcpiRsDumpDescriptor (
261ae115bc7Smrj void *Resource,
262ae115bc7Smrj ACPI_RSDUMP_INFO *Table)
263ae115bc7Smrj {
264ae115bc7Smrj UINT8 *Target = NULL;
265ae115bc7Smrj UINT8 *PreviousTarget;
266*de5d74c2SJerry Jelinek const char *Name;
267ae115bc7Smrj UINT8 Count;
268ae115bc7Smrj
269ae115bc7Smrj
270ae115bc7Smrj /* First table entry must contain the table length (# of table entries) */
271ae115bc7Smrj
272ae115bc7Smrj Count = Table->Offset;
273ae115bc7Smrj
274ae115bc7Smrj while (Count)
275ae115bc7Smrj {
276ae115bc7Smrj PreviousTarget = Target;
277ae115bc7Smrj Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
278ae115bc7Smrj Name = Table->Name;
279ae115bc7Smrj
280ae115bc7Smrj switch (Table->Opcode)
281ae115bc7Smrj {
282ae115bc7Smrj case ACPI_RSD_TITLE:
283ae115bc7Smrj /*
284ae115bc7Smrj * Optional resource title
285ae115bc7Smrj */
286ae115bc7Smrj if (Table->Name)
287ae115bc7Smrj {
288ae115bc7Smrj AcpiOsPrintf ("%s Resource\n", Name);
289ae115bc7Smrj }
290ae115bc7Smrj break;
291ae115bc7Smrj
292ae115bc7Smrj /* Strings */
293ae115bc7Smrj
294ae115bc7Smrj case ACPI_RSD_LITERAL:
295*de5d74c2SJerry Jelinek
296ae115bc7Smrj AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
297ae115bc7Smrj break;
298ae115bc7Smrj
299ae115bc7Smrj case ACPI_RSD_STRING:
300*de5d74c2SJerry Jelinek
301ae115bc7Smrj AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
302ae115bc7Smrj break;
303ae115bc7Smrj
304ae115bc7Smrj /* Data items, 8/16/32/64 bit */
305ae115bc7Smrj
306ae115bc7Smrj case ACPI_RSD_UINT8:
307*de5d74c2SJerry Jelinek
308*de5d74c2SJerry Jelinek if (Table->Pointer)
309*de5d74c2SJerry Jelinek {
310*de5d74c2SJerry Jelinek AcpiRsOutString (Name, Table->Pointer [*Target]);
311*de5d74c2SJerry Jelinek }
312*de5d74c2SJerry Jelinek else
313*de5d74c2SJerry Jelinek {
314ae115bc7Smrj AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
315*de5d74c2SJerry Jelinek }
316ae115bc7Smrj break;
317ae115bc7Smrj
318ae115bc7Smrj case ACPI_RSD_UINT16:
319*de5d74c2SJerry Jelinek
320ae115bc7Smrj AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
321ae115bc7Smrj break;
322ae115bc7Smrj
323ae115bc7Smrj case ACPI_RSD_UINT32:
324*de5d74c2SJerry Jelinek
325ae115bc7Smrj AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
326ae115bc7Smrj break;
327ae115bc7Smrj
328ae115bc7Smrj case ACPI_RSD_UINT64:
329*de5d74c2SJerry Jelinek
330ae115bc7Smrj AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
331ae115bc7Smrj break;
332ae115bc7Smrj
333ae115bc7Smrj /* Flags: 1-bit and 2-bit flags supported */
334ae115bc7Smrj
335ae115bc7Smrj case ACPI_RSD_1BITFLAG:
336*de5d74c2SJerry Jelinek
337*de5d74c2SJerry Jelinek AcpiRsOutString (Name, Table->Pointer [*Target & 0x01]);
338ae115bc7Smrj break;
339ae115bc7Smrj
340ae115bc7Smrj case ACPI_RSD_2BITFLAG:
341*de5d74c2SJerry Jelinek
342*de5d74c2SJerry Jelinek AcpiRsOutString (Name, Table->Pointer [*Target & 0x03]);
343*de5d74c2SJerry Jelinek break;
344*de5d74c2SJerry Jelinek
345*de5d74c2SJerry Jelinek case ACPI_RSD_3BITFLAG:
346*de5d74c2SJerry Jelinek
347*de5d74c2SJerry Jelinek AcpiRsOutString (Name, Table->Pointer [*Target & 0x07]);
348ae115bc7Smrj break;
349ae115bc7Smrj
350ae115bc7Smrj case ACPI_RSD_SHORTLIST:
351ae115bc7Smrj /*
352ae115bc7Smrj * Short byte list (single line output) for DMA and IRQ resources
353ae115bc7Smrj * Note: The list length is obtained from the previous table entry
354ae115bc7Smrj */
355ae115bc7Smrj if (PreviousTarget)
356ae115bc7Smrj {
357ae115bc7Smrj AcpiRsOutTitle (Name);
358ae115bc7Smrj AcpiRsDumpShortByteList (*PreviousTarget, Target);
359ae115bc7Smrj }
360ae115bc7Smrj break;
361ae115bc7Smrj
362*de5d74c2SJerry Jelinek case ACPI_RSD_SHORTLISTX:
363*de5d74c2SJerry Jelinek /*
364*de5d74c2SJerry Jelinek * Short byte list (single line output) for GPIO vendor data
365*de5d74c2SJerry Jelinek * Note: The list length is obtained from the previous table entry
366*de5d74c2SJerry Jelinek */
367*de5d74c2SJerry Jelinek if (PreviousTarget)
368*de5d74c2SJerry Jelinek {
369*de5d74c2SJerry Jelinek AcpiRsOutTitle (Name);
370*de5d74c2SJerry Jelinek AcpiRsDumpShortByteList (*PreviousTarget,
371*de5d74c2SJerry Jelinek *(ACPI_CAST_INDIRECT_PTR (UINT8, Target)));
372*de5d74c2SJerry Jelinek }
373*de5d74c2SJerry Jelinek break;
374*de5d74c2SJerry Jelinek
375ae115bc7Smrj case ACPI_RSD_LONGLIST:
376ae115bc7Smrj /*
377ae115bc7Smrj * Long byte list for Vendor resource data
378ae115bc7Smrj * Note: The list length is obtained from the previous table entry
379ae115bc7Smrj */
380ae115bc7Smrj if (PreviousTarget)
381ae115bc7Smrj {
382ae115bc7Smrj AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
383ae115bc7Smrj }
384ae115bc7Smrj break;
385ae115bc7Smrj
386ae115bc7Smrj case ACPI_RSD_DWORDLIST:
387ae115bc7Smrj /*
388ae115bc7Smrj * Dword list for Extended Interrupt resources
389ae115bc7Smrj * Note: The list length is obtained from the previous table entry
390ae115bc7Smrj */
391ae115bc7Smrj if (PreviousTarget)
392ae115bc7Smrj {
393ae115bc7Smrj AcpiRsDumpDwordList (*PreviousTarget,
394ae115bc7Smrj ACPI_CAST_PTR (UINT32, Target));
395ae115bc7Smrj }
396ae115bc7Smrj break;
397ae115bc7Smrj
398*de5d74c2SJerry Jelinek case ACPI_RSD_WORDLIST:
399*de5d74c2SJerry Jelinek /*
400*de5d74c2SJerry Jelinek * Word list for GPIO Pin Table
401*de5d74c2SJerry Jelinek * Note: The list length is obtained from the previous table entry
402*de5d74c2SJerry Jelinek */
403*de5d74c2SJerry Jelinek if (PreviousTarget)
404*de5d74c2SJerry Jelinek {
405*de5d74c2SJerry Jelinek AcpiRsDumpWordList (*PreviousTarget,
406*de5d74c2SJerry Jelinek *(ACPI_CAST_INDIRECT_PTR (UINT16, Target)));
407*de5d74c2SJerry Jelinek }
408*de5d74c2SJerry Jelinek break;
409*de5d74c2SJerry Jelinek
410ae115bc7Smrj case ACPI_RSD_ADDRESS:
411ae115bc7Smrj /*
412ae115bc7Smrj * Common flags for all Address resources
413ae115bc7Smrj */
414*de5d74c2SJerry Jelinek AcpiRsDumpAddressCommon (ACPI_CAST_PTR (
415*de5d74c2SJerry Jelinek ACPI_RESOURCE_DATA, Target));
416ae115bc7Smrj break;
417ae115bc7Smrj
418ae115bc7Smrj case ACPI_RSD_SOURCE:
419ae115bc7Smrj /*
420ae115bc7Smrj * Optional ResourceSource for Address resources
421ae115bc7Smrj */
422*de5d74c2SJerry Jelinek AcpiRsDumpResourceSource (ACPI_CAST_PTR (
423*de5d74c2SJerry Jelinek ACPI_RESOURCE_SOURCE, Target));
424ae115bc7Smrj break;
425ae115bc7Smrj
426ae115bc7Smrj default:
427*de5d74c2SJerry Jelinek
428ae115bc7Smrj AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
429ae115bc7Smrj Table->Opcode);
430ae115bc7Smrj return;
431ae115bc7Smrj }
432ae115bc7Smrj
433ae115bc7Smrj Table++;
434ae115bc7Smrj Count--;
435ae115bc7Smrj }
436ae115bc7Smrj }
437ae115bc7Smrj
438ae115bc7Smrj
439ae115bc7Smrj /*******************************************************************************
440ae115bc7Smrj *
441ae115bc7Smrj * FUNCTION: AcpiRsDumpResourceSource
442ae115bc7Smrj *
443ae115bc7Smrj * PARAMETERS: ResourceSource - Pointer to a Resource Source struct
444ae115bc7Smrj *
445ae115bc7Smrj * RETURN: None
446ae115bc7Smrj *
447ae115bc7Smrj * DESCRIPTION: Common routine for dumping the optional ResourceSource and the
448ae115bc7Smrj * corresponding ResourceSourceIndex.
449ae115bc7Smrj *
450ae115bc7Smrj ******************************************************************************/
451ae115bc7Smrj
452ae115bc7Smrj static void
AcpiRsDumpResourceSource(ACPI_RESOURCE_SOURCE * ResourceSource)453ae115bc7Smrj AcpiRsDumpResourceSource (
454ae115bc7Smrj ACPI_RESOURCE_SOURCE *ResourceSource)
455ae115bc7Smrj {
456ae115bc7Smrj ACPI_FUNCTION_ENTRY ();
457ae115bc7Smrj
458ae115bc7Smrj
459ae115bc7Smrj if (ResourceSource->Index == 0xFF)
460ae115bc7Smrj {
461ae115bc7Smrj return;
462ae115bc7Smrj }
463ae115bc7Smrj
464ae115bc7Smrj AcpiRsOutInteger8 ("Resource Source Index",
465ae115bc7Smrj ResourceSource->Index);
466ae115bc7Smrj
467ae115bc7Smrj AcpiRsOutString ("Resource Source",
468ae115bc7Smrj ResourceSource->StringPtr ?
469ae115bc7Smrj ResourceSource->StringPtr : "[Not Specified]");
470ae115bc7Smrj }
471ae115bc7Smrj
472ae115bc7Smrj
473ae115bc7Smrj /*******************************************************************************
474ae115bc7Smrj *
475ae115bc7Smrj * FUNCTION: AcpiRsDumpAddressCommon
476ae115bc7Smrj *
477ae115bc7Smrj * PARAMETERS: Resource - Pointer to an internal resource descriptor
478ae115bc7Smrj *
479ae115bc7Smrj * RETURN: None
480ae115bc7Smrj *
481ae115bc7Smrj * DESCRIPTION: Dump the fields that are common to all Address resource
482ae115bc7Smrj * descriptors
483ae115bc7Smrj *
484ae115bc7Smrj ******************************************************************************/
485ae115bc7Smrj
486ae115bc7Smrj static void
AcpiRsDumpAddressCommon(ACPI_RESOURCE_DATA * Resource)487ae115bc7Smrj AcpiRsDumpAddressCommon (
488ae115bc7Smrj ACPI_RESOURCE_DATA *Resource)
489ae115bc7Smrj {
490ae115bc7Smrj ACPI_FUNCTION_ENTRY ();
491ae115bc7Smrj
492ae115bc7Smrj
493ae115bc7Smrj /* Decode the type-specific flags */
494ae115bc7Smrj
495ae115bc7Smrj switch (Resource->Address.ResourceType)
496ae115bc7Smrj {
497ae115bc7Smrj case ACPI_MEMORY_RANGE:
498ae115bc7Smrj
499ae115bc7Smrj AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags);
500ae115bc7Smrj break;
501ae115bc7Smrj
502ae115bc7Smrj case ACPI_IO_RANGE:
503ae115bc7Smrj
504ae115bc7Smrj AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags);
505ae115bc7Smrj break;
506ae115bc7Smrj
507ae115bc7Smrj case ACPI_BUS_NUMBER_RANGE:
508ae115bc7Smrj
509ae115bc7Smrj AcpiRsOutString ("Resource Type", "Bus Number Range");
510ae115bc7Smrj break;
511ae115bc7Smrj
512ae115bc7Smrj default:
513ae115bc7Smrj
514ae115bc7Smrj AcpiRsOutInteger8 ("Resource Type",
515ae115bc7Smrj (UINT8) Resource->Address.ResourceType);
516ae115bc7Smrj break;
517ae115bc7Smrj }
518ae115bc7Smrj
519ae115bc7Smrj /* Decode the general flags */
520ae115bc7Smrj
521ae115bc7Smrj AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags);
522ae115bc7Smrj }
523ae115bc7Smrj
524ae115bc7Smrj
525ae115bc7Smrj /*******************************************************************************
526ae115bc7Smrj *
527ae115bc7Smrj * FUNCTION: AcpiRsOut*
528ae115bc7Smrj *
529ae115bc7Smrj * PARAMETERS: Title - Name of the resource field
530ae115bc7Smrj * Value - Value of the resource field
531ae115bc7Smrj *
532ae115bc7Smrj * RETURN: None
533ae115bc7Smrj *
534ae115bc7Smrj * DESCRIPTION: Miscellaneous helper functions to consistently format the
535ae115bc7Smrj * output of the resource dump routines
536ae115bc7Smrj *
537ae115bc7Smrj ******************************************************************************/
538ae115bc7Smrj
539ae115bc7Smrj static void
AcpiRsOutString(const char * Title,const char * Value)540ae115bc7Smrj AcpiRsOutString (
541*de5d74c2SJerry Jelinek const char *Title,
542*de5d74c2SJerry Jelinek const char *Value)
543ae115bc7Smrj {
544*de5d74c2SJerry Jelinek
545ae115bc7Smrj AcpiOsPrintf ("%27s : %s", Title, Value);
546ae115bc7Smrj if (!*Value)
547ae115bc7Smrj {
548ae115bc7Smrj AcpiOsPrintf ("[NULL NAMESTRING]");
549ae115bc7Smrj }
550ae115bc7Smrj AcpiOsPrintf ("\n");
551ae115bc7Smrj }
552ae115bc7Smrj
553ae115bc7Smrj static void
AcpiRsOutInteger8(const char * Title,UINT8 Value)554ae115bc7Smrj AcpiRsOutInteger8 (
555*de5d74c2SJerry Jelinek const char *Title,
556ae115bc7Smrj UINT8 Value)
557ae115bc7Smrj {
558ae115bc7Smrj AcpiOsPrintf ("%27s : %2.2X\n", Title, Value);
559ae115bc7Smrj }
560ae115bc7Smrj
561ae115bc7Smrj static void
AcpiRsOutInteger16(const char * Title,UINT16 Value)562ae115bc7Smrj AcpiRsOutInteger16 (
563*de5d74c2SJerry Jelinek const char *Title,
564ae115bc7Smrj UINT16 Value)
565ae115bc7Smrj {
566*de5d74c2SJerry Jelinek
567ae115bc7Smrj AcpiOsPrintf ("%27s : %4.4X\n", Title, Value);
568ae115bc7Smrj }
569ae115bc7Smrj
570ae115bc7Smrj static void
AcpiRsOutInteger32(const char * Title,UINT32 Value)571ae115bc7Smrj AcpiRsOutInteger32 (
572*de5d74c2SJerry Jelinek const char *Title,
573ae115bc7Smrj UINT32 Value)
574ae115bc7Smrj {
575*de5d74c2SJerry Jelinek
576ae115bc7Smrj AcpiOsPrintf ("%27s : %8.8X\n", Title, Value);
577ae115bc7Smrj }
578ae115bc7Smrj
579ae115bc7Smrj static void
AcpiRsOutInteger64(const char * Title,UINT64 Value)580ae115bc7Smrj AcpiRsOutInteger64 (
581*de5d74c2SJerry Jelinek const char *Title,
582ae115bc7Smrj UINT64 Value)
583ae115bc7Smrj {
584*de5d74c2SJerry Jelinek
585ae115bc7Smrj AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title,
586ae115bc7Smrj ACPI_FORMAT_UINT64 (Value));
587ae115bc7Smrj }
588ae115bc7Smrj
589ae115bc7Smrj static void
AcpiRsOutTitle(const char * Title)590ae115bc7Smrj AcpiRsOutTitle (
591*de5d74c2SJerry Jelinek const char *Title)
592ae115bc7Smrj {
593*de5d74c2SJerry Jelinek
594ae115bc7Smrj AcpiOsPrintf ("%27s : ", Title);
595ae115bc7Smrj }
596ae115bc7Smrj
597ae115bc7Smrj
598ae115bc7Smrj /*******************************************************************************
599ae115bc7Smrj *
600ae115bc7Smrj * FUNCTION: AcpiRsDump*List
601ae115bc7Smrj *
602ae115bc7Smrj * PARAMETERS: Length - Number of elements in the list
603ae115bc7Smrj * Data - Start of the list
604ae115bc7Smrj *
605ae115bc7Smrj * RETURN: None
606ae115bc7Smrj *
607ae115bc7Smrj * DESCRIPTION: Miscellaneous functions to dump lists of raw data
608ae115bc7Smrj *
609ae115bc7Smrj ******************************************************************************/
610ae115bc7Smrj
611ae115bc7Smrj static void
AcpiRsDumpByteList(UINT16 Length,UINT8 * Data)612ae115bc7Smrj AcpiRsDumpByteList (
613ae115bc7Smrj UINT16 Length,
614ae115bc7Smrj UINT8 *Data)
615ae115bc7Smrj {
616ae115bc7Smrj UINT8 i;
617ae115bc7Smrj
618ae115bc7Smrj
619ae115bc7Smrj for (i = 0; i < Length; i++)
620ae115bc7Smrj {
621*de5d74c2SJerry Jelinek AcpiOsPrintf ("%25s%2.2X : %2.2X\n", "Byte", i, Data[i]);
622ae115bc7Smrj }
623ae115bc7Smrj }
624ae115bc7Smrj
625ae115bc7Smrj static void
AcpiRsDumpShortByteList(UINT8 Length,UINT8 * Data)626ae115bc7Smrj AcpiRsDumpShortByteList (
627ae115bc7Smrj UINT8 Length,
628ae115bc7Smrj UINT8 *Data)
629ae115bc7Smrj {
630ae115bc7Smrj UINT8 i;
631ae115bc7Smrj
632ae115bc7Smrj
633ae115bc7Smrj for (i = 0; i < Length; i++)
634ae115bc7Smrj {
635ae115bc7Smrj AcpiOsPrintf ("%X ", Data[i]);
636ae115bc7Smrj }
637*de5d74c2SJerry Jelinek
638ae115bc7Smrj AcpiOsPrintf ("\n");
639ae115bc7Smrj }
640ae115bc7Smrj
641ae115bc7Smrj static void
AcpiRsDumpDwordList(UINT8 Length,UINT32 * Data)642ae115bc7Smrj AcpiRsDumpDwordList (
643ae115bc7Smrj UINT8 Length,
644ae115bc7Smrj UINT32 *Data)
645ae115bc7Smrj {
646ae115bc7Smrj UINT8 i;
647ae115bc7Smrj
648ae115bc7Smrj
649ae115bc7Smrj for (i = 0; i < Length; i++)
650ae115bc7Smrj {
651*de5d74c2SJerry Jelinek AcpiOsPrintf ("%25s%2.2X : %8.8X\n", "Dword", i, Data[i]);
652ae115bc7Smrj }
653ae115bc7Smrj }
654ae115bc7Smrj
655*de5d74c2SJerry Jelinek static void
AcpiRsDumpWordList(UINT16 Length,UINT16 * Data)656*de5d74c2SJerry Jelinek AcpiRsDumpWordList (
657*de5d74c2SJerry Jelinek UINT16 Length,
658*de5d74c2SJerry Jelinek UINT16 *Data)
659*de5d74c2SJerry Jelinek {
660*de5d74c2SJerry Jelinek UINT16 i;
661ae115bc7Smrj
662*de5d74c2SJerry Jelinek
663*de5d74c2SJerry Jelinek for (i = 0; i < Length; i++)
664*de5d74c2SJerry Jelinek {
665*de5d74c2SJerry Jelinek AcpiOsPrintf ("%25s%2.2X : %4.4X\n", "Word", i, Data[i]);
666*de5d74c2SJerry Jelinek }
667*de5d74c2SJerry Jelinek }
668