All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI : Disable the device's ability to wake the sleeping system in the boot phase
@ 2008-03-18  5:47 Zhao Yakui
  2008-03-19  2:40 ` [PATCH] ACPI : Disable the device's ability to wake the sleepingsystem " Shaohua Li
  0 siblings, 1 reply; 6+ messages in thread
From: Zhao Yakui @ 2008-03-18  5:47 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi

Subject: ACPI : Disable the device's ability to wake the sleeping system in the boot phase
>From : Zhao Yakui <yakui.zhao@intel.com>

In some machines some GPE is shared by several ACPI devices, for example:
sleep button, keyboard, mouse. At the same time one of them is 
non-wake(runtime) device and the other are wake devices. In such case OSPM
should call the _PSW object to disable the device's ability to 
wake the sleeping system in the boot phase.
Otherwise there will be ACPI interrupt flood triggered by the GPE input.

http://bugzilla.kernel.org/show_bug.cgi?id=9781
http://bugzilla.kernel.org/show_bug.cgi?id=10224

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhang Rui  <rui.zhang@intel.com>

---
 drivers/acpi/scan.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

Index: linux-2.6/drivers/acpi/scan.c
===================================================================
--- linux-2.6.orig/drivers/acpi/scan.c
+++ linux-2.6/drivers/acpi/scan.c
@@ -686,6 +686,9 @@ static int acpi_bus_get_wakeup_device_fl
 	acpi_status status = 0;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *package = NULL;
+	union acpi_object arg = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list arg_list = { 1, &arg };
+	acpi_status psw_status = AE_OK;
 
 	struct acpi_device_id button_device_ids[] = {
 		{"PNP0C0D", 0},
@@ -695,6 +698,7 @@ static int acpi_bus_get_wakeup_device_fl
 	};
 
 
+	arg.integer.value = 0;
 	/* _PRW */
 	status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer);
 	if (ACPI_FAILURE(status)) {
@@ -712,6 +716,15 @@ static int acpi_bus_get_wakeup_device_fl
 	kfree(buffer.pointer);
 
 	device->wakeup.flags.valid = 1;
+	/* Call _PSW object to disable its ability to wake the sleeping
+	 * system for the ACPI device with the _PRW object.
+	 */
+#ifdef CONFIG_ACPI_POWER
+	psw_status = acpi_evaluate_object(device->handle, "_PSW",
+						&arg_list, NULL);
+	if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND))
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _PSW\n"));
+#endif
 	/* Power button, Lid switch always enable wakeup */
 	if (!acpi_match_device_ids(device, button_device_ids))
 		device->wakeup.flags.run_wake = 1;



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ACPI : Disable the device's ability to wake the sleepingsystem in the boot phase
  2008-03-18  5:47 [PATCH] ACPI : Disable the device's ability to wake the sleeping system in the boot phase Zhao Yakui
@ 2008-03-19  2:40 ` Shaohua Li
  2008-03-19  3:30   ` Zhao Yakui
  0 siblings, 1 reply; 6+ messages in thread
From: Shaohua Li @ 2008-03-19  2:40 UTC (permalink / raw)
  To: Zhao Yakui; +Cc: lenb, linux-acpi


On Tue, 2008-03-18 at 13:47 +0800, Zhao Yakui wrote:
> Subject: ACPI : Disable the device's ability to wake the sleeping
> system in the boot phase
> >From : Zhao Yakui <yakui.zhao@intel.com>
> 
> In some machines some GPE is shared by several ACPI devices, for
> example:
> sleep button, keyboard, mouse. At the same time one of them is
> non-wake(runtime) device and the other are wake devices. In such case
> OSPM
> should call the _PSW object to disable the device's ability to
> wake the sleeping system in the boot phase.
> Otherwise there will be ACPI interrupt flood triggered by the GPE
> input.
> 
> http://bugzilla.kernel.org/show_bug.cgi?id=9781
> http://bugzilla.kernel.org/show_bug.cgi?id=10224
Good catch, but I'm wondering if we should call _PSR early, eg in ACPICA
before GPE is enabled. Before the acpi bus scan time, the GPE might
already be invoked and cause interrupt flood.

Thanks,
Shaohua 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ACPI : Disable the device's ability to wake the sleepingsystem in the boot phase
  2008-03-19  2:40 ` [PATCH] ACPI : Disable the device's ability to wake the sleepingsystem " Shaohua Li
@ 2008-03-19  3:30   ` Zhao Yakui
  0 siblings, 0 replies; 6+ messages in thread
From: Zhao Yakui @ 2008-03-19  3:30 UTC (permalink / raw)
  To: Shaohua Li; +Cc: lenb, linux-acpi

On Wed, 2008-03-19 at 10:40 +0800, Shaohua Li wrote:
> On Tue, 2008-03-18 at 13:47 +0800, Zhao Yakui wrote:
> > Subject: ACPI : Disable the device's ability to wake the sleeping
> > system in the boot phase
> > >From : Zhao Yakui <yakui.zhao@intel.com>
> > 
> > In some machines some GPE is shared by several ACPI devices, for
> > example:
> > sleep button, keyboard, mouse. At the same time one of them is
> > non-wake(runtime) device and the other are wake devices. In such case
> > OSPM
> > should call the _PSW object to disable the device's ability to
> > wake the sleeping system in the boot phase.
> > Otherwise there will be ACPI interrupt flood triggered by the GPE
> > input.
> > 
> > http://bugzilla.kernel.org/show_bug.cgi?id=9781
> > http://bugzilla.kernel.org/show_bug.cgi?id=10224
> Good catch, but I'm wondering if we should call _PSR early, eg in ACPICA
> before GPE is enabled. Before the acpi bus scan time, the GPE might
> already be invoked and cause interrupt flood.
> 
Thanks for the reminder. 
After check the source code, I think that it is unnecessary to call the
_PSM in ACPICA. The _GPE with the _PRW object will be disabled when the
FADT GPE block device is installed in ACPICA.
For the desktops in bug9781 and 10224, there will be ACPI interrupt
flood only after the shared GPE is reenabled.(This is enabled in the
button driver).

Thanks
   Yakui.
> Thanks,
> Shaohua 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ACPI : Disable the device's ability to wake the sleeping system in the boot phase
  2008-03-19  5:26 [PATCH] ACPI : Disable the device's ability to wake the sleeping system " Zhao Yakui
@ 2008-04-10  1:57 ` Len Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Len Brown @ 2008-04-10  1:57 UTC (permalink / raw)
  To: Zhao Yakui; +Cc: linux-acpi

