aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2011-02-28 04:45:09 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2011-03-04 13:41:32 -0500
commitcdb9755849fbaf2bb9c0a009ba5baa817a0f152d (patch)
tree1bf3e01326a198e0f50e4a8de41866fb416a6987 /drivers
parent457d9d088b026e26dbab98cad9d299c1faf4c343 (diff)
PCI: add more checking to ICH region quirks
Per ICH4 and ICH6 specs, ACPI and GPIO regions are valid iff ACPI_EN and GPIO_EN bits are set to 1. Add checks for these bits into the quirks prior to the region creation. While at it, name the constants by macros. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Thomas Renninger <trenn@suse.de> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/quirks.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index ff01bfb3cc29..9e23912c97ac 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -533,6 +533,17 @@ static void __devinit quirk_piix4_acpi(struct pci_dev *dev)
533DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi); 533DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi);
534DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi); 534DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi);
535 535
536#define ICH_PMBASE 0x40
537#define ICH_ACPI_CNTL 0x44
538#define ICH4_ACPI_EN 0x10
539#define ICH6_ACPI_EN 0x80
540#define ICH4_GPIOBASE 0x58
541#define ICH4_GPIO_CNTL 0x5c
542#define ICH4_GPIO_EN 0x10
543#define ICH6_GPIOBASE 0x48
544#define ICH6_GPIO_CNTL 0x4c
545#define ICH6_GPIO_EN 0x10
546
536/* 547/*
537 * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at 548 * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at
538 * 0x40 (128 bytes of ACPI, GPIO & TCO registers) 549 * 0x40 (128 bytes of ACPI, GPIO & TCO registers)
@@ -541,12 +552,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, qui
541static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev) 552static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev)
542{ 553{
543 u32 region; 554 u32 region;
555 u8 enable;
544 556
545 pci_read_config_dword(dev, 0x40, &region); 557 pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
546 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH4 ACPI/GPIO/TCO"); 558 if (enable & ICH4_ACPI_EN) {
559 pci_read_config_dword(dev, ICH_PMBASE, &region);
560 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
561 "ICH4 ACPI/GPIO/TCO");
562 }
547 563
548 pci_read_config_dword(dev, 0x58, &region); 564 pci_read_config_byte(dev, ICH4_GPIO_CNTL, &enable);
549 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH4 GPIO"); 565 if (enable & ICH4_GPIO_EN) {
566 pci_read_config_dword(dev, ICH4_GPIOBASE, &region);
567 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1,
568 "ICH4 GPIO");
569 }
550} 570}
551DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi); 571DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi);
552DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi); 572DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi);
@@ -562,12 +582,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, qui
562static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev) 582static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev)
563{ 583{
564 u32 region; 584 u32 region;
585 u8 enable;
565 586
566 pci_read_config_dword(dev, 0x40, &region); 587 pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
567 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH6 ACPI/GPIO/TCO"); 588 if (enable & ICH6_ACPI_EN) {
589 pci_read_config_dword(dev, ICH_PMBASE, &region);
590 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
591 "ICH6 ACPI/GPIO/TCO");
592 }
568 593
569 pci_read_config_dword(dev, 0x48, &region); 594 pci_read_config_byte(dev, ICH6_GPIO_CNTL, &enable);
570 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH6 GPIO"); 595 if (enable & ICH4_GPIO_EN) {
596 pci_read_config_dword(dev, ICH6_GPIOBASE, &region);
597 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1,
598 "ICH6 GPIO");
599 }
571} 600}
572 601
573static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize) 602static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize)