linux/drivers/acpi/acpica/rsdump.c

577 lines
14 KiB
C
Raw Normal View History

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/*******************************************************************************
*
* Module Name: rsdump - AML debugger support for resource structures.
*
******************************************************************************/
#include <acpi/acpi.h>
#include "accommon.h"
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rsdump")
/*
* All functions in this module are used by the AML Debugger only
*/
ACPICA 20050408 from Bob Moore Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown <len.brown@intel.com>
2005-04-19 06:49:35 +04:00
/* Local prototypes */
static void acpi_rs_out_string(const char *title, const char *value);
static void acpi_rs_out_integer8(const char *title, u8 value);
static void acpi_rs_out_integer16(const char *title, u16 value);
static void acpi_rs_out_integer32(const char *title, u32 value);
static void acpi_rs_out_integer64(const char *title, u64 value);
static void acpi_rs_out_title(const char *title);
static void acpi_rs_dump_byte_list(u16 length, u8 *data);
static void acpi_rs_dump_word_list(u16 length, u16 *data);
static void acpi_rs_dump_dword_list(u8 length, u32 *data);
static void acpi_rs_dump_short_byte_list(u8 length, u8 *data);
static void
acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
static void
acpi_rs_dump_resource_label(char *title,
struct acpi_resource_label *resource_label);
static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
static void
acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_resource_list
*
* PARAMETERS: resource_list - Pointer to a resource descriptor list
*
* RETURN: None
*
* DESCRIPTION: Dispatches the structure to the correct dump routine.
*
******************************************************************************/
void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
{
u32 count = 0;
u32 type;
ACPI_FUNCTION_ENTRY();
/* Check if debug output enabled */
if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
return;
}
/* Walk list and dump all resource descriptors (END_TAG terminates) */
do {
acpi_os_printf("\n[%02X] ", count);
count++;
/* Validate Type before dispatch */
type = resource_list->type;
if (type > ACPI_RESOURCE_TYPE_MAX) {
acpi_os_printf
("Invalid descriptor type (%X) in resource list\n",
resource_list->type);
return;
}
/* Sanity check the length. It must not be zero, or we loop forever */
if (!resource_list->length) {
acpi_os_printf
("Invalid zero length descriptor in resource list\n");
return;
}
/* Dump the resource descriptor */
if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
acpi_rs_dump_descriptor(&resource_list->data,
acpi_gbl_dump_serial_bus_dispatch
[resource_list->data.
common_serial_bus.type]);
} else {
acpi_rs_dump_descriptor(&resource_list->data,
acpi_gbl_dump_resource_dispatch
[type]);
}
/* Point to the next resource structure */
resource_list = ACPI_NEXT_RESOURCE(resource_list);
/* Exit when END_TAG descriptor is reached */
} while (type != ACPI_RESOURCE_TYPE_END_TAG);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_irq_list
*
* PARAMETERS: route_table - Pointer to the routing table to dump.
*
* RETURN: None
*
* DESCRIPTION: Print IRQ routing table
*
******************************************************************************/
void acpi_rs_dump_irq_list(u8 *route_table)
{
struct acpi_pci_routing_table *prt_element;
u8 count;
ACPI_FUNCTION_ENTRY();
/* Check if debug output enabled */
if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
return;
}
prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
/* Dump all table elements, Exit on zero length element */
for (count = 0; prt_element->length; count++) {
acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
count);
acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
prt_element, prt_element->length);
}
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_descriptor
*
* PARAMETERS: resource - Buffer containing the resource
* table - Table entry to decode the resource
*
* RETURN: None
*
* DESCRIPTION: Dump a resource descriptor based on a dump table entry.
*
******************************************************************************/
static void
acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
{
u8 *target = NULL;
u8 *previous_target;
const char *name;
u8 count;
/* First table entry must contain the table length (# of table entries) */
count = table->offset;
while (count) {
previous_target = target;
[ACPI] ACPICA 20051117 Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-11-17 21:07:00 +03:00
target = ACPI_ADD_PTR(u8, resource, table->offset);
name = table->name;
switch (table->opcode) {
case ACPI_RSD_TITLE:
/*
* Optional resource title
*/
if (table->name) {
acpi_os_printf("%s Resource\n", name);
}
break;
/* Strings */
case ACPI_RSD_LITERAL:
acpi_rs_out_string(name,
ACPI_CAST_PTR(char, table->pointer));
break;
case ACPI_RSD_STRING:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
break;
/* Data items, 8/16/32/64 bit */
case ACPI_RSD_UINT8:
if (table->pointer) {
acpi_rs_out_string(name,
table->pointer[*target]);
} else {
acpi_rs_out_integer8(name, ACPI_GET8(target));
}
break;
case ACPI_RSD_UINT16:
[ACPI] ACPICA 20051117 Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-11-17 21:07:00 +03:00
acpi_rs_out_integer16(name, ACPI_GET16(target));
break;
case ACPI_RSD_UINT32:
[ACPI] ACPICA 20051117 Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-11-17 21:07:00 +03:00
acpi_rs_out_integer32(name, ACPI_GET32(target));
break;
[ACPI] ACPICA 20050930 Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 03:03:00 +04:00
case ACPI_RSD_UINT64:
[ACPI] ACPICA 20051117 Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-11-17 21:07:00 +03:00
acpi_rs_out_integer64(name, ACPI_GET64(target));
break;
/* Flags: 1-bit and 2-bit flags supported */
case ACPI_RSD_1BITFLAG:
acpi_rs_out_string(name,
table->pointer[*target & 0x01]);
break;
case ACPI_RSD_2BITFLAG:
acpi_rs_out_string(name,
table->pointer[*target & 0x03]);
break;
case ACPI_RSD_3BITFLAG:
acpi_rs_out_string(name,
table->pointer[*target & 0x07]);
break;
case ACPI_RSD_SHORTLIST:
/*
* Short byte list (single line output) for DMA and IRQ resources
* Note: The list length is obtained from the previous table entry
*/
if (previous_target) {
acpi_rs_out_title(name);
acpi_rs_dump_short_byte_list(*previous_target,
target);
}
break;
case ACPI_RSD_SHORTLISTX:
/*
* Short byte list (single line output) for GPIO vendor data
* Note: The list length is obtained from the previous table entry
*/
if (previous_target) {
acpi_rs_out_title(name);
acpi_rs_dump_short_byte_list(*previous_target,
*
(ACPI_CAST_INDIRECT_PTR
(u8, target)));
}
break;
case ACPI_RSD_LONGLIST:
/*
* Long byte list for Vendor resource data
* Note: The list length is obtained from the previous table entry
*/
if (previous_target) {
[ACPI] ACPICA 20051117 Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-11-17 21:07:00 +03:00
acpi_rs_dump_byte_list(ACPI_GET16
(previous_target),
target);
}
break;
case ACPI_RSD_DWORDLIST:
/*
* Dword list for Extended Interrupt resources
* Note: The list length is obtained from the previous table entry
*/
if (previous_target) {
acpi_rs_dump_dword_list(*previous_target,
ACPI_CAST_PTR(u32,
target));
}
break;
case ACPI_RSD_WORDLIST:
/*
* Word list for GPIO Pin Table
* Note: The list length is obtained from the previous table entry
*/
if (previous_target) {
acpi_rs_dump_word_list(*previous_target,
*(ACPI_CAST_INDIRECT_PTR
(u16, target)));
}
break;
case ACPI_RSD_ADDRESS:
/*
* Common flags for all Address resources
*/
acpi_rs_dump_address_common(ACPI_CAST_PTR
(union acpi_resource_data,
target));
break;
case ACPI_RSD_SOURCE:
/*
* Optional resource_source for Address resources
*/
ACPICA: Cleanup indentation to reduce differences between Linux and ACPICA. This is a cosmetic patch only. Comparison of the resulting binary showed only line number differences. This patch does not affect the generation of the Linux binary. This patch decreases 210 lines of 20121018 divergence.diff. The ACPICA source codes uses a totally different indentation style from the Linux to be compatible with other users (operating systems or BIOS). Indentation differences are critical to the release automation. There are two causes related to the "indentation" that are affecting the release automation: 1. The ACPICA -> Linux release process is: ACPICA source -- acpisrc - hierarchy - indent -> linuxized ACPICA source -- diff -> linuxized ACPICA patch (x) -- human intervention -> linuxized ACPICA patch (o) Where 'x' means "cannot be directly applied to the Linux" 'o' means "can be directly applied to the Linux" Different "indent" version or "indent" options used in the "indent" step will lead to different divergences. The version of "indent" used for the current release process is: GNU indent 2.2.11 The options of "indent" used for the current release process is: -npro -kr -i8 -ts8 -sob -l80 -ss -ncs 2. Manual indentation prettifying work in the Linux side will also harm the automatically generated linuxized ACPICA patches, making them impossible to apply directly. This patch fixes source code differences caused by the two causes so that the "human intervention" can be reduced in the future. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-12-19 09:37:15 +04:00
acpi_rs_dump_resource_source(ACPI_CAST_PTR
(struct
acpi_resource_source,
target));
break;
case ACPI_RSD_LABEL:
/*
* resource_label
*/
acpi_rs_dump_resource_label("Resource Label",
ACPI_CAST_PTR(struct
acpi_resource_label,
target));
break;
case ACPI_RSD_SOURCE_LABEL:
/*
* resource_source_label
*/
acpi_rs_dump_resource_label("Resource Source Label",
ACPI_CAST_PTR(struct
acpi_resource_label,
target));
break;
default:
acpi_os_printf("**** Invalid table opcode [%X] ****\n",
table->opcode);
return;
}
table++;
count--;
}
[ACPI] ACPICA 20050930 Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 03:03:00 +04:00
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_resource_source
*
* PARAMETERS: resource_source - Pointer to a Resource Source struct
*
* RETURN: None
*
* DESCRIPTION: Common routine for dumping the optional resource_source and the
* corresponding resource_source_index.
*
******************************************************************************/
static void
acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
{
[ACPI] ACPICA 20050930 Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 03:03:00 +04:00
ACPI_FUNCTION_ENTRY();
if (resource_source->index == 0xFF) {
return;
}
acpi_rs_out_integer8("Resource Source Index", resource_source->index);
acpi_rs_out_string("Resource Source",
resource_source->string_ptr ?
resource_source->string_ptr : "[Not Specified]");
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_resource_label
*
* PARAMETERS: title - Title of the dumped resource field
* resource_label - Pointer to a Resource Label struct
*
* RETURN: None
*
* DESCRIPTION: Common routine for dumping the resource_label
*
******************************************************************************/
static void
acpi_rs_dump_resource_label(char *title,
struct acpi_resource_label *resource_label)
{
ACPI_FUNCTION_ENTRY();
acpi_rs_out_string(title,
resource_label->string_ptr ?
resource_label->string_ptr : "[Not Specified]");
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_address_common
*
* PARAMETERS: resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
* DESCRIPTION: Dump the fields that are common to all Address resource
* descriptors
*
******************************************************************************/
static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
/* Decode the type-specific flags */
switch (resource->address.resource_type) {
case ACPI_MEMORY_RANGE:
acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
break;
case ACPI_IO_RANGE:
acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
break;
case ACPI_BUS_NUMBER_RANGE:
acpi_rs_out_string("Resource Type", "Bus Number Range");
break;
default:
acpi_rs_out_integer8("Resource Type",
(u8) resource->address.resource_type);
break;
}
/* Decode the general flags */
acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_out*
*
* PARAMETERS: title - Name of the resource field
* value - Value of the resource field
*
* RETURN: None
*
* DESCRIPTION: Miscellaneous helper functions to consistently format the
* output of the resource dump routines
*
******************************************************************************/
static void acpi_rs_out_string(const char *title, const char *value)
{
[ACPI] ACPICA 20060127 Implemented support in the Resource Manager to allow unresolved namestring references within resource package objects for the _PRT method. This support is in addition to the previously implemented unresolved reference support within the AML parser. If the interpreter slack mode is enabled (true on Linux unless acpi=strict), these unresolved references will be passed through to the caller as a NULL package entry. http://bugzilla.kernel.org/show_bug.cgi?id=5741 Implemented and deployed new macros and functions for error and warning messages across the subsystem. These macros are simpler and generate less code than their predecessors. The new macros ACPI_ERROR, ACPI_EXCEPTION, ACPI_WARNING, and ACPI_INFO replace the ACPI_REPORT_* macros. Implemented the acpi_cpu_flags type to simplify host OS integration of the Acquire/Release Lock OSL interfaces. Suggested by Steven Rostedt and Andrew Morton. Fixed a problem where Alias ASL operators are sometimes not correctly resolved. causing AE_AML_INTERNAL http://bugzilla.kernel.org/show_bug.cgi?id=5189 http://bugzilla.kernel.org/show_bug.cgi?id=5674 Fixed several problems with the implementation of the ConcatenateResTemplate ASL operator. As per the ACPI specification, zero length buffers are now treated as a single EndTag. One-length buffers always cause a fatal exception. Non-zero length buffers that do not end with a full 2-byte EndTag cause a fatal exception. Fixed a possible structure overwrite in the AcpiGetObjectInfo external interface. (With assistance from Thomas Renninger) Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2006-01-28 00:43:00 +03:00
acpi_os_printf("%27s : %s", title, value);
if (!*value) {
acpi_os_printf("[NULL NAMESTRING]");
}
acpi_os_printf("\n");
}
static void acpi_rs_out_integer8(const char *title, u8 value)
{
acpi_os_printf("%27s : %2.2X\n", title, value);
}
static void acpi_rs_out_integer16(const char *title, u16 value)
{
acpi_os_printf("%27s : %4.4X\n", title, value);
}
static void acpi_rs_out_integer32(const char *title, u32 value)
[ACPI] ACPICA 20050930 Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 03:03:00 +04:00
{
acpi_os_printf("%27s : %8.8X\n", title, value);
[ACPI] ACPICA 20050930 Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 03:03:00 +04:00
}
static void acpi_rs_out_integer64(const char *title, u64 value)
{
acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
}
static void acpi_rs_out_title(const char *title)
{
acpi_os_printf("%27s : ", title);
}
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump*List
*
* PARAMETERS: length - Number of elements in the list
* data - Start of the list
*
* RETURN: None
*
* DESCRIPTION: Miscellaneous functions to dump lists of raw data
*
******************************************************************************/
static void acpi_rs_dump_byte_list(u16 length, u8 * data)
{
u8 i;
for (i = 0; i < length; i++) {
acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
}
}
static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
{
u8 i;
for (i = 0; i < length; i++) {
acpi_os_printf("%X ", data[i]);
}
acpi_os_printf("\n");
}
static void acpi_rs_dump_dword_list(u8 length, u32 * data)
{
u8 i;
for (i = 0; i < length; i++) {
acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
}
}
static void acpi_rs_dump_word_list(u16 length, u16 *data)
{
u16 i;
for (i = 0; i < length; i++) {
acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]);
}
}