applied to acpi-test



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ACPI : Disable the device's ability to wake the sleeping system in the boot phase
@ 2008-03-19  5:26 Zhao Yakui
  2008-04-10  1:57 ` Len Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Zhao Yakui @ 2008-03-19  5:26 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi

Subject: ACPI : Disable the device's ability to wake the sleeping system in the boot phase
>From : Zhao Yakui <yakui.zhao@intel.com>

In some machines some GPE is shared by several ACPI devices, for example:
sleep button, keyboard, mouse. At the same time one of them is 
non-wake(runtime) device and the other are wake devices. In such case OSPM
should call the _PSW object to disable the device's ability to 
wake the sleeping system in the boot phase.
Otherwise there will be ACPI interrupt flood triggered by the GPE input.

The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW.
So it is necessary to call _DSW object first. Only when it is not
present will the _PSW object used.

http://bugzilla.kernel.org/show_bug.cgi?id=9781
http://bugzilla.kernel.org/show_bug.cgi?id=10224

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhang Rui  <rui.zhang@intel.com>

---
 drivers/acpi/scan.c |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/acpi/scan.c
===================================================================
--- linux-2.6.orig/drivers/acpi/scan.c
+++ linux-2.6/drivers/acpi/scan.c
@@ -686,6 +686,9 @@ static int acpi_bus_get_wakeup_device_fl
 	acpi_status status = 0;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *package = NULL;
+	union acpi_object in_arg[3];
+	struct acpi_object_list arg_list = { 3, in_arg };
+	acpi_status psw_status = AE_OK;
 
 	struct acpi_device_id button_device_ids[] = {
 		{"PNP0C0D", 0},
@@ -694,7 +697,6 @@ static int acpi_bus_get_wakeup_device_fl
 		{"", 0},
 	};
 
-
 	/* _PRW */
 	status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer);
 	if (ACPI_FAILURE(status)) {
@@ -712,6 +714,45 @@ static int acpi_bus_get_wakeup_device_fl
 	kfree(buffer.pointer);
 
 	device->wakeup.flags.valid = 1;
+	/* Call _PSW/_DSW object to disable its ability to wake the sleeping
+	 * system for the ACPI device with the _PRW object.
+	 * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW.
+	 * So it is necessary to call _DSW object first. Only when it is not
+	 * present will the _PSW object used.
+	 */
+	/*
+	 * Three agruments are needed for the _DSW object.
+	 * Argument 0: enable/disable the wake capabilities
+	 * When _DSW object is called to disable the wake capabilities, maybe
+	 * the first argument is filled. The value of the other two agruments
+	 * is meaningless.
+	 */
+	in_arg[0].type = ACPI_TYPE_INTEGER;
+	in_arg[0].integer.value = 0;
+	in_arg[1].type = ACPI_TYPE_INTEGER;
+	in_arg[1].integer.value = 0;
+	in_arg[2].type = ACPI_TYPE_INTEGER;
+	in_arg[2].integer.value = 0;
+	psw_status = acpi_evaluate_object(device->handle, "_DSW",
+						&arg_list, NULL);
+	if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND))
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n"));
+	/*
+	 * When the _DSW object is not present, OSPM will call _PSW object.
+	 */
+	if (psw_status == AE_NOT_FOUND) {
+		/*
+		 * Only one agruments is required for the _PSW object.
+		 * agrument 0: enable/disable the wake capabilities
+		 */
+		arg_list.count = 1;
+		in_arg[0].integer.value = 0;
+		psw_status = acpi_evaluate_object(device->handle, "_PSW",
+						&arg_list, NULL);
+		if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND))
+			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in "
+						"evaluate _PSW\n"));
+	}
 	/* Power button, Lid switch always enable wakeup */
 	if (!acpi_match_device_ids(device, button_device_ids))
 		device->wakeup.flags.run_wake = 1;



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ACPI : Disable the device's ability to wake the sleeping system in the boot phase
@ 2008-03-18  1:03 Zhao Yakui
  0 siblings, 0 replies; 6+ messages in thread
From: Zhao Yakui @ 2008-03-18  1:03 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi

Subject: ACPI : Disable the device's ability to wake the sleeping system in the boot phase
>From : Zhao Yakui <yakui.zhao@intel.com>

In some machines some GPE is shared by several ACPI devices, for example:
sleep button, keyboard, mouse. At the same time one of them is 
non-wake(runtime) device and the other are wake devices. In such case OSPM
should disable the device's ability to wake the sleeping system in the boot 
phase.Otherwise there will be ACPI interrupt flood triggered by the GPE input.

http://bugzilla.kernel.org/show_bug.cgi?id=9781
http://bugzilla.kernel.org/show_bug.cgi?id=10224

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhang Rui  <rui.zhang@intel.com>

---
 drivers/acpi/scan.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/drivers/acpi/scan.c
===================================================================
--- linux-2.6.orig/drivers/acpi/scan.c
+++ linux-2.6/drivers/acpi/scan.c
@@ -712,6 +712,9 @@ static int acpi_bus_get_wakeup_device_fl
 	kfree(buffer.pointer);
 
 	device->wakeup.flags.valid = 1;
+#ifdef CONFIG_ACPI_POWER
+	acpi_disable_wakeup_device_power(device);
+#endif
 	/* Power button, Lid switch always enable wakeup */
 	if (!acpi_match_device_ids(device, button_device_ids))
 		device->wakeup.flags.run_wake = 1;



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-10  1:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-18  5:47 [PATCH] ACPI : Disable the device's ability to wake the sleeping system in the boot phase Zhao Yakui
2008-03-19  2:40 ` [PATCH] ACPI : Disable the device's ability to wake the sleepingsystem " Shaohua Li
2008-03-19  3:30   ` Zhao Yakui
  -- strict thread matches above, loose matches on Subject: below --
2008-03-19  5:26 [PATCH] ACPI : Disable the device's ability to wake the sleeping system " Zhao Yakui
2008-04-10  1:57 ` Len Brown
2008-03-18  1:03 Zhao Yakui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.