Skip to content

Commit

Permalink
ACPI: ACPICA 20060331
Browse files Browse the repository at this point in the history
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: Bob Moore <[email protected]>
Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
acpibob authored and lenb committed Jun 14, 2006
1 parent 6168612 commit 793c238
Show file tree
Hide file tree
Showing 43 changed files with 1,314 additions and 631 deletions.
4 changes: 2 additions & 2 deletions arch/i386/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/dispatcher/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/dispatcher/dswexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
13 changes: 12 additions & 1 deletion drivers/acpi/events/evrgnini.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion drivers/acpi/executer/exdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/executer/exnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/hardware/hwtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */

Expand Down
2 changes: 2 additions & 0 deletions drivers/acpi/namespace/nsalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*******************************************************************************
Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/namespace/nsdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
50 changes: 30 additions & 20 deletions drivers/acpi/namespace/nssearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 */
Expand All @@ -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);
}

Expand All @@ -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",
Expand All @@ -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);
}
12 changes: 12 additions & 0 deletions drivers/acpi/parser/psloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/parser/psscope.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
8 changes: 5 additions & 3 deletions drivers/acpi/resources/rslist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 793c238

Please sign in to comment.