12 #include <linux/kernel.h>
13 #include <linux/pci.h>
15 #include <linux/string.h>
20 #include <asm/pci-bridge.h>
27 volatile void __iomem *cfg_data;
31 if (hose->indirect_type & INDIRECT_TYPE_NO_PCIE_LINK) {
38 if (hose->indirect_type & INDIRECT_TYPE_SET_CFG_TYPE)
43 hose->self_busno : bus->
number;
45 if (hose->indirect_type & INDIRECT_TYPE_EXT_REG)
46 reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
50 if (hose->indirect_type & INDIRECT_TYPE_BIG_ENDIAN)
51 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
52 (devfn << 8) | reg | cfg_type));
54 out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
55 (devfn << 8) | reg | cfg_type));
61 cfg_data = hose->cfg_data + (offset & 3);
64 *val =
in_8(cfg_data);
77 indirect_write_config(
struct pci_bus *bus,
unsigned int devfn,
int offset,
81 volatile void __iomem *cfg_data;
85 if (hose->indirect_type & INDIRECT_TYPE_NO_PCIE_LINK) {
92 if (hose->indirect_type & INDIRECT_TYPE_SET_CFG_TYPE)
97 hose->self_busno : bus->
number;
99 if (hose->indirect_type & INDIRECT_TYPE_EXT_REG)
100 reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
104 if (hose->indirect_type & INDIRECT_TYPE_BIG_ENDIAN)
105 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
106 (devfn << 8) | reg | cfg_type));
108 out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
109 (devfn << 8) | reg | cfg_type));
112 if (hose->indirect_type & INDIRECT_TYPE_SURPRESS_PRIMARY_BUS)
118 if ((hose->indirect_type & INDIRECT_TYPE_BROKEN_MRM) &&
127 cfg_data = hose->cfg_data + (offset & 3);
130 out_8(cfg_data, val);
143 static struct pci_ops indirect_pci_ops = {
144 .read = indirect_read_config,
145 .write = indirect_write_config,
157 hose->cfg_addr = mbase + (cfg_addr & ~PAGE_MASK);
158 if ((cfg_data & PAGE_MASK) != base)
160 hose->cfg_data = mbase + (cfg_data & ~PAGE_MASK);
161 hose->
ops = &indirect_pci_ops;
162 hose->indirect_type =
flags;