diff options
author | Jiri Slaby <jslaby@suse.cz> | 2011-02-28 04:45:09 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2011-03-04 13:41:32 -0500 |
commit | cdb9755849fbaf2bb9c0a009ba5baa817a0f152d (patch) | |
tree | 1bf3e01326a198e0f50e4a8de41866fb416a6987 /drivers | |
parent | 457d9d088b026e26dbab98cad9d299c1faf4c343 (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.c | 45 |
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) | |||
533 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi); | 533 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi); |
534 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi); | 534 | DECLARE_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 | |||
541 | static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev) | 552 | static 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, ®ion); | 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, ®ion); | ||
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, ®ion); | 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, ®ion); | ||
567 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1, | ||
568 | "ICH4 GPIO"); | ||
569 | } | ||
550 | } | 570 | } |
551 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi); | 571 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi); |
552 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi); | 572 | DECLARE_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 | |||
562 | static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev) | 582 | static 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, ®ion); | 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, ®ion); | ||
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, ®ion); | 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, ®ion); | ||
597 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1, | ||
598 | "ICH6 GPIO"); | ||
599 | } | ||
571 | } | 600 | } |
572 | 601 | ||
573 | static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize) | 602 | static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize) |