aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci.c21
-rw-r--r--drivers/pci/quirks.c28
2 files changed, 41 insertions, 8 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 4e4c295a049f..1f9a7a03847b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -47,6 +47,19 @@ unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE;
47unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE; 47unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE;
48unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE; 48unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
49 49
50#ifndef PCI_CACHE_LINE_BYTES
51#define PCI_CACHE_LINE_BYTES L1_CACHE_BYTES
52#endif
53
54/*
55 * The default CLS is used if arch didn't set CLS explicitly and not
56 * all pci devices agree on the same value. Arch can override either
57 * the dfl or actual value as it sees fit. Don't forget this is
58 * measured in 32-bit words, not bytes.
59 */
60u8 pci_dfl_cache_line_size __initdata = PCI_CACHE_LINE_BYTES >> 2;
61u8 pci_cache_line_size;
62
50/** 63/**
51 * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children 64 * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children
52 * @bus: pointer to PCI bus structure to search 65 * @bus: pointer to PCI bus structure to search
@@ -1883,14 +1896,6 @@ void pci_clear_mwi(struct pci_dev *dev)
1883 1896
1884#else 1897#else
1885 1898
1886#ifndef PCI_CACHE_LINE_BYTES
1887#define PCI_CACHE_LINE_BYTES L1_CACHE_BYTES
1888#endif
1889
1890/* This can be overridden by arch code. */
1891/* Don't forget this is measured in 32-bit words, not bytes */
1892u8 pci_cache_line_size = PCI_CACHE_LINE_BYTES / 4;
1893
1894/** 1899/**
1895 * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed 1900 * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed
1896 * @dev: the PCI device for which MWI is to be enabled 1901 * @dev: the PCI device for which MWI is to be enabled
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 245d2cdb4765..1812ae7698de 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2595,9 +2595,37 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
2595static int __init pci_apply_final_quirks(void) 2595static int __init pci_apply_final_quirks(void)
2596{ 2596{
2597 struct pci_dev *dev = NULL; 2597 struct pci_dev *dev = NULL;
2598 u8 cls = 0;
2599 u8 tmp;
2600
2601 if (pci_cache_line_size)
2602 printk(KERN_DEBUG "PCI: CLS %u bytes\n",
2603 pci_cache_line_size << 2);
2598 2604
2599 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 2605 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
2600 pci_fixup_device(pci_fixup_final, dev); 2606 pci_fixup_device(pci_fixup_final, dev);
2607 /*
2608 * If arch hasn't set it explicitly yet, use the CLS
2609 * value shared by all PCI devices. If there's a
2610 * mismatch, fall back to the default value.
2611 */
2612 if (!pci_cache_line_size) {
2613 pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &tmp);
2614 if (!cls)
2615 cls = tmp;
2616 if (!tmp || cls == tmp)
2617 continue;
2618
2619 printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), "
2620 "using %u bytes\n", cls << 2, tmp << 2,
2621 pci_dfl_cache_line_size << 2);
2622 pci_cache_line_size = pci_dfl_cache_line_size;
2623 }
2624 }
2625 if (!pci_cache_line_size) {
2626 printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",
2627 cls << 2, pci_dfl_cache_line_size << 2);
2628 pci_cache_line_size = cls;
2601 } 2629 }
2602 2630
2603 return 0; 2631 return 0;