aboutsummaryrefslogtreecommitdiffstats
path: root/pci/pci-clear-abnormal-poweroff-flag-on-via-southbridges-fix-resume.patch
blob: 491629b557eea599fba3ec46a4cc61c449629761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From akpm@osdl.org  Fri Jun 30 16:31:13 2006
Message-Id: <200606300931.k5U9VPjg001630@shell0.pdx.osdl.net>
From: Matthew Garrett <mjg59@srcf.ucam.org>
Subject: PCI: Clear abnormal poweroff flag on VIA southbridges, fix resume
To: greg@kroah.com
Cc: akpm@osdl.org, mjg59@srcf.ucam.org, len.brown@intel.com, luming.yu@intel.com
Date: Fri, 30 Jun 2006 02:31:25 -0700

From: Matthew Garrett <mjg59@srcf.ucam.org>

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.

[akpm@osdl.org: cleanups, build fix]
Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Greg KH <greg@kroah.com>
Cc: "Brown, Len" <len.brown@intel.com>
Cc: "Yu, Luming" <luming.yu@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/pci/quirks.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

--- gregkh-2.6.orig/drivers/pci/quirks.c
+++ gregkh-2.6/drivers/pci/quirks.c
@@ -682,6 +682,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_SLEEP
+
+/*
+ * 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,
+				&reg);
+
+	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_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