提交 793c2388 编写于 作者: B Bob Moore 提交者: Len Brown

ACPI: ACPICA 20060331

Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.

Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621

Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)

Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object().  (Valery Podrezov,
Fiodor Suietov)

Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)

Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: NBob Moore <robert.moore@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 61686124
......@@ -621,9 +621,9 @@ extern u32 pmtmr_ioport;
static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
{
struct fadt_descriptor_rev2 *fadt = NULL;
struct fadt_descriptor *fadt = NULL;
fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
if (!fadt) {
printk(KERN_WARNING PREFIX "Unable to map FADT\n");
return 0;
......
......@@ -43,7 +43,7 @@ ACPI_MODULE_NAME("acpi_bus")
extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
#endif
FADT_DESCRIPTOR acpi_fadt;
struct fadt_descriptor acpi_fadt;
EXPORT_SYMBOL(acpi_fadt);
struct acpi_device *acpi_root;
......
......@@ -502,7 +502,7 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
* Delete any namespace entries created immediately underneath
* the method
*/
if (method_node->child) {
if (method_node && method_node->child) {
acpi_ns_delete_namespace_subtree(method_node);
}
......
......@@ -49,7 +49,6 @@
#include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
#include <acpi/acdebug.h>
#include <acpi/acdisasm.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dswexec")
......
......@@ -75,7 +75,18 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
if (function == ACPI_REGION_DEACTIVATE) {
if (*region_context) {
ACPI_FREE(*region_context);
local_region_context =
(struct acpi_mem_space_context *)*region_context;
/* Delete a cached mapping if present */
if (local_region_context->mapped_length) {
acpi_os_unmap_memory(local_region_context->
mapped_logical_address,
local_region_context->
mapped_length);
}
ACPI_FREE(local_region_context);
*region_context = NULL;
}
return_ACPI_STATUS(AE_OK);
......
......@@ -61,6 +61,10 @@ static void acpi_ex_out_pointer(char *title, void *value);
static void acpi_ex_out_address(char *title, acpi_physical_address value);
static void
acpi_ex_dump_object(union acpi_operand_object *obj_desc,
struct acpi_exdump_info *info);
static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
static void
......@@ -263,7 +267,7 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
};
static struct acpi_exdump_info acpi_ex_dump_node[6] = {
static struct acpi_exdump_info acpi_ex_dump_node[5] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
......
......@@ -179,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
for (index = 0;
(index < ACPI_NAME_SIZE)
&& (acpi_ut_valid_acpi_character(*aml_address)); index++) {
&& (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
char_buf[index] = *aml_address++;
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
}
......
......@@ -66,7 +66,7 @@ acpi_status acpi_get_timer_resolution(u32 * resolution)
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
if (0 == acpi_gbl_FADT->tmr_val_ext) {
if (acpi_gbl_FADT->tmr_val_ext == 0) {
*resolution = 24;
} else {
*resolution = 32;
......@@ -153,7 +153,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
if (start_ticks < end_ticks) {
delta_ticks = end_ticks - start_ticks;
} else if (start_ticks > end_ticks) {
if (0 == acpi_gbl_FADT->tmr_val_ext) {
if (acpi_gbl_FADT->tmr_val_ext == 0) {
/* 24-bit Timer */
......
......@@ -211,6 +211,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
acpi_ut_get_node_name(parent_node),
acpi_ut_get_type_name(parent_node->type),
parent_node));
return_VOID;
}
/*******************************************************************************
......
......@@ -204,6 +204,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
}
if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
this_node->name.integer =
acpi_ut_repair_name(this_node->name.integer);
ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
this_node->name.integer));
}
......
......@@ -128,9 +128,8 @@ acpi_ns_search_node(u32 target_name,
next_node->object);
}
/*
* Found matching entry.
*/
/* Found matching entry */
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
ACPI_CAST_PTR(char, &target_name),
......@@ -248,10 +247,8 @@ acpi_ns_search_parent_tree(u32 target_name,
return_ACPI_STATUS(status);
}
/*
* Not found here, go up another level
* (until we reach the root)
*/
/* Not found here, go up another level (until we reach the root) */
parent_node = acpi_ns_get_parent_node(parent_node);
}
......@@ -307,12 +304,29 @@ acpi_ns_search_and_enter(u32 target_name,
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Name must consist of printable characters */
/*
* Name must consist of valid ACPI characters. We will repair the name if
* necessary because we don't want to abort because of this, but we want
* all namespace names to be printable. A warning message is appropriate.
*
* This issue came up because there are in fact machines that exhibit
* this problem, and we want to be able to enable ACPI support for them,
* even though there are a few bad names.
*/
if (!acpi_ut_valid_acpi_name(target_name)) {
ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X",
target_name));
return_ACPI_STATUS(AE_BAD_CHARACTER);
target_name = acpi_ut_repair_name(target_name);
/* Report warning only if in strict mode or debug mode */
if (!acpi_gbl_enable_interpreter_slack) {
ACPI_WARNING((AE_INFO,
"Found bad character(s) in name, repaired: [%4.4s]\n",
ACPI_CAST_PTR(char, &target_name)));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Found bad character(s) in name, repaired: [%4.4s]\n",
ACPI_CAST_PTR(char, &target_name)));
}
}
/* Try to find the name in the namespace level specified by the caller */
......@@ -328,10 +342,8 @@ acpi_ns_search_and_enter(u32 target_name,
status = AE_ALREADY_EXISTS;
}
/*
* Either found it or there was an error
* -- finished either way
*/
/* Either found it or there was an error: finished either way */
return_ACPI_STATUS(status);
}
......@@ -357,9 +369,8 @@ acpi_ns_search_and_enter(u32 target_name,
}
}
/*
* In execute mode, just search, never add names. Exit now.
*/
/* In execute mode, just search, never add names. Exit now */
if (interpreter_mode == ACPI_IMODE_EXECUTE) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"%4.4s Not found in %p [Not adding]\n",
......@@ -379,6 +390,5 @@ acpi_ns_search_and_enter(u32 target_name,
acpi_ns_install_node(walk_state, node, new_node, type);
*return_node = new_node;
return_ACPI_STATUS(AE_OK);
}
......@@ -747,7 +747,19 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}
status2 =
acpi_ds_result_stack_pop
(walk_state);
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}
acpi_ut_delete_generic_state
(acpi_ut_pop_generic_state
(&walk_state->control_state));
}
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types,
&walk_state->arg_count);
......
......@@ -143,7 +143,7 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state,
acpi_status
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object *op,
u32 remaining_args, u8 arg_count)
u32 remaining_args, u32 arg_count)
{
union acpi_generic_state *scope;
......@@ -196,7 +196,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
void
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object **op, u32 * arg_list, u8 * arg_count)
union acpi_parse_object **op, u32 * arg_list, u32 * arg_count)
{
union acpi_generic_state *scope = parser_state->scope;
......
......@@ -64,10 +64,11 @@ ACPI_MODULE_NAME("rslist")
acpi_status
acpi_rs_convert_aml_to_resources(u8 * aml,
u32 length,
u32 offset,
u8 resource_index, void **resource_ptr)
u32 offset, u8 resource_index, void **context)
{
struct acpi_resource *resource = *resource_ptr;
struct acpi_resource **resource_ptr =
ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context);
struct acpi_resource *resource;
acpi_status status;
ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
......@@ -76,6 +77,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
* Check that the input buffer and all subsequent pointers into it
* are aligned on a native word boundary. Most important on IA64
*/
resource = *resource_ptr;
if (ACPI_IS_MISALIGNED(resource)) {
ACPI_WARNING((AE_INFO,
"Misaligned resource pointer %p", resource));
......
......@@ -39,7 +39,7 @@ ACPI_MODULE_NAME("acpi_system")
#define ACPI_SYSTEM_FILE_EVENT "event"
#define ACPI_SYSTEM_FILE_DSDT "dsdt"
#define ACPI_SYSTEM_FILE_FADT "fadt"
extern FADT_DESCRIPTOR acpi_fadt;
extern struct fadt_descriptor acpi_fadt;
/* --------------------------------------------------------------------------
FS Interface (/proc)
......
......@@ -282,8 +282,8 @@ acpi_get_table_header_early(enum acpi_table_id id,
/* Map the DSDT header via the pointer in the FADT */
if (id == ACPI_DSDT) {
struct fadt_descriptor_rev2 *fadt =
(struct fadt_descriptor_rev2 *)*header;
struct fadt_descriptor *fadt =
(struct fadt_descriptor *)*header;
if (fadt->revision == 3 && fadt->Xdsdt) {
*header = (void *)__acpi_map_table(fadt->Xdsdt,
......
......@@ -54,12 +54,12 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
acpi_physical_address address);
static void
acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt,
struct fadt_descriptor_rev1 *original_fadt);
static void
acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
struct fadt_descriptor_rev2 *original_fadt);
acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt,
struct fadt_descriptor *original_fadt);
u8 acpi_fadt_is_v1;
ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1)
......@@ -120,7 +120,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
{
acpi_size table_size;
u32 i;
XSDT_DESCRIPTOR *new_table;
struct xsdt_descriptor *new_table;
ACPI_FUNCTION_ENTRY();
......@@ -151,12 +151,12 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
ACPI_STORE_ADDRESS(new_table->table_offset_entry[i],
(ACPI_CAST_PTR
(struct rsdt_descriptor_rev1,
(struct rsdt_descriptor,
table_info->pointer))->
table_offset_entry[i]);
} else {
new_table->table_offset_entry[i] =
(ACPI_CAST_PTR(XSDT_DESCRIPTOR,
(ACPI_CAST_PTR(struct xsdt_descriptor,
table_info->pointer))->
table_offset_entry[i];
}
......@@ -218,7 +218,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
******************************************************************************/
static void
acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt,
struct fadt_descriptor_rev1 *original_fadt)
{
......@@ -364,14 +364,13 @@ acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
******************************************************************************/
static void
acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
struct fadt_descriptor_rev2 *original_fadt)
acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt,
struct fadt_descriptor *original_fadt)
{
/* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
ACPI_MEMCPY(local_fadt, original_fadt,
sizeof(struct fadt_descriptor_rev2));
ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor));
/*
* "X" fields are optional extensions to the original V1.0 fields, so
......@@ -490,7 +489,7 @@ acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
acpi_status acpi_tb_convert_table_fadt(void)
{
struct fadt_descriptor_rev2 *local_fadt;
struct fadt_descriptor *local_fadt;
struct acpi_table_desc *table_desc;
ACPI_FUNCTION_TRACE("tb_convert_table_fadt");
......@@ -507,13 +506,13 @@ acpi_status acpi_tb_convert_table_fadt(void)
/* Allocate buffer for the ACPI 2.0(+) FADT */
local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor_rev2));
local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor));
if (!local_fadt) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) {
if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor)) {
/* Length is too short to be a V2.0 table */
......@@ -538,7 +537,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
/* Global FADT pointer will point to the new common V2.0 FADT */
acpi_gbl_FADT = local_fadt;
acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR);
acpi_gbl_FADT->length = sizeof(struct fadt_descriptor);
/* Free the original table */
......@@ -550,7 +549,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
table_desc->pointer =
ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT);
table_desc->allocation = ACPI_MEM_ALLOCATED;
table_desc->length = sizeof(struct fadt_descriptor_rev2);
table_desc->length = sizeof(struct fadt_descriptor);
/* Dump the entire FADT */
......
......@@ -280,7 +280,8 @@ acpi_status acpi_tb_get_table_rsdt(void)
return_ACPI_STATUS(status);
}
acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer);
acpi_gbl_XSDT =
ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
return_ACPI_STATUS(status);
......
......@@ -193,73 +193,119 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
/*******************************************************************************
*
* FUNCTION: acpi_tb_verify_table_checksum
* FUNCTION: acpi_tb_sum_table
*
* PARAMETERS: *table_header - ACPI table to verify
* PARAMETERS: Buffer - Buffer to sum
* Length - Size of the buffer
*
* RETURN: 8 bit checksum of table
* RETURN: 8 bit sum of buffer
*
* DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct
* table should have a checksum of 0.
* DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it.
*
******************************************************************************/
acpi_status
acpi_tb_verify_table_checksum(struct acpi_table_header * table_header)
u8 acpi_tb_sum_table(void *buffer, u32 length)
{
acpi_native_uint i;
u8 sum = 0;
if (!buffer || !length) {
return (0);
}
for (i = 0; i < length; i++) {
sum = (u8) (sum + ((u8 *) buffer)[i]);
}
return (sum);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_generate_checksum
*
* PARAMETERS: Table - Pointer to a valid ACPI table (with a
* standard ACPI header)
*
* RETURN: 8 bit checksum of buffer
*
* DESCRIPTION: Computes an 8 bit checksum of the table.
*
******************************************************************************/
u8 acpi_tb_generate_checksum(struct acpi_table_header * table)
{
u8 checksum;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("tb_verify_table_checksum");
/* Sum the entire table as-is */
/* Compute the checksum on the table */
checksum = acpi_tb_sum_table(table, table->length);
checksum =
acpi_tb_generate_checksum(table_header, table_header->length);
/* Subtract off the existing checksum value in the table */
/* Return the appropriate exception */
checksum = (u8) (checksum - table->checksum);
if (checksum) {
ACPI_WARNING((AE_INFO,
"Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)",
table_header->signature,
(u32) table_header->checksum, (u32) checksum));
/* Compute the final checksum */
status = AE_BAD_CHECKSUM;
}
return_ACPI_STATUS(status);
checksum = (u8) (0 - checksum);
return (checksum);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_generate_checksum
* FUNCTION: acpi_tb_set_checksum
*
* PARAMETERS: Buffer - Buffer to checksum
* Length - Size of the buffer
* PARAMETERS: Table - Pointer to a valid ACPI table (with a
* standard ACPI header)
*
* RETURN: 8 bit checksum of buffer
* RETURN: None. Sets the table checksum field
*
* DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it.
* DESCRIPTION: Computes an 8 bit checksum of the table and inserts the
* checksum into the table header.
*
******************************************************************************/
u8 acpi_tb_generate_checksum(void *buffer, u32 length)
void acpi_tb_set_checksum(struct acpi_table_header *table)
{
u8 *end_buffer;
u8 *rover;
u8 sum = 0;
if (buffer && length) {
table->checksum = acpi_tb_generate_checksum(table);
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_verify_table_checksum
*
* PARAMETERS: *table_header - ACPI table to verify
*
* RETURN: 8 bit checksum of table
*
* DESCRIPTION: Generates an 8 bit checksum of table and returns and compares
* it to the existing checksum value.
*
******************************************************************************/
acpi_status
acpi_tb_verify_table_checksum(struct acpi_table_header *table_header)
{
u8 checksum;
ACPI_FUNCTION_TRACE("tb_verify_table_checksum");
/* Compute the checksum on the table */
/* Buffer and Length are valid */
checksum = acpi_tb_generate_checksum(table_header);
end_buffer = ACPI_ADD_PTR(u8, buffer, length);
/* Checksum ok? */
for (rover = buffer; rover < end_buffer; rover++) {
sum = (u8) (sum + *rover);
}
if (checksum == table_header->checksum) {
return_ACPI_STATUS(AE_OK);
}
return (sum);
ACPI_WARNING((AE_INFO,
"Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X",
table_header->signature, table_header->checksum,
checksum));
return_ACPI_STATUS(AE_BAD_CHECKSUM);
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
......@@ -278,7 +324,7 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length)
acpi_status
acpi_tb_handle_to_object(u16 table_id,
struct acpi_table_desc ** return_table_desc)
struct acpi_table_desc **return_table_desc)
{
u32 i;
struct acpi_table_desc *table_desc;
......
......@@ -81,15 +81,14 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp)
/* Check the standard checksum */
if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
return (AE_BAD_CHECKSUM);
}
/* Check extended checksum if table version >= 2 */
if ((rsdp->revision >= 2) &&
(acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) !=
0)) {
(acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
return (AE_BAD_CHECKSUM);
}
......@@ -308,12 +307,12 @@ acpi_get_firmware_table(acpi_string signature,
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
address.pointer.value =
(ACPI_CAST_PTR
(RSDT_DESCRIPTOR,
(struct rsdt_descriptor,
rsdt_info->pointer))->table_offset_entry[i];
} else {
address.pointer.value =
(ACPI_CAST_PTR
(XSDT_DESCRIPTOR,
(struct xsdt_descriptor,
rsdt_info->pointer))->table_offset_entry[i];
}
......
......@@ -517,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number,
*
******************************************************************************/
void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
{
acpi_native_uint i = 0;
acpi_native_uint j;
u32 temp32;
u8 buf_char;
/* Only dump the buffer if tracing is enabled */
if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
(component_id & acpi_dbg_layer))) {
return;
}
if ((count < 4) || (count & 0x01)) {
display = DB_BYTE_DISPLAY;
}
......@@ -556,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
}
switch (display) {
case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
acpi_os_printf("%02X ", buffer[i + j]);
......@@ -613,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
return;
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_dump_buffer
*
* PARAMETERS: Buffer - Buffer to dump
* Count - Amount to dump, in bytes
* Display - BYTE, WORD, DWORD, or QWORD display
* component_iD - Caller's component ID
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
{
/* Only dump the buffer if tracing is enabled */
if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
(component_id & acpi_dbg_layer))) {
return;
}
acpi_ut_dump_buffer2(buffer, count, display);
}
......@@ -202,8 +202,20 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
if (handler_desc) {
if (handler_desc->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
obj_pointer =
second_desc->extra.region_context;
/* Deactivate region and free region context */
if (handler_desc->address_space.setup) {
(void)handler_desc->
address_space.setup(object,
ACPI_REGION_DEACTIVATE,
handler_desc->
address_space.
context,
&second_desc->
extra.
region_context);
}
}
acpi_ut_remove_reference(handler_desc);
......
......@@ -642,7 +642,7 @@ char *acpi_ut_get_node_name(void *object)
/* Name must be a valid ACPI name */
if (!acpi_ut_valid_acpi_name(node->name.integer)) {
return ("????");
node->name.integer = acpi_ut_repair_name(node->name.integer);
}
/* Return the name */
......
......@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit")
/* Local prototypes */
static void
acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset);
acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset);
static void acpi_ut_terminate(void);
......@@ -69,12 +69,12 @@ static void acpi_ut_terminate(void);
******************************************************************************/
static void
acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset)
acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset)
{
ACPI_WARNING((AE_INFO,
"Invalid FADT value %s=%X at offset %X FADT=%p",
register_name, value, (u32) offset, acpi_gbl_FADT));
register_name, value, offset, acpi_gbl_FADT));
}
/******************************************************************************
......
......@@ -47,6 +47,33 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utmisc")
/*******************************************************************************
*
* FUNCTION: acpi_ut_is_aml_table
*
* PARAMETERS: Table - An ACPI table
*
* RETURN: TRUE if table contains executable AML; FALSE otherwise
*
* DESCRIPTION: Check ACPI Signature for a table that contains AML code.
* Currently, these are DSDT,SSDT,PSDT. All other table types are
* data tables that do not contain AML code.
*
******************************************************************************/
u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
{
/* Ignore tables that contain AML */
if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) ||
ACPI_COMPARE_NAME(table->signature, PSDT_SIG) ||
ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) {
return (TRUE);
}
return (FALSE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_allocate_owner_id
......@@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc")
* when the method exits or the table is unloaded.
*
******************************************************************************/
acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
{
acpi_native_uint i;
......@@ -467,6 +495,41 @@ acpi_ut_display_init_pathname(u8 type,
}
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ut_valid_acpi_char
*
* PARAMETERS: Char - The character to be examined
*
* RETURN: TRUE if the character is valid, FALSE otherwise
*
* DESCRIPTION: Check for a valid ACPI character. Must be one of:
* 1) Upper case alpha
* 2) numeric
* 3) underscore
*
* We allow a '!' as the last character because of the ASF! table
*
******************************************************************************/
u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position)
{
if (!((character >= 'A' && character <= 'Z') ||
(character >= '0' && character <= '9') || (character == '_'))) {
/* Allow a '!' in the last position */
if (character == '!' && position == 3) {
return (TRUE);
}
return (FALSE);
}
return (TRUE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_valid_acpi_name
......@@ -484,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type,
u8 acpi_ut_valid_acpi_name(u32 name)
{
char *name_ptr = (char *)&name;
char character;
acpi_native_uint i;
ACPI_FUNCTION_ENTRY();
for (i = 0; i < ACPI_NAME_SIZE; i++) {
character = *name_ptr;
name_ptr++;
if (!((character == '_') ||
(character >= 'A' && character <= 'Z') ||
(character >= '0' && character <= '9'))) {
if (!acpi_ut_valid_acpi_char
((ACPI_CAST_PTR(char, &name))[i], i)) {
return (FALSE);
}
}
......@@ -506,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name)
/*******************************************************************************
*
* FUNCTION: acpi_ut_valid_acpi_character
* FUNCTION: acpi_ut_repair_name
*
* PARAMETERS: Character - The character to be examined
* PARAMETERS: Name - The ACPI name to be repaired
*
* RETURN: 1 if Character may appear in a name, else 0
* RETURN: Repaired version of the name
*
* DESCRIPTION: Check for a printable character
* DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
* return the new name.
*
******************************************************************************/
u8 acpi_ut_valid_acpi_character(char character)
acpi_name acpi_ut_repair_name(acpi_name name)
{
char *name_ptr = ACPI_CAST_PTR(char, &name);
char new_name[ACPI_NAME_SIZE];
acpi_native_uint i;
ACPI_FUNCTION_ENTRY();
for (i = 0; i < ACPI_NAME_SIZE; i++) {
new_name[i] = name_ptr[i];
/*
* Replace a bad character with something printable, yet technically
* still invalid. This prevents any collisions with existing "good"
* names in the namespace.
*/
if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) {
new_name[i] = '*';
}
}
return ((u8) ((character == '_') ||
(character >= 'A' && character <= 'Z') ||
(character >= '0' && character <= '9')));
return (*ACPI_CAST_PTR(u32, new_name));
}
/*******************************************************************************
......
......@@ -258,7 +258,7 @@ static const u8 acpi_gbl_resource_types[] = {
acpi_status
acpi_ut_walk_aml_resources(u8 * aml,
acpi_size aml_length,
acpi_walk_aml_callback user_function, void *context)
acpi_walk_aml_callback user_function, void **context)
{
acpi_status status;
u8 *end_aml;
......@@ -319,7 +319,7 @@ acpi_ut_walk_aml_resources(u8 * aml,
/* Return the pointer to the end_tag if requested */
if (!user_function) {
*(void **)context = aml;
*context = aml;
}
/* Normal exit */
......@@ -610,7 +610,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer,
obj_desc->buffer.length, NULL,
end_tag);
(void **)end_tag);
return_ACPI_STATUS(status);
}
......@@ -321,8 +321,8 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
*
* RETURN: None
*
* DESCRIPTION: Put a state object back into the global state cache. The object
* is not actually freed at this time.
* DESCRIPTION: Release a state object to the state cache. NULL state objects
* are ignored.
*
******************************************************************************/
......@@ -330,6 +330,10 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state)
{
ACPI_FUNCTION_TRACE("ut_delete_generic_state");
(void)acpi_os_release_object(acpi_gbl_state_cache, state);
/* Ignore null state */
if (state) {
(void)acpi_os_release_object(acpi_gbl_state_cache, state);
}
return_VOID;
}
......@@ -63,7 +63,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20060317
#define ACPI_CA_VERSION 0x20060331
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
......
......@@ -59,14 +59,52 @@ struct acpi_external_list {
extern struct acpi_external_list *acpi_gbl_external_list;
/* Strings used for decoding flags to ASL keywords */
typedef const struct acpi_dmtable_info {
u8 opcode;
u8 offset;
char *name;
extern const char *acpi_gbl_word_decode[4];
extern const char *acpi_gbl_irq_decode[2];
extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
} acpi_dmtable_info;
/*
* Values for Opcode above.
* Note: 0-7 must not change, used as a flag shift value
*/
#define ACPI_DMT_FLAG0 0
#define ACPI_DMT_FLAG1 1
#define ACPI_DMT_FLAG2 2
#define ACPI_DMT_FLAG3 3
#define ACPI_DMT_FLAG4 4
#define ACPI_DMT_FLAG5 5
#define ACPI_DMT_FLAG6 6
#define ACPI_DMT_FLAG7 7
#define ACPI_DMT_FLAGS0 8
#define ACPI_DMT_FLAGS2 9
#define ACPI_DMT_UINT8 10
#define ACPI_DMT_UINT16 11
#define ACPI_DMT_UINT24 12
#define ACPI_DMT_UINT32 13
#define ACPI_DMT_UINT56 14
#define ACPI_DMT_UINT64 15
#define ACPI_DMT_STRING 16
#define ACPI_DMT_NAME4 17
#define ACPI_DMT_NAME6 18
#define ACPI_DMT_NAME8 19
#define ACPI_DMT_CHKSUM 20
#define ACPI_DMT_SPACEID 21
#define ACPI_DMT_GAS 22
#define ACPI_DMT_MADT 23
#define ACPI_DMT_SRAT 24
#define ACPI_DMT_EXIT 25
typedef
void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table);
struct acpi_dmtable_data {
char *signature;
struct acpi_dmtable_info *table_info;
ACPI_TABLE_HANDLER table_handler;
};
struct acpi_op_walk_info {
u32 level;
......@@ -84,6 +122,95 @@ struct acpi_resource_tag {
char *tag;
};
/* Strings used for decoding flags to ASL keywords */
extern const char *acpi_gbl_word_decode[4];
extern const char *acpi_gbl_irq_decode[2];
extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
extern struct acpi_dmtable_info acpi_dm_table_info_header[];
extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
/*
* dmtable
*/
void acpi_dm_dump_data_table(struct acpi_table_header *table);
void
acpi_dm_dump_table(u32 table_length,
u32 table_offset,
void *table,
u32 sub_table_length, struct acpi_dmtable_info *info);
void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
/*
* dmtbdump
*/
void acpi_dm_dump_asf(struct acpi_table_header *table);
void acpi_dm_dump_cpep(struct acpi_table_header *table);
void acpi_dm_dump_fadt(struct acpi_table_header *table);
void acpi_dm_dump_srat(struct acpi_table_header *table);
void acpi_dm_dump_mcfg(struct acpi_table_header *table);
void acpi_dm_dump_madt(struct acpi_table_header *table);
u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
void acpi_dm_dump_rsdt(struct acpi_table_header *table);
void acpi_dm_dump_slit(struct acpi_table_header *table);
void acpi_dm_dump_xsdt(struct acpi_table_header *table);
/*
* dmwalk
*/
......
......@@ -107,6 +107,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags;
* 3) Allow access to uninitialized locals/args (auto-init to integer 0)
* 4) Allow ANY object type to be a source operand for the Store() operator
* 5) Allow unresolved references (invalid target name) in package objects
* 6) Enable warning messages for behavior that is not ACPI spec compliant
*/
ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
......@@ -149,10 +150,10 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
ACPI_EXTERN u32 acpi_gbl_table_flags;
ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT;
ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT;
ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT;
ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS;
ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
/*
* Since there may be multiple SSDTs and PSDTs, a single pointer is not
......
......@@ -174,22 +174,28 @@ union acpi_name_union {
*
* The node is optimized for both 32-bit and 64-bit platforms:
* 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
*
* Note: The descriptor_type and Type fields must appear in the identical
* position in both the struct acpi_namespace_node and union acpi_operand_object
* structures.
*/
struct acpi_namespace_node {
union acpi_operand_object *object; /* Interpreter object */
u8 descriptor_type; /* Differentiate object descriptor types */
u8 type; /* ACPI Type associated with this name */
u8 flags; /* Miscellaneous flags */
acpi_owner_id owner_id; /* Node creator */
u8 type; /* ACPI Type associated with this name */
union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
struct acpi_namespace_node *child; /* First child */
struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
/* Fields used by the ASL compiler and disassembler only: */
/*
* The following fields are used by the ASL compiler and disassembler only
*/
#ifdef ACPI_LARGE_NAMESPACE_NODE
union acpi_parse_object *op;
u32 value;
u32 length;
#endif
};
......@@ -470,7 +476,7 @@ struct acpi_scope_state {
};
struct acpi_pscope_state {
ACPI_STATE_COMMON u8 arg_count; /* Number of fixed arguments */
ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
union acpi_parse_object *op; /* Current op being parsed */
u8 *arg_end; /* Current argument end */
u8 *pkg_end; /* Current package end */
......
......@@ -130,7 +130,6 @@
#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i)
#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
#if ACPI_MACHINE_WIDTH == 16
#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
......@@ -141,6 +140,12 @@
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
#endif
#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b)))
#else
#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), 4))
#endif
/*
* Macros for moving data around to/from buffers that are possibly unaligned.
* If the hardware supports the transfer of unaligned data, just do the store.
......
......@@ -65,6 +65,10 @@
*
* descriptor_type is used to differentiate between internal descriptors, and
* must be in the same place across all descriptors
*
* Note: The descriptor_type and Type fields must appear in the identical
* position in both the struct acpi_namespace_node and union acpi_operand_object
* structures.
*/
#define ACPI_OBJECT_COMMON_HEADER \
union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
......
......@@ -46,9 +46,9 @@
#define OP_HAS_RETURN_VALUE 1
/* variable # arguments */
/* Variable number of arguments. This field must be 32 bits */
#define ACPI_VAR_ARGS ACPI_UINT8_MAX
#define ACPI_VAR_ARGS ACPI_UINT32_MAX
#define ACPI_PARSE_DELETE_TREE 0x0001
#define ACPI_PARSE_NO_TREE_DELETE 0x0000
......@@ -146,12 +146,13 @@ u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
void
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object **op, u32 * arg_list, u8 * arg_count);
union acpi_parse_object **op,
u32 * arg_list, u32 * arg_count);
acpi_status
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object *op,
u32 remaining_args, u8 arg_count);
u32 remaining_args, u32 arg_count);
void acpi_ps_cleanup_scope(struct acpi_parse_state *state);
......
......@@ -59,7 +59,7 @@ acpi_evaluate_reference(acpi_handle handle,
#define ACPI_BUS_FILE_ROOT "acpi"
extern struct proc_dir_entry *acpi_root_dir;
extern FADT_DESCRIPTOR acpi_fadt;
extern struct fadt_descriptor acpi_fadt;
enum acpi_bus_removal_type {
ACPI_BUS_REMOVAL_NORMAL = 0,
......
......@@ -169,8 +169,6 @@ acpi_os_queue_for_execution(u32 priority,
void acpi_os_wait_events_complete(void *context);
void acpi_os_wait_events_complete(void *context);
void acpi_os_sleep(acpi_integer milliseconds);
void acpi_os_stall(u32 microseconds);
......
......@@ -86,7 +86,7 @@ struct acpi_walk_state {
struct acpi_parse_state parser_state; /* Current state of parser */
u32 prev_arg_types;
u8 arg_count; /* push for fixed or var args */
u32 arg_count; /* push for fixed or var args */
struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
......
......@@ -136,7 +136,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc);
acpi_status
acpi_tb_verify_table_checksum(struct acpi_table_header *table_header);
u8 acpi_tb_generate_checksum(void *buffer, u32 length);
u8 acpi_tb_sum_table(void *buffer, u32 length);
u8 acpi_tb_generate_checksum(struct acpi_table_header *table);
void acpi_tb_set_checksum(struct acpi_table_header *table);
acpi_status
acpi_tb_validate_table_header(struct acpi_table_header *table_header);
......
此差异已折叠。
此差异已折叠。
......@@ -44,234 +44,6 @@
#ifndef __ACTBL2_H__
#define __ACTBL2_H__
/*
* Prefered Power Management Profiles
*/
#define PM_UNSPECIFIED 0
#define PM_DESKTOP 1
#define PM_MOBILE 2
#define PM_WORKSTATION 3
#define PM_ENTERPRISE_SERVER 4
#define PM_SOHO_SERVER 5
#define PM_APPLIANCE_PC 6
/*
* ACPI Boot Arch Flags
*/
#define BAF_LEGACY_DEVICES 0x0001
#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
#define FADT2_REVISION_ID 3
#define FADT2_MINUS_REVISION_ID 2
#pragma pack(1)
/*
* ACPI 2.0 Root System Description Table (RSDT)
*/
struct rsdt_descriptor_rev2 {
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
};
/*
* ACPI 2.0 Extended System Description Table (XSDT)
*/
struct xsdt_descriptor_rev2 {
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
};
/*
* ACPI 2.0 Firmware ACPI Control Structure (FACS)
*/
struct facs_descriptor_rev2 {
char signature[4]; /* ASCII table signature */
u32 length; /* Length of structure, in bytes */
u32 hardware_signature; /* Hardware configuration signature */
u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */
u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */
/* Flags (32 bits) */
u8 S4bios_f:1; /* 00: S4BIOS support is present */
u8:7; /* 01-07: Reserved, must be zero */
u8 reserved1[3]; /* 08-31: Reserved, must be zero */
u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */
u8 version; /* Version of this table */
u8 reserved3[31]; /* Reserved, must be zero */
};
/*
* ACPI 2.0+ Generic Address Structure (GAS)
*/
struct acpi_generic_address {
u8 address_space_id; /* Address space where struct or register exists. */
u8 register_bit_width; /* Size in bits of given register */
u8 register_bit_offset; /* Bit offset within the register */
u8 access_width; /* Minimum Access size (ACPI 3.0) */
u64 address; /* 64-bit address of struct or register */
};
#define FADT_REV2_COMMON \
u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \
u32 V1_dsdt; /* 32-bit physical address of DSDT */ \
u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \
u16 sci_int; /* System vector of SCI interrupt */ \
u32 smi_cmd; /* Port address of SMI command port */ \
u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \
u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \
u8 pstate_cnt; /* Processor performance state control*/ \
u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \
u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \
u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \
u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \
u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \
u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \
u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \
u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \
u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \
u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \
u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \
u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \
u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \
u16 flush_size; /* Number of flush strides that need to be read */ \
u16 flush_stride; /* Processor's memory cache line width, in bytes */ \
u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \
u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
u8 century; /* Index to century in RTC CMOS RAM */ \
u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
/*
* ACPI 2.0+ Fixed ACPI Description Table (FADT)
*/
struct fadt_descriptor_rev2 {
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
/* Flags (32 bits) */
u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
u8 proc_c1:1; /* 02: All processors support C1 state */
u8 plvl2_up:1; /* 03: C2 state works on MP system */
u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
u8 dock_cap:1; /* 09: Docking supported */
u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
u8 headless:1; /* 12: No local video capabilities or local input devices */
u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */
u8:4; /* 20-23: Reserved, must be zero */
u8 reserved3; /* 24-31: Reserved, must be zero */
struct acpi_generic_address reset_register; /* Reset register address in GAS format */
u8 reset_value; /* Value to write to the reset_register port to reset the system */
u8 reserved4[3]; /* These three bytes must be zero */
u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
u64 Xdsdt; /* 64-bit physical address of DSDT */
struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */
struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */
struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */
};
/* "Down-revved" ACPI 2.0 FADT descriptor */
struct fadt_descriptor_rev2_minus {
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */
u32 flags;
struct acpi_generic_address reset_register; /* Reset register address in GAS format */
u8 reset_value; /* Value to write to the reset_register port to reset the system. */
u8 reserved7[3]; /* Reserved, must be zero */
};
/* ECDT - Embedded Controller Boot Resources Table */
struct ec_boot_resources {
ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */
struct acpi_generic_address ec_data; /* Address of EC data register */
u32 uid; /* Unique ID - must be same as the EC _UID method */
u8 gpe_bit; /* The GPE for the EC */
u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
};
/* SRAT - System Resource Affinity Table */
struct static_resource_alloc {
u8 type;
u8 length;
u8 proximity_domain_lo;
u8 apic_id;
/* Flags (32 bits) */
u8 enabled:1; /* 00: Use affinity structure */
u8:7; /* 01-07: Reserved, must be zero */
u8 reserved3[3]; /* 08-31: Reserved, must be zero */
u8 local_sapic_eid;
u8 proximity_domain_hi[3];
u32 reserved4; /* Reserved, must be zero */
};
struct memory_affinity {
u8 type;
u8 length;
u32 proximity_domain;
u16 reserved3;
u64 base_address;
u64 address_length;
u32 reserved4;
/* Flags (32 bits) */
u8 enabled:1; /* 00: Use affinity structure */
u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
u8 non_volatile:1; /* 02: Memory is non-volatile */
u8:5; /* 03-07: Reserved, must be zero */
u8 reserved5[3]; /* 08-31: Reserved, must be zero */
u64 reserved6; /* Reserved, must be zero */
};
struct system_resource_affinity {
ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */
u64 reserved2; /* Reserved, must be zero */
};
/* SLIT - System Locality Distance Information Table */
struct system_locality_info {
ACPI_TABLE_HEADER_DEF u64 locality_count;
u8 entry[1][1];
};
#pragma pack()
/* Code moved to both actbl.h and actbl1.h */
#endif /* __ACTBL2_H__ */
......@@ -283,6 +283,8 @@ acpi_ut_ptr_exit(u32 line_number,
void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
void acpi_ut_report_error(char *module_name, u32 line_number);
void acpi_ut_report_info(char *module_name, u32 line_number);
......@@ -451,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
/*
* utmisc
*/
u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
......@@ -466,7 +470,9 @@ void acpi_ut_print_string(char *string, u8 max_length);
u8 acpi_ut_valid_acpi_name(u32 name);
u8 acpi_ut_valid_acpi_character(char character);
acpi_name acpi_ut_repair_name(acpi_name name);
u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position);
acpi_status
acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
......@@ -492,7 +498,7 @@ acpi_ut_display_init_pathname(u8 type,
acpi_status
acpi_ut_walk_aml_resources(u8 * aml,
acpi_size aml_length,
acpi_walk_aml_callback user_function, void *context);
acpi_walk_aml_callback user_function, void **context);
acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
......
......@@ -60,6 +60,7 @@
#define ACPI_DISASSEMBLER
#define ACPI_NO_METHOD_EXECUTION
#define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY
#endif
#ifdef ACPI_EXEC_APP
......@@ -79,6 +80,7 @@
#define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY
#endif
#ifdef ACPI_APPLICATION
......@@ -140,7 +142,7 @@
#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
#include "acdos16.h"
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include "acfreebsd.h"
#elif defined(__NetBSD__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册