Commit 17d0e4f4 authored by Andy Grover's avatar Andy Grover

Merge groveronline.com:/root/bk/linux-2.5

into groveronline.com:/root/bk/linux-acpi
parents 1a569433 8e498582
...@@ -1086,7 +1086,7 @@ void __init mp_parse_prt (void) ...@@ -1086,7 +1086,7 @@ void __init mp_parse_prt (void)
/* /*
* Parsing through the PCI Interrupt Routing Table (PRT) and program * Parsing through the PCI Interrupt Routing Table (PRT) and program
* routing for all static (IOAPIC-direct) entries. * routing for all entries.
*/ */
list_for_each(node, &acpi_prt.entries) { list_for_each(node, &acpi_prt.entries) {
entry = list_entry(node, struct acpi_prt_entry, node); entry = list_entry(node, struct acpi_prt_entry, node);
...@@ -1100,6 +1100,10 @@ void __init mp_parse_prt (void) ...@@ -1100,6 +1100,10 @@ void __init mp_parse_prt (void)
else else
irq = entry->link.index; irq = entry->link.index;
/* Don't set up the ACPI SCI because it's already set up */
if (acpi_fadt.sci_int == irq)
continue;
ioapic = mp_find_ioapic(irq); ioapic = mp_find_ioapic(irq);
if (ioapic < 0) if (ioapic < 0)
continue; continue;
......
...@@ -222,8 +222,8 @@ acpi_ds_initialize_objects ( ...@@ -222,8 +222,8 @@ acpi_ds_initialize_objects (
} }
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s] - %hd Objects with %hd Devices %hd Methods %hd Regions\n", "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
table_desc->pointer->signature, info.object_count, table_desc->pointer->signature, table_desc->table_id, info.object_count,
info.device_count, info.method_count, info.op_region_count)); info.device_count, info.method_count, info.op_region_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
......
...@@ -82,7 +82,7 @@ acpi_ds_execute_arguments ( ...@@ -82,7 +82,7 @@ acpi_ds_execute_arguments (
union acpi_parse_object *arg; union acpi_parse_object *arg;
ACPI_FUNCTION_TRACE ("acpi_ds_execute_arguments"); ACPI_FUNCTION_TRACE ("ds_execute_arguments");
/* /*
...@@ -99,7 +99,7 @@ acpi_ds_execute_arguments ( ...@@ -99,7 +99,7 @@ acpi_ds_execute_arguments (
/* Create and initialize a new parser state */ /* Create and initialize a new parser state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, NULL); walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) { if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -139,7 +139,7 @@ acpi_ds_execute_arguments ( ...@@ -139,7 +139,7 @@ acpi_ds_execute_arguments (
/* Create and initialize a new parser state */ /* Create and initialize a new parser state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, NULL); walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) { if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
......
...@@ -113,7 +113,7 @@ acpi_ec_wait ( ...@@ -113,7 +113,7 @@ acpi_ec_wait (
switch (event) { switch (event) {
case ACPI_EC_EVENT_OBF: case ACPI_EC_EVENT_OBF:
do { do {
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr, 0); acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr);
if (acpi_ec_status & ACPI_EC_FLAG_OBF) if (acpi_ec_status & ACPI_EC_FLAG_OBF)
return 0; return 0;
udelay(ACPI_EC_UDELAY); udelay(ACPI_EC_UDELAY);
...@@ -121,7 +121,7 @@ acpi_ec_wait ( ...@@ -121,7 +121,7 @@ acpi_ec_wait (
break; break;
case ACPI_EC_EVENT_IBE: case ACPI_EC_EVENT_IBE:
do { do {
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr, 0); acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr);
if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
return 0; return 0;
udelay(ACPI_EC_UDELAY); udelay(ACPI_EC_UDELAY);
...@@ -161,18 +161,18 @@ acpi_ec_read ( ...@@ -161,18 +161,18 @@ acpi_ec_read (
spin_lock_irqsave(&ec->lock, flags); spin_lock_irqsave(&ec->lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr, 0); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) if (result)
goto end; goto end;
acpi_hw_low_level_write(8, address, &ec->data_addr, 0); acpi_hw_low_level_write(8, address, &ec->data_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (result) if (result)
goto end; goto end;
acpi_hw_low_level_read(8, data, &ec->data_addr, 0); acpi_hw_low_level_read(8, data, &ec->data_addr);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
*data, address)); *data, address));
...@@ -211,17 +211,17 @@ acpi_ec_write ( ...@@ -211,17 +211,17 @@ acpi_ec_write (
spin_lock_irqsave(&ec->lock, flags); spin_lock_irqsave(&ec->lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr, 0); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) if (result)
goto end; goto end;
acpi_hw_low_level_write(8, address, &ec->data_addr, 0); acpi_hw_low_level_write(8, address, &ec->data_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) if (result)
goto end; goto end;
acpi_hw_low_level_write(8, data, &ec->data_addr, 0); acpi_hw_low_level_write(8, data, &ec->data_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) if (result)
goto end; goto end;
...@@ -310,12 +310,12 @@ acpi_ec_query ( ...@@ -310,12 +310,12 @@ acpi_ec_query (
*/ */
spin_lock_irqsave(&ec->lock, flags); spin_lock_irqsave(&ec->lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr, 0); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (result) if (result)
goto end; goto end;
acpi_hw_low_level_read(8, data, &ec->data_addr, 0); acpi_hw_low_level_read(8, data, &ec->data_addr);
if (!*data) if (!*data)
result = -ENODATA; result = -ENODATA;
...@@ -355,7 +355,7 @@ acpi_ec_gpe_query ( ...@@ -355,7 +355,7 @@ acpi_ec_gpe_query (
goto end; goto end;
spin_lock_irqsave(&ec->lock, flags); spin_lock_irqsave(&ec->lock, flags);
acpi_hw_low_level_read(8, &value, &ec->command_addr, 0); acpi_hw_low_level_read(8, &value, &ec->command_addr);
spin_unlock_irqrestore(&ec->lock, flags); spin_unlock_irqrestore(&ec->lock, flags);
/* TBD: Implement asynch events! /* TBD: Implement asynch events!
......
...@@ -170,7 +170,7 @@ acpi_ev_gpe_detect ( ...@@ -170,7 +170,7 @@ acpi_ev_gpe_detect (
/* Read the Status Register */ /* Read the Status Register */
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value, status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value,
&gpe_register_info->status_address, 0); &gpe_register_info->status_address);
gpe_register_info->status = (u8) in_value; gpe_register_info->status = (u8) in_value;
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
...@@ -179,7 +179,7 @@ acpi_ev_gpe_detect ( ...@@ -179,7 +179,7 @@ acpi_ev_gpe_detect (
/* Read the Enable Register */ /* Read the Enable Register */
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value, status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value,
&gpe_register_info->enable_address, 0); &gpe_register_info->enable_address);
gpe_register_info->enable = (u8) in_value; gpe_register_info->enable = (u8) in_value;
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
......
...@@ -634,13 +634,13 @@ acpi_ev_create_gpe_info_blocks ( ...@@ -634,13 +634,13 @@ acpi_ev_create_gpe_info_blocks (
* by writing a '0'. * by writing a '0'.
*/ */
status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0x00, status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0x00,
&this_register->enable_address, 0); &this_register->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto error_exit; goto error_exit;
} }
status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0xFF, status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0xFF,
&this_register->status_address, 0); &this_register->status_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto error_exit; goto error_exit;
} }
......
...@@ -156,10 +156,10 @@ acpi_ev_queue_notify_request ( ...@@ -156,10 +156,10 @@ acpi_ev_queue_notify_request (
case ACPI_TYPE_POWER: case ACPI_TYPE_POWER:
if (notify_value <= ACPI_MAX_SYS_NOTIFY) { if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
handler_obj = obj_desc->common_notify.sys_handler; handler_obj = obj_desc->common_notify.system_notify;
} }
else { else {
handler_obj = obj_desc->common_notify.drv_handler; handler_obj = obj_desc->common_notify.device_notify;
} }
break; break;
...@@ -171,8 +171,8 @@ acpi_ev_queue_notify_request ( ...@@ -171,8 +171,8 @@ acpi_ev_queue_notify_request (
/* If there is any handler to run, schedule the dispatcher */ /* If there is any handler to run, schedule the dispatcher */
if ((acpi_gbl_sys_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) || if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
(acpi_gbl_drv_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) || (acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) ||
handler_obj) { handler_obj) {
notify_info = acpi_ut_create_generic_state (); notify_info = acpi_ut_create_generic_state ();
if (!notify_info) { if (!notify_info) {
...@@ -235,17 +235,17 @@ acpi_ev_notify_dispatch ( ...@@ -235,17 +235,17 @@ acpi_ev_notify_dispatch (
if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
/* Global system notification handler */ /* Global system notification handler */
if (acpi_gbl_sys_notify.handler) { if (acpi_gbl_system_notify.handler) {
global_handler = acpi_gbl_sys_notify.handler; global_handler = acpi_gbl_system_notify.handler;
global_context = acpi_gbl_sys_notify.context; global_context = acpi_gbl_system_notify.context;
} }
} }
else { else {
/* Global driver notification handler */ /* Global driver notification handler */
if (acpi_gbl_drv_notify.handler) { if (acpi_gbl_device_notify.handler) {
global_handler = acpi_gbl_drv_notify.handler; global_handler = acpi_gbl_device_notify.handler;
global_context = acpi_gbl_drv_notify.context; global_context = acpi_gbl_device_notify.context;
} }
} }
...@@ -259,8 +259,8 @@ acpi_ev_notify_dispatch ( ...@@ -259,8 +259,8 @@ acpi_ev_notify_dispatch (
handler_obj = notify_info->notify.handler_obj; handler_obj = notify_info->notify.handler_obj;
if (handler_obj) { if (handler_obj) {
handler_obj->notify_handler.handler (notify_info->notify.node, notify_info->notify.value, handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value,
handler_obj->notify_handler.context); handler_obj->notify.context);
} }
/* All done with the info object */ /* All done with the info object */
......
This diff is collapsed.
...@@ -165,10 +165,11 @@ acpi_ev_pci_config_region_setup ( ...@@ -165,10 +165,11 @@ acpi_ev_pci_config_region_setup (
void **region_context) void **region_context)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_integer temp; acpi_integer pci_value;
struct acpi_pci_id *pci_id = *region_context; struct acpi_pci_id *pci_id = *region_context;
union acpi_operand_object *handler_obj; union acpi_operand_object *handler_obj;
struct acpi_namespace_node *node; struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *pci_root_node;
union acpi_operand_object *region_obj = (union acpi_operand_object *) handle; union acpi_operand_object *region_obj = (union acpi_operand_object *) handle;
struct acpi_device_id object_hID; struct acpi_device_id object_hID;
...@@ -176,7 +177,7 @@ acpi_ev_pci_config_region_setup ( ...@@ -176,7 +177,7 @@ acpi_ev_pci_config_region_setup (
ACPI_FUNCTION_TRACE ("ev_pci_config_region_setup"); ACPI_FUNCTION_TRACE ("ev_pci_config_region_setup");
handler_obj = region_obj->region.addr_handler; handler_obj = region_obj->region.address_space;
if (!handler_obj) { if (!handler_obj) {
/* /*
* No installed handler. This shouldn't happen because the dispatch * No installed handler. This shouldn't happen because the dispatch
...@@ -187,45 +188,15 @@ acpi_ev_pci_config_region_setup ( ...@@ -187,45 +188,15 @@ acpi_ev_pci_config_region_setup (
return_ACPI_STATUS (AE_NOT_EXIST); return_ACPI_STATUS (AE_NOT_EXIST);
} }
*region_context = NULL;
if (function == ACPI_REGION_DEACTIVATE) { if (function == ACPI_REGION_DEACTIVATE) {
if (pci_id) { if (pci_id) {
ACPI_MEM_FREE (pci_id); ACPI_MEM_FREE (pci_id);
*region_context = NULL;
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Create a new context */ parent_node = acpi_ns_get_parent_node (region_obj->region.node);
pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id));
if (!pci_id) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* For PCI Config space access, we have to pass the segment, bus,
* device and function numbers. This routine must acquire those.
*/
/*
* First get device and function numbers from the _ADR object
* in the parent's scope.
*/
node = acpi_ns_get_parent_node (region_obj->region.node);
/* Evaluate the _ADR object */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
/*
* The default is zero, and since the allocation above zeroed
* the data, just do nothing on failure.
*/
if (ACPI_SUCCESS (status)) {
pci_id->device = ACPI_HIWORD (ACPI_LODWORD (temp));
pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp));
}
/* /*
* Get the _SEG and _BBN values from the device upon which the handler * Get the _SEG and _BBN values from the device upon which the handler
...@@ -236,16 +207,16 @@ acpi_ev_pci_config_region_setup ( ...@@ -236,16 +207,16 @@ acpi_ev_pci_config_region_setup (
*/ */
/* /*
* If the addr_handler.Node is still pointing to the root, we need * If the address_space.Node is still pointing to the root, we need
* to scan upward for a PCI Root bridge and re-associate the op_region * to scan upward for a PCI Root bridge and re-associate the op_region
* handlers with that device. * handlers with that device.
*/ */
if (handler_obj->addr_handler.node == acpi_gbl_root_node) { if (handler_obj->address_space.node == acpi_gbl_root_node) {
/* /* Start search from the parent object */
* Node is currently the parent object
*/ pci_root_node = parent_node;
while (node != acpi_gbl_root_node) { while (pci_root_node != acpi_gbl_root_node) {
status = acpi_ut_execute_HID (node, &object_hID); status = acpi_ut_execute_HID (pci_root_node, &object_hID);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* Got a valid _HID, check if this is a PCI root */ /* Got a valid _HID, check if this is a PCI root */
...@@ -253,44 +224,89 @@ acpi_ev_pci_config_region_setup ( ...@@ -253,44 +224,89 @@ acpi_ev_pci_config_region_setup (
sizeof (PCI_ROOT_HID_STRING)))) { sizeof (PCI_ROOT_HID_STRING)))) {
/* Install a handler for this PCI root bridge */ /* Install a handler for this PCI root bridge */
status = acpi_install_address_space_handler ((acpi_handle) node, status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
ACPI_ADR_SPACE_PCI_CONFIG, ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL); ACPI_DEFAULT_HANDLER, NULL, NULL);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not install pci_config handler for %4.4s, %s\n", if (status == AE_SAME_HANDLER) {
node->name.ascii, acpi_format_exception (status))); /*
* 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_REPORT_ERROR ((
"Could not install pci_config handler for Root Bridge %4.4s, %s\n",
pci_root_node->name.ascii, acpi_format_exception (status)));
}
} }
break; break;
} }
} }
node = acpi_ns_get_parent_node (node); pci_root_node = acpi_ns_get_parent_node (pci_root_node);
} }
/* PCI root bridge not found, use namespace root node */
} }
else { else {
node = handler_obj->addr_handler.node; pci_root_node = handler_obj->address_space.node;
} }
/* /*
* The PCI segment number comes from the _SEG method * If this region is now initialized, we are done.
* (install_address_space_handler could have initialized it)
*/ */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp); if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
if (ACPI_SUCCESS (status)) { return_ACPI_STATUS (AE_OK);
pci_id->segment = ACPI_LOWORD (temp); }
/* Region is still not initialized. Create a new context */
pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id));
if (!pci_id) {
return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* /*
* The PCI bus number comes from the _BBN method * For PCI_Config space access, we need the segment, bus,
* device and function numbers. Acquire them here.
*/ */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp);
if (ACPI_SUCCESS (status)) {
pci_id->bus = ACPI_LOWORD (temp);
}
/* /*
* Complete this device's pci_id * Get the PCI device and function numbers from the _ADR object
* contained in the parent's scope.
*/ */
acpi_os_derive_pci_id (node, region_obj->region.node, &pci_id); status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, parent_node, &pci_value);
/*
* The default is zero, and since the allocation above zeroed
* the data, just do nothing on failure.
*/
if (ACPI_SUCCESS (status)) {
pci_id->device = ACPI_HIWORD (ACPI_LODWORD (pci_value));
pci_id->function = ACPI_LOWORD (ACPI_LODWORD (pci_value));
}
/* The PCI segment number comes from the _SEG method */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value);
if (ACPI_SUCCESS (status)) {
pci_id->segment = ACPI_LOWORD (pci_value);
}
/* The PCI bus number comes from the _BBN method */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value);
if (ACPI_SUCCESS (status)) {
pci_id->bus = ACPI_LOWORD (pci_value);
}
/* Complete this device's pci_id */
acpi_os_derive_pci_id (pci_root_node, region_obj->region.node, &pci_id);
*region_context = pci_id; *region_context = pci_id;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -451,14 +467,15 @@ acpi_ev_initialize_region ( ...@@ -451,14 +467,15 @@ acpi_ev_initialize_region (
node = acpi_ns_get_parent_node (region_obj->region.node); node = acpi_ns_get_parent_node (region_obj->region.node);
space_id = region_obj->region.space_id; space_id = region_obj->region.space_id;
region_obj->region.addr_handler = NULL; /* Setup defaults */
region_obj->region.address_space = NULL;
region_obj2->extra.method_REG = NULL; region_obj2->extra.method_REG = NULL;
region_obj->common.flags &= ~(AOPOBJ_SETUP_COMPLETE); region_obj->common.flags &= ~(AOPOBJ_SETUP_COMPLETE);
region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
/* /* Find any "_REG" method associated with this region definition */
* Find any "_REG" method associated with this region definition
*/
status = acpi_ns_search_node (*reg_name_ptr, node, status = acpi_ns_search_node (*reg_name_ptr, node,
ACPI_TYPE_METHOD, &method_node); ACPI_TYPE_METHOD, &method_node);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
...@@ -475,29 +492,27 @@ acpi_ev_initialize_region ( ...@@ -475,29 +492,27 @@ acpi_ev_initialize_region (
* ie: acpi_gbl_root_node->parent_entry being set to NULL * ie: acpi_gbl_root_node->parent_entry being set to NULL
*/ */
while (node) { while (node) {
/* /* Check to see if a handler exists */
* Check to see if a handler exists
*/
handler_obj = NULL; handler_obj = NULL;
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
/* /* Can only be a handler if the object exists */
* Can only be a handler if the object exists
*/
switch (node->type) { switch (node->type) {
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
handler_obj = obj_desc->device.addr_handler; handler_obj = obj_desc->device.address_space;
break; break;
case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_PROCESSOR:
handler_obj = obj_desc->processor.addr_handler; handler_obj = obj_desc->processor.address_space;
break; break;
case ACPI_TYPE_THERMAL: case ACPI_TYPE_THERMAL:
handler_obj = obj_desc->thermal_zone.addr_handler; handler_obj = obj_desc->thermal_zone.address_space;
break; break;
default: default:
...@@ -508,7 +523,7 @@ acpi_ev_initialize_region ( ...@@ -508,7 +523,7 @@ acpi_ev_initialize_region (
while (handler_obj) { while (handler_obj) {
/* Is this handler of the correct type? */ /* Is this handler of the correct type? */
if (handler_obj->addr_handler.space_id == space_id) { if (handler_obj->address_space.space_id == space_id) {
/* Found correct handler */ /* Found correct handler */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
...@@ -523,7 +538,7 @@ acpi_ev_initialize_region ( ...@@ -523,7 +538,7 @@ acpi_ev_initialize_region (
/* Try next handler in the list */ /* Try next handler in the list */
handler_obj = handler_obj->addr_handler.next; handler_obj = handler_obj->address_space.next;
} }
} }
...@@ -534,9 +549,8 @@ acpi_ev_initialize_region ( ...@@ -534,9 +549,8 @@ acpi_ev_initialize_region (
node = acpi_ns_get_parent_node (node); node = acpi_ns_get_parent_node (node);
} }
/* /* If we get here, there is no handler for this region */
* If we get here, there is no handler for this region
*/
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"No handler for region_type %s(%X) (region_obj %p)\n", "No handler for region_type %s(%X) (region_obj %p)\n",
acpi_ut_get_region_name (space_id), space_id, region_obj)); acpi_ut_get_region_name (space_id), space_id, region_obj));
......
...@@ -244,22 +244,22 @@ acpi_install_notify_handler ( ...@@ -244,22 +244,22 @@ acpi_install_notify_handler (
/* Make sure the handler is not already installed */ /* Make sure the handler is not already installed */
if (((handler_type == ACPI_SYSTEM_NOTIFY) && if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
acpi_gbl_sys_notify.handler) || acpi_gbl_system_notify.handler) ||
((handler_type == ACPI_DEVICE_NOTIFY) && ((handler_type == ACPI_DEVICE_NOTIFY) &&
acpi_gbl_drv_notify.handler)) { acpi_gbl_device_notify.handler)) {
status = AE_ALREADY_EXISTS; status = AE_ALREADY_EXISTS;
goto unlock_and_exit; goto unlock_and_exit;
} }
if (handler_type == ACPI_SYSTEM_NOTIFY) { if (handler_type == ACPI_SYSTEM_NOTIFY) {
acpi_gbl_sys_notify.node = node; acpi_gbl_system_notify.node = node;
acpi_gbl_sys_notify.handler = handler; acpi_gbl_system_notify.handler = handler;
acpi_gbl_sys_notify.context = context; acpi_gbl_system_notify.context = context;
} }
else /* ACPI_DEVICE_NOTIFY */ { else /* ACPI_DEVICE_NOTIFY */ {
acpi_gbl_drv_notify.node = node; acpi_gbl_device_notify.node = node;
acpi_gbl_drv_notify.handler = handler; acpi_gbl_device_notify.handler = handler;
acpi_gbl_drv_notify.context = context; acpi_gbl_device_notify.context = context;
} }
/* Global notify handler installed */ /* Global notify handler installed */
...@@ -282,13 +282,12 @@ acpi_install_notify_handler ( ...@@ -282,13 +282,12 @@ acpi_install_notify_handler (
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
/* Object exists - make sure there's no handler */ /* Object exists - make sure there's no handler */
if (((handler_type == ACPI_SYSTEM_NOTIFY) && if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
obj_desc->common_notify.sys_handler) || obj_desc->common_notify.system_notify) ||
((handler_type == ACPI_DEVICE_NOTIFY) && ((handler_type == ACPI_DEVICE_NOTIFY) &&
obj_desc->common_notify.drv_handler)) { obj_desc->common_notify.device_notify)) {
status = AE_ALREADY_EXISTS; status = AE_ALREADY_EXISTS;
goto unlock_and_exit; goto unlock_and_exit;
} }
...@@ -305,6 +304,11 @@ acpi_install_notify_handler ( ...@@ -305,6 +304,11 @@ acpi_install_notify_handler (
/* Attach new object to the Node */ /* Attach new object to the Node */
status = acpi_ns_attach_object (device, obj_desc, node->type); status = acpi_ns_attach_object (device, obj_desc, node->type);
/* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
...@@ -318,15 +322,15 @@ acpi_install_notify_handler ( ...@@ -318,15 +322,15 @@ acpi_install_notify_handler (
goto unlock_and_exit; goto unlock_and_exit;
} }
notify_obj->notify_handler.node = node; notify_obj->notify.node = node;
notify_obj->notify_handler.handler = handler; notify_obj->notify.handler = handler;
notify_obj->notify_handler.context = context; notify_obj->notify.context = context;
if (handler_type == ACPI_SYSTEM_NOTIFY) { if (handler_type == ACPI_SYSTEM_NOTIFY) {
obj_desc->common_notify.sys_handler = notify_obj; obj_desc->common_notify.system_notify = notify_obj;
} }
else /* ACPI_DEVICE_NOTIFY */ { else /* ACPI_DEVICE_NOTIFY */ {
obj_desc->common_notify.drv_handler = notify_obj; obj_desc->common_notify.device_notify = notify_obj;
} }
} }
...@@ -395,22 +399,22 @@ acpi_remove_notify_handler ( ...@@ -395,22 +399,22 @@ acpi_remove_notify_handler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
if (((handler_type == ACPI_SYSTEM_NOTIFY) && if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
!acpi_gbl_sys_notify.handler) || !acpi_gbl_system_notify.handler) ||
((handler_type == ACPI_DEVICE_NOTIFY) && ((handler_type == ACPI_DEVICE_NOTIFY) &&
!acpi_gbl_drv_notify.handler)) { !acpi_gbl_device_notify.handler)) {
status = AE_NOT_EXIST; status = AE_NOT_EXIST;
goto unlock_and_exit; goto unlock_and_exit;
} }
if (handler_type == ACPI_SYSTEM_NOTIFY) { if (handler_type == ACPI_SYSTEM_NOTIFY) {
acpi_gbl_sys_notify.node = NULL; acpi_gbl_system_notify.node = NULL;
acpi_gbl_sys_notify.handler = NULL; acpi_gbl_system_notify.handler = NULL;
acpi_gbl_sys_notify.context = NULL; acpi_gbl_system_notify.context = NULL;
} }
else { else {
acpi_gbl_drv_notify.node = NULL; acpi_gbl_device_notify.node = NULL;
acpi_gbl_drv_notify.handler = NULL; acpi_gbl_device_notify.handler = NULL;
acpi_gbl_drv_notify.context = NULL; acpi_gbl_device_notify.context = NULL;
} }
} }
...@@ -436,14 +440,14 @@ acpi_remove_notify_handler ( ...@@ -436,14 +440,14 @@ acpi_remove_notify_handler (
/* Object exists - make sure there's an existing handler */ /* Object exists - make sure there's an existing handler */
if (handler_type == ACPI_SYSTEM_NOTIFY) { if (handler_type == ACPI_SYSTEM_NOTIFY) {
notify_obj = obj_desc->common_notify.sys_handler; notify_obj = obj_desc->common_notify.system_notify;
} }
else { else {
notify_obj = obj_desc->common_notify.drv_handler; notify_obj = obj_desc->common_notify.device_notify;
} }
if ((!notify_obj) || if ((!notify_obj) ||
(notify_obj->notify_handler.handler != handler)) { (notify_obj->notify.handler != handler)) {
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
goto unlock_and_exit; goto unlock_and_exit;
} }
...@@ -451,10 +455,10 @@ acpi_remove_notify_handler ( ...@@ -451,10 +455,10 @@ acpi_remove_notify_handler (
/* Remove the handler */ /* Remove the handler */
if (handler_type == ACPI_SYSTEM_NOTIFY) { if (handler_type == ACPI_SYSTEM_NOTIFY) {
obj_desc->common_notify.sys_handler = NULL; obj_desc->common_notify.system_notify = NULL;
} }
else { else {
obj_desc->common_notify.drv_handler = NULL; obj_desc->common_notify.device_notify = NULL;
} }
acpi_ut_remove_reference (notify_obj); acpi_ut_remove_reference (notify_obj);
......
...@@ -654,7 +654,11 @@ acpi_install_gpe_block ( ...@@ -654,7 +654,11 @@ acpi_install_gpe_block (
} }
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE); status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE);
/* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
......
...@@ -154,7 +154,7 @@ acpi_install_address_space_handler ( ...@@ -154,7 +154,7 @@ acpi_install_address_space_handler (
break; break;
default: default:
status = AE_NOT_EXIST; status = AE_BAD_PARAMETER;
goto unlock_and_exit; goto unlock_and_exit;
} }
} }
...@@ -170,26 +170,36 @@ acpi_install_address_space_handler ( ...@@ -170,26 +170,36 @@ acpi_install_address_space_handler (
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
/* /*
* The object exists. * The attached device object already exists.
* Make sure the handler is not already installed. * Make sure the handler is not already installed.
*/ */
handler_obj = obj_desc->device.address_space;
/* check the address handler the user requested */ /* Walk the handler list for this device */
handler_obj = obj_desc->device.addr_handler;
while (handler_obj) { while (handler_obj) {
/* /* Same space_id indicates a handler already installed */
* Found an Address handler, see if user requested this
* address space. if(handler_obj->address_space.space_id == space_id) {
*/ if (handler_obj->address_space.handler == handler) {
if(handler_obj->addr_handler.space_id == space_id) { /*
status = AE_ALREADY_EXISTS; * It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen with PCI_Config space.
*/
status = AE_SAME_HANDLER;
goto unlock_and_exit;
}
else {
/* A handler is already installed */
status = AE_ALREADY_EXISTS;
}
goto unlock_and_exit; goto unlock_and_exit;
} }
/* Walk the linked list of handlers */ /* Walk the linked list of handlers */
handler_obj = handler_obj->addr_handler.next; handler_obj = handler_obj->address_space.next;
} }
} }
else { else {
...@@ -218,8 +228,12 @@ acpi_install_address_space_handler ( ...@@ -218,8 +228,12 @@ acpi_install_address_space_handler (
/* Attach the new object to the Node */ /* Attach the new object to the Node */
status = acpi_ns_attach_object (node, obj_desc, type); status = acpi_ns_attach_object (node, obj_desc, type);
/* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (obj_desc);
goto unlock_and_exit; goto unlock_and_exit;
} }
} }
...@@ -241,14 +255,25 @@ acpi_install_address_space_handler ( ...@@ -241,14 +255,25 @@ acpi_install_address_space_handler (
goto unlock_and_exit; goto unlock_and_exit;
} }
handler_obj->addr_handler.space_id = (u8) space_id; /* Init handler obj */
handler_obj->addr_handler.hflags = flags;
handler_obj->addr_handler.next = obj_desc->device.addr_handler; handler_obj->address_space.space_id = (u8) space_id;
handler_obj->addr_handler.region_list = NULL; handler_obj->address_space.hflags = flags;
handler_obj->addr_handler.node = node; handler_obj->address_space.region_list = NULL;
handler_obj->addr_handler.handler = handler; handler_obj->address_space.node = node;
handler_obj->addr_handler.context = context; handler_obj->address_space.handler = handler;
handler_obj->addr_handler.setup = setup; handler_obj->address_space.context = context;
handler_obj->address_space.setup = setup;
/* Install at head of Device.address_space list */
handler_obj->address_space.next = obj_desc->device.address_space;
/*
* The Device object is the first reference on the handler_obj.
* Each region that uses the handler adds a reference.
*/
obj_desc->device.address_space = handler_obj;
/* /*
* Walk the namespace finding all of the regions this * Walk the namespace finding all of the regions this
...@@ -262,18 +287,9 @@ acpi_install_address_space_handler ( ...@@ -262,18 +287,9 @@ acpi_install_address_space_handler (
* In either case, back up and search down the remainder * In either case, back up and search down the remainder
* of the branch * of the branch
*/ */
status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, device, status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, device, ACPI_UINT32_MAX,
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, ACPI_NS_WALK_UNLOCK, acpi_ev_install_handler,
acpi_ev_addr_handler_helper, handler_obj, NULL);
handler_obj, NULL);
/* Place this handler 1st on the list */
handler_obj->common.reference_count =
(u16) (handler_obj->common.reference_count +
obj_desc->common.reference_count - 1);
obj_desc->device.addr_handler = handler_obj;
unlock_and_exit: unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
...@@ -341,12 +357,12 @@ acpi_remove_address_space_handler ( ...@@ -341,12 +357,12 @@ acpi_remove_address_space_handler (
/* Find the address handler the user requested */ /* Find the address handler the user requested */
handler_obj = obj_desc->device.addr_handler; handler_obj = obj_desc->device.address_space;
last_obj_ptr = &obj_desc->device.addr_handler; last_obj_ptr = &obj_desc->device.address_space;
while (handler_obj) { while (handler_obj) {
/* We have a handler, see if user requested this one */ /* We have a handler, see if user requested this one */
if (handler_obj->addr_handler.space_id == space_id) { if (handler_obj->address_space.space_id == space_id) {
/* Matched space_id, first dereference this in the Regions */ /* Matched space_id, first dereference this in the Regions */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
...@@ -354,7 +370,7 @@ acpi_remove_address_space_handler ( ...@@ -354,7 +370,7 @@ acpi_remove_address_space_handler (
handler_obj, handler, acpi_ut_get_region_name (space_id), handler_obj, handler, acpi_ut_get_region_name (space_id),
node, obj_desc)); node, obj_desc));
region_obj = handler_obj->addr_handler.region_list; region_obj = handler_obj->address_space.region_list;
/* Walk the handler's region list */ /* Walk the handler's region list */
...@@ -372,13 +388,13 @@ acpi_remove_address_space_handler ( ...@@ -372,13 +388,13 @@ acpi_remove_address_space_handler (
* Walk the list: Just grab the head because the * Walk the list: Just grab the head because the
* detach_region removed the previous head. * detach_region removed the previous head.
*/ */
region_obj = handler_obj->addr_handler.region_list; region_obj = handler_obj->address_space.region_list;
} }
/* Remove this Handler object from the list */ /* Remove this Handler object from the list */
*last_obj_ptr = handler_obj->addr_handler.next; *last_obj_ptr = handler_obj->address_space.next;
/* Now we can delete the handler object */ /* Now we can delete the handler object */
...@@ -388,8 +404,8 @@ acpi_remove_address_space_handler ( ...@@ -388,8 +404,8 @@ acpi_remove_address_space_handler (
/* Walk the linked list of handlers */ /* Walk the linked list of handlers */
last_obj_ptr = &handler_obj->addr_handler.next; last_obj_ptr = &handler_obj->address_space.next;
handler_obj = handler_obj->addr_handler.next; handler_obj = handler_obj->address_space.next;
} }
/* The handler does not exist */ /* The handler does not exist */
......
...@@ -360,11 +360,11 @@ acpi_ex_load_op ( ...@@ -360,11 +360,11 @@ acpi_ex_load_op (
/* The table must be either an SSDT or a PSDT */ /* The table must be either an SSDT or a PSDT */
if ((!ACPI_STRNCMP (table_ptr->signature, if ((!ACPI_STRNCMP (table_ptr->signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].signature, acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_PSDT].sig_length)) && acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
(!ACPI_STRNCMP (table_ptr->signature, (!ACPI_STRNCMP (table_ptr->signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
acpi_gbl_acpi_table_data[ACPI_TABLE_SSDT].sig_length))) { acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n", "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
table_ptr->signature)); table_ptr->signature));
......
...@@ -635,9 +635,9 @@ acpi_ex_dump_object_descriptor ( ...@@ -635,9 +635,9 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
acpi_ex_out_pointer ("addr_handler", obj_desc->device.addr_handler); acpi_ex_out_pointer ("address_space", obj_desc->device.address_space);
acpi_ex_out_pointer ("sys_handler", obj_desc->device.sys_handler); acpi_ex_out_pointer ("system_notify", obj_desc->device.system_notify);
acpi_ex_out_pointer ("drv_handler", obj_desc->device.drv_handler); acpi_ex_out_pointer ("device_notify", obj_desc->device.device_notify);
break; break;
...@@ -673,7 +673,7 @@ acpi_ex_dump_object_descriptor ( ...@@ -673,7 +673,7 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("Flags", obj_desc->region.flags); acpi_ex_out_integer ("Flags", obj_desc->region.flags);
acpi_ex_out_address ("Address", obj_desc->region.address); acpi_ex_out_address ("Address", obj_desc->region.address);
acpi_ex_out_integer ("Length", obj_desc->region.length); acpi_ex_out_integer ("Length", obj_desc->region.length);
acpi_ex_out_pointer ("addr_handler", obj_desc->region.addr_handler); acpi_ex_out_pointer ("address_space", obj_desc->region.address_space);
acpi_ex_out_pointer ("Next", obj_desc->region.next); acpi_ex_out_pointer ("Next", obj_desc->region.next);
break; break;
...@@ -682,8 +682,8 @@ acpi_ex_dump_object_descriptor ( ...@@ -682,8 +682,8 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("system_level", obj_desc->power_resource.system_level); acpi_ex_out_integer ("system_level", obj_desc->power_resource.system_level);
acpi_ex_out_integer ("resource_order", obj_desc->power_resource.resource_order); acpi_ex_out_integer ("resource_order", obj_desc->power_resource.resource_order);
acpi_ex_out_pointer ("sys_handler", obj_desc->power_resource.sys_handler); acpi_ex_out_pointer ("system_notify", obj_desc->power_resource.system_notify);
acpi_ex_out_pointer ("drv_handler", obj_desc->power_resource.drv_handler); acpi_ex_out_pointer ("device_notify", obj_desc->power_resource.device_notify);
break; break;
...@@ -692,17 +692,17 @@ acpi_ex_dump_object_descriptor ( ...@@ -692,17 +692,17 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("Processor ID", obj_desc->processor.proc_id); acpi_ex_out_integer ("Processor ID", obj_desc->processor.proc_id);
acpi_ex_out_integer ("Length", obj_desc->processor.length); acpi_ex_out_integer ("Length", obj_desc->processor.length);
acpi_ex_out_address ("Address", (acpi_physical_address) obj_desc->processor.address); acpi_ex_out_address ("Address", (acpi_physical_address) obj_desc->processor.address);
acpi_ex_out_pointer ("sys_handler", obj_desc->processor.sys_handler); acpi_ex_out_pointer ("system_notify", obj_desc->processor.system_notify);
acpi_ex_out_pointer ("drv_handler", obj_desc->processor.drv_handler); acpi_ex_out_pointer ("device_notify", obj_desc->processor.device_notify);
acpi_ex_out_pointer ("addr_handler", obj_desc->processor.addr_handler); acpi_ex_out_pointer ("address_space", obj_desc->processor.address_space);
break; break;
case ACPI_TYPE_THERMAL: case ACPI_TYPE_THERMAL:
acpi_ex_out_pointer ("sys_handler", obj_desc->thermal_zone.sys_handler); acpi_ex_out_pointer ("system_notify", obj_desc->thermal_zone.system_notify);
acpi_ex_out_pointer ("drv_handler", obj_desc->thermal_zone.drv_handler); acpi_ex_out_pointer ("device_notify", obj_desc->thermal_zone.device_notify);
acpi_ex_out_pointer ("addr_handler", obj_desc->thermal_zone.addr_handler); acpi_ex_out_pointer ("address_space", obj_desc->thermal_zone.address_space);
break; break;
...@@ -762,18 +762,18 @@ acpi_ex_dump_object_descriptor ( ...@@ -762,18 +762,18 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
acpi_ex_out_integer ("space_id", obj_desc->addr_handler.space_id); acpi_ex_out_integer ("space_id", obj_desc->address_space.space_id);
acpi_ex_out_pointer ("Next", obj_desc->addr_handler.next); acpi_ex_out_pointer ("Next", obj_desc->address_space.next);
acpi_ex_out_pointer ("region_list", obj_desc->addr_handler.region_list); acpi_ex_out_pointer ("region_list", obj_desc->address_space.region_list);
acpi_ex_out_pointer ("Node", obj_desc->addr_handler.node); acpi_ex_out_pointer ("Node", obj_desc->address_space.node);
acpi_ex_out_pointer ("Context", obj_desc->addr_handler.context); acpi_ex_out_pointer ("Context", obj_desc->address_space.context);
break; break;
case ACPI_TYPE_LOCAL_NOTIFY: case ACPI_TYPE_LOCAL_NOTIFY:
acpi_ex_out_pointer ("Node", obj_desc->notify_handler.node); acpi_ex_out_pointer ("Node", obj_desc->notify.node);
acpi_ex_out_pointer ("Context", obj_desc->notify_handler.context); acpi_ex_out_pointer ("Context", obj_desc->notify.context);
break; break;
......
...@@ -77,7 +77,7 @@ acpi_hw_enable_gpe ( ...@@ -77,7 +77,7 @@ acpi_hw_enable_gpe (
* to enable the GPE, and write out the new register. * to enable the GPE, and write out the new register.
*/ */
status = acpi_hw_low_level_read (8, &in_byte, status = acpi_hw_low_level_read (8, &in_byte,
&gpe_event_info->register_info->enable_address, 0); &gpe_event_info->register_info->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -85,7 +85,7 @@ acpi_hw_enable_gpe ( ...@@ -85,7 +85,7 @@ acpi_hw_enable_gpe (
/* Write with the new GPE bit enabled */ /* Write with the new GPE bit enabled */
status = acpi_hw_low_level_write (8, (in_byte | gpe_event_info->bit_mask), status = acpi_hw_low_level_write (8, (in_byte | gpe_event_info->bit_mask),
&gpe_event_info->register_info->enable_address, 0); &gpe_event_info->register_info->enable_address);
return (status); return (status);
} }
...@@ -164,7 +164,7 @@ acpi_hw_disable_gpe ( ...@@ -164,7 +164,7 @@ acpi_hw_disable_gpe (
* and write out the new register value to disable the GPE. * and write out the new register value to disable the GPE.
*/ */
status = acpi_hw_low_level_read (8, &in_byte, status = acpi_hw_low_level_read (8, &in_byte,
&gpe_register_info->enable_address, 0); &gpe_register_info->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -172,7 +172,7 @@ acpi_hw_disable_gpe ( ...@@ -172,7 +172,7 @@ acpi_hw_disable_gpe (
/* Write the byte with this GPE bit cleared */ /* Write the byte with this GPE bit cleared */
status = acpi_hw_low_level_write (8, (in_byte & ~(gpe_event_info->bit_mask)), status = acpi_hw_low_level_write (8, (in_byte & ~(gpe_event_info->bit_mask)),
&gpe_register_info->enable_address, 0); &gpe_register_info->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -246,7 +246,7 @@ acpi_hw_clear_gpe ( ...@@ -246,7 +246,7 @@ acpi_hw_clear_gpe (
* clear this GPE. * clear this GPE.
*/ */
status = acpi_hw_low_level_write (8, gpe_event_info->bit_mask, status = acpi_hw_low_level_write (8, gpe_event_info->bit_mask,
&gpe_event_info->register_info->status_address, 0); &gpe_event_info->register_info->status_address);
return (status); return (status);
} }
...@@ -293,7 +293,7 @@ acpi_hw_get_gpe_status ( ...@@ -293,7 +293,7 @@ acpi_hw_get_gpe_status (
/* GPE Enabled? */ /* GPE Enabled? */
status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->enable_address, 0); status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
...@@ -310,7 +310,7 @@ acpi_hw_get_gpe_status ( ...@@ -310,7 +310,7 @@ acpi_hw_get_gpe_status (
/* GPE active (set)? */ /* GPE active (set)? */
status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address, 0); status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
...@@ -360,7 +360,7 @@ acpi_hw_disable_gpe_block ( ...@@ -360,7 +360,7 @@ acpi_hw_disable_gpe_block (
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
status = acpi_hw_low_level_write (8, 0x00, status = acpi_hw_low_level_write (8, 0x00,
&gpe_block->register_info[i].enable_address, (u32) i); &gpe_block->register_info[i].enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -401,7 +401,7 @@ acpi_hw_clear_gpe_block ( ...@@ -401,7 +401,7 @@ acpi_hw_clear_gpe_block (
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
status = acpi_hw_low_level_write (8, 0xFF, status = acpi_hw_low_level_write (8, 0xFF,
&gpe_block->register_info[i].status_address, (u32) i); &gpe_block->register_info[i].status_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -447,7 +447,7 @@ acpi_hw_disable_non_wakeup_gpe_block ( ...@@ -447,7 +447,7 @@ acpi_hw_disable_non_wakeup_gpe_block (
* will be using it to restore all the GPEs later. * will be using it to restore all the GPEs later.
*/ */
status = acpi_hw_low_level_read (8, &in_value, status = acpi_hw_low_level_read (8, &in_value,
&gpe_register_info->enable_address, 0); &gpe_register_info->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -458,7 +458,7 @@ acpi_hw_disable_non_wakeup_gpe_block ( ...@@ -458,7 +458,7 @@ acpi_hw_disable_non_wakeup_gpe_block (
* Disable all GPEs except wakeup GPEs. * Disable all GPEs except wakeup GPEs.
*/ */
status = acpi_hw_low_level_write (8, gpe_register_info->wake_enable, status = acpi_hw_low_level_write (8, gpe_register_info->wake_enable,
&gpe_register_info->enable_address, 0); &gpe_register_info->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -539,7 +539,7 @@ acpi_hw_enable_non_wakeup_gpe_block ( ...@@ -539,7 +539,7 @@ acpi_hw_enable_non_wakeup_gpe_block (
* Blast them back in. * Blast them back in.
*/ */
status = acpi_hw_low_level_write (8, gpe_register_info->enable, status = acpi_hw_low_level_write (8, gpe_register_info->enable,
&gpe_register_info->enable_address, 0); &gpe_register_info->enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
......
This diff is collapsed.
...@@ -108,7 +108,7 @@ acpi_get_timer ( ...@@ -108,7 +108,7 @@ acpi_get_timer (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->xpm_tmr_blk, 0); status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -116,19 +116,33 @@ acpi_ns_delete_node ( ...@@ -116,19 +116,33 @@ acpi_ns_delete_node (
prev_node = NULL; prev_node = NULL;
next_node = parent_node->child; next_node = parent_node->child;
/* Find the node that is the previous peer in the parent's child list */
while (next_node != node) { while (next_node != node) {
prev_node = next_node; prev_node = next_node;
next_node = prev_node->peer; next_node = prev_node->peer;
} }
if (prev_node) { if (prev_node) {
/* Node is not first child, unlink it */
prev_node->peer = next_node->peer; prev_node->peer = next_node->peer;
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
prev_node->flags |= ANOBJ_END_OF_PEER_LIST; prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
} }
} }
else { else {
parent_node->child = next_node->peer; /* Node is first child (has no previous peer) */
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* No peers at all */
parent_node->child = NULL;
}
else { /* Link peer list to parent */
parent_node->child = next_node->peer;
}
} }
...@@ -222,7 +236,7 @@ acpi_ns_install_node ( ...@@ -222,7 +236,7 @@ acpi_ns_install_node (
struct acpi_namespace_node *node, /* New Child*/ struct acpi_namespace_node *node, /* New Child*/
acpi_object_type type) acpi_object_type type)
{ {
u16 owner_id = TABLE_ID_DSDT; u16 owner_id = 0;
struct acpi_namespace_node *child_node; struct acpi_namespace_node *child_node;
#ifdef ACPI_ALPHABETIC_NAMESPACE #ifdef ACPI_ALPHABETIC_NAMESPACE
...@@ -355,6 +369,7 @@ acpi_ns_delete_children ( ...@@ -355,6 +369,7 @@ acpi_ns_delete_children (
{ {
struct acpi_namespace_node *child_node; struct acpi_namespace_node *child_node;
struct acpi_namespace_node *next_node; struct acpi_namespace_node *next_node;
struct acpi_namespace_node *node;
u8 flags; u8 flags;
...@@ -399,6 +414,25 @@ acpi_ns_delete_children ( ...@@ -399,6 +414,25 @@ acpi_ns_delete_children (
* Detach an object if there is one, then free the child node * Detach an object if there is one, then free the child node
*/ */
acpi_ns_detach_object (child_node); acpi_ns_detach_object (child_node);
/*
* Decrement the reference count(s) of all parents up to
* the root! (counts were incremented when the node was created)
*/
node = child_node;
while ((node = acpi_ns_get_parent_node (node)) != NULL) {
node->reference_count--;
}
/* There should be only one reference remaining on this node */
if (child_node->reference_count != 1) {
ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n",
child_node->reference_count, child_node));
}
/* Now we can delete the node */
ACPI_MEM_FREE (child_node); ACPI_MEM_FREE (child_node);
/* And move on to the next child in the list */ /* And move on to the next child in the list */
...@@ -512,7 +546,7 @@ acpi_ns_delete_namespace_subtree ( ...@@ -512,7 +546,7 @@ acpi_ns_delete_namespace_subtree (
* *
******************************************************************************/ ******************************************************************************/
static void void
acpi_ns_remove_reference ( acpi_ns_remove_reference (
struct acpi_namespace_node *node) struct acpi_namespace_node *node)
{ {
......
...@@ -79,7 +79,7 @@ acpi_ns_load_table ( ...@@ -79,7 +79,7 @@ acpi_ns_load_table (
/* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
if (!(acpi_gbl_acpi_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) { if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) {
/* Just ignore this table */ /* Just ignore this table */
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -182,7 +182,7 @@ acpi_ns_load_table_by_type ( ...@@ -182,7 +182,7 @@ acpi_ns_load_table_by_type (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_DSDT]; table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
/* If table already loaded into namespace, just return */ /* If table already loaded into namespace, just return */
...@@ -190,8 +190,6 @@ acpi_ns_load_table_by_type ( ...@@ -190,8 +190,6 @@ acpi_ns_load_table_by_type (
goto unlock_and_exit; goto unlock_and_exit;
} }
table_desc->table_id = TABLE_ID_DSDT;
/* Now load the single DSDT */ /* Now load the single DSDT */
status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
...@@ -205,13 +203,13 @@ acpi_ns_load_table_by_type ( ...@@ -205,13 +203,13 @@ acpi_ns_load_table_by_type (
case ACPI_TABLE_SSDT: case ACPI_TABLE_SSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count)); acpi_gbl_table_lists[ACPI_TABLE_SSDT].count));
/* /*
* Traverse list of SSDT tables * Traverse list of SSDT tables
*/ */
table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_SSDT]; table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next;
for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count; i++) { for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) {
/* /*
* Only attempt to load table if it is not * Only attempt to load table if it is not
* already loaded! * already loaded!
...@@ -233,14 +231,14 @@ acpi_ns_load_table_by_type ( ...@@ -233,14 +231,14 @@ acpi_ns_load_table_by_type (
case ACPI_TABLE_PSDT: case ACPI_TABLE_PSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count)); acpi_gbl_table_lists[ACPI_TABLE_PSDT].count));
/* /*
* Traverse list of PSDT tables * Traverse list of PSDT tables
*/ */
table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_PSDT]; table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next;
for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count; i++) { for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) {
/* Only attempt to load table if it is not already loaded! */ /* Only attempt to load table if it is not already loaded! */
if (!table_desc->loaded_into_namespace) { if (!table_desc->loaded_into_namespace) {
......
...@@ -85,10 +85,9 @@ acpi_ns_one_complete_parse ( ...@@ -85,10 +85,9 @@ acpi_ns_one_complete_parse (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* Create and initialize a new walk state */ /* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, walk_state = acpi_ds_create_walk_state (table_desc->table_id,
NULL, NULL, NULL); NULL, NULL, NULL);
if (!walk_state) { if (!walk_state) {
acpi_ps_free_op (parse_root); acpi_ps_free_op (parse_root);
......
...@@ -799,38 +799,31 @@ void ...@@ -799,38 +799,31 @@ void
acpi_ns_terminate (void) acpi_ns_terminate (void)
{ {
union acpi_operand_object *obj_desc; union acpi_operand_object *obj_desc;
struct acpi_namespace_node *this_node;
ACPI_FUNCTION_TRACE ("ns_terminate"); ACPI_FUNCTION_TRACE ("ns_terminate");
this_node = acpi_gbl_root_node;
/* /*
* 1) Free the entire namespace -- all objects, tables, and stacks * 1) Free the entire namespace -- all nodes and objects
* *
* Delete all objects linked to the root * Delete all object descriptors attached to namepsace nodes
* (additional table descriptors)
*/ */
acpi_ns_delete_namespace_subtree (this_node); acpi_ns_delete_namespace_subtree (acpi_gbl_root_node);
/* Detach any object(s) attached to the root */ /* Detach any objects attached to the root */
obj_desc = acpi_ns_get_attached_object (this_node); obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node);
if (obj_desc) { if (obj_desc) {
acpi_ns_detach_object (this_node); acpi_ns_detach_object (acpi_gbl_root_node);
acpi_ut_remove_reference (obj_desc);
} }
acpi_ns_delete_children (this_node);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
/* /*
* 2) Now we can delete the ACPI tables * 2) Now we can delete the ACPI tables
*/ */
acpi_tb_delete_acpi_tables (); acpi_tb_delete_all_tables ();
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
return_VOID; return_VOID;
......
...@@ -237,7 +237,7 @@ acpi_os_table_override (struct acpi_table_header *existing_table, ...@@ -237,7 +237,7 @@ acpi_os_table_override (struct acpi_table_header *existing_table,
static irqreturn_t static irqreturn_t
acpi_irq(int irq, void *dev_id, struct pt_regs *regs) acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
return (*acpi_irq_handler)(acpi_irq_context); return (*acpi_irq_handler)(acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
} }
acpi_status acpi_status
...@@ -1006,7 +1006,7 @@ acpi_os_name_setup(char *str) ...@@ -1006,7 +1006,7 @@ acpi_os_name_setup(char *str)
return 0; return 0;
for (; count-- && str && *str; str++) { for (; count-- && str && *str; str++) {
if (isalnum(*str) || *str == ' ') if (isalnum(*str) || *str == ' ' || *str == ':')
*p++ = *str; *p++ = *str;
else if (*str == '\'' || *str == '"') else if (*str == '\'' || *str == '"')
continue; continue;
......
...@@ -270,7 +270,7 @@ acpi_ps_delete_parse_tree ( ...@@ -270,7 +270,7 @@ acpi_ps_delete_parse_tree (
return_VOID; return_VOID;
} }
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, thread); walk_state = acpi_ds_create_walk_state (0, NULL, NULL, thread);
if (!walk_state) { if (!walk_state) {
return_VOID; return_VOID;
} }
......
...@@ -178,7 +178,7 @@ acpi_psx_execute ( ...@@ -178,7 +178,7 @@ acpi_psx_execute (
/* Create and initialize a new walk state */ /* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, NULL); walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) { if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
......
...@@ -379,25 +379,31 @@ acpi_resource_to_address64 ( ...@@ -379,25 +379,31 @@ acpi_resource_to_address64 (
{ {
struct acpi_resource_address16 *address16; struct acpi_resource_address16 *address16;
struct acpi_resource_address32 *address32; struct acpi_resource_address32 *address32;
struct acpi_resource_address64 *address64;
switch (resource->id) { switch (resource->id) {
case ACPI_RSTYPE_ADDRESS16: case ACPI_RSTYPE_ADDRESS16:
address16 = (struct acpi_resource_address16 *) &resource->data; address16 = (struct acpi_resource_address16 *) &resource->data;
ACPI_COPY_ADDRESS(out, address16); ACPI_COPY_ADDRESS(out, address16);
break; break;
case ACPI_RSTYPE_ADDRESS32: case ACPI_RSTYPE_ADDRESS32:
address32 = (struct acpi_resource_address32 *) &resource->data; address32 = (struct acpi_resource_address32 *) &resource->data;
ACPI_COPY_ADDRESS(out, address32); ACPI_COPY_ADDRESS(out, address32);
break; break;
case ACPI_RSTYPE_ADDRESS64: case ACPI_RSTYPE_ADDRESS64:
address64 = (struct acpi_resource_address64 *) &resource->data;
ACPI_COPY_ADDRESS(out, address64); /* Simple copy for 64 bit source */
ACPI_MEMCPY (out, &resource->data, sizeof (struct acpi_resource_address64));
break; break;
default: default:
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
......
...@@ -69,7 +69,7 @@ static void acpi_device_register(struct acpi_device * device, struct acpi_device ...@@ -69,7 +69,7 @@ static void acpi_device_register(struct acpi_device * device, struct acpi_device
device->kobj.parent = &parent->kobj; device->kobj.parent = &parent->kobj;
device->kobj.ktype = &ktype_acpi_ns; device->kobj.ktype = &ktype_acpi_ns;
device->kobj.kset = &acpi_namespace_kset; device->kobj.kset = &acpi_namespace_kset;
kobject_register(&device->kobj); kobject_add(&device->kobj);
} }
static int static int
......
...@@ -164,6 +164,36 @@ acpi_tb_convert_to_xsdt ( ...@@ -164,6 +164,36 @@ acpi_tb_convert_to_xsdt (
} }
/******************************************************************************
*
* FUNCTION: acpi_tb_init_generic_address
*
* PARAMETERS: new_gas_struct - GAS struct to be initialized
* register_bit_width - Width of this register
* Address - Address of the register
*
* RETURN: None
*
* DESCRIPTION: Initialize a GAS structure.
*
******************************************************************************/
static void
acpi_tb_init_generic_address (
struct acpi_generic_address *new_gas_struct,
u8 register_bit_width,
acpi_physical_address address)
{
ACPI_STORE_ADDRESS (new_gas_struct->address, address);
new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
new_gas_struct->register_bit_width = register_bit_width;
new_gas_struct->register_bit_offset = 0;
new_gas_struct->reserved = 0;
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_tb_convert_fadt1 * FUNCTION: acpi_tb_convert_fadt1
...@@ -233,14 +263,34 @@ acpi_tb_convert_fadt1 ( ...@@ -233,14 +263,34 @@ acpi_tb_convert_fadt1 (
/* /*
* Convert the V1.0 block addresses to V2.0 GAS structures * Convert the V1.0 block addresses to V2.0 GAS structures
*/ */
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1a_evt_blk, local_fadt->pm1_evt_len, local_fadt->V1_pm1a_evt_blk); acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, local_fadt->pm1_evt_len,
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1b_evt_blk, local_fadt->pm1_evt_len, local_fadt->V1_pm1b_evt_blk); (acpi_physical_address) local_fadt->V1_pm1a_evt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1a_cnt_blk, local_fadt->pm1_cnt_len, local_fadt->V1_pm1a_cnt_blk); acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, local_fadt->pm1_evt_len,
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len, local_fadt->V1_pm1b_cnt_blk); (acpi_physical_address) local_fadt->V1_pm1b_evt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len, local_fadt->V1_pm2_cnt_blk); acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, local_fadt->pm1_cnt_len,
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len, local_fadt->V1_pm_tmr_blk); (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk);
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xgpe0_blk, 0, local_fadt->V1_gpe0_blk); acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len,
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xgpe1_blk, 0, local_fadt->V1_gpe1_blk); (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk);
acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len,
(acpi_physical_address) local_fadt->V1_pm2_cnt_blk);
acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len,
(acpi_physical_address) local_fadt->V1_pm_tmr_blk);
acpi_tb_init_generic_address (&local_fadt->xgpe0_blk, 0,
(acpi_physical_address) local_fadt->V1_gpe0_blk);
acpi_tb_init_generic_address (&local_fadt->xgpe1_blk, 0,
(acpi_physical_address) local_fadt->V1_gpe1_blk);
/* Create separate GAS structs for the PM1 Enable registers */
acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
(u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
(acpi_physical_address) (local_fadt->xpm1a_evt_blk.address +
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
(u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
(acpi_physical_address) (local_fadt->xpm1b_evt_blk.address +
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
} }
...@@ -282,44 +332,58 @@ acpi_tb_convert_fadt2 ( ...@@ -282,44 +332,58 @@ acpi_tb_convert_fadt2 (
} }
if (!(local_fadt->xpm1a_evt_blk.address)) { if (!(local_fadt->xpm1a_evt_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1a_evt_blk, acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk,
local_fadt->pm1_evt_len, local_fadt->V1_pm1a_evt_blk); local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk);
} }
if (!(local_fadt->xpm1b_evt_blk.address)) { if (!(local_fadt->xpm1b_evt_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1b_evt_blk, acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk,
local_fadt->pm1_evt_len, local_fadt->V1_pm1b_evt_blk); local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk);
} }
if (!(local_fadt->xpm1a_cnt_blk.address)) { if (!(local_fadt->xpm1a_cnt_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1a_cnt_blk, acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk,
local_fadt->pm1_cnt_len, local_fadt->V1_pm1a_cnt_blk); local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk);
} }
if (!(local_fadt->xpm1b_cnt_blk.address)) { if (!(local_fadt->xpm1b_cnt_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm1b_cnt_blk, acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk,
local_fadt->pm1_cnt_len, local_fadt->V1_pm1b_cnt_blk); local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk);
} }
if (!(local_fadt->xpm2_cnt_blk.address)) { if (!(local_fadt->xpm2_cnt_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm2_cnt_blk, acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk,
local_fadt->pm2_cnt_len, local_fadt->V1_pm2_cnt_blk); local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk);
} }
if (!(local_fadt->xpm_tmr_blk.address)) { if (!(local_fadt->xpm_tmr_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xpm_tmr_blk, acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk,
local_fadt->pm_tm_len, local_fadt->V1_pm_tmr_blk); local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk);
} }
if (!(local_fadt->xgpe0_blk.address)) { if (!(local_fadt->xgpe0_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xgpe0_blk, acpi_tb_init_generic_address (&local_fadt->xgpe0_blk,
0, local_fadt->V1_gpe0_blk); 0, (acpi_physical_address) local_fadt->V1_gpe0_blk);
} }
if (!(local_fadt->xgpe1_blk.address)) { if (!(local_fadt->xgpe1_blk.address)) {
ASL_BUILD_GAS_FROM_V1_ENTRY (local_fadt->xgpe1_blk, acpi_tb_init_generic_address (&local_fadt->xgpe1_blk,
0, local_fadt->V1_gpe1_blk); 0, (acpi_physical_address) local_fadt->V1_gpe1_blk);
} }
/* Create separate GAS structs for the PM1 Enable registers */
acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
(u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
(acpi_physical_address) (local_fadt->xpm1a_evt_blk.address +
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id;
acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
(u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
(acpi_physical_address) (local_fadt->xpm1b_evt_blk.address +
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id;
} }
...@@ -396,7 +460,7 @@ acpi_tb_convert_table_fadt (void) ...@@ -396,7 +460,7 @@ acpi_tb_convert_table_fadt (void)
/* Free the original table */ /* Free the original table */
table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_FADT]; table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next;
acpi_tb_delete_single_table (table_desc); acpi_tb_delete_single_table (table_desc);
/* Install the new table */ /* Install the new table */
......
...@@ -456,18 +456,18 @@ acpi_tb_get_table_ptr ( ...@@ -456,18 +456,18 @@ acpi_tb_get_table_ptr (
* instance is always in the list head. * instance is always in the list head.
*/ */
if (instance == 1) { if (instance == 1) {
/* /* Get the first */
* Just pluck the pointer out of the global table!
* Will be null if no table is present if (acpi_gbl_table_lists[table_type].next) {
*/ *table_ptr_loc = acpi_gbl_table_lists[table_type].next->pointer;
*table_ptr_loc = acpi_gbl_acpi_tables[table_type].pointer; }
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* /*
* Check for instance out of range * Check for instance out of range
*/ */
if (instance > acpi_gbl_acpi_tables[table_type].count) { if (instance > acpi_gbl_table_lists[table_type].count) {
return_ACPI_STATUS (AE_NOT_EXIST); return_ACPI_STATUS (AE_NOT_EXIST);
} }
...@@ -478,7 +478,7 @@ acpi_tb_get_table_ptr ( ...@@ -478,7 +478,7 @@ acpi_tb_get_table_ptr (
* need to walk from the 2nd table until we reach the Instance * need to walk from the 2nd table until we reach the Instance
* that the user is looking for and return its table pointer. * that the user is looking for and return its table pointer.
*/ */
table_desc = acpi_gbl_acpi_tables[table_type].next; table_desc = acpi_gbl_table_lists[table_type].next;
for (i = 2; i < instance; i++) { for (i = 2; i < instance; i++) {
table_desc = table_desc->next; table_desc = table_desc->next;
} }
......
...@@ -307,7 +307,7 @@ acpi_tb_get_required_tables ( ...@@ -307,7 +307,7 @@ acpi_tb_get_required_tables (
/* Always delete the RSDP mapping, we are done with it */ /* Always delete the RSDP mapping, we are done with it */
acpi_tb_delete_acpi_table (ACPI_TABLE_RSDP); acpi_tb_delete_tables_by_type (ACPI_TABLE_RSDP);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -79,13 +79,13 @@ acpi_tb_match_signature ( ...@@ -79,13 +79,13 @@ acpi_tb_match_signature (
/* /*
* Search for a signature match among the known table types * Search for a signature match among the known table types
*/ */
for (i = 0; i < NUM_ACPI_TABLES; i++) { for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
if (!(acpi_gbl_acpi_table_data[i].flags & search_type)) { if (!(acpi_gbl_table_data[i].flags & search_type)) {
continue; continue;
} }
if (!ACPI_STRNCMP (signature, acpi_gbl_acpi_table_data[i].signature, if (!ACPI_STRNCMP (signature, acpi_gbl_table_data[i].signature,
acpi_gbl_acpi_table_data[i].sig_length)) { acpi_gbl_table_data[i].sig_length)) {
/* Found a signature match, return index if requested */ /* Found a signature match, return index if requested */
if (table_info) { if (table_info) {
...@@ -94,7 +94,7 @@ acpi_tb_match_signature ( ...@@ -94,7 +94,7 @@ acpi_tb_match_signature (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Table [%4.4s] is an ACPI table consumed by the core subsystem\n", "Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
(char *) acpi_gbl_acpi_table_data[i].signature)); (char *) acpi_gbl_table_data[i].signature));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
...@@ -149,7 +149,7 @@ acpi_tb_install_table ( ...@@ -149,7 +149,7 @@ acpi_tb_install_table (
} }
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
acpi_gbl_acpi_table_data[table_info->type].name, table_info->pointer)); acpi_gbl_table_data[table_info->type].name, table_info->pointer));
(void) acpi_ut_release_mutex (ACPI_MTX_TABLES); (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -239,70 +239,58 @@ acpi_tb_init_table_descriptor ( ...@@ -239,70 +239,58 @@ acpi_tb_init_table_descriptor (
acpi_table_type table_type, acpi_table_type table_type,
struct acpi_table_desc *table_info) struct acpi_table_desc *table_info)
{ {
struct acpi_table_desc *list_head; struct acpi_table_list *list_head;
struct acpi_table_desc *table_desc; struct acpi_table_desc *table_desc;
ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type); ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
/* Allocate a descriptor for this table */
table_desc = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc));
if (!table_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* /*
* Install the table into the global data structure * Install the table into the global data structure
*/ */
list_head = &acpi_gbl_acpi_tables[table_type]; list_head = &acpi_gbl_table_lists[table_type];
table_desc = list_head;
/* /*
* Two major types of tables: 1) Only one instance is allowed. This * Two major types of tables: 1) Only one instance is allowed. This
* includes most ACPI tables such as the DSDT. 2) Multiple instances of * includes most ACPI tables such as the DSDT. 2) Multiple instances of
* the table are allowed. This includes SSDT and PSDTs. * the table are allowed. This includes SSDT and PSDTs.
*/ */
if (ACPI_IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags)) { if (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags)) {
/* /*
* Only one table allowed, and a table has alread been installed * Only one table allowed, and a table has alread been installed
* at this location, so return an error. * at this location, so return an error.
*/ */
if (list_head->pointer) { if (list_head->next) {
return_ACPI_STATUS (AE_ALREADY_EXISTS); return_ACPI_STATUS (AE_ALREADY_EXISTS);
} }
table_desc->count = 1;
table_desc->prev = NULL;
table_desc->next = NULL;
} }
else {
/*
* Multiple tables allowed for this table type, we must link
* the new table in to the list of tables of this type.
*/
if (list_head->pointer) {
table_desc = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc));
if (!table_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
list_head->count++;
/* Update the original previous */
list_head->prev->next = table_desc;
/* Update new entry */
table_desc->prev = list_head->prev; /*
table_desc->next = list_head; * Link the new table in to the list of tables of this type.
* Just insert at the start of the list, order unimportant.
/* Update list head */ *
* table_desc->Prev is already NULL from calloc()
*/
table_desc->next = list_head->next;
list_head->next = table_desc;
list_head->prev = table_desc; if (table_desc->next) {
} table_desc->next->prev = table_desc;
else {
table_desc->count = 1;
}
} }
/* Common initialization of the table descriptor */ list_head->count++;
table_desc->type = table_info->type; /* Finish initialization of the table descriptor */
table_desc->type = (u8) table_type;
table_desc->pointer = table_info->pointer; table_desc->pointer = table_info->pointer;
table_desc->length = table_info->length; table_desc->length = table_info->length;
table_desc->allocation = table_info->allocation; table_desc->allocation = table_info->allocation;
...@@ -316,8 +304,8 @@ acpi_tb_init_table_descriptor ( ...@@ -316,8 +304,8 @@ acpi_tb_init_table_descriptor (
* Set the appropriate global pointer (if there is one) to point to the * Set the appropriate global pointer (if there is one) to point to the
* newly installed table * newly installed table
*/ */
if (acpi_gbl_acpi_table_data[table_type].global_ptr) { if (acpi_gbl_table_data[table_type].global_ptr) {
*(acpi_gbl_acpi_table_data[table_type].global_ptr) = table_info->pointer; *(acpi_gbl_table_data[table_type].global_ptr) = table_info->pointer;
} }
/* Return Data */ /* Return Data */
...@@ -331,7 +319,7 @@ acpi_tb_init_table_descriptor ( ...@@ -331,7 +319,7 @@ acpi_tb_init_table_descriptor (
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_tb_delete_acpi_tables * FUNCTION: acpi_tb_delete_all_tables
* *
* PARAMETERS: None. * PARAMETERS: None.
* *
...@@ -342,7 +330,7 @@ acpi_tb_init_table_descriptor ( ...@@ -342,7 +330,7 @@ acpi_tb_init_table_descriptor (
******************************************************************************/ ******************************************************************************/
void void
acpi_tb_delete_acpi_tables (void) acpi_tb_delete_all_tables (void)
{ {
acpi_table_type type; acpi_table_type type;
...@@ -351,15 +339,15 @@ acpi_tb_delete_acpi_tables (void) ...@@ -351,15 +339,15 @@ acpi_tb_delete_acpi_tables (void)
* Free memory allocated for ACPI tables * Free memory allocated for ACPI tables
* Memory can either be mapped or allocated * Memory can either be mapped or allocated
*/ */
for (type = 0; type < NUM_ACPI_TABLES; type++) { for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) {
acpi_tb_delete_acpi_table (type); acpi_tb_delete_tables_by_type (type);
} }
} }
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_tb_delete_acpi_table * FUNCTION: acpi_tb_delete_tables_by_type
* *
* PARAMETERS: Type - The table type to be deleted * PARAMETERS: Type - The table type to be deleted
* *
...@@ -371,11 +359,15 @@ acpi_tb_delete_acpi_tables (void) ...@@ -371,11 +359,15 @@ acpi_tb_delete_acpi_tables (void)
******************************************************************************/ ******************************************************************************/
void void
acpi_tb_delete_acpi_table ( acpi_tb_delete_tables_by_type (
acpi_table_type type) acpi_table_type type)
{ {
struct acpi_table_desc *table_desc;
u32 count;
u32 i;
ACPI_FUNCTION_TRACE_U32 ("tb_delete_acpi_table", type);
ACPI_FUNCTION_TRACE_U32 ("tb_delete_tables_by_type", type);
if (type > ACPI_TABLE_MAX) { if (type > ACPI_TABLE_MAX) {
...@@ -416,43 +408,10 @@ acpi_tb_delete_acpi_table ( ...@@ -416,43 +408,10 @@ acpi_tb_delete_acpi_table (
} }
/* Free the table */ /* Free the table */
acpi_tb_free_acpi_tables_of_type (&acpi_gbl_acpi_tables[type]);
(void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_tb_free_acpi_tables_of_type
*
* PARAMETERS: table_info - A table info struct
*
* RETURN: None.
*
* DESCRIPTION: Free the memory associated with an internal ACPI table
* Table mutex should be locked.
*
******************************************************************************/
void
acpi_tb_free_acpi_tables_of_type (
struct acpi_table_desc *list_head)
{
struct acpi_table_desc *table_desc;
u32 count;
u32 i;
ACPI_FUNCTION_TRACE_PTR ("tb_free_acpi_tables_of_type", list_head);
/* Get the head of the list */ /* Get the head of the list */
table_desc = list_head; table_desc = acpi_gbl_table_lists[type].next;
count = list_head->count; count = acpi_gbl_table_lists[type].count;
/* /*
* Walk the entire list, deleting both the allocated tables * Walk the entire list, deleting both the allocated tables
...@@ -462,6 +421,7 @@ acpi_tb_free_acpi_tables_of_type ( ...@@ -462,6 +421,7 @@ acpi_tb_free_acpi_tables_of_type (
table_desc = acpi_tb_uninstall_table (table_desc); table_desc = acpi_tb_uninstall_table (table_desc);
} }
(void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_VOID; return_VOID;
} }
...@@ -484,30 +444,31 @@ acpi_tb_delete_single_table ( ...@@ -484,30 +444,31 @@ acpi_tb_delete_single_table (
struct acpi_table_desc *table_desc) struct acpi_table_desc *table_desc)
{ {
if (!table_desc) { /* Must have a valid table descriptor and pointer */
if ((!table_desc) ||
(!table_desc->pointer)) {
return; return;
} }
if (table_desc->pointer) { /* Valid table, determine type of memory allocation */
/* Valid table, determine type of memory allocation */
switch (table_desc->allocation) { switch (table_desc->allocation) {
case ACPI_MEM_NOT_ALLOCATED: case ACPI_MEM_NOT_ALLOCATED:
break; break;
case ACPI_MEM_ALLOCATED: case ACPI_MEM_ALLOCATED:
ACPI_MEM_FREE (table_desc->pointer); ACPI_MEM_FREE (table_desc->pointer);
break; break;
case ACPI_MEM_MAPPED: case ACPI_MEM_MAPPED:
acpi_os_unmap_memory (table_desc->pointer, table_desc->length); acpi_os_unmap_memory (table_desc->pointer, table_desc->length);
break; break;
default: default:
break; break;
}
} }
} }
...@@ -533,18 +494,23 @@ acpi_tb_uninstall_table ( ...@@ -533,18 +494,23 @@ acpi_tb_uninstall_table (
struct acpi_table_desc *next_desc; struct acpi_table_desc *next_desc;
ACPI_FUNCTION_TRACE_PTR ("acpi_tb_uninstall_table", table_desc); ACPI_FUNCTION_TRACE_PTR ("tb_uninstall_table", table_desc);
if (!table_desc) { if (!table_desc) {
return_PTR (NULL); return_PTR (NULL);
} }
/* Unlink the descriptor */ /* Unlink the descriptor from the doubly linked list */
if (table_desc->prev) { if (table_desc->prev) {
table_desc->prev->next = table_desc->next; table_desc->prev->next = table_desc->next;
} }
else {
/* Is first on list, update list head */
acpi_gbl_table_lists[table_desc->type].next = table_desc->next;
}
if (table_desc->next) { if (table_desc->next) {
table_desc->next->prev = table_desc->prev; table_desc->next->prev = table_desc->prev;
...@@ -554,23 +520,12 @@ acpi_tb_uninstall_table ( ...@@ -554,23 +520,12 @@ acpi_tb_uninstall_table (
acpi_tb_delete_single_table (table_desc); acpi_tb_delete_single_table (table_desc);
/* Free the table descriptor (Don't delete the list head, tho) */ /* Free the table descriptor */
if ((table_desc->prev) == (table_desc->next)) {
next_desc = NULL;
/* Clear the list head */ next_desc = table_desc->next;
ACPI_MEM_FREE (table_desc);
table_desc->pointer = NULL; /* Return pointer to the next descriptor */
table_desc->length = 0;
table_desc->count = 0;
}
else {
/* Free the table descriptor */
next_desc = table_desc->next;
ACPI_MEM_FREE (table_desc);
}
return_PTR (next_desc); return_PTR (next_desc);
} }
......
...@@ -66,26 +66,25 @@ ...@@ -66,26 +66,25 @@
acpi_status acpi_status
acpi_tb_handle_to_object ( acpi_tb_handle_to_object (
u16 table_id, u16 table_id,
struct acpi_table_desc **table_desc) struct acpi_table_desc **return_table_desc)
{ {
u32 i; u32 i;
struct acpi_table_desc *list_head; struct acpi_table_desc *table_desc;
ACPI_FUNCTION_NAME ("tb_handle_to_object"); ACPI_FUNCTION_NAME ("tb_handle_to_object");
for (i = 0; i < ACPI_TABLE_MAX; i++) { for (i = 0; i < ACPI_TABLE_MAX; i++) {
list_head = &acpi_gbl_acpi_tables[i]; table_desc = acpi_gbl_table_lists[i].next;
do { while (table_desc) {
if (list_head->table_id == table_id) { if (table_desc->table_id == table_id) {
*table_desc = list_head; *return_table_desc = table_desc;
return (AE_OK); return (AE_OK);
} }
list_head = list_head->next; table_desc = table_desc->next;
}
} while (list_head != &acpi_gbl_acpi_tables[i]);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id));
......
...@@ -235,7 +235,7 @@ acpi_status ...@@ -235,7 +235,7 @@ acpi_status
acpi_unload_table ( acpi_unload_table (
acpi_table_type table_type) acpi_table_type table_type)
{ {
struct acpi_table_desc *list_head; struct acpi_table_desc *table_desc;
ACPI_FUNCTION_TRACE ("acpi_unload_table"); ACPI_FUNCTION_TRACE ("acpi_unload_table");
...@@ -250,22 +250,22 @@ acpi_unload_table ( ...@@ -250,22 +250,22 @@ acpi_unload_table (
/* Find all tables of the requested type */ /* Find all tables of the requested type */
list_head = &acpi_gbl_acpi_tables[table_type]; table_desc = acpi_gbl_table_lists[table_type].next;
do { while (table_desc); {
/* /*
* Delete all namespace entries owned by this table. Note that these * Delete all namespace entries owned by this table. Note that these
* entries can appear anywhere in the namespace by virtue of the AML * entries can appear anywhere in the namespace by virtue of the AML
* "Scope" operator. Thus, we need to track ownership by an ID, not * "Scope" operator. Thus, we need to track ownership by an ID, not
* simply a position within the hierarchy * simply a position within the hierarchy
*/ */
acpi_ns_delete_namespace_by_owner (list_head->table_id); acpi_ns_delete_namespace_by_owner (table_desc->table_id);
/* Delete (or unmap) the actual table */ table_desc = table_desc->next;
}
acpi_tb_delete_acpi_table (table_type);
} while (list_head != &acpi_gbl_acpi_tables[table_type]); /* Delete (or unmap) all tables of this type */
acpi_tb_delete_tables_by_type (table_type);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
...@@ -313,7 +313,7 @@ acpi_get_table_header ( ...@@ -313,7 +313,7 @@ acpi_get_table_header (
/* Check the table type and instance */ /* Check the table type and instance */
if ((table_type > ACPI_TABLE_MAX) || if ((table_type > ACPI_TABLE_MAX) ||
(ACPI_IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) && (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) &&
instance > 1)) { instance > 1)) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
...@@ -394,7 +394,7 @@ acpi_get_table ( ...@@ -394,7 +394,7 @@ acpi_get_table (
/* Check the table type and instance */ /* Check the table type and instance */
if ((table_type > ACPI_TABLE_MAX) || if ((table_type > ACPI_TABLE_MAX) ||
(ACPI_IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) && (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) &&
instance > 1)) { instance > 1)) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* *
*/ */
#define TOSHIBA_ACPI_VERSION "0.14" #define TOSHIBA_ACPI_VERSION "0.15"
#define PROC_INTERFACE_VERSION 1 #define PROC_INTERFACE_VERSION 1
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -172,9 +172,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) ...@@ -172,9 +172,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
for (i = 0; i < HCI_WORDS; ++i) { for (i = 0; i < HCI_WORDS; ++i) {
in_objs[i].type = ACPI_TYPE_INTEGER; in_objs[i].type = ACPI_TYPE_INTEGER;
in_objs[i].integer.value = in[i]; in_objs[i].integer.value = in[i];
/*printk("%04x ", in[i]);*/
} }
/*printk("\n");*/
results.length = sizeof(out_objs); results.length = sizeof(out_objs);
results.pointer = out_objs; results.pointer = out_objs;
...@@ -184,9 +182,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) ...@@ -184,9 +182,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) {
for (i = 0; i < out_objs->package.count; ++i) { for (i = 0; i < out_objs->package.count; ++i) {
out[i] = out_objs->package.elements[i].integer.value; out[i] = out_objs->package.elements[i].integer.value;
/*printk("%04x ", out[i]);*/
} }
/*printk("\n");*/
} }
return status; return status;
...@@ -226,7 +222,7 @@ static int key_event_valid; ...@@ -226,7 +222,7 @@ static int key_event_valid;
typedef struct _ProcItem typedef struct _ProcItem
{ {
char* name; const char* name;
char* (*read_func)(char*); char* (*read_func)(char*);
unsigned long (*write_func)(const char*, unsigned long); unsigned long (*write_func)(const char*, unsigned long);
} ProcItem; } ProcItem;
...@@ -284,10 +280,8 @@ static unsigned long ...@@ -284,10 +280,8 @@ static unsigned long
write_lcd(const char* buffer, unsigned long count) write_lcd(const char* buffer, unsigned long count)
{ {
int value; int value;
/*int byte_count;*/
u32 hci_result; u32 hci_result;
/* ISSUE: %i doesn't work with hex values as advertised */
if (snscanf(buffer, count, " brightness : %i", &value) == 1 && if (snscanf(buffer, count, " brightness : %i", &value) == 1 &&
value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) {
value = value << HCI_LCD_BRIGHTNESS_SHIFT; value = value << HCI_LCD_BRIGHTNESS_SHIFT;
...@@ -414,6 +408,11 @@ read_keys(char* p) ...@@ -414,6 +408,11 @@ read_keys(char* p)
last_key_event = value; last_key_event = value;
} else if (hci_result == HCI_EMPTY) { } else if (hci_result == HCI_EMPTY) {
/* better luck next time */ /* better luck next time */
} else if (hci_result == HCI_NOT_SUPPORTED) {
/* This is a workaround for an unresolved issue on
* some machines where system events sporadically
* become disabled. */
hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result);
} else { } else {
p += sprintf(p, "ERROR\n"); p += sprintf(p, "ERROR\n");
goto end; goto end;
......
...@@ -71,6 +71,7 @@ acpi_ut_delete_internal_obj ( ...@@ -71,6 +71,7 @@ acpi_ut_delete_internal_obj (
void *obj_pointer = NULL; void *obj_pointer = NULL;
union acpi_operand_object *handler_desc; union acpi_operand_object *handler_desc;
union acpi_operand_object *second_desc; union acpi_operand_object *second_desc;
union acpi_operand_object *next_desc;
ACPI_FUNCTION_TRACE_PTR ("ut_delete_internal_obj", object); ACPI_FUNCTION_TRACE_PTR ("ut_delete_internal_obj", object);
...@@ -136,6 +137,15 @@ acpi_ut_delete_internal_obj ( ...@@ -136,6 +137,15 @@ acpi_ut_delete_internal_obj (
if (object->device.gpe_block) { if (object->device.gpe_block) {
(void) acpi_ev_delete_gpe_block (object->device.gpe_block); (void) acpi_ev_delete_gpe_block (object->device.gpe_block);
} }
/* Walk the handler list for this device */
handler_desc = object->device.address_space;
while (handler_desc) {
next_desc = handler_desc->address_space.next;
acpi_ut_remove_reference (handler_desc);
handler_desc = next_desc;
}
break; break;
...@@ -183,10 +193,13 @@ acpi_ut_delete_internal_obj ( ...@@ -183,10 +193,13 @@ acpi_ut_delete_internal_obj (
* default handlers -- and therefore, we created the context object * default handlers -- and therefore, we created the context object
* locally, it was not created by an external caller. * locally, it was not created by an external caller.
*/ */
handler_desc = object->region.addr_handler; handler_desc = object->region.address_space;
if ((handler_desc) && if (handler_desc) {
(handler_desc->addr_handler.hflags == ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { if (handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
obj_pointer = second_desc->extra.region_context; obj_pointer = second_desc->extra.region_context;
}
acpi_ut_remove_reference (handler_desc);
} }
/* Now we can free the Extra object */ /* Now we can free the Extra object */
...@@ -211,7 +224,6 @@ acpi_ut_delete_internal_obj ( ...@@ -211,7 +224,6 @@ acpi_ut_delete_internal_obj (
break; break;
} }
/* Free any allocated memory (pointer within the object) found above */ /* Free any allocated memory (pointer within the object) found above */
if (obj_pointer) { if (obj_pointer) {
...@@ -299,7 +311,7 @@ acpi_ut_update_ref_count ( ...@@ -299,7 +311,7 @@ acpi_ut_update_ref_count (
new_count = count; new_count = count;
/* /*
* Reference count action (increment, decrement, or force delete) * Perform the reference count action (increment, decrement, or force delete)
*/ */
switch (action) { switch (action) {
...@@ -402,8 +414,6 @@ acpi_ut_update_object_reference ( ...@@ -402,8 +414,6 @@ acpi_ut_update_object_reference (
{ {
acpi_status status; acpi_status status;
u32 i; u32 i;
union acpi_operand_object *next;
union acpi_operand_object *new;
union acpi_generic_state *state_list = NULL; union acpi_generic_state *state_list = NULL;
union acpi_generic_state *state; union acpi_generic_state *state;
...@@ -417,9 +427,8 @@ acpi_ut_update_object_reference ( ...@@ -417,9 +427,8 @@ acpi_ut_update_object_reference (
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* /* Make sure that this isn't a namespace handle */
* Make sure that this isn't a namespace handle
*/
if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", object)); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", object));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -439,28 +448,8 @@ acpi_ut_update_object_reference ( ...@@ -439,28 +448,8 @@ acpi_ut_update_object_reference (
switch (ACPI_GET_OBJECT_TYPE (object)) { switch (ACPI_GET_OBJECT_TYPE (object)) {
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
status = acpi_ut_create_update_state_and_push (object->device.addr_handler, acpi_ut_update_ref_count (object->device.system_notify, action);
action, &state_list); acpi_ut_update_ref_count (object->device.device_notify, action);
if (ACPI_FAILURE (status)) {
goto error_exit;
}
acpi_ut_update_ref_count (object->device.sys_handler, action);
acpi_ut_update_ref_count (object->device.drv_handler, action);
break;
case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
/* Must walk list of address handlers */
next = object->addr_handler.next;
while (next) {
new = next->addr_handler.next;
acpi_ut_update_ref_count (next, action);
next = new;
}
break; break;
...@@ -590,16 +579,14 @@ acpi_ut_add_reference ( ...@@ -590,16 +579,14 @@ acpi_ut_add_reference (
ACPI_FUNCTION_TRACE_PTR ("ut_add_reference", object); ACPI_FUNCTION_TRACE_PTR ("ut_add_reference", object);
/* /* Ensure that we have a valid object */
* Ensure that we have a valid object
*/
if (!acpi_ut_valid_internal_object (object)) { if (!acpi_ut_valid_internal_object (object)) {
return_VOID; return_VOID;
} }
/* /* Increment the reference count */
* We have a valid ACPI internal object, now increment the reference count
*/
(void) acpi_ut_update_object_reference (object, REF_INCREMENT); (void) acpi_ut_update_object_reference (object, REF_INCREMENT);
return_VOID; return_VOID;
} }
...@@ -624,6 +611,7 @@ acpi_ut_remove_reference ( ...@@ -624,6 +611,7 @@ acpi_ut_remove_reference (
ACPI_FUNCTION_TRACE_PTR ("ut_remove_reference", object); ACPI_FUNCTION_TRACE_PTR ("ut_remove_reference", object);
/* /*
* Allow a NULL pointer to be passed in, just ignore it. This saves * Allow a NULL pointer to be passed in, just ignore it. This saves
* each caller from having to check. Also, ignore NS nodes. * each caller from having to check. Also, ignore NS nodes.
...@@ -634,9 +622,8 @@ acpi_ut_remove_reference ( ...@@ -634,9 +622,8 @@ acpi_ut_remove_reference (
return_VOID; return_VOID;
} }
/* /* Ensure that we have a valid object */
* Ensure that we have a valid object
*/
if (!acpi_ut_valid_internal_object (object)) { if (!acpi_ut_valid_internal_object (object)) {
return_VOID; return_VOID;
} }
......
...@@ -299,10 +299,10 @@ acpi_ut_hex_to_ascii_char ( ...@@ -299,10 +299,10 @@ acpi_ut_hex_to_ascii_char (
******************************************************************************/ ******************************************************************************/
struct acpi_table_desc acpi_gbl_acpi_tables[NUM_ACPI_TABLES]; struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
struct acpi_table_support acpi_gbl_acpi_table_data[NUM_ACPI_TABLES] = struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] =
{ {
/*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
...@@ -535,12 +535,10 @@ acpi_ut_get_object_type_name ( ...@@ -535,12 +535,10 @@ acpi_ut_get_object_type_name (
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* /*
* Strings and procedures used for debug only * Strings and procedures used for debug only
*/ */
/***************************************************************************** /*****************************************************************************
* *
* FUNCTION: acpi_ut_get_mutex_name * FUNCTION: acpi_ut_get_mutex_name
...@@ -558,7 +556,7 @@ acpi_ut_get_mutex_name ( ...@@ -558,7 +556,7 @@ acpi_ut_get_mutex_name (
u32 mutex_id) u32 mutex_id)
{ {
if (mutex_id > MAX_MTX) if (mutex_id > MAX_MUTEX)
{ {
return ("Invalid Mutex ID"); return ("Invalid Mutex ID");
} }
...@@ -566,7 +564,6 @@ acpi_ut_get_mutex_name ( ...@@ -566,7 +564,6 @@ acpi_ut_get_mutex_name (
return (acpi_gbl_mutex_names[mutex_id]); return (acpi_gbl_mutex_names[mutex_id]);
} }
#endif #endif
...@@ -630,9 +627,12 @@ acpi_ut_allocate_owner_id ( ...@@ -630,9 +627,12 @@ acpi_ut_allocate_owner_id (
owner_id = acpi_gbl_next_table_owner_id; owner_id = acpi_gbl_next_table_owner_id;
acpi_gbl_next_table_owner_id++; acpi_gbl_next_table_owner_id++;
/* Check for wraparound */
if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID) if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID)
{ {
acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID; acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
} }
break; break;
...@@ -644,6 +644,8 @@ acpi_ut_allocate_owner_id ( ...@@ -644,6 +644,8 @@ acpi_ut_allocate_owner_id (
if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID) if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID)
{ {
/* Check for wraparound */
acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID; acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
} }
break; break;
...@@ -710,23 +712,19 @@ acpi_ut_init_globals ( ...@@ -710,23 +712,19 @@ acpi_ut_init_globals (
/* ACPI table structure */ /* ACPI table structure */
for (i = 0; i < NUM_ACPI_TABLES; i++) for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
{ {
acpi_gbl_acpi_tables[i].prev = &acpi_gbl_acpi_tables[i]; acpi_gbl_table_lists[i].next = NULL;
acpi_gbl_acpi_tables[i].next = &acpi_gbl_acpi_tables[i]; acpi_gbl_table_lists[i].count = 0;
acpi_gbl_acpi_tables[i].pointer = NULL;
acpi_gbl_acpi_tables[i].length = 0;
acpi_gbl_acpi_tables[i].allocation = ACPI_MEM_NOT_ALLOCATED;
acpi_gbl_acpi_tables[i].count = 0;
} }
/* Mutex locked flags */ /* Mutex locked flags */
for (i = 0; i < NUM_MTX; i++) for (i = 0; i < NUM_MUTEX; i++)
{ {
acpi_gbl_acpi_mutex_info[i].mutex = NULL; acpi_gbl_mutex_info[i].mutex = NULL;
acpi_gbl_acpi_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
acpi_gbl_acpi_mutex_info[i].use_count = 0; acpi_gbl_mutex_info[i].use_count = 0;
} }
/* GPE support */ /* GPE support */
...@@ -737,8 +735,8 @@ acpi_ut_init_globals ( ...@@ -737,8 +735,8 @@ acpi_ut_init_globals (
/* Global notify handlers */ /* Global notify handlers */
acpi_gbl_sys_notify.handler = NULL; acpi_gbl_system_notify.handler = NULL;
acpi_gbl_drv_notify.handler = NULL; acpi_gbl_device_notify.handler = NULL;
acpi_gbl_init_handler = NULL; acpi_gbl_init_handler = NULL;
/* Global "typed" ACPI table pointers */ /* Global "typed" ACPI table pointers */
......
...@@ -549,7 +549,7 @@ acpi_ut_mutex_initialize ( ...@@ -549,7 +549,7 @@ acpi_ut_mutex_initialize (
/* /*
* Create each of the predefined mutex objects * Create each of the predefined mutex objects
*/ */
for (i = 0; i < NUM_MTX; i++) { for (i = 0; i < NUM_MUTEX; i++) {
status = acpi_ut_create_mutex (i); status = acpi_ut_create_mutex (i);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -588,7 +588,7 @@ acpi_ut_mutex_terminate ( ...@@ -588,7 +588,7 @@ acpi_ut_mutex_terminate (
/* /*
* Delete each predefined mutex object * Delete each predefined mutex object
*/ */
for (i = 0; i < NUM_MTX; i++) { for (i = 0; i < NUM_MUTEX; i++) {
(void) acpi_ut_delete_mutex (i); (void) acpi_ut_delete_mutex (i);
} }
...@@ -619,15 +619,15 @@ acpi_ut_create_mutex ( ...@@ -619,15 +619,15 @@ acpi_ut_create_mutex (
ACPI_FUNCTION_TRACE_U32 ("ut_create_mutex", mutex_id); ACPI_FUNCTION_TRACE_U32 ("ut_create_mutex", mutex_id);
if (mutex_id > MAX_MTX) { if (mutex_id > MAX_MUTEX) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) { if (!acpi_gbl_mutex_info[mutex_id].mutex) {
status = acpi_os_create_semaphore (1, 1, status = acpi_os_create_semaphore (1, 1,
&acpi_gbl_acpi_mutex_info[mutex_id].mutex); &acpi_gbl_mutex_info[mutex_id].mutex);
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
acpi_gbl_acpi_mutex_info[mutex_id].use_count = 0; acpi_gbl_mutex_info[mutex_id].use_count = 0;
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -656,14 +656,14 @@ acpi_ut_delete_mutex ( ...@@ -656,14 +656,14 @@ acpi_ut_delete_mutex (
ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id); ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id);
if (mutex_id > MAX_MTX) { if (mutex_id > MAX_MUTEX) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex); status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex);
acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL; acpi_gbl_mutex_info[mutex_id].mutex = NULL;
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -693,7 +693,7 @@ acpi_ut_acquire_mutex ( ...@@ -693,7 +693,7 @@ acpi_ut_acquire_mutex (
ACPI_FUNCTION_NAME ("ut_acquire_mutex"); ACPI_FUNCTION_NAME ("ut_acquire_mutex");
if (mutex_id > MAX_MTX) { if (mutex_id > MAX_MUTEX) {
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
...@@ -705,8 +705,8 @@ acpi_ut_acquire_mutex ( ...@@ -705,8 +705,8 @@ acpi_ut_acquire_mutex (
* the mutex ordering rule. This indicates a coding error somewhere in * the mutex ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code. * the ACPI subsystem code.
*/ */
for (i = mutex_id; i < MAX_MTX; i++) { for (i = mutex_id; i < MAX_MUTEX; i++) {
if (acpi_gbl_acpi_mutex_info[i].owner_id == this_thread_id) { if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
if (i == mutex_id) { if (i == mutex_id) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Mutex [%s] already acquired by this thread [%X]\n", "Mutex [%s] already acquired by this thread [%X]\n",
...@@ -728,14 +728,14 @@ acpi_ut_acquire_mutex ( ...@@ -728,14 +728,14 @@ acpi_ut_acquire_mutex (
"Thread %X attempting to acquire Mutex [%s]\n", "Thread %X attempting to acquire Mutex [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id))); this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex,
1, ACPI_WAIT_FOREVER); 1, ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id))); this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
acpi_gbl_acpi_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].use_count++;
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id; acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id;
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n",
...@@ -776,14 +776,14 @@ acpi_ut_release_mutex ( ...@@ -776,14 +776,14 @@ acpi_ut_release_mutex (
"Thread %X releasing Mutex [%s]\n", this_thread_id, "Thread %X releasing Mutex [%s]\n", this_thread_id,
acpi_ut_get_mutex_name (mutex_id))); acpi_ut_get_mutex_name (mutex_id)));
if (mutex_id > MAX_MTX) { if (mutex_id > MAX_MUTEX) {
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
/* /*
* Mutex must be acquired in order to release it! * Mutex must be acquired in order to release it!
*/ */
if (acpi_gbl_acpi_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Mutex [%s] is not acquired, cannot release\n", "Mutex [%s] is not acquired, cannot release\n",
acpi_ut_get_mutex_name (mutex_id))); acpi_ut_get_mutex_name (mutex_id)));
...@@ -797,8 +797,8 @@ acpi_ut_release_mutex ( ...@@ -797,8 +797,8 @@ acpi_ut_release_mutex (
* ordering rule. This indicates a coding error somewhere in * ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code. * the ACPI subsystem code.
*/ */
for (i = mutex_id; i < MAX_MTX; i++) { for (i = mutex_id; i < MAX_MUTEX; i++) {
if (acpi_gbl_acpi_mutex_info[i].owner_id == this_thread_id) { if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
if (i == mutex_id) { if (i == mutex_id) {
continue; continue;
} }
...@@ -813,9 +813,9 @@ acpi_ut_release_mutex ( ...@@ -813,9 +813,9 @@ acpi_ut_release_mutex (
/* Mark unlocked FIRST */ /* Mark unlocked FIRST */
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
status = acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1); status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n",
......
...@@ -144,23 +144,9 @@ acpi_enable_subsystem ( ...@@ -144,23 +144,9 @@ acpi_enable_subsystem (
ACPI_FUNCTION_TRACE ("acpi_enable_subsystem"); ACPI_FUNCTION_TRACE ("acpi_enable_subsystem");
/*
* Install the default op_region handlers. These are installed unless
* other handlers have already been installed via the
* install_address_space_handler interface
*/
if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
status = acpi_ev_init_address_spaces ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
/* /*
* We must initialize the hardware before we can enable ACPI. * We must initialize the hardware before we can enable ACPI.
* FADT values are validated here. * The values from the FADT are validated here.
*/ */
if (!(flags & ACPI_NO_HARDWARE_INIT)) { if (!(flags & ACPI_NO_HARDWARE_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n"));
...@@ -172,7 +158,7 @@ acpi_enable_subsystem ( ...@@ -172,7 +158,7 @@ acpi_enable_subsystem (
} }
/* /*
* Enable ACPI on this platform * Enable ACPI mode
*/ */
if (!(flags & ACPI_NO_ACPI_ENABLE)) { if (!(flags & ACPI_NO_ACPI_ENABLE)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
...@@ -187,8 +173,9 @@ acpi_enable_subsystem ( ...@@ -187,8 +173,9 @@ acpi_enable_subsystem (
} }
/* /*
* Note: * Initialize ACPI Event handling
* We must have the hardware AND events initialized before we can execute *
* NOTE: We must have the hardware AND events initialized before we can execute
* ANY control methods SAFELY. Any control method can require ACPI hardware * ANY control methods SAFELY. Any control method can require ACPI hardware
* support, so the hardware MUST be initialized before execution! * support, so the hardware MUST be initialized before execution!
*/ */
...@@ -201,7 +188,7 @@ acpi_enable_subsystem ( ...@@ -201,7 +188,7 @@ acpi_enable_subsystem (
} }
} }
/* Install SCI handler, Global Lock handler, GPE handlers */ /* Install the SCI handler, Global Lock handler, and GPE handlers */
if (!(flags & ACPI_NO_HANDLER_INIT)) { if (!(flags & ACPI_NO_HANDLER_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL/GPE handlers\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL/GPE handlers\n"));
...@@ -237,14 +224,20 @@ acpi_initialize_objects ( ...@@ -237,14 +224,20 @@ acpi_initialize_objects (
ACPI_FUNCTION_TRACE ("acpi_initialize_objects"); ACPI_FUNCTION_TRACE ("acpi_initialize_objects");
/* /*
* Initialize all device objects in the namespace * Install the default op_region handlers. These are installed unless
* This runs the _STA and _INI methods. * other handlers have already been installed via the
* install_address_space_handler interface.
*
* NOTE: This will cause _REG methods to be run. Any objects accessed
* by the _REG methods will be automatically initialized, even if they
* contain executable AML (see call to acpi_ns_initialize_objects below).
*/ */
if (!(flags & ACPI_NO_DEVICE_INIT)) { if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
status = acpi_ns_initialize_devices (); status = acpi_ev_init_address_spaces ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -252,8 +245,8 @@ acpi_initialize_objects ( ...@@ -252,8 +245,8 @@ acpi_initialize_objects (
/* /*
* Initialize the objects that remain uninitialized. This * Initialize the objects that remain uninitialized. This
* runs the executable AML that is part of the declaration of op_regions * runs the executable AML that may be part of the declaration of these
* and Fields. * objects: operation_regions, buffer_fields, Buffers, and Packages.
*/ */
if (!(flags & ACPI_NO_OBJECT_INIT)) { if (!(flags & ACPI_NO_OBJECT_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Objects\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Objects\n"));
...@@ -264,6 +257,19 @@ acpi_initialize_objects ( ...@@ -264,6 +257,19 @@ acpi_initialize_objects (
} }
} }
/*
* Initialize all device objects in the namespace
* This runs the _STA and _INI methods.
*/
if (!(flags & ACPI_NO_DEVICE_INIT)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n"));
status = acpi_ns_initialize_devices ();
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
/* /*
* Empty the caches (delete the cached objects) on the assumption that * Empty the caches (delete the cached objects) on the assumption that
* the table load filled them up more than they will be at runtime -- * the table load filled them up more than they will be at runtime --
...@@ -431,9 +437,9 @@ acpi_get_system_info ( ...@@ -431,9 +437,9 @@ acpi_get_system_info (
/* Current status of the ACPI tables, per table type */ /* Current status of the ACPI tables, per table type */
info_ptr->num_table_types = NUM_ACPI_TABLES; info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES;
for (i = 0; i < NUM_ACPI_TABLES; i++) { for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
info_ptr->table_info[i].count = acpi_gbl_acpi_tables[i].count; info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count;
} }
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20030418 #define ACPI_CA_VERSION 0x20030509
/* Maximum objects in the various object caches */ /* Maximum objects in the various object caches */
......
...@@ -165,7 +165,7 @@ acpi_ev_address_space_dispatch ( ...@@ -165,7 +165,7 @@ acpi_ev_address_space_dispatch (
void *value); void *value);
acpi_status acpi_status
acpi_ev_addr_handler_helper ( acpi_ev_install_handler (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
void *context, void *context,
......
...@@ -94,8 +94,9 @@ ...@@ -94,8 +94,9 @@
#define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) #define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) #define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) #define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
#define AE_CODE_ENV_MAX 0x001C #define AE_CODE_ENV_MAX 0x001D
/* /*
* Programmer exceptions * Programmer exceptions
...@@ -219,7 +220,8 @@ char const *acpi_gbl_exception_names_env[] = ...@@ -219,7 +220,8 @@ char const *acpi_gbl_exception_names_env[] =
"AE_NO_HARDWARE_RESPONSE", "AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK", "AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS", "AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD" "AE_ABORT_METHOD",
"AE_SAME_HANDLER"
}; };
char const *acpi_gbl_exception_names_pgm[] = char const *acpi_gbl_exception_names_pgm[] =
......
...@@ -105,6 +105,8 @@ ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; ...@@ -105,6 +105,8 @@ ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
*/ */
ACPI_EXTERN u8 acpi_gbl_integer_bit_width; ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
ACPI_EXTERN u8 acpi_gbl_integer_byte_width; ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
/* /*
* Since there may be multiple SSDTs and PSDTS, a single pointer is not * Since there may be multiple SSDTs and PSDTS, a single pointer is not
...@@ -115,15 +117,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_byte_width; ...@@ -115,15 +117,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
/* /*
* ACPI Table info arrays * ACPI Table info arrays
*/ */
extern struct acpi_table_desc acpi_gbl_acpi_tables[NUM_ACPI_TABLES]; extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
extern struct acpi_table_support acpi_gbl_acpi_table_data[NUM_ACPI_TABLES]; extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES];
/* /*
* Predefined mutex objects. This array contains the * Predefined mutex objects. This array contains the
* actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
* (The table maps local handles to the real OS handles) * (The table maps local handles to the real OS handles)
*/ */
ACPI_EXTERN struct acpi_mutex_info acpi_gbl_acpi_mutex_info [NUM_MTX]; ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
/***************************************************************************** /*****************************************************************************
...@@ -134,8 +136,8 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_acpi_mutex_info [NUM_MT ...@@ -134,8 +136,8 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_acpi_mutex_info [NUM_MT
ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS]; ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_drv_notify; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_sys_notify; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
...@@ -200,7 +202,7 @@ ACPI_EXTERN u32 acpi_gbl_deepest_nesting; ...@@ -200,7 +202,7 @@ ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
****************************************************************************/ ****************************************************************************/
ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
/* Control method single step flag */ /* Control method single step flag */
...@@ -213,7 +215,7 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step; ...@@ -213,7 +215,7 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step;
* *
****************************************************************************/ ****************************************************************************/
ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
/***************************************************************************** /*****************************************************************************
* *
...@@ -234,8 +236,8 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b; ...@@ -234,8 +236,8 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
extern struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; extern struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
ACPI_EXTERN struct acpi_fixed_event_handler acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; ACPI_EXTERN struct acpi_fixed_event_handler acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
......
...@@ -98,15 +98,13 @@ acpi_status ...@@ -98,15 +98,13 @@ acpi_status
acpi_hw_low_level_read ( acpi_hw_low_level_read (
u32 width, u32 width,
u32 *value, u32 *value,
struct acpi_generic_address *reg, struct acpi_generic_address *reg);
u32 offset);
acpi_status acpi_status
acpi_hw_low_level_write ( acpi_hw_low_level_write (
u32 width, u32 width,
u32 value, u32 value,
struct acpi_generic_address *reg, struct acpi_generic_address *reg);
u32 offset);
acpi_status acpi_status
acpi_hw_clear_acpi_status ( acpi_hw_clear_acpi_status (
......
...@@ -87,8 +87,8 @@ typedef u32 acpi_mutex_handle; ...@@ -87,8 +87,8 @@ typedef u32 acpi_mutex_handle;
#define ACPI_MTX_DEBUG_CMD_COMPLETE 11 #define ACPI_MTX_DEBUG_CMD_COMPLETE 11
#define ACPI_MTX_DEBUG_CMD_READY 12 #define ACPI_MTX_DEBUG_CMD_READY 12
#define MAX_MTX 12 #define MAX_MUTEX 12
#define NUM_MTX MAX_MTX+1 #define NUM_MUTEX MAX_MUTEX+1
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
...@@ -140,12 +140,8 @@ struct acpi_mutex_info ...@@ -140,12 +140,8 @@ struct acpi_mutex_info
typedef u16 acpi_owner_id; typedef u16 acpi_owner_id;
#define ACPI_OWNER_TYPE_TABLE 0x0 #define ACPI_OWNER_TYPE_TABLE 0x0
#define ACPI_OWNER_TYPE_METHOD 0x1 #define ACPI_OWNER_TYPE_METHOD 0x1
#define ACPI_FIRST_METHOD_ID 0x0000 #define ACPI_FIRST_METHOD_ID 0x0001
#define ACPI_FIRST_TABLE_ID 0x8000 #define ACPI_FIRST_TABLE_ID 0xF000
/* TBD: [Restructure] get rid of the need for this! */
#define TABLE_ID_DSDT (acpi_owner_id) 0x8000
/* Field access granularities */ /* Field access granularities */
...@@ -232,13 +228,18 @@ struct acpi_table_desc ...@@ -232,13 +228,18 @@ struct acpi_table_desc
u64 physical_address; u64 physical_address;
u32 aml_length; u32 aml_length;
acpi_size length; acpi_size length;
u32 count;
acpi_owner_id table_id; acpi_owner_id table_id;
u8 type; u8 type;
u8 allocation; u8 allocation;
u8 loaded_into_namespace; u8 loaded_into_namespace;
}; };
struct acpi_table_list
{
struct acpi_table_desc *next;
u32 count;
};
struct acpi_find_context struct acpi_find_context
{ {
......
...@@ -440,26 +440,6 @@ ...@@ -440,26 +440,6 @@
#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH))
/*
* Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions)
*
* 1) Address space
* 2) Length in bytes -- convert to length in bits
* 3) Bit offset is zero
* 4) Reserved field is zero
* 5) Expand address to 64 bits
*/
#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) do {a.address_space_id = (u8) d;\
a.register_bit_width = (u8) ACPI_MUL_8 (b);\
a.register_bit_offset = 0;\
a.reserved = 0;\
ACPI_STORE_ADDRESS (a.address,(acpi_physical_address) c);} while (0)
/* ACPI V1.0 entries -- address space is always I/O */
#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c) ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ACPI_ADR_SPACE_SYSTEM_IO)
/* /*
* Reporting macros that are never compiled out * Reporting macros that are never compiled out
*/ */
......
...@@ -201,6 +201,11 @@ acpi_ns_compare_names ( ...@@ -201,6 +201,11 @@ acpi_ns_compare_names (
char *name1, char *name1,
char *name2); char *name2);
void
acpi_ns_remove_reference (
struct acpi_namespace_node *node);
/* /*
* Namespace modification - nsmodify * Namespace modification - nsmodify
*/ */
......
...@@ -112,9 +112,9 @@ ...@@ -112,9 +112,9 @@
* Common fields for objects that support ASL notifications * Common fields for objects that support ASL notifications
*/ */
#define ACPI_COMMON_NOTIFY_INFO \ #define ACPI_COMMON_NOTIFY_INFO \
union acpi_operand_object *sys_handler; /* Handler for system notifies */\ union acpi_operand_object *system_notify; /* Handler for system notifies */\
union acpi_operand_object *drv_handler; /* Handler for driver notifies */\ union acpi_operand_object *device_notify; /* Handler for driver notifies */\
union acpi_operand_object *addr_handler; /* Handler for Address space */ union acpi_operand_object *address_space; /* Handler for Address space */
/****************************************************************************** /******************************************************************************
...@@ -214,7 +214,7 @@ struct acpi_object_region ...@@ -214,7 +214,7 @@ struct acpi_object_region
ACPI_OBJECT_COMMON_HEADER ACPI_OBJECT_COMMON_HEADER
u8 space_id; u8 space_id;
union acpi_operand_object *addr_handler; /* Handler for system notifies */ union acpi_operand_object *address_space; /* Handler for region access */
struct acpi_namespace_node *node; /* containing object */ struct acpi_namespace_node *node; /* containing object */
union acpi_operand_object *next; union acpi_operand_object *next;
u32 length; u32 length;
...@@ -446,8 +446,8 @@ union acpi_operand_object ...@@ -446,8 +446,8 @@ union acpi_operand_object
struct acpi_object_buffer_field buffer_field; struct acpi_object_buffer_field buffer_field;
struct acpi_object_bank_field bank_field; struct acpi_object_bank_field bank_field;
struct acpi_object_index_field index_field; struct acpi_object_index_field index_field;
struct acpi_object_notify_handler notify_handler; struct acpi_object_notify_handler notify;
struct acpi_object_addr_handler addr_handler; struct acpi_object_addr_handler address_space;
struct acpi_object_reference reference; struct acpi_object_reference reference;
struct acpi_object_extra extra; struct acpi_object_extra extra;
struct acpi_object_data data; struct acpi_object_data data;
......
...@@ -290,12 +290,12 @@ acpi_os_derive_pci_id( ...@@ -290,12 +290,12 @@ acpi_os_derive_pci_id(
u8 u8
acpi_os_readable ( acpi_os_readable (
void *pointer, void *pointer,
u32 length); acpi_size length);
u8 u8
acpi_os_writable ( acpi_os_writable (
void *pointer, void *pointer,
u32 length); acpi_size length);
u32 u32
acpi_os_get_timer ( acpi_os_get_timer (
......
...@@ -157,7 +157,7 @@ acpi_tb_match_signature ( ...@@ -157,7 +157,7 @@ acpi_tb_match_signature (
acpi_status acpi_status
acpi_tb_recognize_table ( acpi_tb_recognize_table (
struct acpi_table_desc *table_info, struct acpi_table_desc *table_info,
u8 search_type); u8 search_type);
acpi_status acpi_status
acpi_tb_init_table_descriptor ( acpi_tb_init_table_descriptor (
...@@ -170,11 +170,11 @@ acpi_tb_init_table_descriptor ( ...@@ -170,11 +170,11 @@ acpi_tb_init_table_descriptor (
*/ */
void void
acpi_tb_delete_acpi_tables ( acpi_tb_delete_all_tables (
void); void);
void void
acpi_tb_delete_acpi_table ( acpi_tb_delete_tables_by_type (
acpi_table_type type); acpi_table_type type);
void void
...@@ -185,10 +185,6 @@ struct acpi_table_desc * ...@@ -185,10 +185,6 @@ struct acpi_table_desc *
acpi_tb_uninstall_table ( acpi_tb_uninstall_table (
struct acpi_table_desc *table_desc); struct acpi_table_desc *table_desc);
void
acpi_tb_free_acpi_tables_of_type (
struct acpi_table_desc *table_info);
/* /*
* tbrsd - RSDP, RSDT utilities * tbrsd - RSDP, RSDT utilities
......
...@@ -407,7 +407,7 @@ typedef u32 acpi_table_type; ...@@ -407,7 +407,7 @@ typedef u32 acpi_table_type;
#define ACPI_TABLE_SSDT (acpi_table_type) 5 #define ACPI_TABLE_SSDT (acpi_table_type) 5
#define ACPI_TABLE_XSDT (acpi_table_type) 6 #define ACPI_TABLE_XSDT (acpi_table_type) 6
#define ACPI_TABLE_MAX 6 #define ACPI_TABLE_MAX 6
#define NUM_ACPI_TABLES (ACPI_TABLE_MAX+1) #define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
/* /*
...@@ -747,7 +747,7 @@ struct acpi_system_info ...@@ -747,7 +747,7 @@ struct acpi_system_info
u32 debug_level; u32 debug_level;
u32 debug_layer; u32 debug_layer;
u32 num_table_types; u32 num_table_types;
struct acpi_table_info table_info [NUM_ACPI_TABLES]; struct acpi_table_info table_info [NUM_ACPI_TABLE_TYPES];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment