Commit 4c774112 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-acpi.bkbits.net/linux-acpi-release-2.6.0

into home.osdl.org:/home/torvalds/v2.5/linux
parents f2cee0af b1ac8feb
...@@ -247,6 +247,34 @@ acpi_parse_nmi_src ( ...@@ -247,6 +247,34 @@ acpi_parse_nmi_src (
#endif /*CONFIG_X86_IO_APIC*/ #endif /*CONFIG_X86_IO_APIC*/
#ifdef CONFIG_ACPI_BUS
/*
* Set specified PIC IRQ to level triggered mode.
*
* Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
* for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge.
* ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0)
* ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
*
* As the BIOS should have done this for us,
* print a warning if the IRQ wasn't already set to level.
*/
void acpi_pic_set_level_irq(unsigned int irq)
{
unsigned char mask = 1 << (irq & 7);
unsigned int port = 0x4d0 + (irq >> 3);
unsigned char val = inb(port);
if (!(val & mask)) {
printk(KERN_WARNING PREFIX "IRQ %d was Edge Triggered, "
"setting to Level Triggerd\n", irq);
outb(val | mask, port);
}
}
#endif /* CONFIG_ACPI_BUS */
static unsigned long __init static unsigned long __init
acpi_scan_rsdp ( acpi_scan_rsdp (
......
...@@ -360,7 +360,7 @@ acpi_battery_read_info ( ...@@ -360,7 +360,7 @@ acpi_battery_read_info (
ACPI_FUNCTION_TRACE("acpi_battery_read_info"); ACPI_FUNCTION_TRACE("acpi_battery_read_info");
if (!battery) if (!battery || (off != 0))
goto end; goto end;
if (battery->flags.present) if (battery->flags.present)
...@@ -459,7 +459,7 @@ acpi_battery_read_state ( ...@@ -459,7 +459,7 @@ acpi_battery_read_state (
ACPI_FUNCTION_TRACE("acpi_battery_read_state"); ACPI_FUNCTION_TRACE("acpi_battery_read_state");
if (!battery) if (!battery || (off != 0))
goto end; goto end;
if (battery->flags.present) if (battery->flags.present)
...@@ -543,7 +543,7 @@ acpi_battery_read_alarm ( ...@@ -543,7 +543,7 @@ acpi_battery_read_alarm (
ACPI_FUNCTION_TRACE("acpi_battery_read_alarm"); ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
if (!battery) if (!battery || (off != 0))
goto end; goto end;
if (!battery->flags.present) { if (!battery->flags.present) {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define _COMPONENT ACPI_BUS_COMPONENT #define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME ("acpi_bus") ACPI_MODULE_NAME ("acpi_bus")
extern void eisa_set_level_irq(unsigned int irq); extern void acpi_pic_set_level_irq(unsigned int irq);
FADT_DESCRIPTOR acpi_fadt; FADT_DESCRIPTOR acpi_fadt;
struct acpi_device *acpi_root; struct acpi_device *acpi_root;
...@@ -615,7 +615,7 @@ acpi_bus_init (void) ...@@ -615,7 +615,7 @@ acpi_bus_init (void)
if (acpi_ioapic) if (acpi_ioapic)
mp_config_ioapic_for_sci(acpi_fadt.sci_int); mp_config_ioapic_for_sci(acpi_fadt.sci_int);
else else
eisa_set_level_irq(acpi_fadt.sci_int); acpi_pic_set_level_irq(acpi_fadt.sci_int);
#endif #endif
status = acpi_enable_subsystem(ACPI_FULL_INITIALIZATION); status = acpi_enable_subsystem(ACPI_FULL_INITIALIZATION);
......
...@@ -94,6 +94,13 @@ static struct acpi_ec *ec_ecdt; ...@@ -94,6 +94,13 @@ static struct acpi_ec *ec_ecdt;
/* External interfaces use first EC only, so remember */ /* External interfaces use first EC only, so remember */
static struct acpi_device *first_ec; static struct acpi_device *first_ec;
/*
* We use kernel thread to handle ec's gpe query, so the query may defer.
* The query need a context, which can be freed when we replace ec_ecdt
* with EC device. So defered query may have a wrong context.
* We use an indication to avoid it
*/
static int ec_device_init = 0;
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Transaction Management Transaction Management
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -393,6 +400,9 @@ acpi_ec_gpe_handler ( ...@@ -393,6 +400,9 @@ acpi_ec_gpe_handler (
acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR);
if (!ec_device_init)
acpi_ec_gpe_query(ec); /* directly query when device didn't init */
else
status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
acpi_ec_gpe_query, ec); acpi_ec_gpe_query, ec);
} }
...@@ -589,6 +599,8 @@ acpi_ec_add ( ...@@ -589,6 +599,8 @@ acpi_ec_add (
we now have the *real* EC info, so kill the makeshift one.*/ we now have the *real* EC info, so kill the makeshift one.*/
acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid); acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid);
if (ec_ecdt && ec_ecdt->uid == uid) { if (ec_ecdt && ec_ecdt->uid == uid) {
acpi_disable_gpe(NULL, ec_ecdt->gpe_bit, ACPI_NOT_ISR);
ec_device_init = 1;
acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
......
...@@ -218,7 +218,7 @@ acpi_ev_gpe_detect ( ...@@ -218,7 +218,7 @@ acpi_ev_gpe_detect (
int_status |= acpi_ev_gpe_dispatch ( int_status |= acpi_ev_gpe_dispatch (
&gpe_block->event_info[gpe_number], &gpe_block->event_info[gpe_number],
gpe_number + gpe_block->register_info[gpe_number].base_gpe_number); j + gpe_register_info->base_gpe_number);
} }
} }
} }
......
...@@ -337,6 +337,9 @@ acpi_power_transition ( ...@@ -337,6 +337,9 @@ acpi_power_transition (
if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
return_VALUE(-EINVAL); return_VALUE(-EINVAL);
if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3))
return_VALUE(-ENODEV);
cl = &device->power.states[device->power.state].resources; cl = &device->power.states[device->power.state].resources;
tl = &device->power.states[state].resources; tl = &device->power.states[state].resources;
...@@ -359,8 +362,6 @@ acpi_power_transition ( ...@@ -359,8 +362,6 @@ acpi_power_transition (
goto end; goto end;
} }
device->power.state = state;
/* /*
* Then we dereference all power resources used in the current list. * Then we dereference all power resources used in the current list.
*/ */
...@@ -370,6 +371,8 @@ acpi_power_transition ( ...@@ -370,6 +371,8 @@ acpi_power_transition (
goto end; goto end;
} }
/* We shouldn't change the state till all above operations succeed */
device->power.state = state;
end: end:
if (result) if (result)
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_DEBUG_PRINT((ACPI_DB_WARN,
......
...@@ -416,7 +416,7 @@ acpi_ut_update_object_reference ( ...@@ -416,7 +416,7 @@ acpi_ut_update_object_reference (
u32 i; u32 i;
union acpi_generic_state *state_list = NULL; union acpi_generic_state *state_list = NULL;
union acpi_generic_state *state; union acpi_generic_state *state;
union acpi_operand_object *tmp;
ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object); ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object);
...@@ -448,8 +448,16 @@ acpi_ut_update_object_reference ( ...@@ -448,8 +448,16 @@ 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:
acpi_ut_update_ref_count (object->device.system_notify, action); tmp = object->device.system_notify;
acpi_ut_update_ref_count (object->device.device_notify, action); if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->device.system_notify = NULL;
acpi_ut_update_ref_count (tmp, action);
tmp = object->device.device_notify;
if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->device.device_notify = NULL;
acpi_ut_update_ref_count (tmp, action);
break; break;
...@@ -470,6 +478,10 @@ acpi_ut_update_object_reference ( ...@@ -470,6 +478,10 @@ acpi_ut_update_object_reference (
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto error_exit; goto error_exit;
} }
tmp = object->package.elements[i];
if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->package.elements[i] = NULL;
} }
break; break;
...@@ -481,6 +493,10 @@ acpi_ut_update_object_reference ( ...@@ -481,6 +493,10 @@ acpi_ut_update_object_reference (
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto error_exit; goto error_exit;
} }
tmp = object->buffer_field.buffer_obj;
if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->buffer_field.buffer_obj = NULL;
break; break;
...@@ -491,6 +507,10 @@ acpi_ut_update_object_reference ( ...@@ -491,6 +507,10 @@ acpi_ut_update_object_reference (
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto error_exit; goto error_exit;
} }
tmp = object->field.region_obj;
if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->field.region_obj = NULL;
break; break;
...@@ -502,11 +522,19 @@ acpi_ut_update_object_reference ( ...@@ -502,11 +522,19 @@ acpi_ut_update_object_reference (
goto error_exit; goto error_exit;
} }
tmp = object->bank_field.bank_obj;
if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->bank_field.bank_obj = NULL;
status = acpi_ut_create_update_state_and_push ( status = acpi_ut_create_update_state_and_push (
object->bank_field.region_obj, action, &state_list); object->bank_field.region_obj, action, &state_list);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto error_exit; goto error_exit;
} }
tmp = object->bank_field.region_obj;
if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->bank_field.region_obj = NULL;
break; break;
...@@ -518,11 +546,19 @@ acpi_ut_update_object_reference ( ...@@ -518,11 +546,19 @@ acpi_ut_update_object_reference (
goto error_exit; goto error_exit;
} }
tmp = object->index_field.index_obj;
if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->index_field.index_obj = NULL;
status = acpi_ut_create_update_state_and_push ( status = acpi_ut_create_update_state_and_push (
object->index_field.data_obj, action, &state_list); object->index_field.data_obj, action, &state_list);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto error_exit; goto error_exit;
} }
tmp = object->index_field.data_obj;
if ( tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
object->index_field.data_obj = NULL;
break; break;
......
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