public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
@ 2002-03-10 18:05 Mario 'BitKoenig' Holbe
  2002-03-11 20:34 ` Pavel Machek
  0 siblings, 1 reply; 9+ messages in thread
From: Mario 'BitKoenig' Holbe @ 2002-03-10 18:05 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

Hello,

since I didn't notice any change about the fact, that since 2.4.14
kernel, after issuing 'halt', the Keyboard Power-ON and Wake-On-LAN
don't work anymore on my ASUS P3B-F, which I reported Thu, 15 Nov 2001
18:43:22 +0100 here on this list, I wrote a small patch to fix
this myself.

The patch does nothing else than suppressing the clearing of the
General Purpose Events (GPEs).

Thanks to Patrick Mochel, who explained me, what was changed
between 2.4.13 and 2.4.14 regarding my problem.

The patch applies to 2.4.14 up to 2.4.18 at least.

With this patch applied and CONFIG_ACPI_NO_GPE_DISABLE #define'd,
Keyboard-Power-ON as well as Wake-On-LAN are working for me,
without this patch or with CONFIG_ACPI_NO_GPE_DISABLE #undef'ined,
both don't work.

Of course, there would be better ways to dynamically change this
behaviour (via some kernel option for example), but the way the
patch goes, was the least invasive one for me.

I have no idea about possible side-effects of suppressing the
execution of acpi_hw_disable_non_wakeup_gpes(), but i'd like
to hear about them, if there are any.

If there are no (relevant) side-effects, I'd be happy, if you'd
consider applying it to 2.4.19 or something like that.

And yes, I did notice, that acpi_hw_disable_non_wakeup_gpes()
should disable *non-wakeup* GPEs, but however - at least for
me it disables more than them :)


PS: I'm not member on the linux-kernel@ list, so please CC me in
    replies, thanks.


regards,
   Mario
-- 
[mod_nessus for iauth]
<delta> "scanning your system...found depreciated OS...found
        hole...installing new OS...please reboot and reconnect now"

[-- Attachment #2: kernel-source-2.4.14.ACPI-SoftWake.patch --]
[-- Type: text/plain, Size: 2024 bytes --]

diff -ur kernel-source-2.4.14.orig/Documentation/Configure.help kernel-source-2.4.14/Documentation/Configure.help
--- kernel-source-2.4.14.orig/Documentation/Configure.help	Thu Nov  8 09:32:56 2001
+++ kernel-source-2.4.14/Documentation/Configure.help	Sun Mar 10 16:54:02 2002
@@ -14727,6 +14727,12 @@
   This driver handles overheating conditions on laptops. It is HIGHLY
   recommended, as your laptop CPU may be damaged without it.
 
+ACPI Dont disable GPE events
+CONFIG_ACPI_NO_GPE_DISABLE
+  Normally we disable all GPE events when we enter a system sleep state.
+  If you experience, that your Keyboard-Power-ON or other Wakeup
+  methods don't work anymore, try setting this to Y. Otherwise, say N.
+  
 Advanced Power Management BIOS support
 CONFIG_APM
   APM is a BIOS specification for saving power using several different
diff -ur kernel-source-2.4.14.orig/drivers/acpi/Config.in kernel-source-2.4.14/drivers/acpi/Config.in
--- kernel-source-2.4.14.orig/drivers/acpi/Config.in	Thu Jun 21 02:47:39 2001
+++ kernel-source-2.4.14/drivers/acpi/Config.in	Sun Mar 10 16:52:58 2002
@@ -14,4 +14,5 @@
 dep_tristate '      Embedded Controller' CONFIG_ACPI_EC $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
 dep_tristate '      Control Method Battery' CONFIG_ACPI_CMBATT $CONFIG_ACPI_BUSMGR $CONFIG_ACPI $CONFIG_ACPI_EC
 dep_tristate '      Thermal' CONFIG_ACPI_THERMAL $CONFIG_ACPI_BUSMGR $CONFIG_ACPI  $CONFIG_ACPI_EC
+dep_bool     '      Dont disable GPE events' CONFIG_ACPI_NO_GPE_DISABLE $CONFIG_ACPI
 #endmenu
diff -ur kernel-source-2.4.14.orig/drivers/acpi/hardware/hwsleep.c kernel-source-2.4.14/drivers/acpi/hardware/hwsleep.c
--- kernel-source-2.4.14.orig/drivers/acpi/hardware/hwsleep.c	Wed Oct 24 23:06:22 2001
+++ kernel-source-2.4.14/drivers/acpi/hardware/hwsleep.c	Sun Mar 10 16:47:45 2002
@@ -171,7 +171,9 @@
 
 	disable ();
 
+#ifndef CONFIG_ACPI_NO_GPE_DISABLE
 	acpi_hw_disable_non_wakeup_gpes();
+#endif /* CONFIG_ACPI_NO_GPE_DISABLE */
 
 	PM1Acontrol = (u16) acpi_hw_register_read (ACPI_MTX_LOCK, PM1_CONTROL);
 

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

* Re: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
  2002-03-10 18:05 [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14 Mario 'BitKoenig' Holbe
@ 2002-03-11 20:34 ` Pavel Machek
  2002-03-12 15:08   ` Mario 'BitKoenig' Holbe
  0 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2002-03-11 20:34 UTC (permalink / raw)
  To: Mario 'BitKoenig' Holbe; +Cc: linux-kernel

Hi!


> With this patch applied and CONFIG_ACPI_NO_GPE_DISABLE #define'd,
> Keyboard-Power-ON as well as Wake-On-LAN are working for me,
> without this patch or with CONFIG_ACPI_NO_GPE_DISABLE #undef'ined,
> both don't work.

I guess this needs to be runtime-configurable at least. It is probably
bug. Introducing the config option is not right fix.
								Pavel

-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa

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

* Re: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
  2002-03-11 20:34 ` Pavel Machek
