aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@enix.org>2008-08-19 04:28:24 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-20 13:53:40 -0400
commit3d137310245e4cdc3e8c8ba1bea2e145a87ae8e3 (patch)
tree478a5864216e1ddca3df9a2d08bde0d8ea4523a5 /drivers
parentb41d6cf38e27a940d998d989526a9748de1bf028 (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')
-rw-r--r--drivers/pci/quirks.c176
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
27int isa_dma_bridge_buggy;
28EXPORT_SYMBOL(isa_dma_bridge_buggy);
29int pci_pci_problems;
30EXPORT_SYMBOL(pci_pci_problems);
31int pcie_mch_quirk;
32EXPORT_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 */
65int isa_dma_bridge_buggy;
66EXPORT_SYMBOL(isa_dma_bridge_buggy);
67 73
68static void __devinit quirk_isa_dma_hangs(struct pci_dev *dev) 74static 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
84DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_dma_hangs); 90DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_dma_hangs);
85DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); 91DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs);
86 92
87int pci_pci_problems;
88EXPORT_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)
1362DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); 1365DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic);
1363#endif 1366#endif
1364 1367
1365int pcie_mch_quirk;
1366EXPORT_SYMBOL(pcie_mch_quirk);
1367
1368static void __devinit quirk_pcie_mch(struct pci_dev *pdev) 1368static 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}
1556DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); 1556DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
1557 1557
1558static 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
1572extern struct pci_fixup __start_pci_fixups_early[];
1573extern struct pci_fixup __end_pci_fixups_early[];
1574extern struct pci_fixup __start_pci_fixups_header[];
1575extern struct pci_fixup __end_pci_fixups_header[];
1576extern struct pci_fixup __start_pci_fixups_final[];
1577extern struct pci_fixup __end_pci_fixups_final[];
1578extern struct pci_fixup __start_pci_fixups_enable[];
1579extern struct pci_fixup __end_pci_fixups_enable[];
1580extern struct pci_fixup __start_pci_fixups_resume[];
1581extern struct pci_fixup __end_pci_fixups_resume[];
1582extern struct pci_fixup __start_pci_fixups_resume_early[];
1583extern struct pci_fixup __end_pci_fixups_resume_early[];
1584extern struct pci_fixup __start_pci_fixups_suspend[];
1585extern struct pci_fixup __end_pci_fixups_suspend[];
1586
1587
1588void 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}
1634EXPORT_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 */
1637static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev) 1559static 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
1932static 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
1947extern struct pci_fixup __start_pci_fixups_early[];
1948extern struct pci_fixup __end_pci_fixups_early[];
1949extern struct pci_fixup __start_pci_fixups_header[];
1950extern struct pci_fixup __end_pci_fixups_header[];
1951extern struct pci_fixup __start_pci_fixups_final[];
1952extern struct pci_fixup __end_pci_fixups_final[];
1953extern struct pci_fixup __start_pci_fixups_enable[];
1954extern struct pci_fixup __end_pci_fixups_enable[];
1955extern struct pci_fixup __start_pci_fixups_resume[];
1956extern struct pci_fixup __end_pci_fixups_resume[];
1957extern struct pci_fixup __start_pci_fixups_resume_early[];
1958extern struct pci_fixup __end_pci_fixups_resume_early[];
1959extern struct pci_fixup __start_pci_fixups_suspend[];
1960extern struct pci_fixup __end_pci_fixups_suspend[];
1961
1962
1963void 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
2010void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
2011#endif
2012EXPORT_SYMBOL(pci_fixup_device);