Skip to content

Commit 2245ba2

Browse files
committed
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: gcc-4.6: ACPI: fix unused but set variables in ACPI ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI video: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI processor: remove deprecated ACPI procfs I/F ACPI power_resource: remove unused procfs I/F ACPI: remove deprecated ACPI procfs I/F ACPI: introduce drivers/acpi/sysfs.c ACPI: introduce module parameter acpi.aml_debug_output ACPI: introduce drivers/acpi/debugfs.c ACPI, APEI, ERST debug support ACPI, APEI, Manage GHES as platform devices ACPI, APEI, Rename CPER and GHES severity constants ACPI, APEI, Fix a typo of error path of apei_resources_request ACPI / ACPICA: Fix reference counting problems with GPE handlers ACPI: Add the check of ADR flag in course of finding ACPI handle for PCI device ACPI / Sleep: Drop acpi_suspend_finish() ACPI / Sleep: Consolidate suspend and hibernation routines ACPI / Wakeup: Simplify enabling of wakeup devices ACPI / Sleep: Rework enabling wakeup devices ACPI / Sleep: Free NVS copy if suspending of devices fails Fixed up totally buggered "ACPI: fix unused but set variables in ACPI" patch that doesn't even compile in the merge. Thanks to Sedat Dilek <sedat.dilek@googlemail.com> for noticing the breakage before I even pulled. And a big "Grrr.." at Len for not even bothering to compile the tree before asking me to pull.
2 parents e2e96c6 + 95ee46a commit 2245ba2

40 files changed

Lines changed: 1071 additions & 1479 deletions

‎Documentation/acpi/method-customizing.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Note: Only ACPI METHOD can be overridden, any other object types like
1919
"Device", "OperationRegion", are not recognized.
2020
Note: The same ACPI control method can be overridden for many times,
2121
and it's always the latest one that used by Linux/kernel.
22+
Note: To get the ACPI debug object output (Store (AAAA, Debug)),
23+
please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
2224

2325
1. override an existing method
2426
a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,

‎arch/x86/kernel/cpu/mcheck/mce-apei.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int apei_write_mce(struct mce *m)
8080
rcd.hdr.revision = CPER_RECORD_REV;
8181
rcd.hdr.signature_end = CPER_SIG_END;
8282
rcd.hdr.section_count = 1;
83-
rcd.hdr.error_severity = CPER_SER_FATAL;
83+
rcd.hdr.error_severity = CPER_SEV_FATAL;
8484
/* timestamp, platform_id, partition_id are all invalid */
8585
rcd.hdr.validation_bits = 0;
8686
rcd.hdr.record_length = sizeof(rcd);
@@ -96,7 +96,7 @@ int apei_write_mce(struct mce *m)
9696
rcd.sec_hdr.validation_bits = 0;
9797
rcd.sec_hdr.flags = CPER_SEC_PRIMARY;
9898
rcd.sec_hdr.section_type = CPER_SECTION_TYPE_MCE;
99-
rcd.sec_hdr.section_severity = CPER_SER_FATAL;
99+
rcd.sec_hdr.section_severity = CPER_SEV_FATAL;
100100

101101
memcpy(&rcd.mce, m, sizeof(*m));
102102

‎drivers/acpi/Kconfig‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,10 @@ config ACPI_PROCFS
5454
they have been replaced by functions in /sys.
5555
The deprecated files (and their replacements) include:
5656

