diff options
author | Matthew Wilcox <matthew@wil.cx> | 2008-02-10 09:45:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-10 15:52:46 -0500 |
commit | b6ce068a1285a24185b01be8a49021827516b3e1 (patch) | |
tree | ea1420fefff86f2e2ee4ed83f08ec2dd99a86dc5 | |
parent | a0ca9909609470ad779b9b9cc68ce96e975afff7 (diff) |
Change pci_raw_ops to pci_raw_read/write
We want to allow different implementations of pci_raw_ops for standard
and extended config space on x86. Rather than clutter generic code with
knowledge of this, we make pci_raw_ops private to x86 and use it to
implement the new raw interface -- raw_pci_read() and raw_pci_write().
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/ia64/pci/pci.c | 25 | ||||
-rw-r--r-- | arch/ia64/sn/pci/tioce_provider.c | 16 | ||||
-rw-r--r-- | arch/x86/kernel/quirks.c | 2 | ||||
-rw-r--r-- | arch/x86/pci/common.c | 25 | ||||
-rw-r--r-- | arch/x86/pci/direct.c | 4 | ||||
-rw-r--r-- | arch/x86/pci/fixup.c | 6 | ||||
-rw-r--r-- | arch/x86/pci/legacy.c | 2 | ||||
-rw-r--r-- | arch/x86/pci/mmconfig-shared.c | 6 | ||||
-rw-r--r-- | arch/x86/pci/mmconfig_32.c | 10 | ||||
-rw-r--r-- | arch/x86/pci/mmconfig_64.c | 8 | ||||
-rw-r--r-- | arch/x86/pci/pci.h | 15 | ||||
-rw-r--r-- | arch/x86/pci/visws.c | 3 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 25 | ||||
-rw-r--r-- | include/linux/pci.h | 16 |
14 files changed, 78 insertions, 85 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 488e48a5deea..8fd7e825192b 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -43,8 +43,7 @@ | |||
43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ | 43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ |
44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) | 44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) |
45 | 45 | ||
46 | static int | 46 | int raw_pci_read(unsigned int seg, unsigned int bus, unsigned int devfn, |
47 | pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
48 | int reg, int len, u32 *value) | 47 | int reg, int len, u32 *value) |
49 | { | 48 | { |
50 | u64 addr, data = 0; | 49 | u64 addr, data = 0; |
@@ -68,8 +67,7 @@ pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
68 | return 0; | 67 | return 0; |
69 | } | 68 | } |
70 | 69 | ||
71 | static int | 70 | int raw_pci_write(unsigned int seg, unsigned int bus, unsigned int devfn, |
72 | pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
73 | int reg, int len, u32 value) | 71 | int reg, int len, u32 value) |
74 | { | 72 | { |
75 | u64 addr; | 73 | u64 addr; |
@@ -91,24 +89,17 @@ pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
91 | return 0; | 89 | return 0; |
92 | } | 90 | } |
93 | 91 | ||
94 | static struct pci_raw_ops pci_sal_ops = { | 92 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, |
95 | .read = pci_sal_read, | 93 | int size, u32 *value) |
96 | .write = pci_sal_write | ||
97 | }; | ||
98 | |||
99 | struct pci_raw_ops *raw_pci_ops = &pci_sal_ops; | ||
100 | |||
101 | static int | ||
102 | pci_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | ||
103 | { | 94 | { |
104 | return raw_pci_ops->read(pci_domain_nr(bus), bus->number, | 95 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
105 | devfn, where, size, value); | 96 | devfn, where, size, value); |
106 | } | 97 | } |
107 | 98 | ||
108 | static int | 99 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, |
109 | pci_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | 100 | int size, u32 value) |
110 | { | 101 | { |
111 | return raw_pci_ops->write(pci_domain_nr(bus), bus->number, | 102 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
112 | devfn, where, size, value); | 103 | devfn, where, size, value); |
113 | } | 104 | } |
114 | 105 | ||
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c index e1a3e19d3d9c..999f14f986e2 100644 --- a/arch/ia64/sn/pci/tioce_provider.c +++ b/arch/ia64/sn/pci/tioce_provider.c | |||
@@ -752,13 +752,13 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
752 | * Determine the secondary bus number of the port2 logical PPB. | 752 | * Determine the secondary bus number of the port2 logical PPB. |
753 | * This is used to decide whether a given pci device resides on | 753 | * This is used to decide whether a given pci device resides on |
754 | * port1 or port2. Note: We don't have enough plumbing set up | 754 | * port1 or port2. Note: We don't have enough plumbing set up |
755 | * here to use pci_read_config_xxx() so use the raw_pci_ops vector. | 755 | * here to use pci_read_config_xxx() so use raw_pci_read(). |
756 | */ | 756 | */ |
757 | 757 | ||
758 | seg = tioce_common->ce_pcibus.bs_persist_segment; | 758 | seg = tioce_common->ce_pcibus.bs_persist_segment; |
759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; | 759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; |
760 | 760 | ||
761 | raw_pci_ops->read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); | 761 | raw_pci_read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); |
762 | tioce_kern->ce_port1_secondary = (u8) tmp; | 762 | tioce_kern->ce_port1_secondary = (u8) tmp; |
763 | 763 | ||
764 | /* | 764 | /* |
@@ -799,11 +799,11 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
799 | 799 | ||
800 | /* mem base/limit */ | 800 | /* mem base/limit */ |
801 | 801 | ||
802 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 802 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
803 | PCI_MEMORY_BASE, 2, &tmp); | 803 | PCI_MEMORY_BASE, 2, &tmp); |
804 | base = (u64)tmp << 16; | 804 | base = (u64)tmp << 16; |
805 | 805 | ||
806 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 806 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
807 | PCI_MEMORY_LIMIT, 2, &tmp); | 807 | PCI_MEMORY_LIMIT, 2, &tmp); |
808 | limit = (u64)tmp << 16; | 808 | limit = (u64)tmp << 16; |
809 | limit |= 0xfffffUL; | 809 | limit |= 0xfffffUL; |
@@ -817,21 +817,21 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
817 | * attributes. | 817 | * attributes. |
818 | */ | 818 | */ |
819 | 819 | ||
820 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 820 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
821 | PCI_PREF_MEMORY_BASE, 2, &tmp); | 821 | PCI_PREF_MEMORY_BASE, 2, &tmp); |
822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
823 | 823 | ||
824 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 824 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
825 | PCI_PREF_BASE_UPPER32, 4, &tmp); | 825 | PCI_PREF_BASE_UPPER32, 4, &tmp); |
826 | base |= (u64)tmp << 32; | 826 | base |= (u64)tmp << 32; |
827 | 827 | ||
828 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 828 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); | 829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); |
830 | 830 | ||
831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
832 | limit |= 0xfffffUL; | 832 | limit |= 0xfffffUL; |
833 | 833 | ||
834 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 834 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); | 835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); |
836 | limit |= (u64)tmp << 32; | 836 | limit |= (u64)tmp << 32; |
837 | 837 | ||
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 6ba33ca8715a..1941482d4ca3 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -27,7 +27,7 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
27 | pci_write_config_byte(dev, 0xf4, config|0x2); | 27 | pci_write_config_byte(dev, 0xf4, config|0x2); |
28 | 28 | ||
29 | /* read xTPR register */ | 29 | /* read xTPR register */ |
30 | raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word); | 30 | raw_pci_read(0, 0, 0x40, 0x4c, 2, &word); |
31 | 31 | ||
32 | if (!(word & (1 << 13))) { | 32 | if (!(word & (1 << 13))) { |
33 | dev_info(&dev->dev, "Intel E7520/7320/7525 detected; " | 33 | dev_info(&dev->dev, "Intel E7520/7320/7525 detected; " |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 52deabc72a6f..b7c67a187b6b 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -26,16 +26,37 @@ int pcibios_last_bus = -1; | |||
26 | unsigned long pirq_table_addr; | 26 | unsigned long pirq_table_addr; |
27 | struct pci_bus *pci_root_bus; | 27 | struct pci_bus *pci_root_bus; |
28 | struct pci_raw_ops *raw_pci_ops; | 28 | struct pci_raw_ops *raw_pci_ops; |
29 | struct pci_raw_ops *raw_pci_ext_ops; | ||
30 | |||
31 | int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, | ||
32 | int reg, int len, u32 *val) | ||
33 | { | ||
34 | if (reg < 256 && raw_pci_ops) | ||
35 | return raw_pci_ops->read(domain, bus, devfn, reg, len, val); | ||
36 | if (raw_pci_ext_ops) | ||
37 | return raw_pci_ext_ops->read(domain, bus, devfn, reg, len, val); | ||
38 | return -EINVAL; | ||
39 | } | ||
40 | |||
41 | int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, | ||
42 | int reg, int len, u32 val) | ||
43 | { | ||
44 | if (reg < 256 && raw_pci_ops) | ||
45 | return raw_pci_ops->write(domain, bus, devfn, reg, len, val); | ||
46 | if (raw_pci_ext_ops) | ||
47 | return raw_pci_ext_ops->write(domain, bus, devfn, reg, len, val); | ||
48 | return -EINVAL; | ||
49 | } | ||
29 | 50 | ||
30 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | 51 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) |
31 | { | 52 | { |
32 | return raw_pci_ops->read(pci_domain_nr(bus), bus->number, | 53 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
33 | devfn, where, size, value); | 54 | devfn, where, size, value); |
34 | } | 55 | } |
35 | 56 | ||
36 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | 57 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) |
37 | { | 58 | { |
38 | return raw_pci_ops->write(pci_domain_nr(bus), bus->number, | 59 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
39 | devfn, where, size, value); | 60 | devfn, where, size, value); |
40 | } | 61 | } |
41 | 62 | ||
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c index 431c9a51b157..42f3e4cad179 100644 --- a/arch/x86/pci/direct.c +++ b/arch/x86/pci/direct.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ | 14 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ |
15 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) | 15 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) |
16 | 16 | ||
17 | int pci_conf1_read(unsigned int seg, unsigned int bus, | 17 | static int pci_conf1_read(unsigned int seg, unsigned int bus, |
18 | unsigned int devfn, int reg, int len, u32 *value) | 18 | unsigned int devfn, int reg, int len, u32 *value) |
19 | { | 19 | { |
20 | unsigned long flags; | 20 | unsigned long flags; |
@@ -45,7 +45,7 @@ int pci_conf1_read(unsigned int seg, unsigned int bus, | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | int pci_conf1_write(unsigned int seg, unsigned int bus, | 48 | static int pci_conf1_write(unsigned int seg, unsigned int bus, |
49 | unsigned int devfn, int reg, int len, u32 value) | 49 | unsigned int devfn, int reg, int len, u32 value) |
50 | { | 50 | { |
51 | unsigned long flags; | 51 | unsigned long flags; |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 74d30ff33c49..a5ef5f551373 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -215,7 +215,8 @@ static int quirk_aspm_offset[MAX_PCIEROOT << 3]; | |||
215 | 215 | ||
216 | static int quirk_pcie_aspm_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | 216 | static int quirk_pcie_aspm_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) |
217 | { | 217 | { |
218 | return raw_pci_ops->read(0, bus->number, devfn, where, size, value); | 218 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
219 | devfn, where, size, value); | ||
219 | } | 220 | } |
220 | 221 | ||
221 | /* | 222 | /* |
@@ -231,7 +232,8 @@ static int quirk_pcie_aspm_write(struct pci_bus *bus, unsigned int devfn, int wh | |||
231 | if ((offset) && (where == offset)) | 232 | if ((offset) && (where == offset)) |
232 | value = value & 0xfffffffc; | 233 | value = value & 0xfffffffc; |
233 | 234 | ||
234 | return raw_pci_ops->write(0, bus->number, devfn, where, size, value); | 235 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
236 | devfn, where, size, value); | ||
235 | } | 237 | } |
236 | 238 | ||
237 | static struct pci_ops quirk_pcie_aspm_ops = { | 239 | static struct pci_ops quirk_pcie_aspm_ops = { |
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c index 5565d7016b75..e041ced0ce13 100644 --- a/arch/x86/pci/legacy.c +++ b/arch/x86/pci/legacy.c | |||
@@ -22,7 +22,7 @@ static void __devinit pcibios_fixup_peer_bridges(void) | |||
22 | if (pci_find_bus(0, n)) | 22 | if (pci_find_bus(0, n)) |
23 | continue; | 23 | continue; |
24 | for (devfn = 0; devfn < 256; devfn += 8) { | 24 | for (devfn = 0; devfn < 256; devfn += 8) { |
25 | if (!raw_pci_ops->read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && | 25 | if (!raw_pci_read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && |
26 | l != 0x0000 && l != 0xffff) { | 26 | l != 0x0000 && l != 0xffff) { |
27 | DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); | 27 | DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); |
28 | printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); | 28 | printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); |
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 6b521d389327..8d54df4dfaad 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -28,7 +28,7 @@ static int __initdata pci_mmcfg_resources_inserted; | |||
28 | static const char __init *pci_mmcfg_e7520(void) | 28 | static const char __init *pci_mmcfg_e7520(void) |
29 | { | 29 | { |
30 | u32 win; | 30 | u32 win; |
31 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); | 31 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); |
32 | 32 | ||
33 | win = win & 0xf000; | 33 | win = win & 0xf000; |
34 | if(win == 0x0000 || win == 0xf000) | 34 | if(win == 0x0000 || win == 0xf000) |
@@ -53,7 +53,7 @@ static const char __init *pci_mmcfg_intel_945(void) | |||
53 | 53 | ||
54 | pci_mmcfg_config_num = 1; | 54 | pci_mmcfg_config_num = 1; |
55 | 55 | ||
56 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); | 56 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); |
57 | 57 | ||
58 | /* Enable bit */ | 58 | /* Enable bit */ |
59 | if (!(pciexbar & 1)) | 59 | if (!(pciexbar & 1)) |
@@ -118,7 +118,7 @@ static int __init pci_mmcfg_check_hostbridge(void) | |||
118 | int i; | 118 | int i; |
119 | const char *name; | 119 | const char *name; |
120 | 120 | ||
121 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0, 4, &l); | 121 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0, 4, &l); |
122 | vendor = l & 0xffff; | 122 | vendor = l & 0xffff; |
123 | device = (l >> 16) & 0xffff; | 123 | device = (l >> 16) & 0xffff; |
124 | 124 | ||
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c index 7b75e6513436..081816ada057 100644 --- a/arch/x86/pci/mmconfig_32.c +++ b/arch/x86/pci/mmconfig_32.c | |||
@@ -68,9 +68,6 @@ err: *value = -1; | |||
68 | return -EINVAL; | 68 | return -EINVAL; |
69 | } | 69 | } |
70 | 70 | ||
71 | if (reg < 256) | ||
72 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | ||
73 | |||
74 | base = get_base_addr(seg, bus, devfn); | 71 | base = get_base_addr(seg, bus, devfn); |
75 | if (!base) | 72 | if (!base) |
76 | goto err; | 73 | goto err; |
@@ -104,9 +101,6 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
104 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) | 101 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) |
105 | return -EINVAL; | 102 | return -EINVAL; |
106 | 103 | ||
107 | if (reg < 256) | ||
108 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | ||
109 | |||
110 | base = get_base_addr(seg, bus, devfn); | 104 | base = get_base_addr(seg, bus, devfn); |
111 | if (!base) | 105 | if (!base) |
112 | return -EINVAL; | 106 | return -EINVAL; |
@@ -138,7 +132,7 @@ static struct pci_raw_ops pci_mmcfg = { | |||
138 | 132 | ||
139 | int __init pci_mmcfg_arch_init(void) | 133 | int __init pci_mmcfg_arch_init(void) |
140 | { | 134 | { |
141 | printk(KERN_INFO "PCI: Using MMCONFIG\n"); | 135 | printk(KERN_INFO "PCI: Using MMCONFIG for extended config space\n"); |
142 | raw_pci_ops = &pci_mmcfg; | 136 | raw_pci_ext_ops = &pci_mmcfg; |
143 | return 1; | 137 | return 1; |
144 | } | 138 | } |
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c index c4cf318e44a9..9207fd49233c 100644 --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c | |||
@@ -58,9 +58,6 @@ err: *value = -1; | |||
58 | return -EINVAL; | 58 | return -EINVAL; |
59 | } | 59 | } |
60 | 60 | ||
61 | if (reg < 256) | ||
62 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | ||
63 | |||
64 | addr = pci_dev_base(seg, bus, devfn); | 61 | addr = pci_dev_base(seg, bus, devfn); |
65 | if (!addr) | 62 | if (!addr) |
66 | goto err; | 63 | goto err; |
@@ -89,9 +86,6 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
89 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) | 86 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) |
90 | return -EINVAL; | 87 | return -EINVAL; |
91 | 88 | ||
92 | if (reg < 256) | ||
93 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | ||
94 | |||
95 | addr = pci_dev_base(seg, bus, devfn); | 89 | addr = pci_dev_base(seg, bus, devfn); |
96 | if (!addr) | 90 | if (!addr) |
97 | return -EINVAL; | 91 | return -EINVAL; |
@@ -150,6 +144,6 @@ int __init pci_mmcfg_arch_init(void) | |||
150 | return 0; | 144 | return 0; |
151 | } | 145 | } |
152 | } | 146 | } |
153 | raw_pci_ops = &pci_mmcfg; | 147 | raw_pci_ext_ops = &pci_mmcfg; |
154 | return 1; | 148 | return 1; |
155 | } | 149 | } |
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h index 36cb44c397c3..3431518d921a 100644 --- a/arch/x86/pci/pci.h +++ b/arch/x86/pci/pci.h | |||
@@ -85,10 +85,17 @@ extern spinlock_t pci_config_lock; | |||
85 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); | 85 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); |
86 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); | 86 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); |
87 | 87 | ||
88 | extern int pci_conf1_write(unsigned int seg, unsigned int bus, | 88 | struct pci_raw_ops { |
89 | unsigned int devfn, int reg, int len, u32 value); | 89 | int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn, |
90 | extern int pci_conf1_read(unsigned int seg, unsigned int bus, | 90 | int reg, int len, u32 *val); |
91 | unsigned int devfn, int reg, int len, u32 *value); | 91 | int (*write)(unsigned int domain, unsigned int bus, unsigned int devfn, |
92 | int reg, int len, u32 val); | ||
93 | }; | ||
94 | |||
95 | extern struct pci_raw_ops *raw_pci_ops; | ||
96 | extern struct pci_raw_ops *raw_pci_ext_ops; | ||
97 | |||
98 | extern struct pci_raw_ops pci_direct_conf1; | ||
92 | 99 | ||
93 | extern int pci_direct_probe(void); | 100 | extern int pci_direct_probe(void); |
94 | extern void pci_direct_init(int type); | 101 | extern void pci_direct_init(int type); |
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c index 8ecb1c722594..c2df4e97eed6 100644 --- a/arch/x86/pci/visws.c +++ b/arch/x86/pci/visws.c | |||
@@ -13,9 +13,6 @@ | |||
13 | 13 | ||
14 | #include "pci.h" | 14 | #include "pci.h" |
15 | 15 | ||
16 | |||
17 | extern struct pci_raw_ops pci_direct_conf1; | ||
18 | |||
19 | static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } | 16 | static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } |
20 | static void pci_visws_disable_irq(struct pci_dev *dev) { } | 17 | static void pci_visws_disable_irq(struct pci_dev *dev) { } |
21 | 18 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index a14501c98f40..34b3386dedca 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -200,15 +200,6 @@ acpi_status __init acpi_os_initialize(void) | |||
200 | 200 | ||
201 | acpi_status acpi_os_initialize1(void) | 201 | acpi_status acpi_os_initialize1(void) |
202 | { | 202 | { |
203 | /* | ||
204 | * Initialize PCI configuration space access, as we'll need to access | ||
205 | * it while walking the namespace (bus 0 and root bridges w/ _BBNs). | ||
206 | */ | ||
207 | if (!raw_pci_ops) { | ||
208 | printk(KERN_ERR PREFIX | ||
209 | "Access to PCI configuration space unavailable\n"); | ||
210 | return AE_NULL_ENTRY; | ||
211 | } | ||
212 | kacpid_wq = create_singlethread_workqueue("kacpid"); | 203 | kacpid_wq = create_singlethread_workqueue("kacpid"); |
213 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); | 204 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); |
214 | BUG_ON(!kacpid_wq); | 205 | BUG_ON(!kacpid_wq); |
@@ -653,11 +644,9 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
653 | return AE_ERROR; | 644 | return AE_ERROR; |
654 | } | 645 | } |
655 | 646 | ||
656 | BUG_ON(!raw_pci_ops); | 647 | result = raw_pci_read(pci_id->segment, pci_id->bus, |
657 | 648 | PCI_DEVFN(pci_id->device, pci_id->function), | |
658 | result = raw_pci_ops->read(pci_id->segment, pci_id->bus, | 649 | reg, size, value); |
659 | PCI_DEVFN(pci_id->device, pci_id->function), | ||
660 | reg, size, value); | ||
661 | 650 | ||
662 | return (result ? AE_ERROR : AE_OK); | 651 | return (result ? AE_ERROR : AE_OK); |
663 | } | 652 | } |
@@ -682,11 +671,9 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
682 | return AE_ERROR; | 671 | return AE_ERROR; |
683 | } | 672 | } |
684 | 673 | ||
685 | BUG_ON(!raw_pci_ops); | 674 | result = raw_pci_write(pci_id->segment, pci_id->bus, |
686 | 675 | PCI_DEVFN(pci_id->device, pci_id->function), | |
687 | result = raw_pci_ops->write(pci_id->segment, pci_id->bus, | 676 | reg, size, value); |
688 | PCI_DEVFN(pci_id->device, pci_id->function), | ||
689 | reg, size, value); | ||
690 | 677 | ||
691 | return (result ? AE_ERROR : AE_OK); | 678 | return (result ? AE_ERROR : AE_OK); |
692 | } | 679 | } |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7215d3b1f4af..87195b62de52 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -301,14 +301,14 @@ struct pci_ops { | |||
301 | int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); | 301 | int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); |
302 | }; | 302 | }; |
303 | 303 | ||
304 | struct pci_raw_ops { | 304 | /* |
305 | int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn, | 305 | * ACPI needs to be able to access PCI config space before we've done a |
306 | int reg, int len, u32 *val); | 306 | * PCI bus scan and created pci_bus structures. |
307 | int (*write)(unsigned int domain, unsigned int bus, unsigned int devfn, | 307 | */ |
308 | int reg, int len, u32 val); | 308 | extern int raw_pci_read(unsigned int domain, unsigned int bus, |
309 | }; | 309 | unsigned int devfn, int reg, int len, u32 *val); |
310 | 310 | extern int raw_pci_write(unsigned int domain, unsigned int bus, | |
311 | extern struct pci_raw_ops *raw_pci_ops; | 311 | unsigned int devfn, int reg, int len, u32 val); |
312 | 312 | ||
313 | struct pci_bus_region { | 313 | struct pci_bus_region { |
314 | resource_size_t start; | 314 | resource_size_t start; |