* [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume @ 2006-06-18 19:14 Matthew Garrett 2006-06-19 22:57 ` karsten wiese 2006-06-20 6:01 ` [PATCH] " Andrew Morton 0 siblings, 2 replies; 7+ messages in thread From: Matthew Garrett @ 2006-06-18 19:14 UTC (permalink / raw) To: linux-kernel, linux-acpi Some VIA southbridges contain a flag in the ACPI register space that indicates whether an abnormal poweroff has occured, presumably with the intention that it can be cleared on clean shutdown. Some BIOSes check this flag at resume time, and will re-POST the system rather than jump back to the OS if it's set. Clearing it at boot time appears to be sufficient. I'm not sure if drivers/pci/quirks.c is the right place to do it, but I'm not sure where would be cleaner. Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 7537260..2f9f996 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -660,6 +660,33 @@ static void __devinit quirk_vt82c598_id( } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); +#ifdef CONFIG_ACPI + +/* Some VIA systems boot with the abnormal status flag set. This can cause + * the BIOS to re-POST the system on resume rather than passing control + * back to the OS. Clear the flag on boot + */ + +static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev) +{ + u32 register; + + acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, + ®ister); + + if (register & 0x800) { + printk ("Clearing abnormal poweroff flag\n"); + acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + (u16)0x800); + } +} + +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff); + +#endif + /* * CardBus controllers have a legacy base address that enables them * to respond as i82365 pcmcia controllers. We don't want them to -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume 2006-06-18 19:14 [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume Matthew Garrett @ 2006-06-19 22:57 ` karsten wiese 2006-06-19 23:51 ` [FIXED PATCH] " Matthew Garrett 2006-06-20 6:01 ` [PATCH] " Andrew Morton 1 sibling, 1 reply; 7+ messages in thread From: karsten wiese @ 2006-06-19 22:57 UTC (permalink / raw) To: Matthew Garrett; +Cc: linux-kernel, linux-acpi --- Matthew Garrett <mjg59@srcf.ucam.org> schrieb: > Some VIA southbridges contain a flag in the ACPI register space that > indicates whether an abnormal poweroff has occured, presumably with the > intention that it can be cleared on clean shutdown. Some BIOSes check (intel defines this bit as being set, when poweroff-button is pressed for > 4s. They say, BIOS is responsible for handling it.) > this flag at resume time, and will re-POST the system rather than jump > back to the OS if it's set. Clearing it at boot time appears to be > sufficient. I'm not sure if drivers/pci/quirks.c is the right place to > do it, but I'm not sure where would be cleaner. > > Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org> > > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > index 7537260..2f9f996 100644 > --- a/drivers/pci/quirks.c > +++ b/drivers/pci/quirks.c > @@ -660,6 +660,33 @@ static void __devinit quirk_vt82c598_id( > } > DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); > > +#ifdef CONFIG_ACPI > + > +/* Some VIA systems boot with the abnormal status flag set. This can cause > + * the BIOS to re-POST the system on resume rather than passing control > + * back to the OS. Clear the flag on boot > + */ > + > +static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev) > +{ > + u32 register; register is a keword for gcc here.... > + > + acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, > + ®ister); > + > + if (register & 0x800) { > + printk ("Clearing abnormal poweroff flag\n"); > + acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, > + ACPI_REGISTER_PM1_STATUS, > + (u16)0x800); > + } > +} > + > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff); and here it should be PCI_VENDOR_ID_VIA. > + > +#endif > + > /* > * CardBus controllers have a legacy base address that enables them > * to respond as i82365 pcmcia controllers. We don't want them to > > -- with above comments applied it works on this VIA K8T800 mobo. Please repost. Thanks! ACKed-by: Karsten Wiese <annabellesgarden@yahoo.de> ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* [FIXED PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume 2006-06-19 22:57 ` karsten wiese @ 2006-06-19 23:51 ` Matthew Garrett 0 siblings, 0 replies; 7+ messages in thread From: Matthew Garrett @ 2006-06-19 23:51 UTC (permalink / raw) To: karsten wiese; +Cc: linux-kernel, linux-acpi, gregkh On Tue, Jun 20, 2006 at 12:57:19AM +0200, karsten wiese wrote: > --- Matthew Garrett <mjg59@srcf.ucam.org> schrieb: > > Some VIA southbridges contain a flag in the ACPI register space that > > indicates whether an abnormal poweroff has occured, presumably with the > > intention that it can be cleared on clean shutdown. Some BIOSes check > > (intel defines this bit as being set, when poweroff-button is > pressed for > 4s. They say, BIOS is responsible for handling it.) Interesting. The ACPI spec claims that it should just be ignored by the OS. > with above comments applied it works on this VIA K8T800 mobo. > Please repost. Thanks! Yes, I sent entirely the wrong one. Try this. Some VIA southbridges contain a flag in the ACPI register space that indicates whether an abnormal poweroff has occured, presumably with the intention that it can be cleared on clean shutdown. Some BIOSes check this and will fail to resume if it's set. Clear it on boot in order to prevent this. Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org> ACKed-by: Karsten Wiese <annabellesgarden@yahoo.de> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 7537260..01da8cc 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -660,6 +660,33 @@ static void __devinit quirk_vt82c598_id( } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); +#ifdef CONFIG_ACPI + +/* Some VIA systems boot with the abnormal status flag set. This can cause + * the BIOS to re-POST the system on resume rather than passing control + * back to the OS. Clear the flag on boot + */ + +static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev) +{ + u32 pm1_status; + + acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, + &pm1_status); + + if (pm1_status & 0x800) { + printk ("Clearing abnormal poweroff flag\n"); + acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + (u16)0x800); + } +} + +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff); + +#endif + /* * CardBus controllers have a legacy base address that enables them * to respond as i82365 pcmcia controllers. We don't want them to -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume 2006-06-18 19:14 [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume Matthew Garrett 2006-06-19 22:57 ` karsten wiese @ 2006-06-20 6:01 ` Andrew Morton 2006-06-20 8:54 ` Matthew Garrett 1 sibling, 1 reply; 7+ messages in thread From: Andrew Morton @ 2006-06-20 6:01 UTC (permalink / raw) To: Matthew Garrett; +Cc: linux-kernel, linux-acpi On Sun, 18 Jun 2006 20:14:22 +0100 Matthew Garrett <mjg59@srcf.ucam.org> wrote: > Some VIA southbridges contain a flag in the ACPI register space that > indicates whether an abnormal poweroff has occured, presumably with the > intention that it can be cleared on clean shutdown. Some BIOSes check > this flag at resume time, and will re-POST the system rather than jump > back to the OS if it's set. Clearing it at boot time appears to be > sufficient. I'm not sure if drivers/pci/quirks.c is the right place to > do it, but I'm not sure where would be cleaner. > > Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org> > > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > index 7537260..2f9f996 100644 > --- a/drivers/pci/quirks.c > +++ b/drivers/pci/quirks.c > @@ -660,6 +660,33 @@ static void __devinit quirk_vt82c598_id( > } > DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); > > +#ifdef CONFIG_ACPI > + > +/* Some VIA systems boot with the abnormal status flag set. This can cause > + * the BIOS to re-POST the system on resume rather than passing control > + * back to the OS. Clear the flag on boot > + */ > + > +static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev) > +{ > + u32 register; > + > + acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, > + ®ister); > + > + if (register & 0x800) { > + printk ("Clearing abnormal poweroff flag\n"); > + acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, > + ACPI_REGISTER_PM1_STATUS, > + (u16)0x800); > + } > +} > + > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff); > + > +#endif Is CONFIG_ACPI the right thing to use here? As opposed to, say, CONFIG_PM? Or CONFIG_ACPI_SLEEP?? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume 2006-06-20 6:01 ` [PATCH] " Andrew Morton @ 2006-06-20 8:54 ` Matthew Garrett 2006-06-20 9:07 ` Andrew Morton 0 siblings, 1 reply; 7+ messages in thread From: Matthew Garrett @ 2006-06-20 8:54 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-kernel, linux-acpi On Mon, Jun 19, 2006 at 11:01:44PM -0700, Andrew Morton wrote: > Is CONFIG_ACPI the right thing to use here? As opposed to, say, CONFIG_PM? > Or CONFIG_ACPI_SLEEP?? I've implemented it using the acpi register handling code, so CONFIG_ACPI_something makes sense. I believe that the APM bios will handle it itself, but the machine I have doesn't support APM so can't check that. CONFIG_ACPI_SLEEP might be a better choice than CONFIG_ACPI, yes. -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume 2006-06-20 8:54 ` Matthew Garrett @ 2006-06-20 9:07 ` Andrew Morton 0 siblings, 0 replies; 7+ messages in thread From: Andrew Morton @ 2006-06-20 9:07 UTC (permalink / raw) To: Matthew Garrett; +Cc: linux-kernel, linux-acpi On Tue, 20 Jun 2006 09:54:29 +0100 Matthew Garrett <mjg59@srcf.ucam.org> wrote: > CONFIG_ACPI_SLEEP might be a better choice than CONFIG_ACPI, > yes. OK, I diddled the diff to use CONFIG_ACPI_SLEEP, thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <9c7fa61f1003121013j3e4c9c5djb8de244f2e345943@mail.gmail.com>]
* Fwd: [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume [not found] <9c7fa61f1003121013j3e4c9c5djb8de244f2e345943@mail.gmail.com> @ 2010-03-12 18:41 ` Marcus Lell 2010-03-12 21:01 ` Marcus Lell 0 siblings, 1 reply; 7+ messages in thread From: Marcus Lell @ 2010-03-12 18:41 UTC (permalink / raw) To: linux-kernel hi all, [please cc me, as I am not subscribed to lkml] maybe this patch got lost... >Mon, 19 Jun 2006 23:01:48 -0700 >Andrew Morton wrote: > >>On Sun, 18 Jun 2006 20:14:22 +0100 >>Matthew Garrett <[EMAIL PROTECTED]> wrote: >> >> Some VIA southbridges contain a flag in the ACPI register space that >> indicates whether an abnormal poweroff has occured, presumably with the >> intention that it can be cleared on clean shutdown. Some BIOSes check >> this flag at resume time, and will re-POST the system rather than jump >> back to the OS if it's set. Clearing it at boot time appears to be >> sufficient. I'm not sure if drivers/pci/quirks.c is the right place to >> do it, but I'm not sure where would be cleaner. >> >> Signed-off-by: Matthew Garrett <[EMAIL PROTECTED]> >> >> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c >> index 7537260..2f9f996 100644 >> --- a/drivers/pci/quirks.c >> +++ b/drivers/pci/quirks.c >> @@ -660,6 +660,33 @@ static void __devinit quirk_vt82c598_id( >> } >> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, >> quirk_vt82c598_id ); >> >> +#ifdef CONFIG_ACPI >> + >> +/* Some VIA systems boot with the abnormal status flag set. This can cause >> + * the BIOS to re-POST the system on resume rather than passing control >> + * back to the OS. Clear the flag on boot >> + */ >> + >> +static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev) >> +{ >> + u32 reg; >> + >> + acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, >> + ®); >> + >> + if (reg & 0x800) { >> + printk ("Clearing abnormal poweroff flag\n"); >> + acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, >> + ACPI_REGISTER_PM1_STATUS, >> + (u16)0x800); >> + } >> +} >> + >> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8235, >> quirk_via_abnormal_poweroff); >> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8237, >> quirk_via_abnormal_poweroff); >> + >> +#endif > >Is CONFIG_ACPI the right thing to use here? As opposed to, say, >CONFIG_PM? >Or CONFIG_ACPI_SLEEP?? I am still (@2010) not able to boot for a suspended (STR) system. my pc reboots normally instead of resuming. maybe this patch fixes this. (I did a 's/register/reg/' in the orginal patch for obvious reasons...) unfortunately I am not able to port it to 2.6.33, I don't know the kernel api... I tried to test it, but it doesn't compile on 2.6.24.7 or 2.6.25.20, but was posted in 2.6.25 time line for sure. (iirc it was based on the 2.6.25-mm2 patch) as I don't know, what I can do about it, I am posting it here. I hope, that someone comes in with advises, or better, patches, that apply to 2.6.33 or 2.6.34-rc1. :-) of course, I will be very glad to test patches, or will try to port this patch, thus it is be more unlikely, that I am able to. marcus lell -- return to the point of no return._ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume 2010-03-12 18:41 ` Fwd: " Marcus Lell @ 2010-03-12 21:01 ` Marcus Lell 0 siblings, 0 replies; 7+ messages in thread From: Marcus Lell @ 2010-03-12 21:01 UTC (permalink / raw) To: linux-kernel oh, googlemail fucked the lat one up... I hope this patch looks better. when not let us blame google... :-) On Fri, Mar 12, 2010 at 7:41 PM, Marcus Lell <marcus.lell@googlemail.com> wrote: > hi all, > > [please cc me, as I am not subscribed to lkml] > > maybe this patch got lost... > >>Mon, 19 Jun 2006 23:01:48 -0700 >>Andrew Morton wrote: >> >>>On Sun, 18 Jun 2006 20:14:22 +0100 >>>Matthew Garrett <[EMAIL PROTECTED]> wrote: >>> >>> Some VIA southbridges contain a flag in the ACPI register space that >>> indicates whether an abnormal poweroff has occured, presumably with the >>> intention that it can be cleared on clean shutdown. Some BIOSes check >>> this flag at resume time, and will re-POST the system rather than jump >>> back to the OS if it's set. Clearing it at boot time appears to be >>> sufficient. I'm not sure if drivers/pci/quirks.c is the right place to >>> do it, but I'm not sure where would be cleaner. >>> >>> Signed-off-by: Matthew Garrett <[EMAIL PROTECTED]> >>> >>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c >>> index 7537260..2f9f996 100644 >>> --- a/drivers/pci/quirks.c >>> +++ b/drivers/pci/quirks.c >>> @@ -660,6 +660,33 @@ static void __devinit quirk_vt82c598_id( >>> } >>> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, >>> quirk_vt82c598_id ); >>> >>> +#ifdef CONFIG_ACPI >>> + >>> +/* Some VIA systems boot with the abnormal status flag set. This can > cause >>> + * the BIOS to re-POST the system on resume rather than passing control >>> + * back to the OS. Clear the flag on boot >>> + */ >>> + >>> +static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev) >>> +{ >>> + u32 reg; >>> + >>> + acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, > ACPI_REGISTER_PM1_STATUS, >>> + ®); >>> + >>> + if (reg & 0x800) { >>> + printk ("Clearing abnormal poweroff flag\n"); >>> + acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, >>> + ACPI_REGISTER_PM1_STATUS, >>> + (u16)0x800); >>> + } >>> +} >>> + >>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8235, >>> quirk_via_abnormal_poweroff); >>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_VIA, PCI_DEVICE_ID_VIA_8237, >>> quirk_via_abnormal_poweroff); >>> + >>> +#endif >> >>Is CONFIG_ACPI the right thing to use here? As opposed to, say, >>CONFIG_PM? >>Or CONFIG_ACPI_SLEEP?? > > I am still (@2010) not able to boot for a suspended (STR) system. my > pc reboots normally > instead of resuming. maybe this patch fixes this. > (I did a 's/register/reg/' in the orginal patch for obvious reasons...) > > unfortunately I am not able to port it to 2.6.33, I don't know the kernel api... > > I tried to test it, but it doesn't compile on 2.6.24.7 or 2.6.25.20, > but was posted in 2.6.25 time line for sure. (iirc it was based on the > 2.6.25-mm2 patch) > > as I don't know, what I can do about it, I am posting it here. > I hope, that someone comes in with advises, or better, patches, that > apply to 2.6.33 or 2.6.34-rc1. :-) > > of course, I will be very glad to test patches, or will try to port > this patch, thus it is be more unlikely, that I am able to. > > > marcus lell > > -- > return to the point of no return._ > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-03-12 21:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-18 19:14 [PATCH] Clear abnormal poweroff flag on VIA southbridges, fix resume Matthew Garrett
2006-06-19 22:57 ` karsten wiese
2006-06-19 23:51 ` [FIXED PATCH] " Matthew Garrett
2006-06-20 6:01 ` [PATCH] " Andrew Morton
2006-06-20 8:54 ` Matthew Garrett
2006-06-20 9:07 ` Andrew Morton
[not found] <9c7fa61f1003121013j3e4c9c5djb8de244f2e345943@mail.gmail.com>
2010-03-12 18:41 ` Fwd: " Marcus Lell
2010-03-12 21:01 ` Marcus Lell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox