summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-10-21 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-12-10 00:22:54 -0500
commit0897831bb54eb36fd9e2a22da7f0f64be1b20d09 (patch)
tree8d77687ce8ebcfb62d6012d2d3c44f6a904b3c15 /drivers/acpi/utilities
parent50eca3eb89d73d9f0aa070b126c7ee6a616016ab (diff)
[ACPI] ACPICA 20051021
Implemented support for the EM64T and other x86_64 processors. This essentially entails recognizing that these processors support non-aligned memory transfers. Previously, all 64-bit processors were assumed to lack hardware support for non-aligned transfers. Completed conversion of the Resource Manager to nearly full table-driven operation. Specifically, the resource conversion code (convert AML to internal format and the reverse) and the debug code to dump internal resource descriptors are fully table-driven, reducing code and data size and improving maintainability. The OSL interfaces for Acquire and Release Lock now use a 64-bit flag word on 64-bit processors instead of a fixed 32-bit word. (Alexey Starikovskiy) Implemented support within the resource conversion code for the Type-Specific byte within the various ACPI 3.0 *WordSpace macros. Fixed some issues within the resource conversion code for the type-specific flags for both Memory and I/O address resource descriptors. For Memory, implemented support for the MTP and TTP flags. For I/O, split the TRS and TTP flags into two separate fields. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utalloc.c2
-rw-r--r--drivers/acpi/utilities/utglobal.c64
-rw-r--r--drivers/acpi/utilities/utmisc.c146
3 files changed, 159 insertions, 53 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index dc7f24b3a1c..e04b6119a4d 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -866,7 +866,7 @@ void acpi_ut_dump_allocations(u32 component, char *module)
if (!num_outstanding) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "No outstanding allocations.\n"));
+ "No outstanding allocations\n"));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"%d(%X) Outstanding allocations\n",
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 7f72839841c..413e1dd8ae3 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -217,23 +217,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
* 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
* perform a Notify() operation on it.
*/
-const struct acpi_predefined_names acpi_gbl_pre_defined_names[] =
- { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
-{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
-{"_SB_", ACPI_TYPE_DEVICE, NULL},
-{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
-{"_TZ_", ACPI_TYPE_THERMAL, NULL},
-{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
-{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
-{"_GL_", ACPI_TYPE_MUTEX, (char *)1},
+const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
+ {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_SB_", ACPI_TYPE_DEVICE, NULL},
+ {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+ {"_TZ_", ACPI_TYPE_THERMAL, NULL},
+ {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
+ {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
+ {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
-{"_OSI", ACPI_TYPE_METHOD, (char *)1},
+ {"_OSI", ACPI_TYPE_METHOD, (char *)1},
#endif
/* Table terminator */
-{NULL, ACPI_TYPE_ANY, NULL}
+ {NULL, ACPI_TYPE_ANY, NULL}
};
/*
@@ -503,11 +503,13 @@ char *acpi_ut_get_region_name(u8 space_id)
/* Event type decoding */
static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
+/*! [Begin] no source code translation (keep these strings as-is) */
"PM_Timer",
- "global_lock",
- "power_button",
- "sleep_button",
- "real_time_clock",
+ "GlobalLock",
+ "PowerButton",
+ "SleepButton",
+ "RealTimeClock",
+/*! [End] no source code translation !*/
};
char *acpi_ut_get_event_name(u32 event_id)
@@ -545,12 +547,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED";
/* Printable names of the ACPI object types */
static const char *acpi_gbl_ns_type_names[] = {
+/*! [Begin] no source code translation (keep these strings as-is) */
/* 00 */ "Untyped",
/* 01 */ "Integer",
/* 02 */ "String",
/* 03 */ "Buffer",
/* 04 */ "Package",
- /* 05 */ "field_unit",
+ /* 05 */ "FieldUnit",
/* 06 */ "Device",
/* 07 */ "Event",
/* 08 */ "Method",
@@ -559,23 +562,24 @@ static const char *acpi_gbl_ns_type_names[] = {
/* 11 */ "Power",
/* 12 */ "Processor",
/* 13 */ "Thermal",
- /* 14 */ "buffer_field",
- /* 15 */ "ddb_handle",
- /* 16 */ "debug_object",
- /* 17 */ "region_field",
- /* 18 */ "bank_field",
- /* 19 */ "index_field",
+ /* 14 */ "BufferField",
+ /* 15 */ "DdbHandle",
+ /* 16 */ "DebugObject",
+ /* 17 */ "RegionField",
+ /* 18 */ "BankField",
+ /* 19 */ "IndexField",
/* 20 */ "Reference",
/* 21 */ "Alias",
- /* 22 */ "method_alias",
+ /* 22 */ "MethodAlias",
/* 23 */ "Notify",
- /* 24 */ "addr_handler",
- /* 25 */ "resource_desc",
- /* 26 */ "resource_fld",
+ /* 24 */ "AddrHandler",
+ /* 25 */ "ResourceDesc",
+ /* 26 */ "ResourceFld",
/* 27 */ "Scope",
/* 28 */ "Extra",
/* 29 */ "Data",
/* 30 */ "Invalid"
+/*! [End] no source code translation !*/
};
char *acpi_ut_get_type_name(acpi_object_type type)
@@ -658,15 +662,16 @@ char *acpi_ut_get_node_name(void *object)
/* Printable names of object descriptor types */
static const char *acpi_gbl_desc_type_names[] = {
+/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
/* 00 */ "Invalid",
/* 01 */ "Cached",
/* 02 */ "State-Generic",
/* 03 */ "State-Update",
/* 04 */ "State-Package",
/* 05 */ "State-Control",
- /* 06 */ "State-root_parse_scope",
- /* 07 */ "State-parse_scope",
- /* 08 */ "State-walk_scope",
+ /* 06 */ "State-RootParseScope",
+ /* 07 */ "State-ParseScope",
+ /* 08 */ "State-WalkScope",
/* 09 */ "State-Result",
/* 10 */ "State-Notify",
/* 11 */ "State-Thread",
@@ -674,6 +679,7 @@ static const char *acpi_gbl_desc_type_names[] = {
/* 13 */ "Parser",
/* 14 */ "Operand",
/* 15 */ "Node"
+/*! [End] no source code translation !*/
};
char *acpi_ut_get_descriptor_name(void *object)
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index b57afa7421e..e9058d4da12 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -43,6 +43,7 @@
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
+#include <acpi/amlresrc.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utmisc")
@@ -790,48 +791,147 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
/*******************************************************************************
*
+ * FUNCTION: acpi_ut_get_resource_type
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: The Resource Type with no extraneous bits (except the
+ * Large/Small descriptor bit -- this is left alone)
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
+
+u8 acpi_ut_get_resource_type(void *aml)
+{
+ ACPI_FUNCTION_ENTRY();
+
+ /*
+ * Byte 0 contains the descriptor name (Resource Type)
+ * Determine if this is a small or large resource
+ */
+ if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource Type -- bits 6:0 contain the name */
+
+ return (*((u8 *) aml));
+ } else {
+ /* Small Resource Type -- bits 6:3 contain the name */
+
+ return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ut_get_resource_length
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte Length
+ *
+ * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
+ * definition, this does not include the size of the descriptor
+ * header or the length field itself.
+ *
+ ******************************************************************************/
+
+u16 acpi_ut_get_resource_length(void *aml)
+{
+ u16 resource_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /*
+ * Byte 0 contains the descriptor name (Resource Type)
+ * Determine if this is a small or large resource
+ */
+ if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+
+ ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]);
+
+ } else {
+ /* Small Resource type -- bits 2:0 of byte 0 contain the length */
+
+ resource_length = (u16) (*((u8 *) aml) &
+ ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
+ }
+
+ return (resource_length);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ut_get_descriptor_length
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte length
+ *
+ * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
+ * length of the descriptor header and the length field itself.
+ * Used to walk descriptor lists.
+ *
+ ******************************************************************************/
+
+u32 acpi_ut_get_descriptor_length(void *aml)
+{
+ u32 descriptor_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /* First get the Resource Length (Does not include header length) */
+
+ descriptor_length = acpi_ut_get_resource_length(aml);
+
+ /* Determine if this is a small or large resource */
+
+ if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) {
+ descriptor_length += sizeof(struct aml_resource_large_header);
+ } else {
+ descriptor_length += sizeof(struct aml_resource_small_header);
+ }
+
+ return (descriptor_length);
+}
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_ut_get_resource_end_tag
*
* PARAMETERS: obj_desc - The resource template buffer object
*
* RETURN: Pointer to the end tag
*
- * DESCRIPTION: Find the END_TAG resource descriptor in a resource template
+ * DESCRIPTION: Find the END_TAG resource descriptor in an AML resource template
*
******************************************************************************/
u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc)
{
- u8 buffer_byte;
- u8 *buffer;
- u8 *end_buffer;
-
- buffer = obj_desc->buffer.pointer;
- end_buffer = buffer + obj_desc->buffer.length;
+ u8 *aml;
+ u8 *end_aml;
- while (buffer < end_buffer) {
- buffer_byte = *buffer;
- if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) {
- /* Large Descriptor - Length is next 2 bytes */
+ aml = obj_desc->buffer.pointer;
+ end_aml = aml + obj_desc->buffer.length;
- buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3);
- } else {
- /* Small Descriptor. End Tag will be found here */
+ /* Walk the resource template, one descriptor per loop */
- if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) ==
- ACPI_RESOURCE_NAME_END_TAG) {
- /* Found the end tag descriptor, all done. */
+ while (aml < end_aml) {
+ if (acpi_ut_get_resource_type(aml) ==
+ ACPI_RESOURCE_NAME_END_TAG) {
+ /* Found the end_tag descriptor, all done */
- return (buffer);
- }
+ return (aml);
+ }
- /* Length is in the header */
+ /* Point to the next resource descriptor */
- buffer += ((buffer_byte & 0x07) + 1);
- }
+ aml += acpi_ut_get_resource_length(aml);
}
- /* End tag not found */
+ /* End tag was not found */
return (NULL);
}