| From 1bf40d5bfd22215e4b877a5a998e9fe6d7b03a6c Mon Sep 17 00:00:00 2001 | |
| From: Ingo Molnar <mingo@elte.hu> | |
| Date: Fri, 3 Jul 2009 08:30:12 -0500 | |
| Subject: [PATCH] ACPI: RT support | |
| commit 3490ceb8e831c92a439dd4ec79e3d1ecd9365545 in tip. | |
| Signed-off-by: Ingo Molnar <mingo@elte.hu> | |
| Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> | |
| --- | |
| drivers/acpi/acpica/acglobal.h | 7 ++++++- | |
| drivers/acpi/acpica/hwregs.c | 4 ++-- | |
| drivers/acpi/acpica/hwxface.c | 4 ++-- | |
| drivers/acpi/acpica/utmutex.c | 7 +------ | |
| drivers/acpi/ec.c | 12 ++++++++++++ | |
| include/acpi/acpiosxf.h | 2 +- | |
| 6 files changed, 24 insertions(+), 12 deletions(-) | |
| diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h | |
| index f8dd8f2..98f8afc 100644 | |
| --- a/drivers/acpi/acpica/acglobal.h | |
| +++ b/drivers/acpi/acpica/acglobal.h | |
| @@ -201,7 +201,12 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_present; | |
| * interrupt level | |
| */ | |
| ACPI_EXTERN spinlock_t _acpi_gbl_gpe_lock; /* For GPE data structs and registers */ | |
| -ACPI_EXTERN spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ | |
| + | |
| +/* | |
| + * Need to be raw because it might be used in acpi_processor_idle(): | |
| + */ | |
| +ACPI_EXTERN raw_spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ | |
| + | |
| #define acpi_gbl_gpe_lock &_acpi_gbl_gpe_lock | |
| #define acpi_gbl_hardware_lock &_acpi_gbl_hardware_lock | |
| diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c | |
| index ec7fc22..1a4c82d 100644 | |
| --- a/drivers/acpi/acpica/hwregs.c | |
| +++ b/drivers/acpi/acpica/hwregs.c | |
| @@ -263,7 +263,7 @@ acpi_status acpi_hw_clear_acpi_status(void) | |
| ACPI_BITMASK_ALL_FIXED_STATUS, | |
| ACPI_FORMAT_UINT64(acpi_gbl_xpm1a_status.address))); | |
| - lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | |
| + raw_spin_lock_irqsave(acpi_gbl_hardware_lock, lock_flags); | |
| /* Clear the fixed events in PM1 A/B */ | |
| @@ -278,7 +278,7 @@ acpi_status acpi_hw_clear_acpi_status(void) | |
| status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); | |
| unlock_and_exit: | |
| - acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); | |
| + raw_spin_unlock_irqrestore(acpi_gbl_hardware_lock, lock_flags); | |
| return_ACPI_STATUS(status); | |
| } | |
| diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c | |
| index 50cc3be..791cdf5 100644 | |
| --- a/drivers/acpi/acpica/hwxface.c | |
| +++ b/drivers/acpi/acpica/hwxface.c | |
| @@ -386,7 +386,7 @@ acpi_status acpi_write_bit_register(u32 register_id, u32 value) | |
| return_ACPI_STATUS(AE_BAD_PARAMETER); | |
| } | |
| - lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | |
| + raw_spin_lock_irqsave(acpi_gbl_hardware_lock, lock_flags); | |
| /* | |
| * At this point, we know that the parent register is one of the | |
| @@ -447,7 +447,7 @@ acpi_status acpi_write_bit_register(u32 register_id, u32 value) | |
| unlock_and_exit: | |
| - acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); | |
| + raw_spin_unlock_irqrestore(acpi_gbl_hardware_lock, lock_flags); | |
| return_ACPI_STATUS(status); | |
| } | |
| diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c | |
| index 55d014e..184d6fa 100644 | |
| --- a/drivers/acpi/acpica/utmutex.c | |
| +++ b/drivers/acpi/acpica/utmutex.c | |
| @@ -84,7 +84,7 @@ acpi_status acpi_ut_mutex_initialize(void) | |
| /* Create the spinlocks for use at interrupt level */ | |
| spin_lock_init(acpi_gbl_gpe_lock); | |
| - spin_lock_init(acpi_gbl_hardware_lock); | |
| + raw_spin_lock_init(acpi_gbl_hardware_lock); | |
| /* Create the reader/writer lock for namespace access */ | |
| @@ -117,11 +117,6 @@ void acpi_ut_mutex_terminate(void) | |
| acpi_ut_delete_mutex(i); | |
| } | |
| - /* Delete the spinlocks */ | |
| - | |
| - acpi_os_delete_lock(acpi_gbl_gpe_lock); | |
| - acpi_os_delete_lock(acpi_gbl_hardware_lock); | |
| - | |
| /* Delete the reader/writer lock */ | |
| acpi_ut_delete_rw_lock(&acpi_gbl_namespace_rw_lock); | |
| diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c | |
| index f2234db..de9ea42 100644 | |
| --- a/drivers/acpi/ec.c | |
| +++ b/drivers/acpi/ec.c | |
| @@ -617,7 +617,19 @@ static u32 acpi_ec_gpe_handler(void *data) | |
| advance_transaction(ec, acpi_ec_read_status(ec)); | |
| if (ec_transaction_done(ec) && | |
| (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | |
| +#ifndef CONFIG_PREEMPT_RT | |
| wake_up(&ec->wait); | |
| +#else | |
| + // hack ... | |
| + if (waitqueue_active(&ec->wait)) { | |
| + struct task_struct *task; | |
| + | |
| + task = list_entry(ec->wait.task_list.next, | |
| + wait_queue_t, task_list)->private; | |
| + if (task) | |
| + wake_up_process(task); | |
| + } | |
| +#endif | |
| ec_check_sci(ec, acpi_ec_read_status(ec)); | |
| } | |
| return ACPI_INTERRUPT_HANDLED; | |
| diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h | |
| index b396854..41fb677 100644 | |
| --- a/include/acpi/acpiosxf.h | |
| +++ b/include/acpi/acpiosxf.h | |
| @@ -61,7 +61,7 @@ typedef enum { | |
| OSL_EC_BURST_HANDLER | |
| } acpi_execute_type; | |
| -#define ACPI_NO_UNIT_LIMIT ((u32) -1) | |
| +#define ACPI_NO_UNIT_LIMIT (INT_MAX/2) | |
| #define ACPI_MUTEX_SEM 1 | |
| /* Functions for acpi_os_signal */ | |
| -- | |
| 1.7.0.4 | |