diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-10-26 16:20:44 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-11-04 11:47:10 -0500 |
commit | ac1aa47b131416a6ff37eb1005a0a1d2541aad6c (patch) | |
tree | 1d7efa15a16f61664a240520970e729b1a47e4a5 /drivers/pci/pci.c | |
parent | 99935a7a59eaca0292c1a5880e10bae03f4a5e3d (diff) |
PCI: determine CLS more intelligently
Till now, CLS has been determined either by arch code or as
L1_CACHE_BYTES. Only x86 and ia64 set CLS explicitly and x86 doesn't
always get it right. On most configurations, the chance is that
firmware configures the correct value during boot.
This patch makes pci_init() determine CLS by looking at what firmware
has configured. It scans all devices and if all non-zero values
agree, the value is used. If none is configured or there is a
disagreement, pci_dfl_cache_line_size is used. arch can set the dfl
value (via PCI_CACHE_LINE_BYTES or pci_dfl_cache_line_size) or
override the actual one.
ia64, x86 and sparc64 updated to set the default cls instead of the
actual one.
While at it, declare pci_cache_line_size and pci_dfl_cache_line_size
in pci.h and drop private declarations from arch code.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David Miller <davem@davemloft.net>
Acked-by: Greg KH <gregkh@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 21 |
1 files changed, 13 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; | |||
47 | unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE; | 47 | unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE; |
48 | unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE; | 48 | unsigned 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 | */ | ||
60 | u8 pci_dfl_cache_line_size __initdata = PCI_CACHE_LINE_BYTES >> 2; | ||
61 | u8 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 */ | ||
1892 | u8 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 |