mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
Pull acpica into test branch
This commit is contained in:
commit
e8bdc5a9c5
197 changed files with 5853 additions and 7818 deletions
|
|
@ -26,7 +26,7 @@
|
|||
* Pontus Fuchs - Helper functions, cleanup
|
||||
* Johann Wiesner - Small compile fixes
|
||||
* John Belmonte - ACPI code for Toshiba laptop was a good starting point.
|
||||
* Éric Burghard - LED display support for W1N
|
||||
* <EFBFBD>ic Burghard - LED display support for W1N
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1128,7 +1128,6 @@ static int asus_model_match(char *model)
|
|||
static int asus_hotk_get_info(void)
|
||||
{
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *model = NULL;
|
||||
int bsts_result;
|
||||
char *string = NULL;
|
||||
|
|
@ -1142,11 +1141,9 @@ static int asus_hotk_get_info(void)
|
|||
* HID), this bit will be moved. A global variable asus_info contains
|
||||
* the DSDT header.
|
||||
*/
|
||||
status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
|
||||
status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info);
|
||||
if (ACPI_FAILURE(status))
|
||||
printk(KERN_WARNING " Couldn't get the DSDT table header\n");
|
||||
else
|
||||
asus_info = dsdt.pointer;
|
||||
|
||||
/* We have to write 0 on init this far for all ASUS models */
|
||||
if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
|
||||
|
|
@ -1358,8 +1355,6 @@ static void __exit asus_acpi_exit(void)
|
|||
acpi_bus_unregister_driver(&asus_hotk_driver);
|
||||
remove_proc_entry(PROC_ASUS, acpi_root_dir);
|
||||
|
||||
kfree(asus_info);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ struct acpi_blacklist_item {
|
|||
char oem_id[7];
|
||||
char oem_table_id[9];
|
||||
u32 oem_revision;
|
||||
acpi_table_type table;
|
||||
char *table;
|
||||
enum acpi_blacklist_predicates oem_revision_predicate;
|
||||
char *reason;
|
||||
u32 is_critical_error;
|
||||
|
|
@ -56,18 +56,18 @@ struct acpi_blacklist_item {
|
|||
*/
|
||||
static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
|
||||
/* Compaq Presario 1700 */
|
||||
{"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal,
|
||||
{"PTLTD ", " DSDT ", 0x06040000, ACPI_SIG_DSDT, less_than_or_equal,
|
||||
"Multiple problems", 1},
|
||||
/* Sony FX120, FX140, FX150? */
|
||||
{"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal,
|
||||
{"SONY ", "U0 ", 0x20010313, ACPI_SIG_DSDT, less_than_or_equal,
|
||||
"ACPI driver problem", 1},
|
||||
/* Compaq Presario 800, Insyde BIOS */
|
||||
{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal,
|
||||
{"INT440", "SYSFexxx", 0x00001001, ACPI_SIG_DSDT, less_than_or_equal,
|
||||
"Does not use _REG to protect EC OpRegions", 1},
|
||||
/* IBM 600E - _ADR should return 7, but it returns 1 */
|
||||
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal,
|
||||
{"IBM ", "TP600E ", 0x00000105, ACPI_SIG_DSDT, less_than_or_equal,
|
||||
"Incorrect _ADR", 1},
|
||||
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions,
|
||||
{"ASUS\0\0", "P2B-S ", 0, ACPI_SIG_DSDT, all_versions,
|
||||
"Bogus PCI routing", 1},
|
||||
|
||||
{""}
|
||||
|
|
@ -79,7 +79,7 @@ static int __init blacklist_by_year(void)
|
|||
{
|
||||
int year = dmi_get_year(DMI_BIOS_DATE);
|
||||
/* Doesn't exist? Likely an old system */
|
||||
if (year == -1)
|
||||
if (year == -1)
|
||||
return 1;
|
||||
/* 0? Likely a buggy new BIOS */
|
||||
if (year == 0)
|
||||
|
|
@ -103,22 +103,21 @@ int __init acpi_blacklisted(void)
|
|||
{
|
||||
int i = 0;
|
||||
int blacklisted = 0;
|
||||
struct acpi_table_header *table_header;
|
||||
struct acpi_table_header table_header;
|
||||
|
||||
while (acpi_blacklist[i].oem_id[0] != '\0') {
|
||||
if (acpi_get_table_header_early
|
||||
(acpi_blacklist[i].table, &table_header)) {
|
||||
if (acpi_get_table_header(acpi_blacklist[i].table, 0, &table_header)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp(acpi_blacklist[i].oem_id, table_header->oem_id, 6)) {
|
||||
if (strncmp(acpi_blacklist[i].oem_id, table_header.oem_id, 6)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp
|
||||
(acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
|
||||
(acpi_blacklist[i].oem_table_id, table_header.oem_table_id,
|
||||
8)) {
|
||||
i++;
|
||||
continue;
|
||||
|
|
@ -127,14 +126,14 @@ int __init acpi_blacklisted(void)
|
|||
if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate ==
|
||||
less_than_or_equal
|
||||
&& table_header->oem_revision <=
|
||||
&& table_header.oem_revision <=
|
||||
acpi_blacklist[i].oem_revision)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate ==
|
||||
greater_than_or_equal
|
||||
&& table_header->oem_revision >=
|
||||
&& table_header.oem_revision >=
|
||||
acpi_blacklist[i].oem_revision)
|
||||
|| (acpi_blacklist[i].oem_revision_predicate == equal
|
||||
&& table_header->oem_revision ==
|
||||
&& table_header.oem_revision ==
|
||||
acpi_blacklist[i].oem_revision)) {
|
||||
|
||||
printk(KERN_ERR PREFIX
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ ACPI_MODULE_NAME("acpi_bus")
|
|||
extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
|
||||
#endif
|
||||
|
||||
struct fadt_descriptor acpi_fadt;
|
||||
EXPORT_SYMBOL(acpi_fadt);
|
||||
|
||||
struct acpi_device *acpi_root;
|
||||
struct proc_dir_entry *acpi_root_dir;
|
||||
EXPORT_SYMBOL(acpi_root_dir);
|
||||
|
|
@ -582,11 +579,12 @@ static int __init acpi_bus_init_irq(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
acpi_native_uint acpi_gbl_permanent_mmap;
|
||||
|
||||
|
||||
void __init acpi_early_init(void)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
|
||||
|
||||
|
||||
if (acpi_disabled)
|
||||
return;
|
||||
|
|
@ -597,6 +595,15 @@ void __init acpi_early_init(void)
|
|||
if (!acpi_strict)
|
||||
acpi_gbl_enable_interpreter_slack = TRUE;
|
||||
|
||||
acpi_gbl_permanent_mmap = 1;
|
||||
|
||||
status = acpi_reallocate_root_table();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(KERN_ERR PREFIX
|
||||
"Unable to reallocate ACPI tables\n");
|
||||
goto error0;
|
||||
}
|
||||
|
||||
status = acpi_initialize_subsystem();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(KERN_ERR PREFIX
|
||||
|
|
@ -611,32 +618,25 @@ void __init acpi_early_init(void)
|
|||
goto error0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a separate copy of the FADT for use by other drivers.
|
||||
*/
|
||||
status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(KERN_ERR PREFIX "Unable to get the FADT\n");
|
||||
goto error0;
|
||||
}
|
||||
#ifdef CONFIG_X86
|
||||
if (!acpi_ioapic) {
|
||||
extern acpi_interrupt_flags acpi_sci_flags;
|
||||
extern u8 acpi_sci_flags;
|
||||
|
||||
/* compatible (0) means level (3) */
|
||||
if (acpi_sci_flags.trigger == 0)
|
||||
acpi_sci_flags.trigger = 3;
|
||||
|
||||
if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) {
|
||||
acpi_sci_flags &= ~ACPI_MADT_TRIGGER_MASK;
|
||||
acpi_sci_flags |= ACPI_MADT_TRIGGER_LEVEL;
|
||||
}
|
||||
/* Set PIC-mode SCI trigger type */
|
||||
acpi_pic_sci_set_trigger(acpi_fadt.sci_int,
|
||||
acpi_sci_flags.trigger);
|
||||
acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt,
|
||||
(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
|
||||
} else {
|
||||
extern int acpi_sci_override_gsi;
|
||||
/*
|
||||
* now that acpi_fadt is initialized,
|
||||
* now that acpi_gbl_FADT is initialized,
|
||||
* update it with result from INT_SRC_OVR parsing
|
||||
*/
|
||||
acpi_fadt.sci_int = acpi_sci_override_gsi;
|
||||
acpi_gbl_FADT.sci_interrupt = acpi_sci_override_gsi;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -133,7 +133,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
|
|||
}
|
||||
}
|
||||
|
||||
/* We could put the returned object (Node) on the object stack for later,
|
||||
/*
|
||||
* We could put the returned object (Node) on the object stack for later,
|
||||
* but for now, we will put it in the "op" object that the parser uses,
|
||||
* so we can get it again at the end of this scope
|
||||
*/
|
||||
|
|
@ -514,8 +515,33 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
|
|||
|
||||
/* Third arg is the bank_value */
|
||||
|
||||
/* TBD: This arg is a term_arg, not a constant, and must be evaluated */
|
||||
|
||||
arg = arg->common.next;
|
||||
info.bank_value = (u32) arg->common.value.integer;
|
||||
|
||||
/* Currently, only the following constants are supported */
|
||||
|
||||
switch (arg->common.aml_opcode) {
|
||||
case AML_ZERO_OP:
|
||||
info.bank_value = 0;
|
||||
break;
|
||||
|
||||
case AML_ONE_OP:
|
||||
info.bank_value = 1;
|
||||
break;
|
||||
|
||||
case AML_BYTE_OP:
|
||||
case AML_WORD_OP:
|
||||
case AML_DWORD_OP:
|
||||
case AML_QWORD_OP:
|
||||
info.bank_value = (u32) arg->common.value.integer;
|
||||
break;
|
||||
|
||||
default:
|
||||
info.bank_value = 0;
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Non-constant BankValue for BankField is not implemented"));
|
||||
}
|
||||
|
||||
/* Fourth arg is the field flags */
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -44,6 +44,7 @@
|
|||
#include <acpi/acpi.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/actables.h>
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME("dsinit")
|
||||
|
|
@ -90,7 +91,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
|
|||
* We are only interested in NS nodes owned by the table that
|
||||
* was just loaded
|
||||
*/
|
||||
if (node->owner_id != info->table_desc->owner_id) {
|
||||
if (node->owner_id != info->owner_id) {
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
|
@ -150,14 +151,21 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
|
||||
acpi_ds_initialize_objects(acpi_native_uint table_index,
|
||||
struct acpi_namespace_node * start_node)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_init_walk_info info;
|
||||
struct acpi_table_header *table;
|
||||
acpi_owner_id owner_id;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ds_initialize_objects);
|
||||
|
||||
status = acpi_tb_get_owner_id(table_index, &owner_id);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"**** Starting initialization of namespace objects ****\n"));
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:"));
|
||||
|
|
@ -166,7 +174,8 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
|
|||
info.op_region_count = 0;
|
||||
info.object_count = 0;
|
||||
info.device_count = 0;
|
||||
info.table_desc = table_desc;
|
||||
info.table_index = table_index;
|
||||
info.owner_id = owner_id;
|
||||
|
||||
/* Walk entire namespace from the supplied root */
|
||||
|
||||
|
|
@ -176,10 +185,14 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
|
|||
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
|
||||
}
|
||||
|
||||
status = acpi_get_table_by_index(table_index, &table);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
|
||||
table_desc->pointer->signature,
|
||||
table_desc->owner_id, info.object_count,
|
||||
table->signature, owner_id, info.object_count,
|
||||
info.device_count, info.method_count,
|
||||
info.op_region_count));
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -327,7 +327,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
|
|||
ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state);
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"Execute method %p, currentstate=%p\n",
|
||||
"Calling method %p, currentstate=%p\n",
|
||||
this_walk_state->prev_op, this_walk_state));
|
||||
|
||||
/*
|
||||
|
|
@ -351,49 +351,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*
|
||||
* 1) Parse the method. All "normal" methods are parsed for each execution.
|
||||
* Internal methods (_OSI, etc.) do not require parsing.
|
||||
*/
|
||||
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
|
||||
|
||||
/* Create a new walk state for the parse */
|
||||
|
||||
next_walk_state =
|
||||
acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
|
||||
obj_desc, NULL);
|
||||
if (!next_walk_state) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Create and init a parse tree root */
|
||||
|
||||
op = acpi_ps_create_scope_op();
|
||||
if (!op) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
status = acpi_ds_init_aml_walk(next_walk_state, op, method_node,
|
||||
obj_desc->method.aml_start,
|
||||
obj_desc->method.aml_length,
|
||||
NULL, 1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ps_delete_parse_tree(op);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Begin AML parse (deletes next_walk_state) */
|
||||
|
||||
status = acpi_ps_parse_aml(next_walk_state);
|
||||
acpi_ps_delete_parse_tree(op);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* 2) Begin method execution. Create a new walk state */
|
||||
/* Begin method parse/execution. Create a new walk state */
|
||||
|
||||
next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id,
|
||||
NULL, obj_desc, thread);
|
||||
|
|
@ -424,7 +382,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
|
|||
|
||||
status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node,
|
||||
obj_desc->method.aml_start,
|
||||
obj_desc->method.aml_length, info, 3);
|
||||
obj_desc->method.aml_length, info,
|
||||
ACPI_IMODE_EXECUTE);
|
||||
|
||||
ACPI_FREE(info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
|
@ -445,8 +404,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
|
|||
this_walk_state->num_operands = 0;
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"Starting nested execution, newstate=%p\n",
|
||||
next_walk_state));
|
||||
"**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
|
||||
method_node->name.ascii, next_walk_state));
|
||||
|
||||
/* Invoke an internal method if necessary */
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -260,7 +260,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
|
|||
}
|
||||
|
||||
obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
|
||||
op->common.node = (struct acpi_namespace_node *)obj_desc;
|
||||
op->common.node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_desc);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +270,8 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
|
|||
*
|
||||
* PARAMETERS: walk_state - Current walk state
|
||||
* Op - Parser object to be translated
|
||||
* package_length - Number of elements in the package
|
||||
* element_count - Number of elements in the package - this is
|
||||
* the num_elements argument to Package()
|
||||
* obj_desc_ptr - Where the ACPI internal object is returned
|
||||
*
|
||||
* RETURN: Status
|
||||
|
|
@ -278,18 +279,29 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
|
|||
* DESCRIPTION: Translate a parser Op package object to the equivalent
|
||||
* namespace object
|
||||
*
|
||||
* NOTE: The number of elements in the package will be always be the num_elements
|
||||
* count, regardless of the number of elements in the package list. If
|
||||
* num_elements is smaller, only that many package list elements are used.
|
||||
* if num_elements is larger, the Package object is padded out with
|
||||
* objects of type Uninitialized (as per ACPI spec.)
|
||||
*
|
||||
* Even though the ASL compilers do not allow num_elements to be smaller
|
||||
* than the Package list length (for the fixed length package opcode), some
|
||||
* BIOS code modifies the AML on the fly to adjust the num_elements, and
|
||||
* this code compensates for that. This also provides compatibility with
|
||||
* other AML interpreters.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
|
||||
union acpi_parse_object *op,
|
||||
u32 package_length,
|
||||
u32 element_count,
|
||||
union acpi_operand_object **obj_desc_ptr)
|
||||
{
|
||||
union acpi_parse_object *arg;
|
||||
union acpi_parse_object *parent;
|
||||
union acpi_operand_object *obj_desc = NULL;
|
||||
u32 package_list_length;
|
||||
acpi_status status = AE_OK;
|
||||
acpi_native_uint i;
|
||||
|
||||
|
|
@ -318,32 +330,13 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
|
|||
obj_desc->package.node = parent->common.node;
|
||||
}
|
||||
|
||||
obj_desc->package.count = package_length;
|
||||
|
||||
/* Count the number of items in the package list */
|
||||
|
||||
arg = op->common.value.arg;
|
||||
arg = arg->common.next;
|
||||
for (package_list_length = 0; arg; package_list_length++) {
|
||||
arg = arg->common.next;
|
||||
}
|
||||
|
||||
/*
|
||||
* The package length (number of elements) will be the greater
|
||||
* of the specified length and the length of the initializer list
|
||||
*/
|
||||
if (package_list_length > package_length) {
|
||||
obj_desc->package.count = package_list_length;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the pointer array (array of pointers to the
|
||||
* individual objects). Add an extra pointer slot so
|
||||
* that the list is always null terminated.
|
||||
* Allocate the element array (array of pointers to the individual
|
||||
* objects) based on the num_elements parameter. Add an extra pointer slot
|
||||
* so that the list is always null terminated.
|
||||
*/
|
||||
obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
|
||||
obj_desc->package.
|
||||
count +
|
||||
element_count +
|
||||
1) * sizeof(void *));
|
||||
|
||||
if (!obj_desc->package.elements) {
|
||||
|
|
@ -351,15 +344,20 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
|
|||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
obj_desc->package.count = element_count;
|
||||
|
||||
/*
|
||||
* Initialize all elements of the package
|
||||
* Initialize the elements of the package, up to the num_elements count.
|
||||
* Package is automatically padded with uninitialized (NULL) elements
|
||||
* if num_elements is greater than the package list length. Likewise,
|
||||
* Package is truncated if num_elements is less than the list length.
|
||||
*/
|
||||
arg = op->common.value.arg;
|
||||
arg = arg->common.next;
|
||||
for (i = 0; arg; i++) {
|
||||
for (i = 0; arg && (i < element_count); i++) {
|
||||
if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
|
||||
|
||||
/* Object (package or buffer) is already built */
|
||||
/* This package element is already built, just get it */
|
||||
|
||||
obj_desc->package.elements[i] =
|
||||
ACPI_CAST_PTR(union acpi_operand_object,
|
||||
|
|
@ -373,8 +371,14 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
|
|||
arg = arg->common.next;
|
||||
}
|
||||
|
||||
if (!arg) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Package List length larger than NumElements count (%X), truncated\n",
|
||||
element_count));
|
||||
}
|
||||
|
||||
obj_desc->package.flags |= AOPOBJ_DATA_VALID;
|
||||
op->common.node = (struct acpi_namespace_node *)obj_desc;
|
||||
op->common.node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_desc);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
|
@ -488,8 +492,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
|
|||
/*
|
||||
* Defer evaluation of Buffer term_arg operand
|
||||
*/
|
||||
obj_desc->buffer.node = (struct acpi_namespace_node *)
|
||||
walk_state->operands[0];
|
||||
obj_desc->buffer.node =
|
||||
ACPI_CAST_PTR(struct acpi_namespace_node,
|
||||
walk_state->operands[0]);
|
||||
obj_desc->buffer.aml_start = op->named.data;
|
||||
obj_desc->buffer.aml_length = op->named.length;
|
||||
break;
|
||||
|
|
@ -499,8 +504,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
|
|||
/*
|
||||
* Defer evaluation of Package term_arg operand
|
||||
*/
|
||||
obj_desc->package.node = (struct acpi_namespace_node *)
|
||||
walk_state->operands[0];
|
||||
obj_desc->package.node =
|
||||
ACPI_CAST_PTR(struct acpi_namespace_node,
|
||||
walk_state->operands[0]);
|
||||
obj_desc->package.aml_start = op->named.data;
|
||||
obj_desc->package.aml_length = op->named.length;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -114,7 +114,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,
|
|||
}
|
||||
|
||||
status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start,
|
||||
aml_length, NULL, 1);
|
||||
aml_length, NULL, ACPI_IMODE_LOAD_PASS1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
goto cleanup;
|
||||
|
|
@ -157,7 +157,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,
|
|||
/* Execute the opcode and arguments */
|
||||
|
||||
status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start,
|
||||
aml_length, NULL, 3);
|
||||
aml_length, NULL, ACPI_IMODE_EXECUTE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
goto cleanup;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -219,7 +219,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
|
|||
if (!op) {
|
||||
status = acpi_ds_load2_begin_op(walk_state, out_op);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
op = *out_op;
|
||||
|
|
@ -238,7 +238,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
|
|||
|
||||
status = acpi_ds_scope_stack_pop(walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
goto error_exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -287,7 +287,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
|
|||
|
||||
status = acpi_ds_result_stack_push(walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
status = acpi_ds_exec_begin_control_op(walk_state, op);
|
||||
|
|
@ -328,6 +328,10 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
|
|||
/* Nothing to do here during method execution */
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
|
||||
error_exit:
|
||||
status = acpi_ds_method_error(status, walk_state);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -196,6 +196,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
|
|||
* one of the opcodes that actually opens a scope
|
||||
*/
|
||||
switch (node->type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
|
||||
case ACPI_TYPE_DEVICE:
|
||||
case ACPI_TYPE_POWER:
|
||||
|
|
@ -546,6 +547,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
|
|||
acpi_status status;
|
||||
acpi_object_type object_type;
|
||||
char *buffer_ptr;
|
||||
u32 flags;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ds_load2_begin_op);
|
||||
|
||||
|
|
@ -669,6 +671,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
|
|||
* one of the opcodes that actually opens a scope
|
||||
*/
|
||||
switch (node->type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
|
||||
case ACPI_TYPE_DEVICE:
|
||||
case ACPI_TYPE_POWER:
|
||||
|
|
@ -750,12 +753,20 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
|
|||
break;
|
||||
}
|
||||
|
||||
/* Add new entry into namespace */
|
||||
flags = ACPI_NS_NO_UPSEARCH;
|
||||
if (walk_state->pass_number == ACPI_IMODE_EXECUTE) {
|
||||
|
||||
/* Execution mode, node cannot already exist, node is temporary */
|
||||
|
||||
flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY);
|
||||
}
|
||||
|
||||
/* Add new entry or lookup existing entry */
|
||||
|
||||
status =
|
||||
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
|
||||
object_type, ACPI_IMODE_LOAD_PASS2,
|
||||
ACPI_NS_NO_UPSEARCH, walk_state, &(node));
|
||||
object_type, ACPI_IMODE_LOAD_PASS2, flags,
|
||||
walk_state, &node);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -872,9 +872,8 @@ static int __init acpi_ec_get_real_ecdt(void)
|
|||
acpi_status status;
|
||||
struct acpi_table_ecdt *ecdt_ptr;
|
||||
|
||||
status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
|
||||
(struct acpi_table_header **)
|
||||
&ecdt_ptr);
|
||||
status = acpi_get_table(ACPI_SIG_ECDT, 1,
|
||||
(struct acpi_table_header **)&ecdt_ptr);
|
||||
if (ACPI_FAILURE(status))
|
||||
return -ENODEV;
|
||||
|
||||
|
|
@ -891,14 +890,14 @@ static int __init acpi_ec_get_real_ecdt(void)
|
|||
if (acpi_ec_mode == EC_INTR) {
|
||||
init_waitqueue_head(&ec_ecdt->wait);
|
||||
}
|
||||
ec_ecdt->command_addr = ecdt_ptr->ec_control.address;
|
||||
ec_ecdt->data_addr = ecdt_ptr->ec_data.address;
|
||||
ec_ecdt->gpe = ecdt_ptr->gpe_bit;
|
||||
ec_ecdt->command_addr = ecdt_ptr->control.address;
|
||||
ec_ecdt->data_addr = ecdt_ptr->data.address;
|
||||
ec_ecdt->gpe = ecdt_ptr->gpe;
|
||||
/* use the GL just to be safe */
|
||||
ec_ecdt->global_lock = TRUE;
|
||||
ec_ecdt->uid = ecdt_ptr->uid;
|
||||
|
||||
status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle);
|
||||
status = acpi_get_handle(NULL, ecdt_ptr->id, &ec_ecdt->handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -70,13 +70,6 @@ acpi_status acpi_ev_initialize_events(void)
|
|||
|
||||
ACPI_FUNCTION_TRACE(ev_initialize_events);
|
||||
|
||||
/* Make sure we have ACPI tables */
|
||||
|
||||
if (!acpi_gbl_DSDT) {
|
||||
ACPI_WARNING((AE_INFO, "No ACPI tables present!"));
|
||||
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the Fixed and General Purpose Events. This is done prior to
|
||||
* enabling SCIs to prevent interrupts from occurring before the handlers are
|
||||
|
|
@ -211,8 +204,7 @@ static acpi_status acpi_ev_fixed_event_initialize(void)
|
|||
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[i].
|
||||
enable_register_id, 0,
|
||||
ACPI_MTX_LOCK);
|
||||
enable_register_id, 0);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
|
@ -298,7 +290,7 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
|
|||
/* Clear the status bit */
|
||||
|
||||
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
status_register_id, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||
status_register_id, 1);
|
||||
|
||||
/*
|
||||
* Make sure we've got a handler. If not, report an error.
|
||||
|
|
@ -306,8 +298,7 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
|
|||
*/
|
||||
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
|
||||
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, 0,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
enable_register_id, 0);
|
||||
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"No installed handler for fixed event [%08X]",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -121,7 +121,9 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
|
|||
if (!gpe_register_info) {
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
register_bit = gpe_event_info->register_bit;
|
||||
register_bit = (u8)
|
||||
(1 <<
|
||||
(gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
|
||||
|
||||
/* 1) Disable case. Simply clear all enable bits */
|
||||
|
||||
|
|
@ -458,8 +460,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
|
|||
|
||||
/* Examine one GPE bit */
|
||||
|
||||
if (enabled_status_byte &
|
||||
acpi_gbl_decode_to8bit[j]) {
|
||||
if (enabled_status_byte & (1 << j)) {
|
||||
/*
|
||||
* Found an active GPE. Dispatch the event to a handler
|
||||
* or method.
|
||||
|
|
@ -570,7 +571,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
|
|||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"While evaluating GPE method [%4.4s]",
|
||||
"while evaluating GPE method [%4.4s]",
|
||||
acpi_ut_get_node_name
|
||||
(local_gpe_event_info.dispatch.
|
||||
method_node)));
|
||||
|
|
@ -618,6 +619,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
|||
|
||||
ACPI_FUNCTION_TRACE(ev_gpe_dispatch);
|
||||
|
||||
acpi_gpe_count++;
|
||||
|
||||
/*
|
||||
* If edge-triggered, clear the GPE status bit now. Note that
|
||||
* level-triggered events are cleared after the GPE is serviced.
|
||||
|
|
@ -633,20 +636,23 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
|||
}
|
||||
}
|
||||
|
||||
/* Save current system state */
|
||||
|
||||
if (acpi_gbl_system_awake_and_running) {
|
||||
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
|
||||
} else {
|
||||
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
|
||||
if (!acpi_gbl_system_awake_and_running) {
|
||||
/*
|
||||
* We just woke up because of a wake GPE. Disable any further GPEs
|
||||
* until we are fully up and running (Only wake GPEs should be enabled
|
||||
* at this time, but we just brute-force disable them all.)
|
||||
* 1) We must disable this particular wake GPE so it won't fire again
|
||||
* 2) We want to disable all wake GPEs, since we are now awake
|
||||
*/
|
||||
(void)acpi_hw_disable_all_gpes();
|
||||
}
|
||||
|
||||
/*
|
||||
* Dispatch the GPE to either an installed handler, or the control
|
||||
* method associated with this GPE (_Lxx or _Exx).
|
||||
* If a handler exists, we invoke it and do not attempt to run the method.
|
||||
* If there is neither a handler nor a method, we disable the level to
|
||||
* prevent further events from coming in here.
|
||||
* Dispatch the GPE to either an installed handler, or the control method
|
||||
* associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke
|
||||
* it and do not attempt to run the method. If there is neither a handler
|
||||
* nor a method, we disable this GPE to prevent further such pointless
|
||||
* events from firing.
|
||||
*/
|
||||
switch (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) {
|
||||
case ACPI_GPE_DISPATCH_HANDLER:
|
||||
|
|
@ -677,8 +683,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
|||
case ACPI_GPE_DISPATCH_METHOD:
|
||||
|
||||
/*
|
||||
* Disable GPE, so it doesn't keep firing before the method has a
|
||||
* chance to run.
|
||||
* Disable the GPE, so it doesn't keep firing before the method has a
|
||||
* chance to run (it runs asynchronously with interrupts enabled).
|
||||
*/
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
|
@ -711,7 +717,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
|||
gpe_number));
|
||||
|
||||
/*
|
||||
* Disable the GPE. The GPE will remain disabled until the ACPI
|
||||
* Disable the GPE. The GPE will remain disabled until the ACPI
|
||||
* Core Subsystem is restarted, or a handler is installed.
|
||||
*/
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
|
|
@ -726,50 +732,3 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
|||
|
||||
return_UINT32(ACPI_INTERRUPT_HANDLED);
|
||||
}
|
||||
|
||||
#ifdef ACPI_GPE_NOTIFY_CHECK
|
||||
/*******************************************************************************
|
||||
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
|
||||
*
|
||||
* FUNCTION: acpi_ev_check_for_wake_only_gpe
|
||||
*
|
||||
* PARAMETERS: gpe_event_info - info for this GPE
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Determine if a a GPE is "wake-only".
|
||||
*
|
||||
* Called from Notify() code in interpreter when a "DeviceWake"
|
||||
* Notify comes in.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe);
|
||||
|
||||
if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */
|
||||
((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */
|
||||
/* This must be a wake-only GPE, disable it */
|
||||
|
||||
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||
|
||||
/* Set GPE to wake-only. Do not change wake disabled/enabled status */
|
||||
|
||||
acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
|
||||
|
||||
ACPI_INFO((AE_INFO,
|
||||
"GPE %p was updated from wake/run to wake-only",
|
||||
gpe_event_info));
|
||||
|
||||
/* This was a wake-only GPE */
|
||||
|
||||
return_ACPI_STATUS(AE_WAKE_ONLY_GPE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -529,7 +529,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
|
|||
|
||||
/* Install new interrupt handler if not SCI_INT */
|
||||
|
||||
if (interrupt_number != acpi_gbl_FADT->sci_int) {
|
||||
if (interrupt_number != acpi_gbl_FADT.sci_interrupt) {
|
||||
status = acpi_os_install_interrupt_handler(interrupt_number,
|
||||
acpi_ev_gpe_xrupt_handler,
|
||||
gpe_xrupt);
|
||||
|
|
@ -567,7 +567,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
|
|||
|
||||
/* We never want to remove the SCI interrupt handler */
|
||||
|
||||
if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) {
|
||||
if (gpe_xrupt->interrupt_number == acpi_gbl_FADT.sci_interrupt) {
|
||||
gpe_xrupt->gpe_block_list_head = NULL;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
|
@ -796,30 +796,31 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
|
|||
(u8) (gpe_block->block_base_number +
|
||||
(i * ACPI_GPE_REGISTER_WIDTH));
|
||||
|
||||
ACPI_STORE_ADDRESS(this_register->status_address.address,
|
||||
(gpe_block->block_address.address + i));
|
||||
this_register->status_address.address =
|
||||
gpe_block->block_address.address + i;
|
||||
|
||||
ACPI_STORE_ADDRESS(this_register->enable_address.address,
|
||||
(gpe_block->block_address.address
|
||||
+ i + gpe_block->register_count));
|
||||
this_register->enable_address.address =
|
||||
gpe_block->block_address.address + i +
|
||||
gpe_block->register_count;
|
||||
|
||||
this_register->status_address.address_space_id =
|
||||
gpe_block->block_address.address_space_id;
|
||||
this_register->enable_address.address_space_id =
|
||||
gpe_block->block_address.address_space_id;
|
||||
this_register->status_address.register_bit_width =
|
||||
this_register->status_address.space_id =
|
||||
gpe_block->block_address.space_id;
|
||||
this_register->enable_address.space_id =
|
||||
gpe_block->block_address.space_id;
|
||||
this_register->status_address.bit_width =
|
||||
ACPI_GPE_REGISTER_WIDTH;
|
||||
this_register->enable_address.register_bit_width =
|
||||
this_register->enable_address.bit_width =
|
||||
ACPI_GPE_REGISTER_WIDTH;
|
||||
this_register->status_address.register_bit_offset =
|
||||
this_register->status_address.bit_offset =
|
||||
ACPI_GPE_REGISTER_WIDTH;
|
||||
this_register->enable_address.register_bit_offset =
|
||||
this_register->enable_address.bit_offset =
|
||||
ACPI_GPE_REGISTER_WIDTH;
|
||||
|
||||
/* Init the event_info for each GPE within this register */
|
||||
|
||||
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
|
||||
this_event->register_bit = acpi_gbl_decode_to8bit[j];
|
||||
this_event->gpe_number =
|
||||
(u8) (this_register->base_gpe_number + j);
|
||||
this_event->register_info = this_register;
|
||||
this_event++;
|
||||
}
|
||||
|
|
@ -1109,11 +1110,12 @@ acpi_status acpi_ev_gpe_initialize(void)
|
|||
* If EITHER the register length OR the block address are zero, then that
|
||||
* particular block is not supported.
|
||||
*/
|
||||
if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) {
|
||||
if (acpi_gbl_FADT.gpe0_block_length &&
|
||||
acpi_gbl_FADT.xgpe0_block.address) {
|
||||
|
||||
/* GPE block 0 exists (has both length and address > 0) */
|
||||
|
||||
register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2);
|
||||
register_count0 = (u16) (acpi_gbl_FADT.gpe0_block_length / 2);
|
||||
|
||||
gpe_number_max =
|
||||
(register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1;
|
||||
|
|
@ -1121,9 +1123,9 @@ acpi_status acpi_ev_gpe_initialize(void)
|
|||
/* Install GPE Block 0 */
|
||||
|
||||
status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
|
||||
&acpi_gbl_FADT->xgpe0_blk,
|
||||
&acpi_gbl_FADT.xgpe0_block,
|
||||
register_count0, 0,
|
||||
acpi_gbl_FADT->sci_int,
|
||||
acpi_gbl_FADT.sci_interrupt,
|
||||
&acpi_gbl_gpe_fadt_blocks[0]);
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
|
@ -1132,20 +1134,21 @@ acpi_status acpi_ev_gpe_initialize(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) {
|
||||
if (acpi_gbl_FADT.gpe1_block_length &&
|
||||
acpi_gbl_FADT.xgpe1_block.address) {
|
||||
|
||||
/* GPE block 1 exists (has both length and address > 0) */
|
||||
|
||||
register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2);
|
||||
register_count1 = (u16) (acpi_gbl_FADT.gpe1_block_length / 2);
|
||||
|
||||
/* Check for GPE0/GPE1 overlap (if both banks exist) */
|
||||
|
||||
if ((register_count0) &&
|
||||
(gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
|
||||
(gpe_number_max >= acpi_gbl_FADT.gpe1_base)) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
|
||||
gpe_number_max, acpi_gbl_FADT->gpe1_base,
|
||||
acpi_gbl_FADT->gpe1_base +
|
||||
gpe_number_max, acpi_gbl_FADT.gpe1_base,
|
||||
acpi_gbl_FADT.gpe1_base +
|
||||
((register_count1 *
|
||||
ACPI_GPE_REGISTER_WIDTH) - 1)));
|
||||
|
||||
|
|
@ -1157,10 +1160,11 @@ acpi_status acpi_ev_gpe_initialize(void)
|
|||
|
||||
status =
|
||||
acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
|
||||
&acpi_gbl_FADT->xgpe1_blk,
|
||||
&acpi_gbl_FADT.xgpe1_block,
|
||||
register_count1,
|
||||
acpi_gbl_FADT->gpe1_base,
|
||||
acpi_gbl_FADT->sci_int,
|
||||
acpi_gbl_FADT.gpe1_base,
|
||||
acpi_gbl_FADT.
|
||||
sci_interrupt,
|
||||
&acpi_gbl_gpe_fadt_blocks
|
||||
[1]);
|
||||
|
||||
|
|
@ -1173,7 +1177,7 @@ acpi_status acpi_ev_gpe_initialize(void)
|
|||
* GPE0 and GPE1 do not have to be contiguous in the GPE number
|
||||
* space. However, GPE0 always starts at GPE number zero.
|
||||
*/
|
||||
gpe_number_max = acpi_gbl_FADT->gpe1_base +
|
||||
gpe_number_max = acpi_gbl_FADT.gpe1_base +
|
||||
((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -63,14 +63,18 @@ static const char *acpi_notify_value_names[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
/* Pointer to FACS needed for the Global Lock */
|
||||
|
||||
static struct acpi_table_facs *facs = NULL;
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
|
||||
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context);
|
||||
|
||||
static u32 acpi_ev_global_lock_handler(void *context);
|
||||
|
||||
static acpi_status acpi_ev_remove_global_lock_handler(void);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_is_notify_object
|
||||
|
|
@ -280,51 +284,21 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
|
|||
acpi_ut_delete_generic_state(notify_info);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_global_lock_thread
|
||||
*
|
||||
* PARAMETERS: Context - From thread interface, not used
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Invoked by SCI interrupt handler upon acquisition of the
|
||||
* Global Lock. Simply signal all threads that are waiting
|
||||
* for the lock.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
/* Signal threads that are waiting for the lock */
|
||||
|
||||
if (acpi_gbl_global_lock_thread_count) {
|
||||
|
||||
/* Send sufficient units to the semaphore */
|
||||
|
||||
status =
|
||||
acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
|
||||
acpi_gbl_global_lock_thread_count);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Could not signal Global Lock semaphore"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_global_lock_handler
|
||||
*
|
||||
* PARAMETERS: Context - From thread interface, not used
|
||||
*
|
||||
* RETURN: ACPI_INTERRUPT_HANDLED or ACPI_INTERRUPT_NOT_HANDLED
|
||||
* RETURN: ACPI_INTERRUPT_HANDLED
|
||||
*
|
||||
* DESCRIPTION: Invoked directly from the SCI handler when a global lock
|
||||
* release interrupt occurs. Grab the global lock and queue
|
||||
* the global lock thread for execution
|
||||
* release interrupt occurs. Attempt to acquire the global lock,
|
||||
* if successful, signal the thread waiting for the lock.
|
||||
*
|
||||
* NOTE: Assumes that the semaphore can be signaled from interrupt level. If
|
||||
* this is not possible for some reason, a separate thread will have to be
|
||||
* scheduled to do this.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
|
@ -333,16 +307,24 @@ static u32 acpi_ev_global_lock_handler(void *context)
|
|||
u8 acquired = FALSE;
|
||||
|
||||
/*
|
||||
* Attempt to get the lock
|
||||
* Attempt to get the lock.
|
||||
*
|
||||
* If we don't get it now, it will be marked pending and we will
|
||||
* take another interrupt when it becomes free.
|
||||
*/
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired);
|
||||
if (acquired) {
|
||||
|
||||
/* Got the lock, now wake all threads waiting for it */
|
||||
|
||||
acpi_gbl_global_lock_acquired = TRUE;
|
||||
acpi_ev_global_lock_thread(context);
|
||||
/* Send a unit to the semaphore */
|
||||
|
||||
if (ACPI_FAILURE(acpi_os_signal_semaphore(
|
||||
acpi_gbl_global_lock_semaphore, 1))) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Could not signal Global Lock semaphore"));
|
||||
}
|
||||
}
|
||||
|
||||
return (ACPI_INTERRUPT_HANDLED);
|
||||
|
|
@ -366,6 +348,13 @@ acpi_status acpi_ev_init_global_lock_handler(void)
|
|||
|
||||
ACPI_FUNCTION_TRACE(ev_init_global_lock_handler);
|
||||
|
||||
status =
|
||||
acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
|
||||
(struct acpi_table_header **)&facs);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
acpi_gbl_global_lock_present = TRUE;
|
||||
status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
|
||||
acpi_ev_global_lock_handler,
|
||||
|
|
@ -389,6 +378,31 @@ acpi_status acpi_ev_init_global_lock_handler(void)
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_remove_global_lock_handler
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Remove the handler for the Global Lock
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static acpi_status acpi_ev_remove_global_lock_handler(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ev_remove_global_lock_handler);
|
||||
|
||||
acpi_gbl_global_lock_present = FALSE;
|
||||
status = acpi_remove_fixed_event_handler(ACPI_EVENT_GLOBAL,
|
||||
acpi_ev_global_lock_handler);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_acquire_global_lock
|
||||
|
|
@ -399,6 +413,16 @@ acpi_status acpi_ev_init_global_lock_handler(void)
|
|||
*
|
||||
* DESCRIPTION: Attempt to gain ownership of the Global Lock.
|
||||
*
|
||||
* MUTEX: Interpreter must be locked
|
||||
*
|
||||
* Note: The original implementation allowed multiple threads to "acquire" the
|
||||
* Global Lock, and the OS would hold the lock until the last thread had
|
||||
* released it. However, this could potentially starve the BIOS out of the
|
||||
* lock, especially in the case where there is a tight handshake between the
|
||||
* Embedded Controller driver and the BIOS. Therefore, this implementation
|
||||
* allows only one thread to acquire the HW Global Lock at a time, and makes
|
||||
* the global lock appear as a standard mutex on the OS side.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
acpi_status acpi_ev_acquire_global_lock(u16 timeout)
|
||||
|
|
@ -408,53 +432,51 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
|
|||
|
||||
ACPI_FUNCTION_TRACE(ev_acquire_global_lock);
|
||||
|
||||
#ifndef ACPI_APPLICATION
|
||||
/* Make sure that we actually have a global lock */
|
||||
|
||||
if (!acpi_gbl_global_lock_present) {
|
||||
return_ACPI_STATUS(AE_NO_GLOBAL_LOCK);
|
||||
/*
|
||||
* Only one thread can acquire the GL at a time, the global_lock_mutex
|
||||
* enforces this. This interface releases the interpreter if we must wait.
|
||||
*/
|
||||
status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* One more thread wants the global lock */
|
||||
|
||||
acpi_gbl_global_lock_thread_count++;
|
||||
|
||||
/*
|
||||
* If we (OS side vs. BIOS side) have the hardware lock already,
|
||||
* we are done
|
||||
* Make sure that a global lock actually exists. If not, just treat
|
||||
* the lock as a standard mutex.
|
||||
*/
|
||||
if (acpi_gbl_global_lock_acquired) {
|
||||
if (!acpi_gbl_global_lock_present) {
|
||||
acpi_gbl_global_lock_acquired = TRUE;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* We must acquire the actual hardware lock */
|
||||
/* Attempt to acquire the actual hardware lock */
|
||||
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
|
||||
ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired);
|
||||
if (acquired) {
|
||||
|
||||
/* We got the lock */
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"Acquired the HW Global Lock\n"));
|
||||
"Acquired hardware Global Lock\n"));
|
||||
|
||||
acpi_gbl_global_lock_acquired = TRUE;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Did not get the lock. The pending bit was set above, and we must now
|
||||
* Did not get the lock. The pending bit was set above, and we must now
|
||||
* wait until we get the global lock released interrupt.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Waiting for hardware Global Lock\n"));
|
||||
|
||||
/*
|
||||
* Acquire the global lock semaphore first.
|
||||
* Since this wait will block, we must release the interpreter
|
||||
* Wait for handshake with the global lock interrupt handler.
|
||||
* This interface releases the interpreter if we must wait.
|
||||
*/
|
||||
status =
|
||||
acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
|
||||
timeout);
|
||||
status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
|
||||
ACPI_WAIT_FOREVER);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
|
@ -477,38 +499,39 @@ acpi_status acpi_ev_release_global_lock(void)
|
|||
|
||||
ACPI_FUNCTION_TRACE(ev_release_global_lock);
|
||||
|
||||
if (!acpi_gbl_global_lock_thread_count) {
|
||||
/* Lock must be already acquired */
|
||||
|
||||
if (!acpi_gbl_global_lock_acquired) {
|
||||
ACPI_WARNING((AE_INFO,
|
||||
"Cannot release HW Global Lock, it has not been acquired"));
|
||||
"Cannot release the ACPI Global Lock, it has not been acquired"));
|
||||
return_ACPI_STATUS(AE_NOT_ACQUIRED);
|
||||
}
|
||||
|
||||
/* One fewer thread has the global lock */
|
||||
if (acpi_gbl_global_lock_present) {
|
||||
|
||||
acpi_gbl_global_lock_thread_count--;
|
||||
if (acpi_gbl_global_lock_thread_count) {
|
||||
/* Allow any thread to release the lock */
|
||||
|
||||
/* There are still some threads holding the lock, cannot release */
|
||||
ACPI_RELEASE_GLOBAL_LOCK(facs, pending);
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
/*
|
||||
* If the pending bit was set, we must write GBL_RLS to the control
|
||||
* register
|
||||
*/
|
||||
if (pending) {
|
||||
status =
|
||||
acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE,
|
||||
1);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"Released hardware Global Lock\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
* No more threads holding lock, we can do the actual hardware
|
||||
* release
|
||||
*/
|
||||
ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, pending);
|
||||
acpi_gbl_global_lock_acquired = FALSE;
|
||||
|
||||
/*
|
||||
* If the pending bit was set, we must write GBL_RLS to the control
|
||||
* register
|
||||
*/
|
||||
if (pending) {
|
||||
status = acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE,
|
||||
1, ACPI_MTX_LOCK);
|
||||
}
|
||||
/* Release the local GL mutex */
|
||||
|
||||
acpi_os_release_mutex(acpi_gbl_global_lock_mutex);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
|
@ -558,6 +581,12 @@ void acpi_ev_terminate(void)
|
|||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_ERROR((AE_INFO, "Could not remove SCI handler"));
|
||||
}
|
||||
|
||||
status = acpi_ev_remove_global_lock_handler();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Could not remove Global Lock handler"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Deallocate all handler objects installed within GPE info structs */
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -291,7 +291,6 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
|
|||
u32 bit_width, acpi_integer * value)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status2;
|
||||
acpi_adr_space_handler handler;
|
||||
acpi_adr_space_setup region_setup;
|
||||
union acpi_operand_object *handler_desc;
|
||||
|
|
@ -345,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
|
|||
* setup will potentially execute control methods
|
||||
* (e.g., _REG method for this region)
|
||||
*/
|
||||
acpi_ex_exit_interpreter();
|
||||
acpi_ex_relinquish_interpreter();
|
||||
|
||||
status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
|
||||
handler_desc->address_space.context,
|
||||
|
|
@ -353,10 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
|
|||
|
||||
/* Re-enter the interpreter */
|
||||
|
||||
status2 = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status2)) {
|
||||
return_ACPI_STATUS(status2);
|
||||
}
|
||||
acpi_ex_reacquire_interpreter();
|
||||
|
||||
/* Check for failure of the Region Setup */
|
||||
|
||||
|
|
@ -409,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
|
|||
* exit the interpreter because the handler *might* block -- we don't
|
||||
* know what it will do, so we can't hold the lock on the intepreter.
|
||||
*/
|
||||
acpi_ex_exit_interpreter();
|
||||
acpi_ex_relinquish_interpreter();
|
||||
}
|
||||
|
||||
/* Call the handler */
|
||||
|
|
@ -430,10 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
|
|||
* We just returned from a non-default handler, we must re-enter the
|
||||
* interpreter
|
||||
*/
|
||||
status2 = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status2)) {
|
||||
return_ACPI_STATUS(status2);
|
||||
}
|
||||
acpi_ex_reacquire_interpreter();
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -48,6 +48,11 @@
|
|||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME("evrgnini")
|
||||
|
||||
/* Local prototypes */
|
||||
static u8 acpi_ev_match_pci_root_bridge(char *id);
|
||||
|
||||
static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_system_memory_region_setup
|
||||
|
|
@ -62,6 +67,7 @@ ACPI_MODULE_NAME("evrgnini")
|
|||
* DESCRIPTION: Setup a system_memory operation region
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_system_memory_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
|
|
@ -168,9 +174,9 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
|
|||
union acpi_operand_object *handler_obj;
|
||||
struct acpi_namespace_node *parent_node;
|
||||
struct acpi_namespace_node *pci_root_node;
|
||||
struct acpi_namespace_node *pci_device_node;
|
||||
union acpi_operand_object *region_obj =
|
||||
(union acpi_operand_object *)handle;
|
||||
struct acpi_device_id object_hID;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ev_pci_config_region_setup);
|
||||
|
||||
|
|
@ -215,45 +221,30 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
|
|||
|
||||
pci_root_node = parent_node;
|
||||
while (pci_root_node != acpi_gbl_root_node) {
|
||||
status =
|
||||
acpi_ut_execute_HID(pci_root_node, &object_hID);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
/*
|
||||
* Got a valid _HID string, check if this is a PCI root.
|
||||
* New for ACPI 3.0: check for a PCI Express root also.
|
||||
*/
|
||||
if (!
|
||||
(ACPI_STRNCMP
|
||||
(object_hID.value, PCI_ROOT_HID_STRING,
|
||||
sizeof(PCI_ROOT_HID_STRING)))
|
||||
||
|
||||
!(ACPI_STRNCMP
|
||||
(object_hID.value,
|
||||
PCI_EXPRESS_ROOT_HID_STRING,
|
||||
sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) {
|
||||
|
||||
/* Install a handler for this PCI root bridge */
|
||||
/* Get the _HID/_CID in order to detect a root_bridge */
|
||||
|
||||
status =
|
||||
acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status == AE_SAME_HANDLER) {
|
||||
/*
|
||||
* It is OK if the handler is already installed on the root
|
||||
* bridge. Still need to return a context object for the
|
||||
* new PCI_Config operation region, however.
|
||||
*/
|
||||
status = AE_OK;
|
||||
} else {
|
||||
ACPI_EXCEPTION((AE_INFO,
|
||||
status,
|
||||
"Could not install PciConfig handler for Root Bridge %4.4s",
|
||||
acpi_ut_get_node_name
|
||||
(pci_root_node)));
|
||||
}
|
||||
if (acpi_ev_is_pci_root_bridge(pci_root_node)) {
|
||||
|
||||
/* Install a handler for this PCI root bridge */
|
||||
|
||||
status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status == AE_SAME_HANDLER) {
|
||||
/*
|
||||
* It is OK if the handler is already installed on the root
|
||||
* bridge. Still need to return a context object for the
|
||||
* new PCI_Config operation region, however.
|
||||
*/
|
||||
status = AE_OK;
|
||||
} else {
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"Could not install PciConfig handler for Root Bridge %4.4s",
|
||||
acpi_ut_get_node_name
|
||||
(pci_root_node)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pci_root_node = acpi_ns_get_parent_node(pci_root_node);
|
||||
|
|
@ -282,14 +273,25 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
|
|||
/*
|
||||
* For PCI_Config space access, we need the segment, bus,
|
||||
* device and function numbers. Acquire them here.
|
||||
*
|
||||
* Find the parent device object. (This allows the operation region to be
|
||||
* within a subscope under the device, such as a control method.)
|
||||
*/
|
||||
pci_device_node = region_obj->region.node;
|
||||
while (pci_device_node && (pci_device_node->type != ACPI_TYPE_DEVICE)) {
|
||||
pci_device_node = acpi_ns_get_parent_node(pci_device_node);
|
||||
}
|
||||
|
||||
if (!pci_device_node) {
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the PCI device and function numbers from the _ADR object
|
||||
* contained in the parent's scope.
|
||||
*/
|
||||
status =
|
||||
acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, parent_node,
|
||||
acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node,
|
||||
&pci_value);
|
||||
|
||||
/*
|
||||
|
|
@ -327,6 +329,91 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_match_pci_root_bridge
|
||||
*
|
||||
* PARAMETERS: Id - The HID/CID in string format
|
||||
*
|
||||
* RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
|
||||
*
|
||||
* DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static u8 acpi_ev_match_pci_root_bridge(char *id)
|
||||
{
|
||||
|
||||
/*
|
||||
* Check if this is a PCI root.
|
||||
* ACPI 3.0+: check for a PCI Express root also.
|
||||
*/
|
||||
if (!(ACPI_STRNCMP(id,
|
||||
PCI_ROOT_HID_STRING,
|
||||
sizeof(PCI_ROOT_HID_STRING))) ||
|
||||
!(ACPI_STRNCMP(id,
|
||||
PCI_EXPRESS_ROOT_HID_STRING,
|
||||
sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_is_pci_root_bridge
|
||||
*
|
||||
* PARAMETERS: Node - Device node being examined
|
||||
*
|
||||
* RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
|
||||
*
|
||||
* DESCRIPTION: Determine if the input device represents a PCI Root Bridge by
|
||||
* examining the _HID and _CID for the device.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_device_id hid;
|
||||
struct acpi_compatible_id_list *cid;
|
||||
acpi_native_uint i;
|
||||
|
||||
/*
|
||||
* Get the _HID and check for a PCI Root Bridge
|
||||
*/
|
||||
status = acpi_ut_execute_HID(node, &hid);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (acpi_ev_match_pci_root_bridge(hid.value)) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* The _HID did not match.
|
||||
* Get the _CID and check for a PCI Root Bridge
|
||||
*/
|
||||
status = acpi_ut_execute_CID(node, &cid);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* Check all _CIDs in the returned list */
|
||||
|
||||
for (i = 0; i < cid->count; i++) {
|
||||
if (acpi_ev_match_pci_root_bridge(cid->id[i].value)) {
|
||||
ACPI_FREE(cid);
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_FREE(cid);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_pci_bar_region_setup
|
||||
|
|
@ -432,6 +519,9 @@ acpi_ev_default_region_setup(acpi_handle handle,
|
|||
* a PCI address in the scope of the definition. This address is
|
||||
* required to perform an access to PCI config space.
|
||||
*
|
||||
* MUTEX: Interpreter should be unlocked, because we may run the _REG
|
||||
* method for this region.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -142,9 +142,10 @@ u32 acpi_ev_install_sci_handler(void)
|
|||
|
||||
ACPI_FUNCTION_TRACE(ev_install_sci_handler);
|
||||
|
||||
status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
|
||||
acpi_ev_sci_xrupt_handler,
|
||||
acpi_gbl_gpe_xrupt_list_head);
|
||||
status =
|
||||
acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt,
|
||||
acpi_ev_sci_xrupt_handler,
|
||||
acpi_gbl_gpe_xrupt_list_head);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
|
@ -175,8 +176,9 @@ acpi_status acpi_ev_remove_sci_handler(void)
|
|||
|
||||
/* Just let the OS remove the handler and disable the level */
|
||||
|
||||
status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
|
||||
acpi_ev_sci_xrupt_handler);
|
||||
status =
|
||||
acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt,
|
||||
acpi_ev_sci_xrupt_handler);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -768,11 +768,9 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
|
|||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
/* Must lock interpreter to prevent race conditions */
|
||||
|
||||
acpi_ex_enter_interpreter();
|
||||
status = acpi_ev_acquire_global_lock(timeout);
|
||||
acpi_ex_exit_interpreter();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -44,6 +44,7 @@
|
|||
#include <acpi/acpi.h>
|
||||
#include <acpi/acevents.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/actables.h>
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME("evxfevnt")
|
||||
|
|
@ -65,13 +66,14 @@ acpi_status acpi_enable(void)
|
|||
|
||||
ACPI_FUNCTION_TRACE(acpi_enable);
|
||||
|
||||
/* Make sure we have the FADT */
|
||||
/* ACPI tables must be present */
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
ACPI_WARNING((AE_INFO, "No FADT information present!"));
|
||||
if (!acpi_tb_tables_loaded()) {
|
||||
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
/* Check current mode */
|
||||
|
||||
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||
"System is already in ACPI mode\n"));
|
||||
|
|
@ -111,11 +113,6 @@ acpi_status acpi_disable(void)
|
|||
|
||||
ACPI_FUNCTION_TRACE(acpi_disable);
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
ACPI_WARNING((AE_INFO, "No FADT information present!"));
|
||||
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||
"System is already in legacy (non-ACPI) mode\n"));
|
||||
|
|
@ -169,7 +166,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
|
|||
*/
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, 1, ACPI_MTX_LOCK);
|
||||
enable_register_id, 1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -178,7 +175,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
|
|||
|
||||
status =
|
||||
acpi_get_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, &value, ACPI_MTX_LOCK);
|
||||
enable_register_id, &value);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -368,14 +365,14 @@ acpi_status acpi_disable_event(u32 event, u32 flags)
|
|||
*/
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, 0, ACPI_MTX_LOCK);
|
||||
enable_register_id, 0);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
status =
|
||||
acpi_get_register(acpi_gbl_fixed_event_info[event].
|
||||
enable_register_id, &value, ACPI_MTX_LOCK);
|
||||
enable_register_id, &value);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -421,7 +418,7 @@ acpi_status acpi_clear_event(u32 event)
|
|||
*/
|
||||
status =
|
||||
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||
status_register_id, 1, ACPI_MTX_LOCK);
|
||||
status_register_id, 1);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -510,7 +507,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
|
|||
|
||||
status =
|
||||
acpi_get_register(acpi_gbl_fixed_event_info[event].
|
||||
status_register_id, event_status, ACPI_MTX_LOCK);
|
||||
status_register_id, event_status);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -54,7 +54,7 @@ ACPI_MODULE_NAME("exconfig")
|
|||
|
||||
/* Local prototypes */
|
||||
static acpi_status
|
||||
acpi_ex_add_table(struct acpi_table_header *table,
|
||||
acpi_ex_add_table(acpi_native_uint table_index,
|
||||
struct acpi_namespace_node *parent_node,
|
||||
union acpi_operand_object **ddb_handle);
|
||||
|
||||
|
|
@ -74,12 +74,11 @@ acpi_ex_add_table(struct acpi_table_header *table,
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_add_table(struct acpi_table_header *table,
|
||||
acpi_ex_add_table(acpi_native_uint table_index,
|
||||
struct acpi_namespace_node *parent_node,
|
||||
union acpi_operand_object **ddb_handle)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_table_desc table_info;
|
||||
union acpi_operand_object *obj_desc;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_add_table);
|
||||
|
|
@ -98,42 +97,16 @@ acpi_ex_add_table(struct acpi_table_header *table,
|
|||
|
||||
/* Install the new table into the local data structures */
|
||||
|
||||
ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc));
|
||||
|
||||
table_info.type = ACPI_TABLE_ID_SSDT;
|
||||
table_info.pointer = table;
|
||||
table_info.length = (acpi_size) table->length;
|
||||
table_info.allocation = ACPI_MEM_ALLOCATED;
|
||||
|
||||
status = acpi_tb_install_table(&table_info);
|
||||
obj_desc->reference.object = table_info.installed_desc;
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status == AE_ALREADY_EXISTS) {
|
||||
|
||||
/* Table already exists, just return the handle */
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
obj_desc->reference.object = ACPI_CAST_PTR(void, table_index);
|
||||
|
||||
/* Add the table to the namespace */
|
||||
|
||||
status = acpi_ns_load_table(table_info.installed_desc, parent_node);
|
||||
status = acpi_ns_load_table(table_index, parent_node);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
||||
/* Uninstall table on error */
|
||||
|
||||
(void)acpi_tb_uninstall_table(table_info.installed_desc);
|
||||
goto cleanup;
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
*ddb_handle = NULL;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
||||
cleanup:
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
*ddb_handle = NULL;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +119,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
|
|||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load an ACPI table
|
||||
* DESCRIPTION: Load an ACPI table from the RSDT/XSDT
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
|
@ -156,33 +129,20 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
|
|||
{
|
||||
acpi_status status;
|
||||
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||
struct acpi_table_header *table;
|
||||
acpi_native_uint table_index;
|
||||
struct acpi_namespace_node *parent_node;
|
||||
struct acpi_namespace_node *start_node;
|
||||
struct acpi_namespace_node *parameter_node = NULL;
|
||||
union acpi_operand_object *ddb_handle;
|
||||
struct acpi_table_header *table;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_load_table_op);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Make sure that the signature does not match one of the tables that
|
||||
* is already loaded.
|
||||
*/
|
||||
status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
|
||||
if (status == AE_OK) {
|
||||
|
||||
/* Signature matched -- don't allow override */
|
||||
|
||||
return_ACPI_STATUS(AE_ALREADY_EXISTS);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Find the ACPI table */
|
||||
/* Find the ACPI table in the RSDT/XSDT */
|
||||
|
||||
status = acpi_tb_find_table(operand[0]->string.pointer,
|
||||
operand[1]->string.pointer,
|
||||
operand[2]->string.pointer, &table);
|
||||
operand[2]->string.pointer, &table_index);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (status != AE_NOT_FOUND) {
|
||||
return_ACPI_STATUS(status);
|
||||
|
|
@ -245,7 +205,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
|
|||
|
||||
/* Load the table into the namespace */
|
||||
|
||||
status = acpi_ex_add_table(table, parent_node, &ddb_handle);
|
||||
status = acpi_ex_add_table(table_index, parent_node, &ddb_handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -266,9 +226,13 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
|
|||
}
|
||||
}
|
||||
|
||||
ACPI_INFO((AE_INFO,
|
||||
"Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]",
|
||||
table->signature, table->oem_id, table->oem_table_id));
|
||||
status = acpi_get_table_by_index(table_index, &table);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
ACPI_INFO((AE_INFO,
|
||||
"Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]",
|
||||
table->signature, table->oem_id,
|
||||
table->oem_table_id));
|
||||
}
|
||||
|
||||
*return_desc = ddb_handle;
|
||||
return_ACPI_STATUS(status);
|
||||
|
|
@ -278,7 +242,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
|
|||
*
|
||||
* FUNCTION: acpi_ex_load_op
|
||||
*
|
||||
* PARAMETERS: obj_desc - Region or Field where the table will be
|
||||
* PARAMETERS: obj_desc - Region or Buffer/Field where the table will be
|
||||
* obtained
|
||||
* Target - Where a handle to the table will be stored
|
||||
* walk_state - Current state
|
||||
|
|
@ -287,6 +251,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
|
|||
*
|
||||
* DESCRIPTION: Load an ACPI table from a field or operation region
|
||||
*
|
||||
* NOTE: Region Fields (Field, bank_field, index_fields) are resolved to buffer
|
||||
* objects before this code is reached.
|
||||
*
|
||||
* If source is an operation region, it must refer to system_memory, as
|
||||
* per the ACPI specification.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
|
|
@ -294,22 +264,26 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
|
|||
union acpi_operand_object *target,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
acpi_status status;
|
||||
union acpi_operand_object *ddb_handle;
|
||||
union acpi_operand_object *buffer_desc = NULL;
|
||||
struct acpi_table_header *table_ptr = NULL;
|
||||
acpi_physical_address address;
|
||||
struct acpi_table_header table_header;
|
||||
acpi_integer temp;
|
||||
u32 i;
|
||||
struct acpi_table_desc table_desc;
|
||||
acpi_native_uint table_index;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_load_op);
|
||||
|
||||
/* Object can be either an op_region or a Field */
|
||||
ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc));
|
||||
|
||||
/* Source Object can be either an op_region or a Buffer/Field */
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||
case ACPI_TYPE_REGION:
|
||||
|
||||
/* Region must be system_memory (from ACPI spec) */
|
||||
|
||||
if (obj_desc->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) {
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n",
|
||||
obj_desc,
|
||||
acpi_ut_get_object_type_name(obj_desc)));
|
||||
|
|
@ -325,113 +299,41 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
|
|||
}
|
||||
}
|
||||
|
||||
/* Get the base physical address of the region */
|
||||
|
||||
address = obj_desc->region.address;
|
||||
|
||||
/* Get part of the table header to get the table length */
|
||||
|
||||
table_header.length = 0;
|
||||
for (i = 0; i < 8; i++) {
|
||||
status =
|
||||
acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
|
||||
(acpi_physical_address)
|
||||
(i + address), 8,
|
||||
&temp);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Get the one valid byte of the returned 64-bit value */
|
||||
|
||||
ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp;
|
||||
}
|
||||
|
||||
/* Sanity check the table length */
|
||||
|
||||
if (table_header.length < sizeof(struct acpi_table_header)) {
|
||||
return_ACPI_STATUS(AE_BAD_HEADER);
|
||||
}
|
||||
|
||||
/* Allocate a buffer for the entire table */
|
||||
|
||||
table_ptr = ACPI_ALLOCATE(table_header.length);
|
||||
if (!table_ptr) {
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Get the entire table from the op region */
|
||||
|
||||
for (i = 0; i < table_header.length; i++) {
|
||||
status =
|
||||
acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
|
||||
(acpi_physical_address)
|
||||
(i + address), 8,
|
||||
&temp);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Get the one valid byte of the returned 64-bit value */
|
||||
|
||||
ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp;
|
||||
}
|
||||
table_desc.address = obj_desc->region.address;
|
||||
table_desc.length = obj_desc->region.length;
|
||||
table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||
case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Field %p %s\n",
|
||||
obj_desc,
|
||||
/* Simply extract the buffer from the buffer object */
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"Load from Buffer or Field %p %s\n", obj_desc,
|
||||
acpi_ut_get_object_type_name(obj_desc)));
|
||||
|
||||
/*
|
||||
* The length of the field must be at least as large as the table.
|
||||
* Read the entire field and thus the entire table. Buffer is
|
||||
* allocated during the read.
|
||||
*/
|
||||
status =
|
||||
acpi_ex_read_data_from_field(walk_state, obj_desc,
|
||||
&buffer_desc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
table_desc.pointer = ACPI_CAST_PTR(struct acpi_table_header,
|
||||
obj_desc->buffer.pointer);
|
||||
table_desc.length = table_desc.pointer->length;
|
||||
table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED;
|
||||
|
||||
table_ptr = ACPI_CAST_PTR(struct acpi_table_header,
|
||||
buffer_desc->buffer.pointer);
|
||||
|
||||
/* All done with the buffer_desc, delete it */
|
||||
|
||||
buffer_desc->buffer.pointer = NULL;
|
||||
acpi_ut_remove_reference(buffer_desc);
|
||||
|
||||
/* Sanity check the table length */
|
||||
|
||||
if (table_ptr->length < sizeof(struct acpi_table_header)) {
|
||||
status = AE_BAD_HEADER;
|
||||
goto cleanup;
|
||||
}
|
||||
obj_desc->buffer.pointer = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
/* The table must be either an SSDT or a PSDT */
|
||||
|
||||
if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) &&
|
||||
(!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Table has invalid signature [%4.4s], must be SSDT or PSDT",
|
||||
table_ptr->signature));
|
||||
status = AE_BAD_SIGNATURE;
|
||||
/*
|
||||
* Install the new table into the local data structures
|
||||
*/
|
||||
status = acpi_tb_add_table(&table_desc, &table_index);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Install the new table into the local data structures */
|
||||
|
||||
status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
|
||||
status =
|
||||
acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
||||
/* On error, table_ptr was deallocated above */
|
||||
|
|
@ -450,13 +352,9 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
ACPI_INFO((AE_INFO,
|
||||
"Dynamic SSDT Load - OemId [%6.6s] OemTableId [%8.8s]",
|
||||
table_ptr->oem_id, table_ptr->oem_table_id));
|
||||
|
||||
cleanup:
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_FREE(table_ptr);
|
||||
acpi_tb_delete_table(&table_desc);
|
||||
}
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -477,7 +375,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
|
|||
{
|
||||
acpi_status status = AE_OK;
|
||||
union acpi_operand_object *table_desc = ddb_handle;
|
||||
struct acpi_table_desc *table_info;
|
||||
acpi_native_uint table_index;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_unload_table);
|
||||
|
||||
|
|
@ -493,19 +391,18 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
|
|||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Get the actual table descriptor from the ddb_handle */
|
||||
/* Get the table index from the ddb_handle */
|
||||
|
||||
table_info = (struct acpi_table_desc *)table_desc->reference.object;
|
||||
table_index = (acpi_native_uint) table_desc->reference.object;
|
||||
|
||||
/*
|
||||
* Delete the entire namespace under this table Node
|
||||
* (Offset contains the table_id)
|
||||
*/
|
||||
acpi_ns_delete_namespace_by_owner(table_info->owner_id);
|
||||
acpi_tb_delete_namespace_by_owner(table_index);
|
||||
acpi_tb_release_owner_id(table_index);
|
||||
|
||||
/* Delete the table itself */
|
||||
|
||||
(void)acpi_tb_uninstall_table(table_info->installed_desc);
|
||||
acpi_tb_set_table_loaded_flag(table_index, FALSE);
|
||||
|
||||
/* Delete the table descriptor (ddb_handle) */
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -359,8 +359,9 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
|
|||
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||
union acpi_operand_object *obj_desc;
|
||||
struct acpi_namespace_node *node;
|
||||
struct acpi_table_header *table;
|
||||
union acpi_operand_object *region_obj2;
|
||||
acpi_native_uint table_index;
|
||||
struct acpi_table_header *table;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_create_table_region);
|
||||
|
||||
|
|
@ -380,7 +381,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
|
|||
|
||||
status = acpi_tb_find_table(operand[1]->string.pointer,
|
||||
operand[2]->string.pointer,
|
||||
operand[3]->string.pointer, &table);
|
||||
operand[3]->string.pointer, &table_index);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -395,6 +396,11 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
|
|||
region_obj2 = obj_desc->common.next_object;
|
||||
region_obj2->extra.region_context = NULL;
|
||||
|
||||
status = acpi_get_table_by_index(table_index, &table);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Init the region from the operands */
|
||||
|
||||
obj_desc->region.space_id = REGION_DATA_TABLE;
|
||||
|
|
@ -553,7 +559,8 @@ acpi_ex_create_method(u8 * aml_start,
|
|||
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
status = AE_NO_MEMORY;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Save the method's AML pointer and length */
|
||||
|
|
@ -576,10 +583,7 @@ acpi_ex_create_method(u8 * aml_start,
|
|||
* Get the sync_level. If method is serialized, a mutex will be
|
||||
* created for this method when it is parsed.
|
||||
*/
|
||||
if (acpi_gbl_all_methods_serialized) {
|
||||
obj_desc->method.sync_level = 0;
|
||||
obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
|
||||
} else if (method_flags & AML_METHOD_SERIALIZED) {
|
||||
if (method_flags & AML_METHOD_SERIALIZED) {
|
||||
/*
|
||||
* ACPI 1.0: sync_level = 0
|
||||
* ACPI 2.0: sync_level = sync_level in method declaration
|
||||
|
|
@ -597,6 +601,7 @@ acpi_ex_create_method(u8 * aml_start,
|
|||
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
|
||||
exit:
|
||||
/* Remove a reference to the operand */
|
||||
|
||||
acpi_ut_remove_reference(operand[1]);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -59,8 +59,6 @@ static void acpi_ex_out_string(char *title, char *value);
|
|||
|
||||
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);
|
||||
|
|
@ -92,10 +90,11 @@ static struct acpi_exdump_info acpi_ex_dump_string[4] = {
|
|||
{ACPI_EXD_STRING, 0, NULL}
|
||||
};
|
||||
|
||||
static struct acpi_exdump_info acpi_ex_dump_buffer[4] = {
|
||||
static struct acpi_exdump_info acpi_ex_dump_buffer[5] = {
|
||||
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL},
|
||||
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"},
|
||||
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"},
|
||||
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.node), "Parent Node"},
|
||||
{ACPI_EXD_BUFFER, 0, NULL}
|
||||
};
|
||||
|
||||
|
|
@ -165,8 +164,8 @@ static struct acpi_exdump_info acpi_ex_dump_power[5] = {
|
|||
|
||||
static struct acpi_exdump_info acpi_ex_dump_processor[7] = {
|
||||
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL},
|
||||
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"},
|
||||
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.length), "Length"},
|
||||
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"},
|
||||
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.length), "Length"},
|
||||
{ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"},
|
||||
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify),
|
||||
"System Notify"},
|
||||
|
|
@ -379,18 +378,12 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
|
|||
break;
|
||||
|
||||
case ACPI_EXD_POINTER:
|
||||
case ACPI_EXD_ADDRESS:
|
||||
|
||||
acpi_ex_out_pointer(name,
|
||||
*ACPI_CAST_PTR(void *, target));
|
||||
break;
|
||||
|
||||
case ACPI_EXD_ADDRESS:
|
||||
|
||||
acpi_ex_out_address(name,
|
||||
*ACPI_CAST_PTR
|
||||
(acpi_physical_address, target));
|
||||
break;
|
||||
|
||||
case ACPI_EXD_STRING:
|
||||
|
||||
acpi_ut_print_string(obj_desc->string.pointer,
|
||||
|
|
@ -834,16 +827,6 @@ static void acpi_ex_out_pointer(char *title, void *value)
|
|||
acpi_os_printf("%20s : %p\n", title, value);
|
||||
}
|
||||
|
||||
static void acpi_ex_out_address(char *title, acpi_physical_address value)
|
||||
{
|
||||
|
||||
#if ACPI_MACHINE_WIDTH == 16
|
||||
acpi_os_printf("%20s : %p\n", title, value);
|
||||
#else
|
||||
acpi_os_printf("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_dump_namespace_node
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -257,14 +257,13 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
|
|||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
|
||||
" Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
|
||||
" Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n",
|
||||
acpi_ut_get_region_name(rgn_desc->region.
|
||||
space_id),
|
||||
rgn_desc->region.space_id,
|
||||
obj_desc->common_field.access_byte_width,
|
||||
obj_desc->common_field.base_byte_offset,
|
||||
field_datum_byte_offset,
|
||||
ACPI_FORMAT_UINT64(address)));
|
||||
field_datum_byte_offset, (void *)address));
|
||||
|
||||
/* Invoke the appropriate address_space/op_region handler */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/acevents.h>
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exmutex")
|
||||
|
|
@ -150,7 +151,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
|
|||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Sanity check -- we must have a valid thread ID */
|
||||
/* Sanity check: we must have a valid thread ID */
|
||||
|
||||
if (!walk_state->thread) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
|
|
@ -174,24 +175,28 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
|
|||
/* Support for multiple acquires by the owning thread */
|
||||
|
||||
if (obj_desc->mutex.owner_thread) {
|
||||
|
||||
/* Special case for Global Lock, allow all threads */
|
||||
|
||||
if ((obj_desc->mutex.owner_thread->thread_id ==
|
||||
walk_state->thread->thread_id) ||
|
||||
(obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK)) {
|
||||
if (obj_desc->mutex.owner_thread->thread_id ==
|
||||
walk_state->thread->thread_id) {
|
||||
/*
|
||||
* The mutex is already owned by this thread,
|
||||
* just increment the acquisition depth
|
||||
* The mutex is already owned by this thread, just increment the
|
||||
* acquisition depth
|
||||
*/
|
||||
obj_desc->mutex.acquisition_depth++;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/* Acquire the mutex, wait if necessary */
|
||||
/* Acquire the mutex, wait if necessary. Special case for Global Lock */
|
||||
|
||||
if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) {
|
||||
status =
|
||||
acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
|
||||
} else {
|
||||
status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex,
|
||||
(u16) time_desc->integer.
|
||||
value);
|
||||
}
|
||||
|
||||
status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
||||
/* Includes failure from a timeout on time_desc */
|
||||
|
|
@ -211,7 +216,6 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
|
|||
/* Link the mutex to the current thread for force-unlock at method exit */
|
||||
|
||||
acpi_ex_link_mutex(obj_desc, walk_state->thread);
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +236,7 @@ acpi_status
|
|||
acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_release_mutex);
|
||||
|
||||
|
|
@ -249,7 +253,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
|
|||
return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
|
||||
}
|
||||
|
||||
/* Sanity check -- we must have a valid thread ID */
|
||||
/* Sanity check: we must have a valid thread ID */
|
||||
|
||||
if (!walk_state->thread) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
|
|
@ -264,7 +268,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
|
|||
*/
|
||||
if ((obj_desc->mutex.owner_thread->thread_id !=
|
||||
walk_state->thread->thread_id)
|
||||
&& (obj_desc->mutex.os_mutex != ACPI_GLOBAL_LOCK)) {
|
||||
&& (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX",
|
||||
(unsigned long)walk_state->thread->thread_id,
|
||||
|
|
@ -274,8 +278,8 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
|
|||
}
|
||||
|
||||
/*
|
||||
* The sync level of the mutex must be less than or
|
||||
* equal to the current sync level
|
||||
* The sync level of the mutex must be less than or equal to the current
|
||||
* sync level
|
||||
*/
|
||||
if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
|
|
@ -298,11 +302,15 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
|
|||
|
||||
acpi_ex_unlink_mutex(obj_desc);
|
||||
|
||||
/* Release the mutex */
|
||||
/* Release the mutex, special case for Global Lock */
|
||||
|
||||
status = acpi_ex_system_release_mutex(obj_desc);
|
||||
if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) {
|
||||
status = acpi_ev_release_global_lock();
|
||||
} else {
|
||||
acpi_os_release_mutex(obj_desc->mutex.os_mutex);
|
||||
}
|
||||
|
||||
/* Update the mutex and walk state, restore sync_level before acquire */
|
||||
/* Update the mutex and restore sync_level */
|
||||
|
||||
obj_desc->mutex.owner_thread = NULL;
|
||||
walk_state->thread->current_sync_level =
|
||||
|
|
@ -321,39 +329,49 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
|
|||
*
|
||||
* DESCRIPTION: Release all mutexes held by this thread
|
||||
*
|
||||
* NOTE: This function is called as the thread is exiting the interpreter.
|
||||
* Mutexes are not released when an individual control method is exited, but
|
||||
* only when the parent thread actually exits the interpreter. This allows one
|
||||
* method to acquire a mutex, and a different method to release it, as long as
|
||||
* this is performed underneath a single parent control method.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
|
||||
{
|
||||
union acpi_operand_object *next = thread->acquired_mutex_list;
|
||||
union acpi_operand_object *this;
|
||||
acpi_status status;
|
||||
union acpi_operand_object *obj_desc;
|
||||
|
||||
ACPI_FUNCTION_ENTRY();
|
||||
|
||||
/* Traverse the list of owned mutexes, releasing each one */
|
||||
|
||||
while (next) {
|
||||
this = next;
|
||||
next = this->mutex.next;
|
||||
obj_desc = next;
|
||||
next = obj_desc->mutex.next;
|
||||
|
||||
this->mutex.acquisition_depth = 1;
|
||||
this->mutex.prev = NULL;
|
||||
this->mutex.next = NULL;
|
||||
obj_desc->mutex.prev = NULL;
|
||||
obj_desc->mutex.next = NULL;
|
||||
obj_desc->mutex.acquisition_depth = 0;
|
||||
|
||||
/* Release the mutex */
|
||||
/* Release the mutex, special case for Global Lock */
|
||||
|
||||
status = acpi_ex_system_release_mutex(this);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
continue;
|
||||
if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) {
|
||||
|
||||
/* Ignore errors */
|
||||
|
||||
(void)acpi_ev_release_global_lock();
|
||||
} else {
|
||||
acpi_os_release_mutex(obj_desc->mutex.os_mutex);
|
||||
}
|
||||
|
||||
/* Mark mutex unowned */
|
||||
|
||||
this->mutex.owner_thread = NULL;
|
||||
obj_desc->mutex.owner_thread = NULL;
|
||||
|
||||
/* Update Thread sync_level (Last mutex is the important one) */
|
||||
|
||||
thread->current_sync_level = this->mutex.original_sync_level;
|
||||
thread->current_sync_level =
|
||||
obj_desc->mutex.original_sync_level;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -104,9 +104,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
|
|||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
#if ACPI_MACHINE_WIDTH != 16
|
||||
return_desc->integer.value = acpi_os_get_timer();
|
||||
#endif
|
||||
break;
|
||||
|
||||
default: /* Unknown opcode */
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -155,16 +155,15 @@ acpi_ex_system_memory_space_handler(u32 function,
|
|||
|
||||
/* Create a new mapping starting at the address given */
|
||||
|
||||
status = acpi_os_map_memory(address, window_size,
|
||||
(void **)&mem_info->
|
||||
mapped_logical_address);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
mem_info->mapped_logical_address =
|
||||
acpi_os_map_memory((acpi_native_uint) address, window_size);
|
||||
if (!mem_info->mapped_logical_address) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Could not map memory at %8.8X%8.8X, size %X",
|
||||
ACPI_FORMAT_UINT64(address),
|
||||
(u32) window_size));
|
||||
mem_info->mapped_length = 0;
|
||||
return_ACPI_STATUS(status);
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Save the physical address and mapping size */
|
||||
|
|
@ -210,11 +209,10 @@ acpi_ex_system_memory_space_handler(u32 function,
|
|||
*value = (acpi_integer) ACPI_GET32(logical_addr_ptr);
|
||||
break;
|
||||
|
||||
#if ACPI_MACHINE_WIDTH != 16
|
||||
case 64:
|
||||
*value = (acpi_integer) ACPI_GET64(logical_addr_ptr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* bit_width was already validated */
|
||||
break;
|
||||
|
|
@ -236,11 +234,9 @@ acpi_ex_system_memory_space_handler(u32 function,
|
|||
ACPI_SET32(logical_addr_ptr) = (u32) * value;
|
||||
break;
|
||||
|
||||
#if ACPI_MACHINE_WIDTH != 16
|
||||
case 64:
|
||||
ACPI_SET64(logical_addr_ptr) = (u64) * value;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* bit_width was already validated */
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -141,7 +141,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
|||
acpi_status status = AE_OK;
|
||||
union acpi_operand_object *stack_desc;
|
||||
void *temp_node;
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *obj_desc = NULL;
|
||||
u16 opcode;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
|
||||
|
|
@ -299,8 +299,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
|||
status = acpi_ds_get_package_arguments(stack_desc);
|
||||
break;
|
||||
|
||||
/* These cases may never happen here, but just in case.. */
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
|
|
@ -314,6 +312,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
|||
status =
|
||||
acpi_ex_read_data_from_field(walk_state, stack_desc,
|
||||
&obj_desc);
|
||||
|
||||
/* Remove a reference to the original operand, then override */
|
||||
|
||||
acpi_ut_remove_reference(*stack_ptr);
|
||||
*stack_ptr = (void *)obj_desc;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -611,22 +611,20 @@ acpi_ex_resolve_operands(u16 opcode,
|
|||
}
|
||||
goto next_operand;
|
||||
|
||||
case ARGI_REGION_OR_FIELD:
|
||||
case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
|
||||
|
||||
/* Need an operand of type REGION or a FIELD in a region */
|
||||
/* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||
case ACPI_TYPE_BUFFER:
|
||||
case ACPI_TYPE_REGION:
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||
|
||||
/* Valid operand */
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Needed [Region/RegionField], found [%s] %p",
|
||||
"Needed [Region/Buffer], found [%s] %p",
|
||||
acpi_ut_get_object_type_name
|
||||
(obj_desc), obj_desc));
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -66,7 +66,6 @@ ACPI_MODULE_NAME("exsystem")
|
|||
acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status2;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_system_wait_semaphore);
|
||||
|
||||
|
|
@ -79,7 +78,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
|
|||
|
||||
/* We must wait, so unlock the interpreter */
|
||||
|
||||
acpi_ex_exit_interpreter();
|
||||
acpi_ex_relinquish_interpreter();
|
||||
|
||||
status = acpi_os_wait_semaphore(semaphore, 1, timeout);
|
||||
|
||||
|
|
@ -89,13 +88,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
|
|||
|
||||
/* Reacquire the interpreter */
|
||||
|
||||
status2 = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status2)) {
|
||||
|
||||
/* Report fatal error, could not acquire interpreter */
|
||||
|
||||
return_ACPI_STATUS(status2);
|
||||
}
|
||||
acpi_ex_reacquire_interpreter();
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
|
|
@ -119,7 +112,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
|
|||
acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status2;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_system_wait_mutex);
|
||||
|
||||
|
|
@ -132,7 +124,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
|
|||
|
||||
/* We must wait, so unlock the interpreter */
|
||||
|
||||
acpi_ex_exit_interpreter();
|
||||
acpi_ex_relinquish_interpreter();
|
||||
|
||||
status = acpi_os_acquire_mutex(mutex, timeout);
|
||||
|
||||
|
|
@ -142,13 +134,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
|
|||
|
||||
/* Reacquire the interpreter */
|
||||
|
||||
status2 = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status2)) {
|
||||
|
||||
/* Report fatal error, could not acquire interpreter */
|
||||
|
||||
return_ACPI_STATUS(status2);
|
||||
}
|
||||
acpi_ex_reacquire_interpreter();
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
|
|
@ -209,96 +195,18 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)
|
|||
|
||||
acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_ENTRY();
|
||||
|
||||
/* Since this thread will sleep, we must release the interpreter */
|
||||
|
||||
acpi_ex_exit_interpreter();
|
||||
acpi_ex_relinquish_interpreter();
|
||||
|
||||
acpi_os_sleep(how_long);
|
||||
|
||||
/* And now we must get the interpreter again */
|
||||
|
||||
status = acpi_ex_enter_interpreter();
|
||||
return (status);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_acquire_mutex
|
||||
*
|
||||
* PARAMETERS: time_desc - Maximum time to wait for the mutex
|
||||
* obj_desc - The object descriptor for this op
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Provides an access point to perform synchronization operations
|
||||
* within the AML. This function will cause a lock to be generated
|
||||
* for the Mutex pointed to by obj_desc.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc,
|
||||
union acpi_operand_object * obj_desc)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR(ex_system_acquire_mutex, obj_desc);
|
||||
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Support for the _GL_ Mutex object -- go get the global lock */
|
||||
|
||||
if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) {
|
||||
status =
|
||||
acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex,
|
||||
(u16) time_desc->integer.value);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_release_mutex
|
||||
*
|
||||
* PARAMETERS: obj_desc - The object descriptor for this op
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Provides an access point to perform synchronization operations
|
||||
* within the AML. This operation is a request to release a
|
||||
* previously acquired Mutex. If the Mutex variable is set then
|
||||
* it will be decremented.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ex_system_release_mutex);
|
||||
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Support for the _GL_ Mutex object -- release the global lock */
|
||||
|
||||
if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) {
|
||||
status = acpi_ev_release_global_lock();
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
acpi_os_release_mutex(obj_desc->mutex.os_mutex);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
acpi_ex_reacquire_interpreter();
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
@ -314,7 +222,7 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
|
||||
acpi_status acpi_ex_system_signal_event(union acpi_operand_object * obj_desc)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -76,14 +76,15 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
|
|||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Enter the interpreter execution region. Failure to enter
|
||||
* the interpreter region is a fatal system error
|
||||
* DESCRIPTION: Enter the interpreter execution region. Failure to enter
|
||||
* the interpreter region is a fatal system error. Used in
|
||||
* conjunction with exit_interpreter.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status acpi_ex_enter_interpreter(void)
|
||||
void acpi_ex_enter_interpreter(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
|
@ -91,10 +92,42 @@ acpi_status acpi_ex_enter_interpreter(void)
|
|||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Could not acquire AML Interpreter mutex"));
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_reacquire_interpreter
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Reacquire the interpreter execution region from within the
|
||||
* interpreter code. Failure to enter the interpreter region is a
|
||||
* fatal system error. Used in conjuction with
|
||||
* relinquish_interpreter
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void acpi_ex_reacquire_interpreter(void)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE(ex_reacquire_interpreter);
|
||||
|
||||
/*
|
||||
* If the global serialized flag is set, do not release the interpreter,
|
||||
* since it was not actually released by acpi_ex_relinquish_interpreter.
|
||||
* This forces the interpreter to be single threaded.
|
||||
*/
|
||||
if (!acpi_gbl_all_methods_serialized) {
|
||||
acpi_ex_enter_interpreter();
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
@ -105,17 +138,9 @@ acpi_status acpi_ex_enter_interpreter(void)
|
|||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Exit the interpreter execution region
|
||||
*
|
||||
* Cases where the interpreter is unlocked:
|
||||
* 1) Completion of the execution of a control method
|
||||
* 2) Method blocked on a Sleep() AML opcode
|
||||
* 3) Method blocked on an Acquire() AML opcode
|
||||
* 4) Method blocked on a Wait() AML opcode
|
||||
* 5) Method blocked to acquire the global lock
|
||||
* 6) Method blocked to execute a serialized control method that is
|
||||
* already executing
|
||||
* 7) About to invoke a user-installed opregion handler
|
||||
* DESCRIPTION: Exit the interpreter execution region. This is the top level
|
||||
* routine used to exit the interpreter when all processing has
|
||||
* been completed.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
|
@ -127,7 +152,46 @@ void acpi_ex_exit_interpreter(void)
|
|||
|
||||
status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Could not release AML Interpreter mutex"));
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_relinquish_interpreter
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Exit the interpreter execution region, from within the
|
||||
* interpreter - before attempting an operation that will possibly
|
||||
* block the running thread.
|
||||
*
|
||||
* Cases where the interpreter is unlocked internally
|
||||
* 1) Method to be blocked on a Sleep() AML opcode
|
||||
* 2) Method to be blocked on an Acquire() AML opcode
|
||||
* 3) Method to be blocked on a Wait() AML opcode
|
||||
* 4) Method to be blocked to acquire the global lock
|
||||
* 5) Method to be blocked waiting to execute a serialized control method
|
||||
* that is currently executing
|
||||
* 6) About to invoke a user-installed opregion handler
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void acpi_ex_relinquish_interpreter(void)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE(ex_relinquish_interpreter);
|
||||
|
||||
/*
|
||||
* If the global serialized flag is set, do not release the interpreter.
|
||||
* This forces the interpreter to be single threaded.
|
||||
*/
|
||||
if (!acpi_gbl_all_methods_serialized) {
|
||||
acpi_ex_exit_interpreter();
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
|
|
@ -141,8 +205,8 @@ void acpi_ex_exit_interpreter(void)
|
|||
*
|
||||
* RETURN: none
|
||||
*
|
||||
* DESCRIPTION: Truncate a number to 32-bits if the currently executing method
|
||||
* belongs to a 32-bit ACPI table.
|
||||
* DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
|
||||
* 32-bit, as determined by the revision of the DSDT.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -47,41 +47,6 @@
|
|||
#define _COMPONENT ACPI_HARDWARE
|
||||
ACPI_MODULE_NAME("hwacpi")
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_hw_initialize
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Initialize and validate the various ACPI registers defined in
|
||||
* the FADT.
|
||||
*
|
||||
******************************************************************************/
|
||||
acpi_status acpi_hw_initialize(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE(hw_initialize);
|
||||
|
||||
/* We must have the ACPI tables by the time we get here */
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
ACPI_ERROR((AE_INFO, "No FADT is present"));
|
||||
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||
}
|
||||
|
||||
/* Sanity check the FADT for valid values */
|
||||
|
||||
status = acpi_ut_validate_fadt();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_hw_set_mode
|
||||
|
|
@ -93,7 +58,6 @@ acpi_status acpi_hw_initialize(void)
|
|||
* DESCRIPTION: Transitions the system into the requested mode.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status acpi_hw_set_mode(u32 mode)
|
||||
{
|
||||
|
||||
|
|
@ -106,7 +70,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
|
|||
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
|
||||
* system does not support mode transition.
|
||||
*/
|
||||
if (!acpi_gbl_FADT->smi_cmd) {
|
||||
if (!acpi_gbl_FADT.smi_command) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"No SMI_CMD in FADT, mode transition failed"));
|
||||
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||
|
|
@ -119,7 +83,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
|
|||
* we make sure both the numbers are zero to determine these
|
||||
* transitions are not supported.
|
||||
*/
|
||||
if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
|
||||
if (!acpi_gbl_FADT.acpi_enable && !acpi_gbl_FADT.acpi_disable) {
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"No ACPI mode transition supported in this system (enable/disable both zero)"));
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
|
@ -130,9 +94,8 @@ acpi_status acpi_hw_set_mode(u32 mode)
|
|||
|
||||
/* BIOS should have disabled ALL fixed and GP events */
|
||||
|
||||
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
|
||||
(u32) acpi_gbl_FADT->acpi_enable,
|
||||
8);
|
||||
status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
|
||||
(u32) acpi_gbl_FADT.acpi_enable, 8);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Attempting to enable ACPI mode\n"));
|
||||
break;
|
||||
|
|
@ -143,8 +106,8 @@ acpi_status acpi_hw_set_mode(u32 mode)
|
|||
* BIOS should clear all fixed status bits and restore fixed event
|
||||
* enable bits to default
|
||||
*/
|
||||
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
|
||||
(u32) acpi_gbl_FADT->acpi_disable,
|
||||
status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
|
||||
(u32) acpi_gbl_FADT.acpi_disable,
|
||||
8);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Attempting to enable Legacy (non-ACPI) mode\n"));
|
||||
|
|
@ -204,12 +167,11 @@ u32 acpi_hw_get_mode(void)
|
|||
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
|
||||
* system does not support mode transition.
|
||||
*/
|
||||
if (!acpi_gbl_FADT->smi_cmd) {
|
||||
if (!acpi_gbl_FADT.smi_command) {
|
||||
return_UINT32(ACPI_SYS_MODE_ACPI);
|
||||
}
|
||||
|
||||
status =
|
||||
acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
|
||||
status = acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_UINT32(ACPI_SYS_MODE_LEGACY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -105,14 +105,20 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
|
|||
acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
|
||||
{
|
||||
acpi_status status;
|
||||
u8 register_bit;
|
||||
|
||||
ACPI_FUNCTION_ENTRY();
|
||||
|
||||
register_bit = (u8)
|
||||
(1 <<
|
||||
(gpe_event_info->gpe_number -
|
||||
gpe_event_info->register_info->base_gpe_number));
|
||||
|
||||
/*
|
||||
* Write a one to the appropriate bit in the status register to
|
||||
* clear this GPE.
|
||||
*/
|
||||
status = acpi_hw_low_level_write(8, gpe_event_info->register_bit,
|
||||
status = acpi_hw_low_level_write(8, register_bit,
|
||||
&gpe_event_info->register_info->
|
||||
status_address);
|
||||
|
||||
|
|
@ -155,7 +161,10 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
|
|||
|
||||
/* Get the register bitmask for this GPE */
|
||||
|
||||
register_bit = gpe_event_info->register_bit;
|
||||
register_bit = (u8)
|
||||
(1 <<
|
||||
(gpe_event_info->gpe_number -
|
||||
gpe_event_info->register_info->base_gpe_number));
|
||||
|
||||
/* GPE currently enabled? (enabled for runtime?) */
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -54,17 +54,15 @@ ACPI_MODULE_NAME("hwregs")
|
|||
*
|
||||
* FUNCTION: acpi_hw_clear_acpi_status
|
||||
*
|
||||
* PARAMETERS: Flags - Lock the hardware or not
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: none
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Clears all fixed and general purpose status bits
|
||||
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
|
||||
*
|
||||
* NOTE: TBD: Flags parameter is obsolete, to be removed
|
||||
*
|
||||
******************************************************************************/
|
||||
acpi_status acpi_hw_clear_acpi_status(u32 flags)
|
||||
acpi_status acpi_hw_clear_acpi_status(void)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_cpu_flags lock_flags = 0;
|
||||
|
|
@ -73,7 +71,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
|
|||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
|
||||
ACPI_BITMASK_ALL_FIXED_STATUS,
|
||||
(u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
|
||||
(u16) acpi_gbl_FADT.xpm1a_event_block.address));
|
||||
|
||||
lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
|
||||
|
||||
|
|
@ -86,10 +84,10 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
|
|||
|
||||
/* Clear the fixed events */
|
||||
|
||||
if (acpi_gbl_FADT->xpm1b_evt_blk.address) {
|
||||
if (acpi_gbl_FADT.xpm1b_event_block.address) {
|
||||
status =
|
||||
acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
|
||||
&acpi_gbl_FADT->xpm1b_evt_blk);
|
||||
&acpi_gbl_FADT.xpm1b_event_block);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
|
@ -253,18 +251,15 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
|
|||
*
|
||||
* PARAMETERS: register_id - ID of ACPI bit_register to access
|
||||
* return_value - Value that was read from the register
|
||||
* Flags - Lock the hardware or not
|
||||
*
|
||||
* RETURN: Status and the value read from specified Register. Value
|
||||
* returned is normalized to bit0 (is shifted all the way right)
|
||||
*
|
||||
* DESCRIPTION: ACPI bit_register read function.
|
||||
*
|
||||
* NOTE: TBD: Flags parameter is obsolete, to be removed
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
|
||||
acpi_status acpi_get_register(u32 register_id, u32 * return_value)
|
||||
{
|
||||
u32 register_value = 0;
|
||||
struct acpi_bit_register_info *bit_reg_info;
|
||||
|
|
@ -312,16 +307,13 @@ ACPI_EXPORT_SYMBOL(acpi_get_register)
|
|||
* PARAMETERS: register_id - ID of ACPI bit_register to access
|
||||
* Value - (only used on write) value to write to the
|
||||
* Register, NOT pre-normalized to the bit pos
|
||||
* Flags - Lock the hardware or not
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: ACPI Bit Register write function.
|
||||
*
|
||||
* NOTE: TBD: Flags parameter is obsolete, to be removed
|
||||
*
|
||||
******************************************************************************/
|
||||
acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
|
||||
acpi_status acpi_set_register(u32 register_id, u32 value)
|
||||
{
|
||||
u32 register_value = 0;
|
||||
struct acpi_bit_register_info *bit_reg_info;
|
||||
|
|
@ -422,8 +414,9 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
|
|||
ACPI_DEBUG_PRINT((ACPI_DB_IO,
|
||||
"PM2 control: Read %X from %8.8X%8.8X\n",
|
||||
register_value,
|
||||
ACPI_FORMAT_UINT64(acpi_gbl_FADT->
|
||||
xpm2_cnt_blk.address)));
|
||||
ACPI_FORMAT_UINT64(acpi_gbl_FADT.
|
||||
xpm2_control_block.
|
||||
address)));
|
||||
|
||||
ACPI_REGISTER_INSERT_VALUE(register_value,
|
||||
bit_reg_info->bit_position,
|
||||
|
|
@ -433,8 +426,9 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
|
|||
ACPI_DEBUG_PRINT((ACPI_DB_IO,
|
||||
"About to write %4.4X to %8.8X%8.8X\n",
|
||||
register_value,
|
||||
ACPI_FORMAT_UINT64(acpi_gbl_FADT->
|
||||
xpm2_cnt_blk.address)));
|
||||
ACPI_FORMAT_UINT64(acpi_gbl_FADT.
|
||||
xpm2_control_block.
|
||||
address)));
|
||||
|
||||
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||
ACPI_REGISTER_PM2_CONTROL,
|
||||
|
|
@ -495,7 +489,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
|
|||
|
||||
status =
|
||||
acpi_hw_low_level_read(16, &value1,
|
||||
&acpi_gbl_FADT->xpm1a_evt_blk);
|
||||
&acpi_gbl_FADT.xpm1a_event_block);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
|
@ -504,7 +498,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
|
|||
|
||||
status =
|
||||
acpi_hw_low_level_read(16, &value2,
|
||||
&acpi_gbl_FADT->xpm1b_evt_blk);
|
||||
&acpi_gbl_FADT.xpm1b_event_block);
|
||||
value1 |= value2;
|
||||
break;
|
||||
|
||||
|
|
@ -527,14 +521,14 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
|
|||
|
||||
status =
|
||||
acpi_hw_low_level_read(16, &value1,
|
||||
&acpi_gbl_FADT->xpm1a_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm1a_control_block);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
status =
|
||||
acpi_hw_low_level_read(16, &value2,
|
||||
&acpi_gbl_FADT->xpm1b_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm1b_control_block);
|
||||
value1 |= value2;
|
||||
break;
|
||||
|
||||
|
|
@ -542,19 +536,20 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
|
|||
|
||||
status =
|
||||
acpi_hw_low_level_read(8, &value1,
|
||||
&acpi_gbl_FADT->xpm2_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm2_control_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
|
||||
|
||||
status =
|
||||
acpi_hw_low_level_read(32, &value1,
|
||||
&acpi_gbl_FADT->xpm_tmr_blk);
|
||||
&acpi_gbl_FADT.xpm_timer_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
|
||||
|
||||
status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8);
|
||||
status =
|
||||
acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -635,7 +630,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
|
|||
|
||||
status =
|
||||
acpi_hw_low_level_write(16, value,
|
||||
&acpi_gbl_FADT->xpm1a_evt_blk);
|
||||
&acpi_gbl_FADT.xpm1a_event_block);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
|
@ -644,7 +639,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
|
|||
|
||||
status =
|
||||
acpi_hw_low_level_write(16, value,
|
||||
&acpi_gbl_FADT->xpm1b_evt_blk);
|
||||
&acpi_gbl_FADT.xpm1b_event_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
|
||||
|
|
@ -682,49 +677,50 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
|
|||
|
||||
status =
|
||||
acpi_hw_low_level_write(16, value,
|
||||
&acpi_gbl_FADT->xpm1a_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm1a_control_block);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
status =
|
||||
acpi_hw_low_level_write(16, value,
|
||||
&acpi_gbl_FADT->xpm1b_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm1b_control_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
|
||||
|
||||
status =
|
||||
acpi_hw_low_level_write(16, value,
|
||||
&acpi_gbl_FADT->xpm1a_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm1a_control_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
|
||||
|
||||
status =
|
||||
acpi_hw_low_level_write(16, value,
|
||||
&acpi_gbl_FADT->xpm1b_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm1b_control_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
|
||||
|
||||
status =
|
||||
acpi_hw_low_level_write(8, value,
|
||||
&acpi_gbl_FADT->xpm2_cnt_blk);
|
||||
&acpi_gbl_FADT.xpm2_control_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
|
||||
|
||||
status =
|
||||
acpi_hw_low_level_write(32, value,
|
||||
&acpi_gbl_FADT->xpm_tmr_blk);
|
||||
&acpi_gbl_FADT.xpm_timer_block);
|
||||
break;
|
||||
|
||||
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
|
||||
|
||||
/* SMI_CMD is currently always in IO space */
|
||||
|
||||
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8);
|
||||
status =
|
||||
acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -783,7 +779,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
|
|||
* Two address spaces supported: Memory or IO.
|
||||
* PCI_Config is not supported here because the GAS struct is insufficient
|
||||
*/
|
||||
switch (reg->address_space_id) {
|
||||
switch (reg->space_id) {
|
||||
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
||||
|
||||
status = acpi_os_read_memory((acpi_physical_address) address,
|
||||
|
|
@ -792,22 +788,20 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
|
|||
|
||||
case ACPI_ADR_SPACE_SYSTEM_IO:
|
||||
|
||||
status = acpi_os_read_port((acpi_io_address) address,
|
||||
value, width);
|
||||
status =
|
||||
acpi_os_read_port((acpi_io_address) address, value, width);
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Unsupported address space: %X",
|
||||
reg->address_space_id));
|
||||
"Unsupported address space: %X", reg->space_id));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_IO,
|
||||
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
|
||||
*value, width,
|
||||
ACPI_FORMAT_UINT64(address),
|
||||
acpi_ut_get_region_name(reg->address_space_id)));
|
||||
*value, width, ACPI_FORMAT_UINT64(address),
|
||||
acpi_ut_get_region_name(reg->space_id)));
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
|
@ -854,7 +848,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
|
|||
* Two address spaces supported: Memory or IO.
|
||||
* PCI_Config is not supported here because the GAS struct is insufficient
|
||||
*/
|
||||
switch (reg->address_space_id) {
|
||||
switch (reg->space_id) {
|
||||
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
||||
|
||||
status = acpi_os_write_memory((acpi_physical_address) address,
|
||||
|
|
@ -863,22 +857,20 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
|
|||
|
||||
case ACPI_ADR_SPACE_SYSTEM_IO:
|
||||
|
||||
status = acpi_os_write_port((acpi_io_address) address,
|
||||
value, width);
|
||||
status = acpi_os_write_port((acpi_io_address) address, value,
|
||||
width);
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_ERROR((AE_INFO,
|
||||
"Unsupported address space: %X",
|
||||
reg->address_space_id));
|
||||
"Unsupported address space: %X", reg->space_id));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_IO,
|
||||
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
|
||||
value, width,
|
||||
ACPI_FORMAT_UINT64(address),
|
||||
acpi_ut_get_region_name(reg->address_space_id)));
|
||||
value, width, ACPI_FORMAT_UINT64(address),
|
||||
acpi_ut_get_region_name(reg->space_id)));
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -43,6 +43,7 @@
|
|||
*/
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/actables.h>
|
||||
|
||||
#define _COMPONENT ACPI_HARDWARE
|
||||
ACPI_MODULE_NAME("hwsleep")
|
||||
|
|
@ -62,17 +63,32 @@ ACPI_MODULE_NAME("hwsleep")
|
|||
acpi_status
|
||||
acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
|
||||
{
|
||||
struct acpi_table_facs *facs;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
|
||||
|
||||
/* Get the FACS */
|
||||
|
||||
status =
|
||||
acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
|
||||
(struct acpi_table_header **)&facs);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Set the vector */
|
||||
|
||||
if (acpi_gbl_common_fACS.vector_width == 32) {
|
||||
*(ACPI_CAST_PTR
|
||||
(u32, acpi_gbl_common_fACS.firmware_waking_vector))
|
||||
= (u32) physical_address;
|
||||
if ((facs->length < 32) || (!(facs->xfirmware_waking_vector))) {
|
||||
/*
|
||||
* ACPI 1.0 FACS or short table or optional X_ field is zero
|
||||
*/
|
||||
facs->firmware_waking_vector = (u32) physical_address;
|
||||
} else {
|
||||
*acpi_gbl_common_fACS.firmware_waking_vector = physical_address;
|
||||
/*
|
||||
* ACPI 2.0 FACS with valid X_ field
|
||||
*/
|
||||
facs->xfirmware_waking_vector = physical_address;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
|
@ -97,6 +113,8 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
|
|||
acpi_status
|
||||
acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
|
||||
{
|
||||
struct acpi_table_facs *facs;
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector);
|
||||
|
||||
|
|
@ -104,16 +122,29 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
|
|||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Get the FACS */
|
||||
|
||||
status =
|
||||
acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
|
||||
(struct acpi_table_header **)&facs);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Get the vector */
|
||||
|
||||
if (acpi_gbl_common_fACS.vector_width == 32) {
|
||||
*physical_address = (acpi_physical_address)
|
||||
*
|
||||
(ACPI_CAST_PTR
|
||||
(u32, acpi_gbl_common_fACS.firmware_waking_vector));
|
||||
} else {
|
||||
if ((facs->length < 32) || (!(facs->xfirmware_waking_vector))) {
|
||||
/*
|
||||
* ACPI 1.0 FACS or short table or optional X_ field is zero
|
||||
*/
|
||||
*physical_address =
|
||||
*acpi_gbl_common_fACS.firmware_waking_vector;
|
||||
(acpi_physical_address) facs->firmware_waking_vector;
|
||||
} else {
|
||||
/*
|
||||
* ACPI 2.0 FACS with valid X_ field
|
||||
*/
|
||||
*physical_address =
|
||||
(acpi_physical_address) facs->xfirmware_waking_vector;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
|
@ -246,15 +277,14 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
|
|||
|
||||
/* Clear wake status */
|
||||
|
||||
status =
|
||||
acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||
status = acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Clear all fixed and general purpose status bits */
|
||||
|
||||
status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
|
||||
status = acpi_hw_clear_acpi_status();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -367,8 +397,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
|
|||
/* Wait until we enter sleep state */
|
||||
|
||||
do {
|
||||
status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -401,13 +430,12 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
|
|||
|
||||
ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios);
|
||||
|
||||
status =
|
||||
acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||
status = acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
|
||||
status = acpi_hw_clear_acpi_status();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -429,13 +457,12 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
|
|||
|
||||
ACPI_FLUSH_CPU_CACHE();
|
||||
|
||||
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
|
||||
(u32) acpi_gbl_FADT->S4bios_req, 8);
|
||||
status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
|
||||
(u32) acpi_gbl_FADT.S4bios_request, 8);
|
||||
|
||||
do {
|
||||
acpi_os_stall(1000);
|
||||
status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -568,13 +595,11 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
|
|||
|
||||
(void)
|
||||
acpi_set_register(acpi_gbl_fixed_event_info
|
||||
[ACPI_EVENT_POWER_BUTTON].enable_register_id, 1,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
[ACPI_EVENT_POWER_BUTTON].enable_register_id, 1);
|
||||
|
||||
(void)
|
||||
acpi_set_register(acpi_gbl_fixed_event_info
|
||||
[ACPI_EVENT_POWER_BUTTON].status_register_id, 1,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
[ACPI_EVENT_POWER_BUTTON].status_register_id, 1);
|
||||
|
||||
arg.integer.value = ACPI_SST_WORKING;
|
||||
status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -66,7 +66,7 @@ acpi_status acpi_get_timer_resolution(u32 * resolution)
|
|||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
if (acpi_gbl_FADT->tmr_val_ext == 0) {
|
||||
if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) {
|
||||
*resolution = 24;
|
||||
} else {
|
||||
*resolution = 32;
|
||||
|
|
@ -98,7 +98,8 @@ acpi_status acpi_get_timer(u32 * ticks)
|
|||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
|
||||
status =
|
||||
acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT.xpm_timer_block);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -153,7 +154,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 (acpi_gbl_FADT->tmr_val_ext == 0) {
|
||||
if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) {
|
||||
|
||||
/* 24-bit Timer */
|
||||
|
||||
|
|
|
|||
|
|
@ -134,41 +134,41 @@ static void __init acpi_request_region (struct acpi_generic_address *addr,
|
|||
if (!addr->address || !length)
|
||||
return;
|
||||
|
||||
if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO)
|
||||
if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
|
||||
request_region(addr->address, length, desc);
|
||||
else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
|
||||
else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
|
||||
request_mem_region(addr->address, length, desc);
|
||||
}
|
||||
|
||||
static void __init acpi_reserve_resources(void)
|
||||
{
|
||||
acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk,
|
||||
acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK");
|
||||
acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block,
|
||||
acpi_gbl_FADT.pm1_event_length, "ACPI PM1a_EVT_BLK");
|
||||
|
||||
acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk,
|
||||
acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK");
|
||||
acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block,
|
||||
acpi_gbl_FADT.pm1_event_length, "ACPI PM1b_EVT_BLK");
|
||||
|
||||
acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk,
|
||||
acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK");
|
||||
acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block,
|
||||
acpi_gbl_FADT.pm1_control_length, "ACPI PM1a_CNT_BLK");
|
||||
|
||||
acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk,
|
||||
acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK");
|
||||
acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block,
|
||||
acpi_gbl_FADT.pm1_control_length, "ACPI PM1b_CNT_BLK");
|
||||
|
||||
if (acpi_gbl_FADT->pm_tm_len == 4)
|
||||
acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR");
|
||||
if (acpi_gbl_FADT.pm_timer_length == 4)
|
||||
acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
|
||||
|
||||
acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk,
|
||||
acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK");
|
||||
acpi_request_region(&acpi_gbl_FADT.xpm2_control_block,
|
||||
acpi_gbl_FADT.pm2_control_length, "ACPI PM2_CNT_BLK");
|
||||
|
||||
/* Length of GPE blocks must be a non-negative multiple of 2 */
|
||||
|
||||
if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
|
||||
acpi_request_region(&acpi_gbl_FADT->xgpe0_blk,
|
||||
acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK");
|
||||
if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
|
||||
acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
|
||||
acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
|
||||
|
||||
if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
|
||||
acpi_request_region(&acpi_gbl_FADT->xgpe1_blk,
|
||||
acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK");
|
||||
if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
|
||||
acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
|
||||
acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
|
||||
}
|
||||
|
||||
static int __init acpi_motherboard_init(void)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -195,31 +195,27 @@ acpi_status acpi_ns_root_initialize(void)
|
|||
obj_desc->mutex.sync_level =
|
||||
(u8) (ACPI_TO_INTEGER(val) - 1);
|
||||
|
||||
/* Create a mutex */
|
||||
|
||||
status =
|
||||
acpi_os_create_mutex(&obj_desc->mutex.
|
||||
os_mutex);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Special case for ACPI Global Lock */
|
||||
|
||||
if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
|
||||
acpi_gbl_global_lock_mutex =
|
||||
obj_desc->mutex.os_mutex;
|
||||
|
||||
/* Create a counting semaphore for the global lock */
|
||||
/* Create additional counting semaphore for global lock */
|
||||
|
||||
status =
|
||||
acpi_os_create_semaphore
|
||||
(ACPI_NO_UNIT_LIMIT, 1,
|
||||
&acpi_gbl_global_lock_semaphore);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_remove_reference
|
||||
(obj_desc);
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Mark this mutex as very special */
|
||||
|
||||
obj_desc->mutex.os_mutex =
|
||||
ACPI_GLOBAL_LOCK;
|
||||
} else {
|
||||
/* Create a mutex */
|
||||
|
||||
status =
|
||||
acpi_os_create_mutex(&obj_desc->
|
||||
mutex.
|
||||
os_mutex);
|
||||
acpi_os_create_semaphore(1, 0,
|
||||
&acpi_gbl_global_lock_semaphore);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_remove_reference
|
||||
(obj_desc);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -61,6 +61,9 @@ ACPI_MODULE_NAME("nsalloc")
|
|||
struct acpi_namespace_node *acpi_ns_create_node(u32 name)
|
||||
{
|
||||
struct acpi_namespace_node *node;
|
||||
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
|
||||
u32 temp;
|
||||
#endif
|
||||
|
||||
ACPI_FUNCTION_TRACE(ns_create_node);
|
||||
|
||||
|
|
@ -71,6 +74,15 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
|
|||
|
||||
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
|
||||
|
||||
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
|
||||
temp =
|
||||
acpi_gbl_ns_node_list->total_allocated -
|
||||
acpi_gbl_ns_node_list->total_freed;
|
||||
if (temp > acpi_gbl_ns_node_list->max_occupied) {
|
||||
acpi_gbl_ns_node_list->max_occupied = temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
node->name.integer = name;
|
||||
ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
|
||||
return_PTR(node);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -205,7 +205,7 @@ 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_ut_repair_name(this_node->name.ascii);
|
||||
|
||||
ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
|
||||
this_node->name.integer));
|
||||
|
|
@ -226,6 +226,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
|
|||
obj_desc = acpi_ns_get_attached_object(this_node);
|
||||
acpi_dbg_level = dbg_level;
|
||||
|
||||
/* Temp nodes are those nodes created by a control method */
|
||||
|
||||
if (this_node->flags & ANOBJ_TEMPORARY) {
|
||||
acpi_os_printf("(T) ");
|
||||
}
|
||||
|
||||
switch (info->display_type & ACPI_DISPLAY_MASK) {
|
||||
case ACPI_DISPLAY_SUMMARY:
|
||||
|
||||
|
|
@ -623,7 +629,8 @@ acpi_ns_dump_objects(acpi_object_type type,
|
|||
info.display_type = display_type;
|
||||
|
||||
(void)acpi_ns_walk_namespace(type, start_handle, max_depth,
|
||||
ACPI_NS_WALK_NO_UNLOCK,
|
||||
ACPI_NS_WALK_NO_UNLOCK |
|
||||
ACPI_NS_WALK_TEMP_NODES,
|
||||
acpi_ns_dump_one_object, (void *)&info,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -154,11 +154,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
|
|||
* Execute the method via the interpreter. The interpreter is locked
|
||||
* here before calling into the AML parser
|
||||
*/
|
||||
status = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
acpi_ex_enter_interpreter();
|
||||
status = acpi_ps_execute_method(info);
|
||||
acpi_ex_exit_interpreter();
|
||||
} else {
|
||||
|
|
@ -182,10 +178,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
|
|||
* resolution, we must lock it because we could access an opregion.
|
||||
* The opregion access code assumes that the interpreter is locked.
|
||||
*/
|
||||
status = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
acpi_ex_enter_interpreter();
|
||||
|
||||
/* Function has a strange interface */
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -213,7 +213,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
|
|||
u32 level, void *context, void **return_value)
|
||||
{
|
||||
acpi_object_type type;
|
||||
acpi_status status;
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_init_walk_info *info =
|
||||
(struct acpi_init_walk_info *)context;
|
||||
struct acpi_namespace_node *node =
|
||||
|
|
@ -267,10 +267,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
|
|||
/*
|
||||
* Must lock the interpreter before executing AML code
|
||||
*/
|
||||
status = acpi_ex_enter_interpreter();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
acpi_ex_enter_interpreter();
|
||||
|
||||
/*
|
||||
* Each of these types can contain executable AML code within the
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -44,13 +44,12 @@
|
|||
#include <acpi/acpi.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/actables.h>
|
||||
|
||||
#define _COMPONENT ACPI_NAMESPACE
|
||||
ACPI_MODULE_NAME("nsload")
|
||||
|
||||
/* Local prototypes */
|
||||
static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type);
|
||||
|
||||
#ifdef ACPI_FUTURE_IMPLEMENTATION
|
||||
acpi_status acpi_ns_unload_namespace(acpi_handle handle);
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
|
|||
*
|
||||
* FUNCTION: acpi_ns_load_table
|
||||
*
|
||||
* PARAMETERS: table_desc - Descriptor for table to be loaded
|
||||
* PARAMETERS: table_index - Index for table to be loaded
|
||||
* Node - Owning NS node
|
||||
*
|
||||
* RETURN: Status
|
||||
|
|
@ -72,42 +71,13 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ns_load_table(struct acpi_table_desc *table_desc,
|
||||
acpi_ns_load_table(acpi_native_uint table_index,
|
||||
struct acpi_namespace_node *node)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ns_load_table);
|
||||
|
||||
/* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
|
||||
|
||||
if (!
|
||||
(acpi_gbl_table_data[table_desc->type].
|
||||
flags & ACPI_TABLE_EXECUTABLE)) {
|
||||
|
||||
/* Just ignore this table */
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/* Check validity of the AML start and length */
|
||||
|
||||
if (!table_desc->aml_start) {
|
||||
ACPI_ERROR((AE_INFO, "Null AML pointer"));
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n",
|
||||
table_desc->aml_start));
|
||||
|
||||
/* Ignore table if there is no AML contained within */
|
||||
|
||||
if (!table_desc->aml_length) {
|
||||
ACPI_WARNING((AE_INFO, "Zero-length AML block in table [%4.4s]",
|
||||
table_desc->pointer->signature));
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the table and load the namespace with all named
|
||||
* objects found within. Control methods are NOT parsed
|
||||
|
|
@ -117,15 +87,34 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
|
|||
* to another control method, we can't continue parsing
|
||||
* because we don't know how many arguments to parse next!
|
||||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"**** Loading table into namespace ****\n"));
|
||||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
status = acpi_ns_parse_table(table_desc, node->child);
|
||||
/* If table already loaded into namespace, just return */
|
||||
|
||||
if (acpi_tb_is_table_loaded(table_index)) {
|
||||
status = AE_ALREADY_EXISTS;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"**** Loading table into namespace ****\n"));
|
||||
|
||||
status = acpi_tb_allocate_owner_id(table_index);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
status = acpi_ns_parse_table(table_index, node->child);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
acpi_tb_set_table_loaded_flag(table_index, TRUE);
|
||||
} else {
|
||||
acpi_tb_release_owner_id(table_index);
|
||||
}
|
||||
|
||||
unlock:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
|
@ -141,7 +130,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
|
|||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"**** Begin Table Method Parsing and Object Initialization ****\n"));
|
||||
|
||||
status = acpi_ds_initialize_objects(table_desc, node);
|
||||
status = acpi_ds_initialize_objects(table_index, node);
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"**** Completed Table Method Parsing and Object Initialization ****\n"));
|
||||
|
|
@ -149,99 +138,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ns_load_table_by_type
|
||||
*
|
||||
* PARAMETERS: table_type - Id of the table type to load
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load an ACPI table or tables into the namespace. All tables
|
||||
* of the given type are loaded. The mechanism allows this
|
||||
* routine to be called repeatedly.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
|
||||
{
|
||||
u32 i;
|
||||
acpi_status status;
|
||||
struct acpi_table_desc *table_desc;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ns_load_table_by_type);
|
||||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Table types supported are:
|
||||
* DSDT (one), SSDT/PSDT (multiple)
|
||||
*/
|
||||
switch (table_type) {
|
||||
case ACPI_TABLE_ID_DSDT:
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n"));
|
||||
|
||||
table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next;
|
||||
|
||||
/* If table already loaded into namespace, just return */
|
||||
|
||||
if (table_desc->loaded_into_namespace) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Now load the single DSDT */
|
||||
|
||||
status = acpi_ns_load_table(table_desc, acpi_gbl_root_node);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
table_desc->loaded_into_namespace = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TABLE_ID_SSDT:
|
||||
case ACPI_TABLE_ID_PSDT:
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Namespace load: %d SSDT or PSDTs\n",
|
||||
acpi_gbl_table_lists[table_type].count));
|
||||
|
||||
/*
|
||||
* Traverse list of SSDT or PSDT tables
|
||||
*/
|
||||
table_desc = acpi_gbl_table_lists[table_type].next;
|
||||
for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) {
|
||||
/*
|
||||
* Only attempt to load table into namespace if it is not
|
||||
* already loaded!
|
||||
*/
|
||||
if (!table_desc->loaded_into_namespace) {
|
||||
status =
|
||||
acpi_ns_load_table(table_desc,
|
||||
acpi_gbl_root_node);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
table_desc->loaded_into_namespace = TRUE;
|
||||
}
|
||||
|
||||
table_desc = table_desc->next;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
status = AE_SUPPORT;
|
||||
break;
|
||||
}
|
||||
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_load_namespace
|
||||
|
|
@ -288,6 +185,7 @@ acpi_status acpi_ns_load_namespace(void)
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ACPI_FUTURE_IMPLEMENTATION
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/actables.h>
|
||||
|
||||
#define _COMPONENT ACPI_NAMESPACE
|
||||
ACPI_MODULE_NAME("nsparse")
|
||||
|
|
@ -62,14 +63,24 @@ ACPI_MODULE_NAME("nsparse")
|
|||
*
|
||||
******************************************************************************/
|
||||
acpi_status
|
||||
acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc)
|
||||
acpi_ns_one_complete_parse(acpi_native_uint pass_number,
|
||||
acpi_native_uint table_index)
|
||||
{
|
||||
union acpi_parse_object *parse_root;
|
||||
acpi_status status;
|
||||
acpi_native_uint aml_length;
|
||||
u8 *aml_start;
|
||||
struct acpi_walk_state *walk_state;
|
||||
struct acpi_table_header *table;
|
||||
acpi_owner_id owner_id;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ns_one_complete_parse);
|
||||
|
||||
status = acpi_tb_get_owner_id(table_index, &owner_id);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
parse_root = acpi_ps_create_scope_op();
|
||||
|
|
@ -79,26 +90,41 @@ acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc)
|
|||
|
||||
/* Create and initialize a new walk state */
|
||||
|
||||
walk_state = acpi_ds_create_walk_state(table_desc->owner_id,
|
||||
NULL, NULL, NULL);
|
||||
walk_state = acpi_ds_create_walk_state(owner_id, NULL, NULL, NULL);
|
||||
if (!walk_state) {
|
||||
acpi_ps_free_op(parse_root);
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
|
||||
table_desc->aml_start,
|
||||
table_desc->aml_length, NULL,
|
||||
pass_number);
|
||||
status = acpi_get_table_by_index(table_index, &table);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
acpi_ps_free_op(parse_root);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Table must consist of at least a complete header */
|
||||
|
||||
if (table->length < sizeof(struct acpi_table_header)) {
|
||||
status = AE_BAD_HEADER;
|
||||
} else {
|
||||
aml_start = (u8 *) table + sizeof(struct acpi_table_header);
|
||||
aml_length = table->length - sizeof(struct acpi_table_header);
|
||||
status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
|
||||
aml_start, aml_length, NULL,
|
||||
(u8) pass_number);
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
acpi_ps_delete_parse_tree(parse_root);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Parse the AML */
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n",
|
||||
pass_number));
|
||||
(unsigned)pass_number));
|
||||
status = acpi_ps_parse_aml(walk_state);
|
||||
|
||||
acpi_ps_delete_parse_tree(parse_root);
|
||||
|
|
@ -119,7 +145,7 @@ acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc)
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ns_parse_table(struct acpi_table_desc *table_desc,
|
||||
acpi_ns_parse_table(acpi_native_uint table_index,
|
||||
struct acpi_namespace_node *start_node)
|
||||
{
|
||||
acpi_status status;
|
||||
|
|
@ -134,10 +160,10 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc,
|
|||
* each Parser Op subtree is deleted when it is finished. This saves
|
||||
* a great deal of memory, and allows a small cache of parse objects
|
||||
* to service the entire parse. The second pass of the parse then
|
||||
* performs another complete parse of the AML..
|
||||
* performs another complete parse of the AML.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
|
||||
status = acpi_ns_one_complete_parse(1, table_desc);
|
||||
status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
@ -152,7 +178,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc,
|
|||
* parse objects are all cached.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n"));
|
||||
status = acpi_ns_one_complete_parse(2, table_desc);
|
||||
status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -321,7 +321,8 @@ acpi_ns_search_and_enter(u32 target_name,
|
|||
* even though there are a few bad names.
|
||||
*/
|
||||
if (!acpi_ut_valid_acpi_name(target_name)) {
|
||||
target_name = acpi_ut_repair_name(target_name);
|
||||
target_name =
|
||||
acpi_ut_repair_name(ACPI_CAST_PTR(char, &target_name));
|
||||
|
||||
/* Report warning only if in strict mode or debug mode */
|
||||
|
||||
|
|
@ -401,6 +402,10 @@ acpi_ns_search_and_enter(u32 target_name,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (flags & ACPI_NS_TEMPORARY) {
|
||||
new_node->flags |= ANOBJ_TEMPORARY;
|
||||
}
|
||||
|
||||
/* Install the new object into the parent's list of children */
|
||||
|
||||
acpi_ns_install_node(walk_state, node, new_node, type);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -770,13 +770,6 @@ void acpi_ns_terminate(void)
|
|||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
|
||||
|
||||
/*
|
||||
* 2) Now we can delete the ACPI tables
|
||||
*/
|
||||
acpi_tb_delete_all_tables();
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -126,7 +126,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
|
|||
* PARAMETERS: Type - acpi_object_type to search for
|
||||
* start_node - Handle in namespace where search begins
|
||||
* max_depth - Depth to which search is to reach
|
||||
* unlock_before_callback- Whether to unlock the NS before invoking
|
||||
* Flags - Whether to unlock the NS before invoking
|
||||
* the callback routine
|
||||
* user_function - Called when an object of "Type" is found
|
||||
* Context - Passed to user function
|
||||
|
|
@ -153,7 +153,7 @@ acpi_status
|
|||
acpi_ns_walk_namespace(acpi_object_type type,
|
||||
acpi_handle start_node,
|
||||
u32 max_depth,
|
||||
u8 unlock_before_callback,
|
||||
u32 flags,
|
||||
acpi_walk_callback user_function,
|
||||
void *context, void **return_value)
|
||||
{
|
||||
|
|
@ -193,20 +193,34 @@ acpi_ns_walk_namespace(acpi_object_type type,
|
|||
acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
|
||||
child_node);
|
||||
if (child_node) {
|
||||
/*
|
||||
* Found node, Get the type if we are not
|
||||
* searching for ANY
|
||||
*/
|
||||
|
||||
/* Found next child, get the type if we are not searching for ANY */
|
||||
|
||||
if (type != ACPI_TYPE_ANY) {
|
||||
child_type = child_node->type;
|
||||
}
|
||||
|
||||
if (child_type == type) {
|
||||
/*
|
||||
* Ignore all temporary namespace nodes (created during control
|
||||
* method execution) unless told otherwise. These temporary nodes
|
||||
* can cause a race condition because they can be deleted during the
|
||||
* execution of the user function (if the namespace is unlocked before
|
||||
* invocation of the user function.) Only the debugger namespace dump
|
||||
* will examine the temporary nodes.
|
||||
*/
|
||||
if ((child_node->flags & ANOBJ_TEMPORARY) &&
|
||||
!(flags & ACPI_NS_WALK_TEMP_NODES)) {
|
||||
status = AE_CTRL_DEPTH;
|
||||
}
|
||||
|
||||
/* Type must match requested type */
|
||||
|
||||
else if (child_type == type) {
|
||||
/*
|
||||
* Found a matching node, invoke the user
|
||||
* callback function
|
||||
* Found a matching node, invoke the user callback function.
|
||||
* Unlock the namespace if flag is set.
|
||||
*/
|
||||
if (unlock_before_callback) {
|
||||
if (flags & ACPI_NS_WALK_UNLOCK) {
|
||||
mutex_status =
|
||||
acpi_ut_release_mutex
|
||||
(ACPI_MTX_NAMESPACE);
|
||||
|
|
@ -216,10 +230,11 @@ acpi_ns_walk_namespace(acpi_object_type type,
|
|||
}
|
||||
}
|
||||
|
||||
status = user_function(child_node, level,
|
||||
context, return_value);
|
||||
status =
|
||||
user_function(child_node, level, context,
|
||||
return_value);
|
||||
|
||||
if (unlock_before_callback) {
|
||||
if (flags & ACPI_NS_WALK_UNLOCK) {
|
||||
mutex_status =
|
||||
acpi_ut_acquire_mutex
|
||||
(ACPI_MTX_NAMESPACE);
|
||||
|
|
@ -251,20 +266,17 @@ acpi_ns_walk_namespace(acpi_object_type type,
|
|||
}
|
||||
|
||||
/*
|
||||
* Depth first search:
|
||||
* Attempt to go down another level in the namespace
|
||||
* if we are allowed to. Don't go any further if we
|
||||
* have reached the caller specified maximum depth
|
||||
* or if the user function has specified that the
|
||||
* maximum depth has been reached.
|
||||
* Depth first search: Attempt to go down another level in the
|
||||
* namespace if we are allowed to. Don't go any further if we have
|
||||
* reached the caller specified maximum depth or if the user
|
||||
* function has specified that the maximum depth has been reached.
|
||||
*/
|
||||
if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
|
||||
if (acpi_ns_get_next_node
|
||||
(ACPI_TYPE_ANY, child_node, NULL)) {
|
||||
/*
|
||||
* There is at least one child of this
|
||||
* node, visit the onde
|
||||
*/
|
||||
|
||||
/* There is at least one child of this node, visit it */
|
||||
|
||||
level++;
|
||||
parent_node = child_node;
|
||||
child_node = NULL;
|
||||
|
|
@ -272,9 +284,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
|
|||
}
|
||||
} else {
|
||||
/*
|
||||
* No more children of this node (acpi_ns_get_next_node
|
||||
* failed), go back upwards in the namespace tree to
|
||||
* the node's parent.
|
||||
* No more children of this node (acpi_ns_get_next_node failed), go
|
||||
* back upwards in the namespace tree to the node's parent.
|
||||
*/
|
||||
level--;
|
||||
child_node = parent_node;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -170,7 +170,6 @@ acpi_evaluate_object(acpi_handle handle,
|
|||
struct acpi_buffer *return_buffer)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status2;
|
||||
struct acpi_evaluate_info *info;
|
||||
acpi_size buffer_space_needed;
|
||||
u32 i;
|
||||
|
|
@ -329,14 +328,12 @@ acpi_evaluate_object(acpi_handle handle,
|
|||
* Delete the internal return object. NOTE: Interpreter must be
|
||||
* locked to avoid race condition.
|
||||
*/
|
||||
status2 = acpi_ex_enter_interpreter();
|
||||
if (ACPI_SUCCESS(status2)) {
|
||||
acpi_ex_enter_interpreter();
|
||||
|
||||
/* Remove one reference on the return object (should delete it) */
|
||||
/* Remove one reference on the return object (should delete it) */
|
||||
|
||||
acpi_ut_remove_reference(info->return_object);
|
||||
acpi_ex_exit_interpreter();
|
||||
}
|
||||
acpi_ut_remove_reference(info->return_object);
|
||||
acpi_ex_exit_interpreter();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -84,38 +84,41 @@ acpi_get_handle(acpi_handle parent,
|
|||
/* Convert a parent handle to a prefix node */
|
||||
|
||||
if (parent) {
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
prefix_node = acpi_ns_map_handle_to_node(parent);
|
||||
if (!prefix_node) {
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Special case for root, since we can't search for it */
|
||||
|
||||
if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) {
|
||||
*ret_handle =
|
||||
acpi_ns_convert_entry_to_handle(acpi_gbl_root_node);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the Node and convert to a handle
|
||||
* Valid cases are:
|
||||
* 1) Fully qualified pathname
|
||||
* 2) Parent + Relative pathname
|
||||
*
|
||||
* Error for <null Parent + relative path>
|
||||
*/
|
||||
status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH,
|
||||
&node);
|
||||
if (acpi_ns_valid_root_prefix(pathname[0])) {
|
||||
|
||||
*ret_handle = NULL;
|
||||
/* Pathname is fully qualified (starts with '\') */
|
||||
|
||||
/* Special case for root-only, since we can't search for it */
|
||||
|
||||
if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) {
|
||||
*ret_handle =
|
||||
acpi_ns_convert_entry_to_handle(acpi_gbl_root_node);
|
||||
return (AE_OK);
|
||||
}
|
||||
} else if (!prefix_node) {
|
||||
|
||||
/* Relative path with null prefix is disallowed */
|
||||
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Find the Node and convert to a handle */
|
||||
|
||||
status =
|
||||
acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
*ret_handle = acpi_ns_convert_entry_to_handle(node);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS]
|
|||
int __cpuinitdata node_to_pxm_map[MAX_NUMNODES]
|
||||
= { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
|
||||
|
||||
extern int __init acpi_table_parse_madt_family(enum acpi_table_id id,
|
||||
extern int __init acpi_table_parse_madt_family(char *id,
|
||||
unsigned long madt_size,
|
||||
int entry_id,
|
||||
acpi_madt_entry_handler handler,
|
||||
|
|
@ -89,7 +89,7 @@ void __cpuinit acpi_unmap_pxm_to_node(int node)
|
|||
node_clear(node, nodes_found_map);
|
||||
}
|
||||
|
||||
void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
|
||||
void __init acpi_table_print_srat_entry(struct acpi_subtable_header * header)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
|
||||
|
|
@ -99,36 +99,35 @@ void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
|
|||
|
||||
switch (header->type) {
|
||||
|
||||
case ACPI_SRAT_PROCESSOR_AFFINITY:
|
||||
case ACPI_SRAT_TYPE_CPU_AFFINITY:
|
||||
#ifdef ACPI_DEBUG_OUTPUT
|
||||
{
|
||||
struct acpi_table_processor_affinity *p =
|
||||
(struct acpi_table_processor_affinity *)header;
|
||||
struct acpi_srat_cpu_affinity *p =
|
||||
(struct acpi_srat_cpu_affinity *)header;
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
|
||||
p->apic_id, p->lsapic_eid,
|
||||
p->proximity_domain,
|
||||
p->flags.
|
||||
enabled ? "enabled" : "disabled"));
|
||||
p->apic_id, p->local_sapic_eid,
|
||||
p->proximity_domain_lo,
|
||||
(p->flags & ACPI_SRAT_CPU_ENABLED)?
|
||||
"enabled" : "disabled"));
|
||||
}
|
||||
#endif /* ACPI_DEBUG_OUTPUT */
|
||||
break;
|
||||
|
||||
case ACPI_SRAT_MEMORY_AFFINITY:
|
||||
case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
|
||||
#ifdef ACPI_DEBUG_OUTPUT
|
||||
{
|
||||
struct acpi_table_memory_affinity *p =
|
||||
(struct acpi_table_memory_affinity *)header;
|
||||
struct acpi_srat_mem_affinity *p =
|
||||
(struct acpi_srat_mem_affinity *)header;
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
|
||||
p->base_addr_hi, p->base_addr_lo,
|
||||
p->length_hi, p->length_lo,
|
||||
"SRAT Memory (0x%lx length 0x%lx type 0x%x) in proximity domain %d %s%s\n",
|
||||
(unsigned long)p->base_address,
|
||||
(unsigned long)p->length,
|
||||
p->memory_type, p->proximity_domain,
|
||||
p->flags.
|
||||
enabled ? "enabled" : "disabled",
|
||||
p->flags.
|
||||
hot_pluggable ? " hot-pluggable" :
|
||||
""));
|
||||
(p->flags & ACPI_SRAT_MEM_ENABLED)?
|
||||
"enabled" : "disabled",
|
||||
(p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)?
|
||||
" hot-pluggable" : ""));
|
||||
}
|
||||
#endif /* ACPI_DEBUG_OUTPUT */
|
||||
break;
|
||||
|
|
@ -141,18 +140,18 @@ void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
|
|||
}
|
||||
}
|
||||
|
||||
static int __init acpi_parse_slit(unsigned long phys_addr, unsigned long size)
|
||||
static int __init acpi_parse_slit(struct acpi_table_header *table)
|
||||
{
|
||||
struct acpi_table_slit *slit;
|
||||
u32 localities;
|
||||
|
||||
if (!phys_addr || !size)
|
||||
if (!table)
|
||||
return -EINVAL;
|
||||
|
||||
slit = (struct acpi_table_slit *)__va(phys_addr);
|
||||
slit = (struct acpi_table_slit *)table;
|
||||
|
||||
/* downcast just for %llu vs %lu for i386/ia64 */
|
||||
localities = (u32) slit->localities;
|
||||
localities = (u32) slit->locality_count;
|
||||
|
||||
acpi_numa_slit_init(slit);
|
||||
|
||||
|
|
@ -160,12 +159,12 @@ static int __init acpi_parse_slit(unsigned long phys_addr, unsigned long size)
|
|||
}
|
||||
|
||||
static int __init
|
||||
acpi_parse_processor_affinity(acpi_table_entry_header * header,
|
||||
acpi_parse_processor_affinity(struct acpi_subtable_header * header,
|
||||
const unsigned long end)
|
||||
{
|
||||
struct acpi_table_processor_affinity *processor_affinity;
|
||||
struct acpi_srat_cpu_affinity *processor_affinity;
|
||||
|
||||
processor_affinity = (struct acpi_table_processor_affinity *)header;
|
||||
processor_affinity = (struct acpi_srat_cpu_affinity *)header;
|
||||
if (!processor_affinity)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -178,12 +177,12 @@ acpi_parse_processor_affinity(acpi_table_entry_header * header,
|
|||
}
|
||||
|
||||
static int __init
|
||||
acpi_parse_memory_affinity(acpi_table_entry_header * header,
|
||||
acpi_parse_memory_affinity(struct acpi_subtable_header * header,
|
||||
const unsigned long end)
|
||||
{
|
||||
struct acpi_table_memory_affinity *memory_affinity;
|
||||
struct acpi_srat_mem_affinity *memory_affinity;
|
||||
|
||||
memory_affinity = (struct acpi_table_memory_affinity *)header;
|
||||
memory_affinity = (struct acpi_srat_mem_affinity *)header;
|
||||
if (!memory_affinity)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -195,23 +194,23 @@ acpi_parse_memory_affinity(acpi_table_entry_header * header,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __init acpi_parse_srat(unsigned long phys_addr, unsigned long size)
|
||||
static int __init acpi_parse_srat(struct acpi_table_header *table)
|
||||
{
|
||||
struct acpi_table_srat *srat;
|
||||
|
||||
if (!phys_addr || !size)
|
||||
if (!table)
|
||||
return -EINVAL;
|
||||
|
||||
srat = (struct acpi_table_srat *)__va(phys_addr);
|
||||
srat = (struct acpi_table_srat *)table;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __init
|
||||
acpi_table_parse_srat(enum acpi_srat_entry_id id,
|
||||
acpi_table_parse_srat(enum acpi_srat_type id,
|
||||
acpi_madt_entry_handler handler, unsigned int max_entries)
|
||||
{
|
||||
return acpi_table_parse_madt_family(ACPI_SRAT,
|
||||
return acpi_table_parse_madt_family(ACPI_SIG_SRAT,
|
||||
sizeof(struct acpi_table_srat), id,
|
||||
handler, max_entries);
|
||||
}
|
||||
|
|
@ -221,17 +220,17 @@ int __init acpi_numa_init(void)
|
|||
int result;
|
||||
|
||||
/* SRAT: Static Resource Affinity Table */
|
||||
result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
|
||||
result = acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat);
|
||||
|
||||
if (result > 0) {
|
||||
result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
|
||||
result = acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
|
||||
acpi_parse_processor_affinity,
|
||||
NR_CPUS);
|
||||
result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific
|
||||
result = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific
|
||||
}
|
||||
|
||||
/* SLIT: System Locality Information Table */
|
||||
result = acpi_table_parse(ACPI_SLIT, acpi_parse_slit);
|
||||
result = acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit);
|
||||
|
||||
acpi_numa_arch_fixup();
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <linux/delay.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/nmi.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <acpi/acpi.h>
|
||||
#include <asm/io.h>
|
||||
#include <acpi/acpi_bus.h>
|
||||
|
|
@ -136,53 +137,43 @@ void acpi_os_vprintf(const char *fmt, va_list args)
|
|||
#endif
|
||||
}
|
||||
|
||||
acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
|
||||
acpi_physical_address __init acpi_os_get_root_pointer(void)
|
||||
{
|
||||
if (efi_enabled) {
|
||||
addr->pointer_type = ACPI_PHYSICAL_POINTER;
|
||||
if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
|
||||
addr->pointer.physical = efi.acpi20;
|
||||
return efi.acpi20;
|
||||
else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
|
||||
addr->pointer.physical = efi.acpi;
|
||||
return efi.acpi;
|
||||
else {
|
||||
printk(KERN_ERR PREFIX
|
||||
"System description tables not found\n");
|
||||
return AE_NOT_FOUND;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) {
|
||||
printk(KERN_ERR PREFIX
|
||||
"System description tables not found\n");
|
||||
return AE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
return AE_OK;
|
||||
} else
|
||||
return acpi_find_rsdp();
|
||||
}
|
||||
|
||||
acpi_status
|
||||
acpi_os_map_memory(acpi_physical_address phys, acpi_size size,
|
||||
void __iomem ** virt)
|
||||
void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
|
||||
{
|
||||
if (phys > ULONG_MAX) {
|
||||
printk(KERN_ERR PREFIX "Cannot map memory that high\n");
|
||||
return AE_BAD_PARAMETER;
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* ioremap checks to ensure this is in reserved space
|
||||
*/
|
||||
*virt = ioremap((unsigned long)phys, size);
|
||||
|
||||
if (!*virt)
|
||||
return AE_NO_MEMORY;
|
||||
|
||||
return AE_OK;
|
||||
if (acpi_gbl_permanent_mmap)
|
||||
/*
|
||||
* ioremap checks to ensure this is in reserved space
|
||||
*/
|
||||
return ioremap((unsigned long)phys, size);
|
||||
else
|
||||
return __acpi_map_table((unsigned long)phys, size);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_os_map_memory);
|
||||
|
||||
void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
|
||||
{
|
||||
iounmap(virt);
|
||||
if (acpi_gbl_permanent_mmap) {
|
||||
iounmap(virt);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
|
||||
|
||||
|
|
@ -254,7 +245,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
|
|||
* FADT. It may not be the same if an interrupt source override exists
|
||||
* for the SCI.
|
||||
*/
|
||||
gsi = acpi_fadt.sci_int;
|
||||
gsi = acpi_gbl_FADT.sci_interrupt;
|
||||
if (acpi_gsi_to_irq(gsi, &irq) < 0) {
|
||||
printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n",
|
||||
gsi);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -540,6 +540,11 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
|
|||
|
||||
if ((status == AE_ALREADY_EXISTS) &&
|
||||
(!walk_state->method_desc->method.mutex)) {
|
||||
ACPI_INFO((AE_INFO,
|
||||
"Marking method %4.4s as Serialized",
|
||||
walk_state->method_node->name.
|
||||
ascii));
|
||||
|
||||
/*
|
||||
* Method tried to create an object twice. The probable cause is
|
||||
* that the method cannot handle reentrancy.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -54,8 +54,6 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info);
|
|||
|
||||
static void acpi_ps_stop_trace(struct acpi_evaluate_info *info);
|
||||
|
||||
static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info);
|
||||
|
||||
static void
|
||||
acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
|
||||
|
||||
|
|
@ -215,6 +213,8 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
|
|||
acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
|
||||
{
|
||||
acpi_status status;
|
||||
union acpi_parse_object *op;
|
||||
struct acpi_walk_state *walk_state;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ps_execute_method);
|
||||
|
||||
|
|
@ -234,8 +234,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
|
|||
}
|
||||
|
||||
/*
|
||||
* The caller "owns" the parameters, so give each one an extra
|
||||
* reference
|
||||
* The caller "owns" the parameters, so give each one an extra reference
|
||||
*/
|
||||
acpi_ps_update_parameter_list(info, REF_INCREMENT);
|
||||
|
||||
|
|
@ -244,30 +243,50 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
|
|||
acpi_ps_start_trace(info);
|
||||
|
||||
/*
|
||||
* 1) Perform the first pass parse of the method to enter any
|
||||
* named objects that it creates into the namespace
|
||||
* Execute the method. Performs parse simultaneously
|
||||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||
"**** Begin Method Parse **** Entry=%p obj=%p\n",
|
||||
info->resolved_node, info->obj_desc));
|
||||
"**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
|
||||
info->resolved_node->name.ascii, info->resolved_node,
|
||||
info->obj_desc));
|
||||
|
||||
info->pass_number = 1;
|
||||
status = acpi_ps_execute_pass(info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
/* Create and init a Root Node */
|
||||
|
||||
op = acpi_ps_create_scope_op();
|
||||
if (!op) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* 2) Execute the method. Performs second pass parse simultaneously
|
||||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||
"**** Begin Method Execution **** Entry=%p obj=%p\n",
|
||||
info->resolved_node, info->obj_desc));
|
||||
/* Create and initialize a new walk state */
|
||||
|
||||
info->pass_number = 3;
|
||||
status = acpi_ps_execute_pass(info);
|
||||
info->pass_number = ACPI_IMODE_EXECUTE;
|
||||
walk_state =
|
||||
acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
|
||||
NULL, NULL);
|
||||
if (!walk_state) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
|
||||
info->obj_desc->method.aml_start,
|
||||
info->obj_desc->method.aml_length, info,
|
||||
info->pass_number);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Parse the AML */
|
||||
|
||||
status = acpi_ps_parse_aml(walk_state);
|
||||
|
||||
/* walk_state was deleted by parse_aml */
|
||||
|
||||
cleanup:
|
||||
acpi_ps_delete_parse_tree(op);
|
||||
|
||||
/* End optional tracing */
|
||||
|
||||
acpi_ps_stop_trace(info);
|
||||
|
|
@ -330,62 +349,3 @@ acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ps_execute_pass
|
||||
*
|
||||
* PARAMETERS: Info - See struct acpi_evaluate_info
|
||||
* (Used: pass_number, Node, and obj_desc)
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Single AML pass: Parse or Execute a control method
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info)
|
||||
{
|
||||
acpi_status status;
|
||||
union acpi_parse_object *op;
|
||||
struct acpi_walk_state *walk_state;
|
||||
|
||||
ACPI_FUNCTION_TRACE(ps_execute_pass);
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
op = acpi_ps_create_scope_op();
|
||||
if (!op) {
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Create and initialize a new walk state */
|
||||
|
||||
walk_state =
|
||||
acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
|
||||
NULL, NULL);
|
||||
if (!walk_state) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
|
||||
info->obj_desc->method.aml_start,
|
||||
info->obj_desc->method.aml_length,
|
||||
info->pass_number == 1 ? NULL : info,
|
||||
info->pass_number);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Parse the AML */
|
||||
|
||||
status = acpi_ps_parse_aml(walk_state);
|
||||
|
||||
/* Walk state was deleted by parse_aml */
|
||||
|
||||
cleanup:
|
||||
acpi_ps_delete_parse_tree(op);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ int __init acpi_irq_penalty_init(void)
|
|||
}
|
||||
}
|
||||
/* Add a penalty for the SCI */
|
||||
acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING;
|
||||
acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -785,7 +785,7 @@ static int irqrouter_resume(struct sys_device *dev)
|
|||
|
||||
|
||||
/* Make sure SCI is enabled again (Apple firmware bug?) */
|
||||
acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1);
|
||||
|
||||
list_for_each(node, &acpi_link.entries) {
|
||||
link = list_entry(node, struct acpi_pci_link, node);
|
||||
|
|
|
|||
|
|
@ -375,30 +375,126 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
|
|||
}
|
||||
|
||||
/* Use the acpiid in MADT to map cpus in case of SMP */
|
||||
|
||||
#ifndef CONFIG_SMP
|
||||
#define convert_acpiid_to_cpu(acpi_id) (-1)
|
||||
static int get_cpu_id(acpi_handle handle, u32 acpi_id) {return -1;}
|
||||
#else
|
||||
|
||||
static struct acpi_table_madt *madt;
|
||||
|
||||
static int map_lapic_id(struct acpi_subtable_header *entry,
|
||||
u32 acpi_id, int *apic_id)
|
||||
{
|
||||
struct acpi_madt_local_apic *lapic =
|
||||
(struct acpi_madt_local_apic *)entry;
|
||||
if ((lapic->lapic_flags & ACPI_MADT_ENABLED) &&
|
||||
lapic->processor_id == acpi_id) {
|
||||
*apic_id = lapic->id;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int map_lsapic_id(struct acpi_subtable_header *entry,
|
||||
u32 acpi_id, int *apic_id)
|
||||
{
|
||||
struct acpi_madt_local_sapic *lsapic =
|
||||
(struct acpi_madt_local_sapic *)entry;
|
||||
/* Only check enabled APICs*/
|
||||
if (lsapic->lapic_flags & ACPI_MADT_ENABLED) {
|
||||
/* First check against id */
|
||||
if (lsapic->processor_id == acpi_id) {
|
||||
*apic_id = lsapic->id;
|
||||
return 1;
|
||||
/* Check against optional uid */
|
||||
} else if (entry->length >= 16 &&
|
||||
lsapic->uid == acpi_id) {
|
||||
*apic_id = lsapic->uid;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IA64
|
||||
#define arch_acpiid_to_apicid ia64_acpiid_to_sapicid
|
||||
#define arch_cpu_to_apicid ia64_cpu_to_sapicid
|
||||
#define ARCH_BAD_APICID (0xffff)
|
||||
#else
|
||||
#define arch_acpiid_to_apicid x86_acpiid_to_apicid
|
||||
#define arch_cpu_to_apicid x86_cpu_to_apicid
|
||||
#define ARCH_BAD_APICID (0xff)
|
||||
#endif
|
||||
|
||||
static int convert_acpiid_to_cpu(u8 acpi_id)
|
||||
static int map_madt_entry(u32 acpi_id)
|
||||
{
|
||||
unsigned long madt_end, entry;
|
||||
int apic_id = -1;
|
||||
|
||||
if (!madt)
|
||||
return apic_id;
|
||||
|
||||
entry = (unsigned long)madt;
|
||||
madt_end = entry + madt->header.length;
|
||||
|
||||
/* Parse all entries looking for a match. */
|
||||
|
||||
entry += sizeof(struct acpi_table_madt);
|
||||
while (entry + sizeof(struct acpi_subtable_header) < madt_end) {
|
||||
struct acpi_subtable_header *header =
|
||||
(struct acpi_subtable_header *)entry;
|
||||
if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
|
||||
if (map_lapic_id(header, acpi_id, &apic_id))
|
||||
break;
|
||||
} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
|
||||
if (map_lsapic_id(header, acpi_id, &apic_id))
|
||||
break;
|
||||
}
|
||||
entry += header->length;
|
||||
}
|
||||
return apic_id;
|
||||
}
|
||||
|
||||
static int map_mat_entry(acpi_handle handle, u32 acpi_id)
|
||||
{
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *obj;
|
||||
struct acpi_subtable_header *header;
|
||||
int apic_id = -1;
|
||||
|
||||
if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
|
||||
goto exit;
|
||||
|
||||
if (!buffer.length || !buffer.pointer)
|
||||
goto exit;
|
||||
|
||||
obj = buffer.pointer;
|
||||
if (obj->type != ACPI_TYPE_BUFFER ||
|
||||
obj->buffer.length < sizeof(struct acpi_subtable_header)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
header = (struct acpi_subtable_header *)obj->buffer.pointer;
|
||||
if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
|
||||
map_lapic_id(header, acpi_id, &apic_id);
|
||||
} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
|
||||
map_lsapic_id(header, acpi_id, &apic_id);
|
||||
}
|
||||
|
||||
exit:
|
||||
if (buffer.pointer)
|
||||
kfree(buffer.pointer);
|
||||
return apic_id;
|
||||
}
|
||||
|
||||
static int get_cpu_id(acpi_handle handle, u32 acpi_id)
|
||||
{
|
||||
u16 apic_id;
|
||||
int i;
|
||||
int apic_id = -1;
|
||||
|
||||
apic_id = arch_acpiid_to_apicid[acpi_id];
|
||||
if (apic_id == ARCH_BAD_APICID)
|
||||
return -1;
|
||||
apic_id = map_mat_entry(handle, acpi_id);
|
||||
if (apic_id == -1)
|
||||
apic_id = map_madt_entry(acpi_id);
|
||||
if (apic_id == -1)
|
||||
return apic_id;
|
||||
|
||||
for (i = 0; i < NR_CPUS; i++) {
|
||||
for (i = 0; i < NR_CPUS; ++i) {
|
||||
if (arch_cpu_to_apicid[i] == apic_id)
|
||||
return i;
|
||||
}
|
||||
|
|
@ -410,7 +506,7 @@ static int convert_acpiid_to_cpu(u8 acpi_id)
|
|||
Driver Interface
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static int acpi_processor_get_info(struct acpi_processor *pr)
|
||||
static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
|
||||
{
|
||||
acpi_status status = 0;
|
||||
union acpi_object object = { 0 };
|
||||
|
|
@ -431,7 +527,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
|
|||
* Check to see if we have bus mastering arbitration control. This
|
||||
* is required for proper C3 usage (to maintain cache coherency).
|
||||
*/
|
||||
if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len) {
|
||||
if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) {
|
||||
pr->flags.bm_control = 1;
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Bus mastering arbitration control present\n"));
|
||||
|
|
@ -439,24 +535,35 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
|
|||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"No bus mastering arbitration control\n"));
|
||||
|
||||
/*
|
||||
* Evalute the processor object. Note that it is common on SMP to
|
||||
* have the first (boot) processor with a valid PBLK address while
|
||||
* all others have a NULL address.
|
||||
*/
|
||||
status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(KERN_ERR PREFIX "Evaluating processor object\n");
|
||||
return -ENODEV;
|
||||
/* Check if it is a Device with HID and UID */
|
||||
if (has_uid) {
|
||||
unsigned long value;
|
||||
status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
|
||||
NULL, &value);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(KERN_ERR PREFIX "Evaluating processor _UID\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
pr->acpi_id = value;
|
||||
} else {
|
||||
/*
|
||||
* Evalute the processor object. Note that it is common on SMP to
|
||||
* have the first (boot) processor with a valid PBLK address while
|
||||
* all others have a NULL address.
|
||||
*/
|
||||
status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
printk(KERN_ERR PREFIX "Evaluating processor object\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
|
||||
* >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c
|
||||
*/
|
||||
pr->acpi_id = object.processor.proc_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
|
||||
* >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c
|
||||
*/
|
||||
pr->acpi_id = object.processor.proc_id;
|
||||
|
||||
cpu_index = convert_acpiid_to_cpu(pr->acpi_id);
|
||||
cpu_index = get_cpu_id(pr->handle, pr->acpi_id);
|
||||
|
||||
/* Handle UP system running SMP kernel, with no LAPIC in MADT */
|
||||
if (!cpu0_initialized && (cpu_index == -1) &&
|
||||
|
|
@ -473,7 +580,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
|
|||
* less than the max # of CPUs. They should be ignored _iff
|
||||
* they are physically not present.
|
||||
*/
|
||||
if (cpu_index == -1) {
|
||||
if (pr->id == -1) {
|
||||
if (ACPI_FAILURE
|
||||
(acpi_processor_hotadd_init(pr->handle, &pr->id))) {
|
||||
return -ENODEV;
|
||||
|
|
@ -490,8 +597,8 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
|
|||
object.processor.pblk_length);
|
||||
else {
|
||||
pr->throttling.address = object.processor.pblk_address;
|
||||
pr->throttling.duty_offset = acpi_fadt.duty_offset;
|
||||
pr->throttling.duty_width = acpi_fadt.duty_width;
|
||||
pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset;
|
||||
pr->throttling.duty_width = acpi_gbl_FADT.duty_width;
|
||||
|
||||
pr->pblk = object.processor.pblk_address;
|
||||
|
||||
|
|
@ -525,7 +632,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
|
|||
|
||||
pr = acpi_driver_data(device);
|
||||
|
||||
result = acpi_processor_get_info(pr);
|
||||
result = acpi_processor_get_info(pr, device->flags.unique_id);
|
||||
if (result) {
|
||||
/* Processor is physically not present */
|
||||
return 0;
|
||||
|
|
@ -895,6 +1002,12 @@ static int __init acpi_processor_init(void)
|
|||
memset(&processors, 0, sizeof(processors));
|
||||
memset(&errata, 0, sizeof(errata));
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0,
|
||||
(struct acpi_table_header **)&madt)))
|
||||
madt = 0;
|
||||
#endif
|
||||
|
||||
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
|
||||
if (!acpi_processor_dir)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ static inline u32 ticks_elapsed(u32 t1, u32 t2)
|
|||
{
|
||||
if (t2 >= t1)
|
||||
return (t2 - t1);
|
||||
else if (!acpi_fadt.tmr_val_ext)
|
||||
else if (!(acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER))
|
||||
return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF);
|
||||
else
|
||||
return ((0xFFFFFFFF - t1) + t2);
|
||||
|
|
@ -187,8 +187,7 @@ acpi_processor_power_activate(struct acpi_processor *pr,
|
|||
case ACPI_STATE_C3:
|
||||
/* Disable bus master reload */
|
||||
if (new->type != ACPI_STATE_C3 && pr->flags.bm_check)
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -198,8 +197,7 @@ acpi_processor_power_activate(struct acpi_processor *pr,
|
|||
case ACPI_STATE_C3:
|
||||
/* Enable bus master reload */
|
||||
if (old->type != ACPI_STATE_C3 && pr->flags.bm_check)
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +234,7 @@ static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
|
|||
/* Dummy wait op - must do something useless after P_LVL2 read
|
||||
because chipsets cannot guarantee that STPCLK# signal
|
||||
gets asserted in time to freeze execution properly. */
|
||||
unused = inl(acpi_fadt.xpm_tmr_blk.address);
|
||||
unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,12 +289,10 @@ static void acpi_processor_idle(void)
|
|||
|
||||
pr->power.bm_activity <<= diff;
|
||||
|
||||
acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS,
|
||||
&bm_status, ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
|
||||
if (bm_status) {
|
||||
pr->power.bm_activity |= 0x1;
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS,
|
||||
1, ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
|
||||
}
|
||||
/*
|
||||
* PIIX4 Erratum #18: Note that BM_STS doesn't always reflect
|
||||
|
|
@ -338,7 +334,7 @@ static void acpi_processor_idle(void)
|
|||
* detection phase, to work cleanly with logical CPU hotplug.
|
||||
*/
|
||||
if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
|
||||
!pr->flags.has_cst && !acpi_fadt.plvl2_up)
|
||||
!pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
|
||||
cx = &pr->power.states[ACPI_STATE_C1];
|
||||
#endif
|
||||
|
||||
|
|
@ -384,11 +380,11 @@ static void acpi_processor_idle(void)
|
|||
|
||||
case ACPI_STATE_C2:
|
||||
/* Get start time (ticks) */
|
||||
t1 = inl(acpi_fadt.xpm_tmr_blk.address);
|
||||
t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
|
||||
/* Invoke C2 */
|
||||
acpi_cstate_enter(cx);
|
||||
/* Get end time (ticks) */
|
||||
t2 = inl(acpi_fadt.xpm_tmr_blk.address);
|
||||
t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
|
||||
|
||||
#ifdef CONFIG_GENERIC_TIME
|
||||
/* TSC halts in C2, so notify users */
|
||||
|
|
@ -411,8 +407,7 @@ static void acpi_processor_idle(void)
|
|||
* All CPUs are trying to go to C3
|
||||
* Disable bus master arbitration
|
||||
*/
|
||||
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
|
||||
}
|
||||
} else {
|
||||
/* SMP with no shared cache... Invalidate cache */
|
||||
|
|
@ -420,16 +415,15 @@ static void acpi_processor_idle(void)
|
|||
}
|
||||
|
||||
/* Get start time (ticks) */
|
||||
t1 = inl(acpi_fadt.xpm_tmr_blk.address);
|
||||
t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
|
||||
/* Invoke C3 */
|
||||
acpi_cstate_enter(cx);
|
||||
/* Get end time (ticks) */
|
||||
t2 = inl(acpi_fadt.xpm_tmr_blk.address);
|
||||
t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
|
||||
if (pr->flags.bm_check) {
|
||||
/* Enable bus master arbitration */
|
||||
atomic_dec(&c3_cpu_count);
|
||||
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0,
|
||||
ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GENERIC_TIME
|
||||
|
|
@ -457,7 +451,7 @@ static void acpi_processor_idle(void)
|
|||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
/* Don't do promotion/demotion */
|
||||
if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) &&
|
||||
!pr->flags.has_cst && !acpi_fadt.plvl2_up) {
|
||||
!pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) {
|
||||
next_state = cx;
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -627,7 +621,8 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
|
|||
* Check for P_LVL2_UP flag before entering C2 and above on
|
||||
* an SMP system.
|
||||
*/
|
||||
if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up)
|
||||
if ((num_online_cpus() > 1) &&
|
||||
!(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
|
||||
return -ENODEV;
|
||||
#endif
|
||||
|
||||
|
|
@ -636,8 +631,8 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
|
|||
pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5;
|
||||
|
||||
/* determine latencies from FADT */
|
||||
pr->power.states[ACPI_STATE_C2].latency = acpi_fadt.plvl2_lat;
|
||||
pr->power.states[ACPI_STATE_C3].latency = acpi_fadt.plvl3_lat;
|
||||
pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency;
|
||||
pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency;
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"lvl2[0x%08x] lvl3[0x%08x]\n",
|
||||
|
|
@ -883,14 +878,13 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
|
|||
* WBINVD should be set in fadt, for C3 state to be
|
||||
* supported on when bm_check is not required.
|
||||
*/
|
||||
if (acpi_fadt.wb_invd != 1) {
|
||||
if (!(acpi_gbl_FADT.flags & ACPI_FADT_WBINVD)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Cache invalidation should work properly"
|
||||
" for C3 to be enabled on SMP systems\n"));
|
||||
return;
|
||||
}
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD,
|
||||
0, ACPI_MTX_DO_NOT_LOCK);
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1096,7 +1090,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
|
|||
seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n",
|
||||
pr->power.states[i].latency,
|
||||
pr->power.states[i].usage,
|
||||
pr->power.states[i].time);
|
||||
(unsigned long long)pr->power.states[i].time);
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -1164,9 +1158,9 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
|
|||
if (!pr)
|
||||
return -EINVAL;
|
||||
|
||||
if (acpi_fadt.cst_cnt && !nocst) {
|
||||
if (acpi_gbl_FADT.cst_control && !nocst) {
|
||||
status =
|
||||
acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8);
|
||||
acpi_os_write_port(acpi_gbl_FADT.smi_command, acpi_gbl_FADT.cst_control, 8);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"Notifying BIOS of _CST ability failed"));
|
||||
|
|
|
|||
|
|
@ -352,31 +352,24 @@ int acpi_processor_notify_smm(struct module *calling_module)
|
|||
|
||||
is_done = -EIO;
|
||||
|
||||
/* Can't write pstate_cnt to smi_cmd if either value is zero */
|
||||
if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n"));
|
||||
/* Can't write pstate_control to smi_command if either value is zero */
|
||||
if ((!acpi_gbl_FADT.smi_command) || (!acpi_gbl_FADT.pstate_control)) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_control\n"));
|
||||
module_put(calling_module);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n",
|
||||
acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd));
|
||||
"Writing pstate_control [0x%x] to smi_command [0x%x]\n",
|
||||
acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
|
||||
|
||||
/* FADT v1 doesn't support pstate_cnt, many BIOS vendors use
|
||||
* it anyway, so we need to support it... */
|
||||
if (acpi_fadt_is_v1) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Using v1.0 FADT reserved value for pstate_cnt\n"));
|
||||
}
|
||||
|
||||
status = acpi_os_write_port(acpi_fadt.smi_cmd,
|
||||
(u32) acpi_fadt.pstate_cnt, 8);
|
||||
status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
|
||||
(u32) acpi_gbl_FADT.pstate_control, 8);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"Failed to write pstate_cnt [0x%x] to "
|
||||
"smi_cmd [0x%x]", acpi_fadt.pstate_cnt,
|
||||
acpi_fadt.smi_cmd));
|
||||
"Failed to write pstate_control [0x%x] to "
|
||||
"smi_command [0x%x]", acpi_gbl_FADT.pstate_control,
|
||||
acpi_gbl_FADT.smi_command));
|
||||
module_put(calling_module);
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
|
|||
/* Used to clear all duty_value bits */
|
||||
duty_mask = pr->throttling.state_count - 1;
|
||||
|
||||
duty_mask <<= acpi_fadt.duty_offset;
|
||||
duty_mask <<= acpi_gbl_FADT.duty_offset;
|
||||
duty_mask = ~duty_mask;
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
pr->throttling.state_count = 1 << acpi_fadt.duty_width;
|
||||
pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
|
||||
|
||||
/*
|
||||
* Compute state values. Note that throttling displays a linear power/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 - 2006, R. Byron Moore
|
||||
* Copyright (C) 2000 - 2007, R. Byron Moore
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1333,7 +1333,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
|
|||
/*
|
||||
* Enumerate all fixed-feature devices.
|
||||
*/
|
||||
if (acpi_fadt.pwr_button == 0) {
|
||||
if ((acpi_gbl_FADT.flags & ACPI_FADT_POWER_BUTTON) == 0) {
|
||||
result = acpi_add_single_object(&device, acpi_root,
|
||||
NULL,
|
||||
ACPI_BUS_TYPE_POWER_BUTTON);
|
||||
|
|
@ -1341,7 +1341,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
|
|||
result = acpi_start_single_object(device);
|
||||
}
|
||||
|
||||
if (acpi_fadt.sleep_button == 0) {
|
||||
if ((acpi_gbl_FADT.flags & ACPI_FADT_SLEEP_BUTTON) == 0) {
|
||||
result = acpi_add_single_object(&device, acpi_root,
|
||||
NULL,
|
||||
ACPI_BUS_TYPE_SLEEP_BUTTON);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ acpi_system_write_sleep(struct file *file,
|
|||
static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
|
||||
{
|
||||
u32 sec, min, hr;
|
||||
u32 day, mo, yr;
|
||||
u32 day, mo, yr, cent = 0;
|
||||
unsigned char rtc_control = 0;
|
||||
unsigned long flags;
|
||||
|
||||
|
|
@ -87,20 +87,19 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
|
|||
rtc_control = CMOS_READ(RTC_CONTROL);
|
||||
|
||||
/* If we ever get an FACP with proper values... */
|
||||
if (acpi_gbl_FADT->day_alrm)
|
||||
if (acpi_gbl_FADT.day_alarm)
|
||||
/* ACPI spec: only low 6 its should be cared */
|
||||
day = CMOS_READ(acpi_gbl_FADT->day_alrm) & 0x3F;
|
||||
day = CMOS_READ(acpi_gbl_FADT.day_alarm) & 0x3F;
|
||||
else
|
||||
day = CMOS_READ(RTC_DAY_OF_MONTH);
|
||||
if (acpi_gbl_FADT->mon_alrm)
|
||||
mo = CMOS_READ(acpi_gbl_FADT->mon_alrm);
|
||||
if (acpi_gbl_FADT.month_alarm)
|
||||
mo = CMOS_READ(acpi_gbl_FADT.month_alarm);
|
||||
else
|
||||
mo = CMOS_READ(RTC_MONTH);
|
||||
if (acpi_gbl_FADT->century)
|
||||
yr = CMOS_READ(acpi_gbl_FADT->century) * 100 +
|
||||
CMOS_READ(RTC_YEAR);
|
||||
else
|
||||
yr = CMOS_READ(RTC_YEAR);
|
||||
if (acpi_gbl_FADT.century)
|
||||
cent = CMOS_READ(acpi_gbl_FADT.century);
|
||||
|
||||
yr = CMOS_READ(RTC_YEAR);
|
||||
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
|
||||
|
|
@ -111,10 +110,11 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
|
|||
BCD_TO_BIN(day);
|
||||
BCD_TO_BIN(mo);
|
||||
BCD_TO_BIN(yr);
|
||||
BCD_TO_BIN(cent);
|
||||
}
|
||||
|
||||
/* we're trusting the FADT (see above) */
|
||||
if (!acpi_gbl_FADT->century)
|
||||
if (!acpi_gbl_FADT.century)
|
||||
/* If we're not trusting the FADT, we should at least make it
|
||||
* right for _this_ century... ehm, what is _this_ century?
|
||||
*
|
||||
|
|
@ -134,6 +134,8 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
|
|||
*
|
||||
*/
|
||||
yr += 2000;
|
||||
else
|
||||
yr += cent * 100;
|
||||
|
||||
seq_printf(seq, "%4.4u-", yr);
|
||||
(mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo);
|
||||
|
|
@ -317,12 +319,12 @@ acpi_system_write_alarm(struct file *file,
|
|||
* offsets into the CMOS RAM here -- which for some reason are pointing
|
||||
* to the RTC area of memory.
|
||||
*/
|
||||
if (acpi_gbl_FADT->day_alrm)
|
||||
CMOS_WRITE(day, acpi_gbl_FADT->day_alrm);
|
||||
if (acpi_gbl_FADT->mon_alrm)
|
||||
CMOS_WRITE(mo, acpi_gbl_FADT->mon_alrm);
|
||||
if (acpi_gbl_FADT->century)
|
||||
CMOS_WRITE(yr / 100, acpi_gbl_FADT->century);
|
||||
if (acpi_gbl_FADT.day_alarm)
|
||||
CMOS_WRITE(day, acpi_gbl_FADT.day_alarm);
|
||||
if (acpi_gbl_FADT.month_alarm)
|
||||
CMOS_WRITE(mo, acpi_gbl_FADT.month_alarm);
|
||||
if (acpi_gbl_FADT.century)
|
||||
CMOS_WRITE(yr / 100, acpi_gbl_FADT.century);
|
||||
/* enable the rtc alarm interrupt */
|
||||
rtc_control |= RTC_AIE;
|
||||
CMOS_WRITE(rtc_control, RTC_CONTROL);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue