Clear abnormal poweroff flag on VIA southbridges, fix resume
PATCH 1/1 Clear abnormal poweroff flag on VIA southbridges, fix resume
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.
drivers/pci/quirks.c +27 -0
@@ -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
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 3 lines · --- Matthew Garrett
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.)
Quoted 15 lines
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.cis the right place to do it, but I'm not sure where would be cleaner.Signed-off-by Matthew Garrett <[email protected]>drivers/pci/quirks.c +0
-0@@ -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 );
drivers/pci/quirks.c static void __devinit quirk_vt82c598_id( · line 672
Quoted 10 lines
drivers/pci/quirks.c +10
-0+#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....
Quoted 4 lines
drivers/pci/quirks.c +4
-0+ +acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK ,ACPI_REGISTER_PM1_STATUS , + ®ister); +
drivers/pci/quirks.c static void __devinit quirk_vt82c598_id( · line 686
Quoted 10 lines
drivers/pci/quirks.c +10
-0+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.
Quoted 8 lines
drivers/pci/quirks.c +3
-0+ +#endif +/* * CardBus controllers have a legacy base address that enables them * to respond as i82365 pcmcia controllers. We don't want them to Signature · 1 line
--
with above comments applied it works on this VIA K8T800 mobo. Please repost. Thanks!
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
PATCH 1/1 Clear abnormal poweroff flag on VIA southbridges, fix resume
Quoted 7 lines · karsten wiese
Quoted 3 lines · --- Matthew Garrett
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.
Quoted 2 lines
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.
drivers/pci/quirks.c +27 -0
@@ -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
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 34 lines · 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.cis the right place to do it, but I'm not sure where would be cleaner.Signed-off-by Matthew Garrett <[email protected]>drivers/pci/quirks.c +16
-0@@ -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" );
drivers/pci/quirks.c static void __devinit quirk_vt82c598_id( · line 688
Quoted 10 lines
drivers/pci/quirks.c +10
-0+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??
Quoted 2 lines · Andrew Morton
Is
CONFIG_ACPIthe right thing to use here? As opposed to, say,CONFIG_PM? OrCONFIG_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.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 2 lines · On Tue, 20 Jun 2006 09:54:29 +0100 Matthew Garrett <[email protected]> wrote:
CONFIG_ACPI_SLEEPmight be a better choice thanCONFIG_ACPI, yes.
OK, I diddled the diff to use CONFIG_ACPI_SLEEP, thanks.