195857638SErik Schmauss // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
295b482a8SLen Brown /*******************************************************************************
395b482a8SLen Brown *
439239fedSBob Moore * Module Name: rsdump - AML debugger support for resource structures.
595b482a8SLen Brown *
695b482a8SLen Brown ******************************************************************************/
795b482a8SLen Brown
895b482a8SLen Brown #include <acpi/acpi.h>
9e2f7a777SLen Brown #include "accommon.h"
10e2f7a777SLen Brown #include "acresrc.h"
1195b482a8SLen Brown
1295b482a8SLen Brown #define _COMPONENT ACPI_RESOURCES
1395b482a8SLen Brown ACPI_MODULE_NAME("rsdump")
143334861bSLv Zheng
1539239fedSBob Moore /*
1639239fedSBob Moore * All functions in this module are used by the AML Debugger only
1739239fedSBob Moore */
1895b482a8SLen Brown /* Local prototypes */
190dfaaa3dSBob Moore static void acpi_rs_out_string(const char *title, const char *value);
2095b482a8SLen Brown
210dfaaa3dSBob Moore static void acpi_rs_out_integer8(const char *title, u8 value);
2295b482a8SLen Brown
230dfaaa3dSBob Moore static void acpi_rs_out_integer16(const char *title, u16 value);
2495b482a8SLen Brown
250dfaaa3dSBob Moore static void acpi_rs_out_integer32(const char *title, u32 value);
2695b482a8SLen Brown
270dfaaa3dSBob Moore static void acpi_rs_out_integer64(const char *title, u64 value);
2895b482a8SLen Brown
290dfaaa3dSBob Moore static void acpi_rs_out_title(const char *title);
3095b482a8SLen Brown
3195b482a8SLen Brown static void acpi_rs_dump_byte_list(u16 length, u8 *data);
3295b482a8SLen Brown
33e0fe0a8dSLin Ming static void acpi_rs_dump_word_list(u16 length, u16 *data);
34e0fe0a8dSLin Ming
3595b482a8SLen Brown static void acpi_rs_dump_dword_list(u8 length, u32 *data);
3695b482a8SLen Brown
3795b482a8SLen Brown static void acpi_rs_dump_short_byte_list(u8 length, u8 *data);
3895b482a8SLen Brown
3995b482a8SLen Brown static void
4095b482a8SLen Brown acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
4195b482a8SLen Brown
42fdaa0980SMika Westerberg static void
43fdaa0980SMika Westerberg acpi_rs_dump_resource_label(char *title,
44fdaa0980SMika Westerberg struct acpi_resource_label *resource_label);
45fdaa0980SMika Westerberg
4695b482a8SLen Brown static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
4795b482a8SLen Brown
4895b482a8SLen Brown static void
4995b482a8SLen Brown acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
5095b482a8SLen Brown
5195b482a8SLen Brown /*******************************************************************************
5295b482a8SLen Brown *
5339239fedSBob Moore * FUNCTION: acpi_rs_dump_resource_list
5439239fedSBob Moore *
5539239fedSBob Moore * PARAMETERS: resource_list - Pointer to a resource descriptor list
5639239fedSBob Moore *
5739239fedSBob Moore * RETURN: None
5839239fedSBob Moore *
5939239fedSBob Moore * DESCRIPTION: Dispatches the structure to the correct dump routine.
6039239fedSBob Moore *
6139239fedSBob Moore ******************************************************************************/
6239239fedSBob Moore
acpi_rs_dump_resource_list(struct acpi_resource * resource_list)6339239fedSBob Moore void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
6439239fedSBob Moore {
6539239fedSBob Moore u32 count = 0;
6639239fedSBob Moore u32 type;
6739239fedSBob Moore
6839239fedSBob Moore ACPI_FUNCTION_ENTRY();
6939239fedSBob Moore
7039239fedSBob Moore /* Check if debug output enabled */
7139239fedSBob Moore
7239239fedSBob Moore if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
7339239fedSBob Moore return;
7439239fedSBob Moore }
7539239fedSBob Moore
7639239fedSBob Moore /* Walk list and dump all resource descriptors (END_TAG terminates) */
7739239fedSBob Moore
7839239fedSBob Moore do {
7939239fedSBob Moore acpi_os_printf("\n[%02X] ", count);
8039239fedSBob Moore count++;
8139239fedSBob Moore
8239239fedSBob Moore /* Validate Type before dispatch */
8339239fedSBob Moore
8439239fedSBob Moore type = resource_list->type;
8539239fedSBob Moore if (type > ACPI_RESOURCE_TYPE_MAX) {
8639239fedSBob Moore acpi_os_printf
8739239fedSBob Moore ("Invalid descriptor type (%X) in resource list\n",
8839239fedSBob Moore resource_list->type);
8939239fedSBob Moore return;
90*a2befbb2SBob Moore } else if (!resource_list->type) {
91*a2befbb2SBob Moore ACPI_ERROR((AE_INFO, "Invalid Zero Resource Type"));
92*a2befbb2SBob Moore return;
9339239fedSBob Moore }
9439239fedSBob Moore
9539239fedSBob Moore /* Sanity check the length. It must not be zero, or we loop forever */
9639239fedSBob Moore
9739239fedSBob Moore if (!resource_list->length) {
9839239fedSBob Moore acpi_os_printf
9939239fedSBob Moore ("Invalid zero length descriptor in resource list\n");
10039239fedSBob Moore return;
10139239fedSBob Moore }
10239239fedSBob Moore
10339239fedSBob Moore /* Dump the resource descriptor */
10439239fedSBob Moore
10539239fedSBob Moore if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
10639239fedSBob Moore acpi_rs_dump_descriptor(&resource_list->data,
10739239fedSBob Moore acpi_gbl_dump_serial_bus_dispatch
10839239fedSBob Moore [resource_list->data.
10939239fedSBob Moore common_serial_bus.type]);
11039239fedSBob Moore } else {
11139239fedSBob Moore acpi_rs_dump_descriptor(&resource_list->data,
11239239fedSBob Moore acpi_gbl_dump_resource_dispatch
11339239fedSBob Moore [type]);
11439239fedSBob Moore }
11539239fedSBob Moore
11639239fedSBob Moore /* Point to the next resource structure */
11739239fedSBob Moore
11839239fedSBob Moore resource_list = ACPI_NEXT_RESOURCE(resource_list);
11939239fedSBob Moore
12039239fedSBob Moore /* Exit when END_TAG descriptor is reached */
12139239fedSBob Moore
12239239fedSBob Moore } while (type != ACPI_RESOURCE_TYPE_END_TAG);
12339239fedSBob Moore }
12439239fedSBob Moore
12539239fedSBob Moore /*******************************************************************************
12639239fedSBob Moore *
12739239fedSBob Moore * FUNCTION: acpi_rs_dump_irq_list
12839239fedSBob Moore *
12939239fedSBob Moore * PARAMETERS: route_table - Pointer to the routing table to dump.
13039239fedSBob Moore *
13139239fedSBob Moore * RETURN: None
13239239fedSBob Moore *
13339239fedSBob Moore * DESCRIPTION: Print IRQ routing table
13439239fedSBob Moore *
13539239fedSBob Moore ******************************************************************************/
13639239fedSBob Moore
acpi_rs_dump_irq_list(u8 * route_table)13739239fedSBob Moore void acpi_rs_dump_irq_list(u8 *route_table)
13839239fedSBob Moore {
13939239fedSBob Moore struct acpi_pci_routing_table *prt_element;
14039239fedSBob Moore u8 count;
14139239fedSBob Moore
14239239fedSBob Moore ACPI_FUNCTION_ENTRY();
14339239fedSBob Moore
14439239fedSBob Moore /* Check if debug output enabled */
14539239fedSBob Moore
14639239fedSBob Moore if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
14739239fedSBob Moore return;
14839239fedSBob Moore }
14939239fedSBob Moore
15039239fedSBob Moore prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
15139239fedSBob Moore
15239239fedSBob Moore /* Dump all table elements, Exit on zero length element */
15339239fedSBob Moore
15439239fedSBob Moore for (count = 0; prt_element->length; count++) {
15539239fedSBob Moore acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
15639239fedSBob Moore count);
15739239fedSBob Moore acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
15839239fedSBob Moore
15939239fedSBob Moore prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
16039239fedSBob Moore prt_element, prt_element->length);
16139239fedSBob Moore }
16239239fedSBob Moore }
16339239fedSBob Moore
16439239fedSBob Moore /*******************************************************************************
16539239fedSBob Moore *
16695b482a8SLen Brown * FUNCTION: acpi_rs_dump_descriptor
16795b482a8SLen Brown *
16842f8fb75SBob Moore * PARAMETERS: resource - Buffer containing the resource
16942f8fb75SBob Moore * table - Table entry to decode the resource
17095b482a8SLen Brown *
17195b482a8SLen Brown * RETURN: None
17295b482a8SLen Brown *
17342f8fb75SBob Moore * DESCRIPTION: Dump a resource descriptor based on a dump table entry.
17495b482a8SLen Brown *
17595b482a8SLen Brown ******************************************************************************/
17695b482a8SLen Brown
17795b482a8SLen Brown static void
acpi_rs_dump_descriptor(void * resource,struct acpi_rsdump_info * table)17895b482a8SLen Brown acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
17995b482a8SLen Brown {
18095b482a8SLen Brown u8 *target = NULL;
18195b482a8SLen Brown u8 *previous_target;
1820dfaaa3dSBob Moore const char *name;
18395b482a8SLen Brown u8 count;
18495b482a8SLen Brown
18595b482a8SLen Brown /* First table entry must contain the table length (# of table entries) */
18695b482a8SLen Brown
18795b482a8SLen Brown count = table->offset;
18895b482a8SLen Brown
18995b482a8SLen Brown while (count) {
19095b482a8SLen Brown previous_target = target;
19195b482a8SLen Brown target = ACPI_ADD_PTR(u8, resource, table->offset);
19295b482a8SLen Brown name = table->name;
19395b482a8SLen Brown
19495b482a8SLen Brown switch (table->opcode) {
19595b482a8SLen Brown case ACPI_RSD_TITLE:
19695b482a8SLen Brown /*
19795b482a8SLen Brown * Optional resource title
19895b482a8SLen Brown */
19995b482a8SLen Brown if (table->name) {
20095b482a8SLen Brown acpi_os_printf("%s Resource\n", name);
20195b482a8SLen Brown }
20295b482a8SLen Brown break;
20395b482a8SLen Brown
20495b482a8SLen Brown /* Strings */
20595b482a8SLen Brown
20695b482a8SLen Brown case ACPI_RSD_LITERAL:
2071d1ea1b7SChao Guan
20895b482a8SLen Brown acpi_rs_out_string(name,
20995b482a8SLen Brown ACPI_CAST_PTR(char, table->pointer));
21095b482a8SLen Brown break;
21195b482a8SLen Brown
21295b482a8SLen Brown case ACPI_RSD_STRING:
2131d1ea1b7SChao Guan
21495b482a8SLen Brown acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
21595b482a8SLen Brown break;
21695b482a8SLen Brown
21795b482a8SLen Brown /* Data items, 8/16/32/64 bit */
21895b482a8SLen Brown
21995b482a8SLen Brown case ACPI_RSD_UINT8:
2201d1ea1b7SChao Guan
221e0fe0a8dSLin Ming if (table->pointer) {
2220dfaaa3dSBob Moore acpi_rs_out_string(name,
2230dfaaa3dSBob Moore table->pointer[*target]);
224e0fe0a8dSLin Ming } else {
22595b482a8SLen Brown acpi_rs_out_integer8(name, ACPI_GET8(target));
226e0fe0a8dSLin Ming }
22795b482a8SLen Brown break;
22895b482a8SLen Brown
22995b482a8SLen Brown case ACPI_RSD_UINT16:
2301d1ea1b7SChao Guan
23195b482a8SLen Brown acpi_rs_out_integer16(name, ACPI_GET16(target));
23295b482a8SLen Brown break;
23395b482a8SLen Brown
23495b482a8SLen Brown case ACPI_RSD_UINT32:
2351d1ea1b7SChao Guan
23695b482a8SLen Brown acpi_rs_out_integer32(name, ACPI_GET32(target));
23795b482a8SLen Brown break;
23895b482a8SLen Brown
23995b482a8SLen Brown case ACPI_RSD_UINT64:
2401d1ea1b7SChao Guan
24195b482a8SLen Brown acpi_rs_out_integer64(name, ACPI_GET64(target));
24295b482a8SLen Brown break;
24395b482a8SLen Brown
24495b482a8SLen Brown /* Flags: 1-bit and 2-bit flags supported */
24595b482a8SLen Brown
24695b482a8SLen Brown case ACPI_RSD_1BITFLAG:
2471d1ea1b7SChao Guan
2480dfaaa3dSBob Moore acpi_rs_out_string(name,
2490dfaaa3dSBob Moore table->pointer[*target & 0x01]);
25095b482a8SLen Brown break;
25195b482a8SLen Brown
25295b482a8SLen Brown case ACPI_RSD_2BITFLAG:
2531d1ea1b7SChao Guan
2540dfaaa3dSBob Moore acpi_rs_out_string(name,
2550dfaaa3dSBob Moore table->pointer[*target & 0x03]);
25695b482a8SLen Brown break;
25795b482a8SLen Brown
258e0fe0a8dSLin Ming case ACPI_RSD_3BITFLAG:
2591d1ea1b7SChao Guan
2600dfaaa3dSBob Moore acpi_rs_out_string(name,
2610dfaaa3dSBob Moore table->pointer[*target & 0x07]);
262e0fe0a8dSLin Ming break;
263e0fe0a8dSLin Ming
264*a2befbb2SBob Moore case ACPI_RSD_6BITFLAG:
265*a2befbb2SBob Moore
266*a2befbb2SBob Moore acpi_rs_out_integer8(name, (ACPI_GET8(target) & 0x3F));
267*a2befbb2SBob Moore break;
268*a2befbb2SBob Moore
26995b482a8SLen Brown case ACPI_RSD_SHORTLIST:
27095b482a8SLen Brown /*
27195b482a8SLen Brown * Short byte list (single line output) for DMA and IRQ resources
27295b482a8SLen Brown * Note: The list length is obtained from the previous table entry
27395b482a8SLen Brown */
27495b482a8SLen Brown if (previous_target) {
27595b482a8SLen Brown acpi_rs_out_title(name);
27695b482a8SLen Brown acpi_rs_dump_short_byte_list(*previous_target,
27795b482a8SLen Brown target);
27895b482a8SLen Brown }
27995b482a8SLen Brown break;
28095b482a8SLen Brown
281e0fe0a8dSLin Ming case ACPI_RSD_SHORTLISTX:
282e0fe0a8dSLin Ming /*
283e0fe0a8dSLin Ming * Short byte list (single line output) for GPIO vendor data
284e0fe0a8dSLin Ming * Note: The list length is obtained from the previous table entry
285e0fe0a8dSLin Ming */
286e0fe0a8dSLin Ming if (previous_target) {
287e0fe0a8dSLin Ming acpi_rs_out_title(name);
288e0fe0a8dSLin Ming acpi_rs_dump_short_byte_list(*previous_target,
289e0fe0a8dSLin Ming *
290e0fe0a8dSLin Ming (ACPI_CAST_INDIRECT_PTR
291e0fe0a8dSLin Ming (u8, target)));
292e0fe0a8dSLin Ming }
293e0fe0a8dSLin Ming break;
294e0fe0a8dSLin Ming
29595b482a8SLen Brown case ACPI_RSD_LONGLIST:
29695b482a8SLen Brown /*
29795b482a8SLen Brown * Long byte list for Vendor resource data
29895b482a8SLen Brown * Note: The list length is obtained from the previous table entry
29995b482a8SLen Brown */
30095b482a8SLen Brown if (previous_target) {
30195b482a8SLen Brown acpi_rs_dump_byte_list(ACPI_GET16
30295b482a8SLen Brown (previous_target),
30395b482a8SLen Brown target);
30495b482a8SLen Brown }
30595b482a8SLen Brown break;
30695b482a8SLen Brown
30795b482a8SLen Brown case ACPI_RSD_DWORDLIST:
30895b482a8SLen Brown /*
30995b482a8SLen Brown * Dword list for Extended Interrupt resources
31095b482a8SLen Brown * Note: The list length is obtained from the previous table entry
31195b482a8SLen Brown */
31295b482a8SLen Brown if (previous_target) {
31395b482a8SLen Brown acpi_rs_dump_dword_list(*previous_target,
31495b482a8SLen Brown ACPI_CAST_PTR(u32,
31595b482a8SLen Brown target));
31695b482a8SLen Brown }
31795b482a8SLen Brown break;
31895b482a8SLen Brown
319e0fe0a8dSLin Ming case ACPI_RSD_WORDLIST:
320e0fe0a8dSLin Ming /*
321e0fe0a8dSLin Ming * Word list for GPIO Pin Table
322e0fe0a8dSLin Ming * Note: The list length is obtained from the previous table entry
323e0fe0a8dSLin Ming */
324e0fe0a8dSLin Ming if (previous_target) {
325e0fe0a8dSLin Ming acpi_rs_dump_word_list(*previous_target,
326e0fe0a8dSLin Ming *(ACPI_CAST_INDIRECT_PTR
327e0fe0a8dSLin Ming (u16, target)));
328e0fe0a8dSLin Ming }
329e0fe0a8dSLin Ming break;
330e0fe0a8dSLin Ming
33195b482a8SLen Brown case ACPI_RSD_ADDRESS:
33295b482a8SLen Brown /*
33395b482a8SLen Brown * Common flags for all Address resources
33495b482a8SLen Brown */
33595b482a8SLen Brown acpi_rs_dump_address_common(ACPI_CAST_PTR
33695b482a8SLen Brown (union acpi_resource_data,
33795b482a8SLen Brown target));
33895b482a8SLen Brown break;
33995b482a8SLen Brown
34095b482a8SLen Brown case ACPI_RSD_SOURCE:
34195b482a8SLen Brown /*
34295b482a8SLen Brown * Optional resource_source for Address resources
34395b482a8SLen Brown */
3443e8214e5SLv Zheng acpi_rs_dump_resource_source(ACPI_CAST_PTR
3453e8214e5SLv Zheng (struct
34695b482a8SLen Brown acpi_resource_source,
34795b482a8SLen Brown target));
34895b482a8SLen Brown break;
34995b482a8SLen Brown
350fdaa0980SMika Westerberg case ACPI_RSD_LABEL:
351fdaa0980SMika Westerberg /*
352fdaa0980SMika Westerberg * resource_label
353fdaa0980SMika Westerberg */
354fdaa0980SMika Westerberg acpi_rs_dump_resource_label("Resource Label",
355fdaa0980SMika Westerberg ACPI_CAST_PTR(struct
356fdaa0980SMika Westerberg acpi_resource_label,
357fdaa0980SMika Westerberg target));
358fdaa0980SMika Westerberg break;
359fdaa0980SMika Westerberg
360f8a6c866SMika Westerberg case ACPI_RSD_SOURCE_LABEL:
361f8a6c866SMika Westerberg /*
362f8a6c866SMika Westerberg * resource_source_label
363f8a6c866SMika Westerberg */
364f8a6c866SMika Westerberg acpi_rs_dump_resource_label("Resource Source Label",
365f8a6c866SMika Westerberg ACPI_CAST_PTR(struct
366f8a6c866SMika Westerberg acpi_resource_label,
367f8a6c866SMika Westerberg target));
368f8a6c866SMika Westerberg break;
369f8a6c866SMika Westerberg
37095b482a8SLen Brown default:
3711d1ea1b7SChao Guan
37295b482a8SLen Brown acpi_os_printf("**** Invalid table opcode [%X] ****\n",
37395b482a8SLen Brown table->opcode);
37495b482a8SLen Brown return;
37595b482a8SLen Brown }
37695b482a8SLen Brown
37795b482a8SLen Brown table++;
37895b482a8SLen Brown count--;
37995b482a8SLen Brown }
38095b482a8SLen Brown }
38195b482a8SLen Brown
38295b482a8SLen Brown /*******************************************************************************
38395b482a8SLen Brown *
38495b482a8SLen Brown * FUNCTION: acpi_rs_dump_resource_source
38595b482a8SLen Brown *
38695b482a8SLen Brown * PARAMETERS: resource_source - Pointer to a Resource Source struct
38795b482a8SLen Brown *
38895b482a8SLen Brown * RETURN: None
38995b482a8SLen Brown *
39095b482a8SLen Brown * DESCRIPTION: Common routine for dumping the optional resource_source and the
39195b482a8SLen Brown * corresponding resource_source_index.
39295b482a8SLen Brown *
39395b482a8SLen Brown ******************************************************************************/
39495b482a8SLen Brown
39595b482a8SLen Brown static void
acpi_rs_dump_resource_source(struct acpi_resource_source * resource_source)39695b482a8SLen Brown acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
39795b482a8SLen Brown {
39895b482a8SLen Brown ACPI_FUNCTION_ENTRY();
39995b482a8SLen Brown
40095b482a8SLen Brown if (resource_source->index == 0xFF) {
40195b482a8SLen Brown return;
40295b482a8SLen Brown }
40395b482a8SLen Brown
40495b482a8SLen Brown acpi_rs_out_integer8("Resource Source Index", resource_source->index);
40595b482a8SLen Brown
40695b482a8SLen Brown acpi_rs_out_string("Resource Source",
40795b482a8SLen Brown resource_source->string_ptr ?
40895b482a8SLen Brown resource_source->string_ptr : "[Not Specified]");
40995b482a8SLen Brown }
41095b482a8SLen Brown
41195b482a8SLen Brown /*******************************************************************************
41295b482a8SLen Brown *
413fdaa0980SMika Westerberg * FUNCTION: acpi_rs_dump_resource_label
414fdaa0980SMika Westerberg *
415fdaa0980SMika Westerberg * PARAMETERS: title - Title of the dumped resource field
416fdaa0980SMika Westerberg * resource_label - Pointer to a Resource Label struct
417fdaa0980SMika Westerberg *
418fdaa0980SMika Westerberg * RETURN: None
419fdaa0980SMika Westerberg *
420fdaa0980SMika Westerberg * DESCRIPTION: Common routine for dumping the resource_label
421fdaa0980SMika Westerberg *
422fdaa0980SMika Westerberg ******************************************************************************/
423fdaa0980SMika Westerberg
424fdaa0980SMika Westerberg static void
acpi_rs_dump_resource_label(char * title,struct acpi_resource_label * resource_label)425fdaa0980SMika Westerberg acpi_rs_dump_resource_label(char *title,
426fdaa0980SMika Westerberg struct acpi_resource_label *resource_label)
427fdaa0980SMika Westerberg {
428fdaa0980SMika Westerberg ACPI_FUNCTION_ENTRY();
429fdaa0980SMika Westerberg
430fdaa0980SMika Westerberg acpi_rs_out_string(title,
431fdaa0980SMika Westerberg resource_label->string_ptr ?
432fdaa0980SMika Westerberg resource_label->string_ptr : "[Not Specified]");
433fdaa0980SMika Westerberg }
434fdaa0980SMika Westerberg
435fdaa0980SMika Westerberg /*******************************************************************************
436fdaa0980SMika Westerberg *
43795b482a8SLen Brown * FUNCTION: acpi_rs_dump_address_common
43895b482a8SLen Brown *
439ba494beeSBob Moore * PARAMETERS: resource - Pointer to an internal resource descriptor
44095b482a8SLen Brown *
44195b482a8SLen Brown * RETURN: None
44295b482a8SLen Brown *
44395b482a8SLen Brown * DESCRIPTION: Dump the fields that are common to all Address resource
44495b482a8SLen Brown * descriptors
44595b482a8SLen Brown *
44695b482a8SLen Brown ******************************************************************************/
44795b482a8SLen Brown
acpi_rs_dump_address_common(union acpi_resource_data * resource)44895b482a8SLen Brown static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
44995b482a8SLen Brown {
45095b482a8SLen Brown ACPI_FUNCTION_ENTRY();
45195b482a8SLen Brown
45295b482a8SLen Brown /* Decode the type-specific flags */
45395b482a8SLen Brown
45495b482a8SLen Brown switch (resource->address.resource_type) {
45595b482a8SLen Brown case ACPI_MEMORY_RANGE:
45695b482a8SLen Brown
45795b482a8SLen Brown acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
45895b482a8SLen Brown break;
45995b482a8SLen Brown
46095b482a8SLen Brown case ACPI_IO_RANGE:
46195b482a8SLen Brown
46295b482a8SLen Brown acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
46395b482a8SLen Brown break;
46495b482a8SLen Brown
46595b482a8SLen Brown case ACPI_BUS_NUMBER_RANGE:
46695b482a8SLen Brown
46795b482a8SLen Brown acpi_rs_out_string("Resource Type", "Bus Number Range");
46895b482a8SLen Brown break;
46995b482a8SLen Brown
47095b482a8SLen Brown default:
47195b482a8SLen Brown
47295b482a8SLen Brown acpi_rs_out_integer8("Resource Type",
47395b482a8SLen Brown (u8) resource->address.resource_type);
47495b482a8SLen Brown break;
47595b482a8SLen Brown }
47695b482a8SLen Brown
47795b482a8SLen Brown /* Decode the general flags */
47895b482a8SLen Brown
47995b482a8SLen Brown acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
48095b482a8SLen Brown }
48195b482a8SLen Brown
48295b482a8SLen Brown /*******************************************************************************
48395b482a8SLen Brown *
48495b482a8SLen Brown * FUNCTION: acpi_rs_out*
48595b482a8SLen Brown *
486ba494beeSBob Moore * PARAMETERS: title - Name of the resource field
487ba494beeSBob Moore * value - Value of the resource field
48895b482a8SLen Brown *
48995b482a8SLen Brown * RETURN: None
49095b482a8SLen Brown *
49195b482a8SLen Brown * DESCRIPTION: Miscellaneous helper functions to consistently format the
49295b482a8SLen Brown * output of the resource dump routines
49395b482a8SLen Brown *
49495b482a8SLen Brown ******************************************************************************/
49595b482a8SLen Brown
acpi_rs_out_string(const char * title,const char * value)4960dfaaa3dSBob Moore static void acpi_rs_out_string(const char *title, const char *value)
49795b482a8SLen Brown {
4981fad8738SBob Moore
49995b482a8SLen Brown acpi_os_printf("%27s : %s", title, value);
50095b482a8SLen Brown if (!*value) {
50195b482a8SLen Brown acpi_os_printf("[NULL NAMESTRING]");
50295b482a8SLen Brown }
50395b482a8SLen Brown acpi_os_printf("\n");
50495b482a8SLen Brown }
50595b482a8SLen Brown
acpi_rs_out_integer8(const char * title,u8 value)5060dfaaa3dSBob Moore static void acpi_rs_out_integer8(const char *title, u8 value)
50795b482a8SLen Brown {
50895b482a8SLen Brown acpi_os_printf("%27s : %2.2X\n", title, value);
50995b482a8SLen Brown }
51095b482a8SLen Brown
acpi_rs_out_integer16(const char * title,u16 value)5110dfaaa3dSBob Moore static void acpi_rs_out_integer16(const char *title, u16 value)
51295b482a8SLen Brown {
5131fad8738SBob Moore
51495b482a8SLen Brown acpi_os_printf("%27s : %4.4X\n", title, value);
51595b482a8SLen Brown }
51695b482a8SLen Brown
acpi_rs_out_integer32(const char * title,u32 value)5170dfaaa3dSBob Moore static void acpi_rs_out_integer32(const char *title, u32 value)
51895b482a8SLen Brown {
5191fad8738SBob Moore
52095b482a8SLen Brown acpi_os_printf("%27s : %8.8X\n", title, value);
52195b482a8SLen Brown }
52295b482a8SLen Brown
acpi_rs_out_integer64(const char * title,u64 value)5230dfaaa3dSBob Moore static void acpi_rs_out_integer64(const char *title, u64 value)
52495b482a8SLen Brown {
5251fad8738SBob Moore
52695b482a8SLen Brown acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
52795b482a8SLen Brown }
52895b482a8SLen Brown
acpi_rs_out_title(const char * title)5290dfaaa3dSBob Moore static void acpi_rs_out_title(const char *title)
53095b482a8SLen Brown {
5311fad8738SBob Moore
53295b482a8SLen Brown acpi_os_printf("%27s : ", title);
53395b482a8SLen Brown }
53495b482a8SLen Brown
53595b482a8SLen Brown /*******************************************************************************
53695b482a8SLen Brown *
53795b482a8SLen Brown * FUNCTION: acpi_rs_dump*List
53895b482a8SLen Brown *
539ba494beeSBob Moore * PARAMETERS: length - Number of elements in the list
540ba494beeSBob Moore * data - Start of the list
54195b482a8SLen Brown *
54295b482a8SLen Brown * RETURN: None
54395b482a8SLen Brown *
54495b482a8SLen Brown * DESCRIPTION: Miscellaneous functions to dump lists of raw data
54595b482a8SLen Brown *
54695b482a8SLen Brown ******************************************************************************/
54795b482a8SLen Brown
acpi_rs_dump_byte_list(u16 length,u8 * data)54895b482a8SLen Brown static void acpi_rs_dump_byte_list(u16 length, u8 * data)
54995b482a8SLen Brown {
5509df758d9SColin Ian King u16 i;
55195b482a8SLen Brown
55295b482a8SLen Brown for (i = 0; i < length; i++) {
55395b482a8SLen Brown acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
55495b482a8SLen Brown }
55595b482a8SLen Brown }
55695b482a8SLen Brown
acpi_rs_dump_short_byte_list(u8 length,u8 * data)55795b482a8SLen Brown static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
55895b482a8SLen Brown {
55995b482a8SLen Brown u8 i;
56095b482a8SLen Brown
56195b482a8SLen Brown for (i = 0; i < length; i++) {
56295b482a8SLen Brown acpi_os_printf("%X ", data[i]);
56395b482a8SLen Brown }
5641fad8738SBob Moore
56595b482a8SLen Brown acpi_os_printf("\n");
56695b482a8SLen Brown }
56795b482a8SLen Brown
acpi_rs_dump_dword_list(u8 length,u32 * data)56895b482a8SLen Brown static void acpi_rs_dump_dword_list(u8 length, u32 * data)
56995b482a8SLen Brown {
57095b482a8SLen Brown u8 i;
57195b482a8SLen Brown
57295b482a8SLen Brown for (i = 0; i < length; i++) {
57395b482a8SLen Brown acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
57495b482a8SLen Brown }
57595b482a8SLen Brown }
57695b482a8SLen Brown
acpi_rs_dump_word_list(u16 length,u16 * data)577e0fe0a8dSLin Ming static void acpi_rs_dump_word_list(u16 length, u16 *data)
578e0fe0a8dSLin Ming {
579e0fe0a8dSLin Ming u16 i;
580e0fe0a8dSLin Ming
581e0fe0a8dSLin Ming for (i = 0; i < length; i++) {
582e0fe0a8dSLin Ming acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]);
583e0fe0a8dSLin Ming }
584e0fe0a8dSLin Ming }
585