@ 2002-03-12 15:08   ` Mario 'BitKoenig' Holbe
  0 siblings, 0 replies; 9+ messages in thread
From: Mario 'BitKoenig' Holbe @ 2002-03-12 15:08 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

On Mon, Mar 11, 2002 at 09:34:39PM +0100, Pavel Machek wrote:
> I guess this needs to be runtime-configurable at least. It is probably
> bug. Introducing the config option is not right fix.

Yes, you are right.
But as I told: It was the least invasive method for me.

Applying it as a config option, would include adding a MODULE_PARM
section, which doesn't exist yet (not for me, I have ACPI compiled
into the kernel, but to keep it consistent even if compiled as
module). I'm not *that* proof with linux kernel source to guarantee
side-effect-freeness and so on.

This part I'd like to leave for developers knowing better, what
they're doing :)

However, if someone of the ACPI developers or someone of the
patch-acceptors (:)) tells me 'do it, we'll patch it in', I'll do
it.
If it has no chance to get in, I wont do it - for me myself, my
patch is quite enough :)


thanks for your response & regards,
   Mario
-- 
Mario 'BitKoenig' Holbe <Mario.Holbe@RZ.TU-Ilmenau.DE>

"Why are we hiding from the police, daddy?"      | J. E. Guenther
"Because we use SuSE son, they use SYSVR4."      | de.alt.sysadmin.recovery

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

* RE: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
@ 2002-03-12 19:57 Grover, Andrew
  2002-03-12 20:40 ` Patrick Mochel
  2002-03-12 22:38 ` Mario 'BitKoenig' Holbe
  0 siblings, 2 replies; 9+ messages in thread
From: Grover, Andrew @ 2002-03-12 19:57 UTC (permalink / raw)
  To: 'Mario 'BitKoenig' Holbe', Pavel Machek; +Cc: linux-kernel

> From: Mario 'BitKoenig' Holbe [mailto:Mario.Holbe@RZ.TU-Ilmenau.DE]
> However, if someone of the ACPI developers or someone of the
> patch-acceptors (:)) tells me 'do it, we'll patch it in', I'll do
> it.
> If it has no chance to get in, I wont do it - for me myself, my
> patch is quite enough :)

Basically we have to disable non-wake GPEs prior to sleeping - I agree with
Pavel that this should not be a config option. The real problem is that the
keyboard GPE should be flagged as a wake GPE, but it isn't yet.

What needs to happen is, when we are entering a sleep state, we need to
evaluate _PRW and _PSW objects for devices, and take the appropriate action
- I would bet that a result of doing this would be that keyboard (WOL too?
maybe) would be properly flagged as a wake device, so the call to that
function would but turn off its GPE bit.

Regards -- Andy

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

* RE: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
  2002-03-12 19:57 Grover, Andrew
@ 2002-03-12 20:40 ` Patrick Mochel
  2002-03-12 22:38 ` Mario 'BitKoenig' Holbe
  1 sibling, 0 replies; 9+ messages in thread
From: Patrick Mochel @ 2002-03-12 20:40 UTC (permalink / raw)
  To: Grover, Andrew
  Cc: 'Mario 'BitKoenig' Holbe', Pavel Machek,
	linux-kernel


On Tue, 12 Mar 2002, Grover, Andrew wrote:

> > From: Mario 'BitKoenig' Holbe [mailto:Mario.Holbe@RZ.TU-Ilmenau.DE]
> > However, if someone of the ACPI developers or someone of the
> > patch-acceptors (:)) tells me 'do it, we'll patch it in', I'll do
> > it.
> > If it has no chance to get in, I wont do it - for me myself, my
> > patch is quite enough :)
> 
> Basically we have to disable non-wake GPEs prior to sleeping - I agree with
> Pavel that this should not be a config option. The real problem is that the
> keyboard GPE should be flagged as a wake GPE, but it isn't yet.
> 
> What needs to happen is, when we are entering a sleep state, we need to
> evaluate _PRW and _PSW objects for devices, and take the appropriate action
> - I would bet that a result of doing this would be that keyboard (WOL too?
> maybe) would be properly flagged as a wake device, so the call to that
> function would but turn off its GPE bit.

It seems like this would ideally be specified in the config file for the 
power management agent. So, before the transition to sleep began, the 
agent would enable those devices to wake the system (probably by writing a 
value to a driverfs file). 

The only thing is that you probably want all devices of a particular class 
to wake a system - like all keyboards or all net devices. I don't know 
what the config file format for ospmd looks like, but it might articulated 
like:

/* devices to wake the system when we go to sleep */
wake {
	keyboard
	network
	mouse
}

Right?

	-pat


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

* RE: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
@ 2002-03-12 21:51 Grover, Andrew
  0 siblings, 0 replies; 9+ messages in thread
From: Grover, Andrew @ 2002-03-12 21:51 UTC (permalink / raw)
  To: 'Patrick Mochel'
  Cc: 'Mario 'BitKoenig' Holbe', Pavel Machek,
	linux-kernel

> From: Patrick Mochel [mailto:mochel@osdl.org]
> It seems like this would ideally be specified in the config 
> file for the 
> power management agent. So, before the transition to sleep began, the 
> agent would enable those devices to wake the system (probably 
> by writing a 
> value to a driverfs file). 

Agree.

> The only thing is that you probably want all devices of a 
> particular class 
> to wake a system - like all keyboards or all net devices. I 
> don't know 
> what the config file format for ospmd looks like, but it 
> might articulated 
> like:
> 
> /* devices to wake the system when we go to sleep */
> wake {
> 	keyboard
> 	network
> 	mouse
> }
> Right?

Sounds OK to me. Once the wake capability and class of a device are both
visible through driverfs, implementing functionality like this in userspace
is easy.

Regards -- Andy

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

* Re: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
  2002-03-12 19:57 Grover, Andrew
  2002-03-12 20:40 ` Patrick Mochel
@ 2002-03-12 22:38 ` Mario 'BitKoenig' Holbe
  1 sibling, 0 replies; 9+ messages in thread
From: Mario 'BitKoenig' Holbe @ 2002-03-12 22:38 UTC (permalink / raw)
  To: Grover, Andrew; +Cc: Pavel Machek, linux-kernel

On Tue, Mar 12, 2002 at 11:57:48AM -0800, Grover, Andrew wrote:
> Pavel that this should not be a config option. The real problem is that the
> keyboard GPE should be flagged as a wake GPE, but it isn't yet.
> 
> What needs to happen is, when we are entering a sleep state, we need to
> evaluate _PRW and _PSW objects for devices, and take the appropriate action

Well, as I said a few postings ago, I'm not really proof with
ACPI.

But ... from a users point of view (which I seem to be proof for -
especially in *this* case :)):

I enable in the BIOS, what devices should be considered wake
up devices.
This works very well with Windows (not that I'm going to use that,
I just tested it to validate, if it works there), it did work
very well with 2.4.13 too (yes, I know, there was the TODO: disable
GPEs).

Where is the problem to read those wake up events from the BIOS?

Why should I configure this twice - once in BIOS, once in some
ominous ospmd?

I grepped the ACPI code...

If I understand it right, a call to acpi_hw_enable_gpe_for_wakeup(event)
would mark one specific event as wakeup event.
The only call to this function is in acpi_enable_event(...).
And the only call to acpi_enable_event() is in
acpi_install_fixed_event_handler(...) and is flagged as
ACPI_EVENT_FIXED, so that acpi_hw_enable_gpe_for_wakeup() is
*never* called in the whole ACPI code at the moment, so how
can there be GPEs marked as wakeup events however?

And if there can't be any, why should I'm not be able to work
around this bug?
And yes - I consider this as bug :) There is code, which is never
called, afaics.


regards,
   Mario, trying to understand :)
-- 
Programmieren in C++ haelt die grauen Zellen am Leben. Es schaerft
alle fuenf Sinne: den Schwachsinn, den Bloedsinn, den Wahnsinn, den
Unsinn und den Stumpfsinn.
                                 [Holger Veit in doc]

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

* RE: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
@ 2002-03-12 23:05 Grover, Andrew
  2002-03-12 23:13 ` Mario 'BitKoenig' Holbe
  0 siblings, 1 reply; 9+ messages in thread
From: Grover, Andrew @ 2002-03-12 23:05 UTC (permalink / raw)
  To: 'Mario 'BitKoenig' Holbe'; +Cc: Pavel Machek, linux-kernel

> From: Mario 'BitKoenig' Holbe [mailto:Mario.Holbe@RZ.TU-Ilmenau.DE]

[explanation of problem and various code paths snipped]

> And if there can't be any, why should I'm not be able to work
> around this bug?
> And yes - I consider this as bug :) There is code, which is never
> called, afaics.

Well sure, you can work around this bug on your particular machine, but I
can't do the same because then, unlike your machine where not enough devices
are enabled for wake, *too many* devices will be enabled for wake on some
machines. This results in them not turning off properly -- they come right
back on. ;-)

So, there is a general-purpose fix for this, it just is going to take more
than deleting one line.

Regards -- Andy

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

* Re: [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14
  2002-03-12 23:05 Grover, Andrew
@ 2002-03-12 23:13 ` Mario 'BitKoenig' Holbe
  0 siblings, 0 replies; 9+ messages in thread
From: Mario 'BitKoenig' Holbe @ 2002-03-12 23:13 UTC (permalink / raw)
  To: Grover, Andrew; +Cc: Pavel Machek, linux-kernel

On Tue, Mar 12, 2002 at 03:05:04PM -0800, Grover, Andrew wrote:
> Well sure, you can work around this bug on your particular machine, but I
> can't do the same because then, unlike your machine where not enough devices
> are enabled for wake, *too many* devices will be enabled for wake on some
> machines. This results in them not turning off properly -- they come right
> back on. ;-)

Okay, I understand this part :)

But what's with the more important one? Isn't that simply readable
from the BIOS somehow?
Doesn't store the BIOS the devices used for ACPI wakeup somewhere
in the ACPI tables?
Can't one read them out there?

And if not - is there actually a syscall interface where i can reach
acpi_hw_enable_gpe_for_wakeup()?
And if so - how can I translate devices to GPE numbers?


thanks & regards,
   Mario
-- 
[mod_nessus for iauth]
<delta> "scanning your system...found depreciated OS...found
        hole...installing new OS...please reboot and reconnect now"

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

end of thread, other threads:[~2002-03-12 23:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-10 18:05 [patch] ACPI: kbd-pw-on/WOL don't work anymore since 2.4.14 Mario 'BitKoenig' Holbe
2002-03-11 20:34 ` Pavel Machek
2002-03-12 15:08   ` Mario 'BitKoenig' Holbe
  -- strict thread matches above, loose matches on Subject: below --
2002-03-12 19:57 Grover, Andrew
2002-03-12 20:40 ` Patrick Mochel
2002-03-12 22:38 ` Mario 'BitKoenig' Holbe
2002-03-12 21:51 Grover, Andrew
2002-03-12 23:05 Grover, Andrew
2002-03-12 23:13 ` Mario 'BitKoenig' Holbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox