diff options
author | Ivan Kokshaysky <ink@jurassic.park.msu.ru> | 2008-01-14 17:31:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-10 15:52:45 -0500 |
commit | a0ca9909609470ad779b9b9cc68ce96e975afff7 (patch) | |
tree | af1ce8cdf6e927e25ad92869849456916e236fbf /arch/x86/pci/mmconfig_64.c | |
parent | 7cf712db6087342e5e7e259d3883a7b5ac3212d1 (diff) |
PCI x86: always use conf1 to access config space below 256 bytes
Thanks to Loic Prylli <loic@myri.com>, who originally proposed
this idea.
Always using legacy configuration mechanism for the legacy config space
and extended mechanism (mmconf) for the extended config space is
a simple and very logical approach. It's supposed to resolve all
known mmconf problems. It still allows per-device quirks (tweaking
dev->cfg_size). It also allows to get rid of mmconf fallback code.
Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/pci/mmconfig_64.c')
-rw-r--r-- | arch/x86/pci/mmconfig_64.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c index 4095e4d66a1d..c4cf318e44a9 100644 --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c | |||
@@ -40,9 +40,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus) | |||
40 | static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) | 40 | static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) |
41 | { | 41 | { |
42 | char __iomem *addr; | 42 | char __iomem *addr; |
43 | if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS && | 43 | |
44 | test_bit(32*bus + PCI_SLOT(devfn), pci_mmcfg_fallback_slots)) | ||
45 | return NULL; | ||
46 | addr = get_virt(seg, bus); | 44 | addr = get_virt(seg, bus); |
47 | if (!addr) | 45 | if (!addr) |
48 | return NULL; | 46 | return NULL; |
@@ -56,13 +54,16 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
56 | 54 | ||
57 | /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ | 55 | /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ |
58 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { | 56 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { |
59 | *value = -1; | 57 | err: *value = -1; |
60 | return -EINVAL; | 58 | return -EINVAL; |
61 | } | 59 | } |
62 | 60 | ||
61 | if (reg < 256) | ||
62 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | ||
63 | |||
63 | addr = pci_dev_base(seg, bus, devfn); | 64 | addr = pci_dev_base(seg, bus, devfn); |
64 | if (!addr) | 65 | if (!addr) |
65 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | 66 | goto err; |
66 | 67 | ||
67 | switch (len) { | 68 | switch (len) { |
68 | case 1: | 69 | case 1: |
@@ -88,9 +89,12 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
88 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) | 89 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) |
89 | return -EINVAL; | 90 | return -EINVAL; |
90 | 91 | ||
92 | if (reg < 256) | ||
93 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | ||
94 | |||
91 | addr = pci_dev_base(seg, bus, devfn); | 95 | addr = pci_dev_base(seg, bus, devfn); |
92 | if (!addr) | 96 | if (!addr) |
93 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | 97 | return -EINVAL; |
94 | 98 | ||
95 | switch (len) { | 99 | switch (len) { |
96 | case 1: | 100 | case 1: |
@@ -126,12 +130,6 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg) | |||
126 | return addr; | 130 | return addr; |
127 | } | 131 | } |
128 | 132 | ||
129 | int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, | ||
130 | unsigned int devfn) | ||
131 | { | ||
132 | return pci_dev_base(seg, bus, devfn) != NULL; | ||
133 | } | ||
134 | |||
135 | int __init pci_mmcfg_arch_init(void) | 133 | int __init pci_mmcfg_arch_init(void) |
136 | { | 134 | { |
137 | int i; | 135 | int i; |