diff options
author | Thomas Petazzoni <thomas.petazzoni@enix.org> | 2008-08-19 04:28:24 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-10-20 13:53:40 -0400 |
commit | 3d137310245e4cdc3e8c8ba1bea2e145a87ae8e3 (patch) | |
tree | 478a5864216e1ddca3df9a2d08bde0d8ea4523a5 /drivers/pci/quirks.c | |
parent | b41d6cf38e27a940d998d989526a9748de1bf028 (diff) |
PCI: allow quirks to be compiled out
This patch adds the CONFIG_PCI_QUIRKS option which allows to remove all
the PCI quirks, which are not necessarily used on embedded systems when
PCI is working properly. As this is a size-reduction option, it depends
on CONFIG_EMBEDDED. It allows to save almost 12 kilobytes of kernel
code:
text data bss dec hex filename
1287806 123596 212992 1624394 18c94a vmlinux.old
1275854 123596 212992 1612442 189a9a vmlinux
-11952 0 0 -11952 -2EB0 +/-
This patch has originally been written by Zwane Mwaikambo
<zwane@arm.linux.org.uk> and is part of the Linux Tiny project.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r-- | drivers/pci/quirks.c | 176 |
1 files changed, 90 insertions, 86 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index e872ac925b4b..246918fe9482 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -24,6 +24,14 @@ | |||
24 | #include <linux/kallsyms.h> | 24 | #include <linux/kallsyms.h> |
25 | #include "pci.h" | 25 | #include "pci.h" |
26 | 26 | ||
27 | int isa_dma_bridge_buggy; | ||
28 | EXPORT_SYMBOL(isa_dma_bridge_buggy); | ||
29 | int pci_pci_problems; | ||
30 | EXPORT_SYMBOL(pci_pci_problems); | ||
31 | int pcie_mch_quirk; | ||
32 | EXPORT_SYMBOL(pcie_mch_quirk); | ||
33 | |||
34 | #ifdef CONFIG_PCI_QUIRKS | ||
27 | /* The Mellanox Tavor device gives false positive parity errors | 35 | /* The Mellanox Tavor device gives false positive parity errors |
28 | * Mark this device with a broken_parity_status, to allow | 36 | * Mark this device with a broken_parity_status, to allow |
29 | * PCI scanning code to "skip" this now blacklisted device. | 37 | * PCI scanning code to "skip" this now blacklisted device. |
@@ -62,8 +70,6 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_p | |||
62 | 70 | ||
63 | This appears to be BIOS not version dependent. So presumably there is a | 71 | This appears to be BIOS not version dependent. So presumably there is a |
64 | chipset level fix */ | 72 | chipset level fix */ |
65 | int isa_dma_bridge_buggy; | ||
66 | EXPORT_SYMBOL(isa_dma_bridge_buggy); | ||
67 | 73 | ||
68 | static void __devinit quirk_isa_dma_hangs(struct pci_dev *dev) | 74 | static void __devinit quirk_isa_dma_hangs(struct pci_dev *dev) |
69 | { | 75 | { |
@@ -84,9 +90,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_1, quirk_isa_d | |||
84 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_dma_hangs); | 90 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_dma_hangs); |
85 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); | 91 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); |
86 | 92 | ||
87 | int pci_pci_problems; | ||
88 | EXPORT_SYMBOL(pci_pci_problems); | ||
89 | |||
90 | /* | 93 | /* |
91 | * Chipsets where PCI->PCI transfers vanish or hang | 94 | * Chipsets where PCI->PCI transfers vanish or hang |
92 | */ | 95 | */ |
@@ -1362,9 +1365,6 @@ static void __init quirk_alder_ioapic(struct pci_dev *pdev) | |||
1362 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); | 1365 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); |
1363 | #endif | 1366 | #endif |
1364 | 1367 | ||
1365 | int pcie_mch_quirk; | ||
1366 | EXPORT_SYMBOL(pcie_mch_quirk); | ||
1367 | |||
1368 | static void __devinit quirk_pcie_mch(struct pci_dev *pdev) | 1368 | static void __devinit quirk_pcie_mch(struct pci_dev *pdev) |
1369 | { | 1369 | { |
1370 | pcie_mch_quirk = 1; | 1370 | pcie_mch_quirk = 1; |
@@ -1555,84 +1555,6 @@ static void __devinit fixup_rev1_53c810(struct pci_dev* dev) | |||
1555 | } | 1555 | } |
1556 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); | 1556 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); |
1557 | 1557 | ||
1558 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) | ||
1559 | { | ||
1560 | while (f < end) { | ||
1561 | if ((f->vendor == dev->vendor || f->vendor == (u16) PCI_ANY_ID) && | ||
1562 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { | ||
1563 | #ifdef DEBUG | ||
1564 | dev_dbg(&dev->dev, "calling %pF\n", f->hook); | ||
1565 | #endif | ||
1566 | f->hook(dev); | ||
1567 | } | ||
1568 | f++; | ||
1569 | } | ||
1570 | } | ||
1571 | |||
1572 | extern struct pci_fixup __start_pci_fixups_early[]; | ||
1573 | extern struct pci_fixup __end_pci_fixups_early[]; | ||
1574 | extern struct pci_fixup __start_pci_fixups_header[]; | ||
1575 | extern struct pci_fixup __end_pci_fixups_header[]; | ||
1576 | extern struct pci_fixup __start_pci_fixups_final[]; | ||
1577 | extern struct pci_fixup __end_pci_fixups_final[]; | ||
1578 | extern struct pci_fixup __start_pci_fixups_enable[]; | ||
1579 | extern struct pci_fixup __end_pci_fixups_enable[]; | ||
1580 | extern struct pci_fixup __start_pci_fixups_resume[]; | ||
1581 | extern struct pci_fixup __end_pci_fixups_resume[]; | ||
1582 | extern struct pci_fixup __start_pci_fixups_resume_early[]; | ||
1583 | extern struct pci_fixup __end_pci_fixups_resume_early[]; | ||
1584 | extern struct pci_fixup __start_pci_fixups_suspend[]; | ||
1585 | extern struct pci_fixup __end_pci_fixups_suspend[]; | ||
1586 | |||
1587 | |||
1588 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | ||
1589 | { | ||
1590 | struct pci_fixup *start, *end; | ||
1591 | |||
1592 | switch(pass) { | ||
1593 | case pci_fixup_early: | ||
1594 | start = __start_pci_fixups_early; | ||
1595 | end = __end_pci_fixups_early; | ||
1596 | break; | ||
1597 | |||
1598 | case pci_fixup_header: | ||
1599 | start = __start_pci_fixups_header; | ||
1600 | end = __end_pci_fixups_header; | ||
1601 | break; | ||
1602 | |||
1603 | case pci_fixup_final: | ||
1604 | start = __start_pci_fixups_final; | ||
1605 | end = __end_pci_fixups_final; | ||
1606 | break; | ||
1607 | |||
1608 | case pci_fixup_enable: | ||
1609 | start = __start_pci_fixups_enable; | ||
1610 | end = __end_pci_fixups_enable; | ||
1611 | break; | ||
1612 | |||
1613 | case pci_fixup_resume: | ||
1614 | start = __start_pci_fixups_resume; | ||
1615 | end = __end_pci_fixups_resume; | ||
1616 | break; | ||
1617 | |||
1618 | case pci_fixup_resume_early: | ||
1619 | start = __start_pci_fixups_resume_early; | ||
1620 | end = __end_pci_fixups_resume_early; | ||
1621 | break; | ||
1622 | |||
1623 | case pci_fixup_suspend: | ||
1624 | start = __start_pci_fixups_suspend; | ||
1625 | end = __end_pci_fixups_suspend; | ||
1626 | break; | ||
1627 | |||
1628 | default: | ||
1629 | /* stupid compiler warning, you would think with an enum... */ | ||
1630 | return; | ||
1631 | } | ||
1632 | pci_do_fixups(dev, start, end); | ||
1633 | } | ||
1634 | EXPORT_SYMBOL(pci_fixup_device); | ||
1635 | |||
1636 | /* Enable 1k I/O space granularity on the Intel P64H2 */ | 1558 | /* Enable 1k I/O space granularity on the Intel P64H2 */ |
1637 | static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev) | 1559 | static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev) |
1638 | { | 1560 | { |
@@ -2006,3 +1928,85 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375, | |||
2006 | quirk_msi_intx_disable_bug); | 1928 | quirk_msi_intx_disable_bug); |
2007 | 1929 | ||
2008 | #endif /* CONFIG_PCI_MSI */ | 1930 | #endif /* CONFIG_PCI_MSI */ |
1931 | |||
1932 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) | ||
1933 | { | ||
1934 | while (f < end) { | ||
1935 | if ((f->vendor == dev->vendor || f->vendor == (u16) PCI_ANY_ID) && | ||
1936 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { | ||
1937 | #ifdef DEBUG | ||
1938 | dev_dbg(&dev->dev, "calling "); | ||
1939 | print_fn_descriptor_symbol("%s\n", f->hook); | ||
1940 | #endif | ||
1941 | f->hook(dev); | ||
1942 | } | ||
1943 | f++; | ||
1944 | } | ||
1945 | } | ||
1946 | |||
1947 | extern struct pci_fixup __start_pci_fixups_early[]; | ||
1948 | extern struct pci_fixup __end_pci_fixups_early[]; | ||
1949 | extern struct pci_fixup __start_pci_fixups_header[]; | ||
1950 | extern struct pci_fixup __end_pci_fixups_header[]; | ||
1951 | extern struct pci_fixup __start_pci_fixups_final[]; | ||
1952 | extern struct pci_fixup __end_pci_fixups_final[]; | ||
1953 | extern struct pci_fixup __start_pci_fixups_enable[]; | ||
1954 | extern struct pci_fixup __end_pci_fixups_enable[]; | ||
1955 | extern struct pci_fixup __start_pci_fixups_resume[]; | ||
1956 | extern struct pci_fixup __end_pci_fixups_resume[]; | ||
1957 | extern struct pci_fixup __start_pci_fixups_resume_early[]; | ||
1958 | extern struct pci_fixup __end_pci_fixups_resume_early[]; | ||
1959 | extern struct pci_fixup __start_pci_fixups_suspend[]; | ||
1960 | extern struct pci_fixup __end_pci_fixups_suspend[]; | ||
1961 | |||
1962 | |||
1963 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | ||
1964 | { | ||
1965 | struct pci_fixup *start, *end; | ||
1966 | |||
1967 | switch(pass) { | ||
1968 | case pci_fixup_early: | ||
1969 | start = __start_pci_fixups_early; | ||
1970 | end = __end_pci_fixups_early; | ||
1971 | break; | ||
1972 | |||
1973 | case pci_fixup_header: | ||
1974 | start = __start_pci_fixups_header; | ||
1975 | end = __end_pci_fixups_header; | ||
1976 | break; | ||
1977 | |||
1978 | case pci_fixup_final: | ||
1979 | start = __start_pci_fixups_final; | ||
1980 | end = __end_pci_fixups_final; | ||
1981 | break; | ||
1982 | |||
1983 | case pci_fixup_enable: | ||
1984 | start = __start_pci_fixups_enable; | ||
1985 | end = __end_pci_fixups_enable; | ||
1986 | break; | ||
1987 | |||
1988 | case pci_fixup_resume: | ||
1989 | start = __start_pci_fixups_resume; | ||
1990 | end = __end_pci_fixups_resume; | ||
1991 | break; | ||
1992 | |||
1993 | case pci_fixup_resume_early: | ||
1994 | start = __start_pci_fixups_resume_early; | ||
1995 | end = __end_pci_fixups_resume_early; | ||
1996 | break; | ||
1997 | |||
1998 | case pci_fixup_suspend: | ||
1999 | start = __start_pci_fixups_suspend; | ||
2000 | end = __end_pci_fixups_suspend; | ||
2001 | break; | ||
2002 | |||
2003 | default: | ||
2004 | /* stupid compiler warning, you would think with an enum... */ | ||
2005 | return; | ||
2006 | } | ||
2007 | pci_do_fixups(dev, start, end); | ||
2008 | } | ||
2009 | #else | ||
2010 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} | ||
2011 | #endif | ||
2012 | EXPORT_SYMBOL(pci_fixup_device); | ||