57-
/proc/acpi/sleep (/sys/power/state)
58-
/proc/acpi/info (/sys/module/acpi/parameters/acpica_version)
59-
/proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
60-
/proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
61-
/proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
62-
/proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
63-
/proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*)
64-
/proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/
65-
cpufreq/*)
6657
/proc/acpi/processor/*/throttling (/sys/class/thermal/
6758
cooling_device*/*)
59+
/proc/acpi/video/*/brightness (/sys/class/backlight/)
60+
/proc/acpi/thermal_zone/*/* (/sys/class/thermal/)
6861
This option has no effect on /proc/acpi/ files
6962
and functions which do not yet exist in /sys.
7063

‎drivers/acpi/Makefile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ acpi-y += ec.o
3737
acpi-$(CONFIG_ACPI_DOCK) += dock.o
3838
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
3939
acpi-y += power.o
40-
acpi-y += system.o event.o
41-
acpi-$(CONFIG_ACPI_DEBUG) += debug.o
40+
acpi-y += event.o
41+
acpi-y += sysfs.o
42+
acpi-$(CONFIG_DEBUG_FS) += debugfs.o
4243
acpi-$(CONFIG_ACPI_NUMA) += numa.o
4344
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
4445
ifdef CONFIG_ACPI_VIDEO

‎drivers/acpi/acpica/acevents.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
8282

8383
acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
8484

85+
acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
86+
87+
acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
88+
8589
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
8690
u32 gpe_number);
8791

‎drivers/acpi/acpica/acglobal.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
108108
/*
109109
* Optionally enable output from the AML Debug Object.
110110
*/
111-
u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
111+
u32 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
112112

113113
/*
114114
* Optionally copy the entire DSDT to local memory (instead of simply

‎drivers/acpi/acpica/aclocal.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ struct acpi_handler_info {
412412
acpi_event_handler address; /* Address of handler, if any */
413413
void *context; /* Context to be passed to handler */
414414
struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
415+
u8 orig_flags; /* Original misc info about this GPE */
415416
};
416417

417418
union acpi_gpe_dispatch_info {

‎drivers/acpi/acpica/evgpe.c‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,79 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
135135
}
136136

137137

138+
/*******************************************************************************
139+
*
140+
* FUNCTION: acpi_raw_enable_gpe
141+
*
142+
* PARAMETERS: gpe_event_info - GPE to enable
143+
*
144+
* RETURN: Status
145+
*
146+
* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
147+
* hardware-enabled.
148+
*
149+
******************************************************************************/
150+
151+
acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
152+
{
153+
acpi_status status = AE_OK;
154+
155+
if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
156+
return_ACPI_STATUS(AE_LIMIT);
157+
}
158+
159+
gpe_event_info->runtime_count++;
160+
if (gpe_event_info->runtime_count == 1) {
161+
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
162+
if (ACPI_SUCCESS(status)) {
163+
status = acpi_ev_enable_gpe(gpe_event_info);
164+
}
165+
166+
if (ACPI_FAILURE(status)) {
167+
gpe_event_info->runtime_count--;
168+
}
169+
}
170+
171+
return_ACPI_STATUS(status);
172+
}
173+
174+
/*******************************************************************************
175+
*
176+
* FUNCTION: acpi_raw_disable_gpe
177+
*
178+
* PARAMETERS: gpe_event_info - GPE to disable
179+
*
180+
* RETURN: Status
181+
*
182+
* DESCRIPTION: Remove a reference to a GPE. When the last reference is
183+
* removed, the GPE is hardware-disabled.
184+
*
185+
******************************************************************************/
186+
187+
acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
188+
{
189+
acpi_status status = AE_OK;
190+
191+
if (!gpe_event_info->runtime_count) {
192+
return_ACPI_STATUS(AE_LIMIT);
193+
}
194+
195+
gpe_event_info->runtime_count--;
196+
if (!gpe_event_info->runtime_count) {
197+
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
198+
if (ACPI_SUCCESS(status)) {
199+
status = acpi_hw_low_set_gpe(gpe_event_info,
200+
ACPI_GPE_DISABLE);
201+
}
202+
203+
if (ACPI_FAILURE(status)) {
204+
gpe_event_info->runtime_count++;
205+
}
206+
}
207+
208+
return_ACPI_STATUS(status);
209+
}
210+
138211
/*******************************************************************************
139212
*
140213
* FUNCTION: acpi_ev_low_get_gpe_info

‎drivers/acpi/acpica/evxface.c‎

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -691,37 +691,53 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
691691
return_ACPI_STATUS(status);
692692
}
693693

694+
/* Allocate memory for the handler object */
695+
696+
handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
697+
if (!handler) {
698+
status = AE_NO_MEMORY;
699+
goto unlock_and_exit;
700+
}
701+
702+
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
703+
694704
/* Ensure that we have a valid GPE number */
695705

696706
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
697707
if (!gpe_event_info) {
698708
status = AE_BAD_PARAMETER;
699-
goto unlock_and_exit;
709+
goto free_and_exit;
700710
}
701711

702712
/* Make sure that there isn't a handler there already */
703713

704714
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
705715
ACPI_GPE_DISPATCH_HANDLER) {
706716
status = AE_ALREADY_EXISTS;
707-
goto unlock_and_exit;
717+
goto free_and_exit;
708718
}
709719

710720
/* Allocate and init handler object */
711721

712-
handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
713-
if (!handler) {
714-
status = AE_NO_MEMORY;
715-
goto unlock_and_exit;
716-
}
717-
718722
handler->address = address;
719723
handler->context = context;
720724
handler->method_node = gpe_event_info->dispatch.method_node;
725+
handler->orig_flags = gpe_event_info->flags &
726+
(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
727+
728+
/*
729+
* If the GPE is associated with a method and it cannot wake up the
730+
* system from sleep states, it was enabled automatically during
731+
* initialization, so it has to be disabled now to avoid spurious
732+
* execution of the handler.
733+
*/
734+
735+
if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD)
736+
&& !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE))
737+
(void)acpi_raw_disable_gpe(gpe_event_info);
721738

722739
/* Install the handler */
723740

724-
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
725741
gpe_event_info->dispatch.handler = handler;
726742

727743
/* Setup up dispatch flags to indicate handler (vs. method) */
@@ -735,6 +751,11 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
735751
unlock_and_exit:
736752
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
737753
return_ACPI_STATUS(status);
754+
755+
free_and_exit:
756+
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
757+
ACPI_FREE(handler);
758+
goto unlock_and_exit;
738759
}
739760

740761
ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
@@ -770,11 +791,17 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
770791
return_ACPI_STATUS(AE_BAD_PARAMETER);
771792
}
772793

794+
/* Make sure all deferred tasks are completed */
795+
796+
acpi_os_wait_events_complete(NULL);
797+
773798
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
774799
if (ACPI_FAILURE(status)) {
775800
return_ACPI_STATUS(status);
776801
}
777802

803+
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
804+
778805
/* Ensure that we have a valid GPE number */
779806

780807
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
@@ -798,34 +825,34 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
798825
goto unlock_and_exit;
799826
}
800827

801-
/* Make sure all deferred tasks are completed */
802-
803-
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
804-
acpi_os_wait_events_complete(NULL);
805-
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
806-
if (ACPI_FAILURE(status)) {
807-
return_ACPI_STATUS(status);
808-
}
809-
810828
/* Remove the handler */
811829

812-
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
813830
handler = gpe_event_info->dispatch.handler;
814831

815832
/* Restore Method node (if any), set dispatch flags */
816833

817834
gpe_event_info->dispatch.method_node = handler->method_node;
818-
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
819-
if (handler->method_node) {
820-
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
821-
}
822-
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
835+
gpe_event_info->flags &=
836+
~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
837+
gpe_event_info->flags |= handler->orig_flags;
838+
839+
/*
840+
* If the GPE was previously associated with a method and it cannot wake
841+
* up the system from sleep states, it should be enabled at this point
842+
* to restore the post-initialization configuration.
843+
*/
844+
845+
if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD)
846+
&& !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE))
847+
(void)acpi_raw_enable_gpe(gpe_event_info);
823848

824849
/* Now we can free the handler object */
825850

826851
ACPI_FREE(handler);
827852

828-
unlock_and_exit:
853+
unlock_and_exit:
854+
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
855+
829856
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
830857
return_ACPI_STATUS(status);
831858
}

0 commit comments

Comments
 (0)