12 #include <linux/kernel.h>
13 #include <linux/pci.h>
15 #include <linux/string.h>
20 #include <asm/pci-bridge.h>
21 #include <asm/machdep.h>
28 volatile void __iomem *cfg_data;
32 if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
39 if (
ppc_md.pci_exclude_device)
43 if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE)
48 hose->self_busno : bus->
number;
50 if (hose->indirect_type & PPC_INDIRECT_TYPE_EXT_REG)
51 reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
55 if (hose->indirect_type & PPC_INDIRECT_TYPE_BIG_ENDIAN)
56 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
57 (devfn << 8) | reg | cfg_type));
59 out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
60 (devfn << 8) | reg | cfg_type));
66 cfg_data = hose->cfg_data + (offset & 3);
69 *val =
in_8(cfg_data);
82 indirect_write_config(
struct pci_bus *bus,
unsigned int devfn,
int offset,
86 volatile void __iomem *cfg_data;
90 if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
97 if (
ppc_md.pci_exclude_device)
101 if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE)
106 hose->self_busno : bus->
number;
108 if (hose->indirect_type & PPC_INDIRECT_TYPE_EXT_REG)
109 reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
113 if (hose->indirect_type & PPC_INDIRECT_TYPE_BIG_ENDIAN)
114 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
115 (devfn << 8) | reg | cfg_type));
117 out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
118 (devfn << 8) | reg | cfg_type));
121 if (hose->indirect_type & PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS)
127 if ((hose->indirect_type & PPC_INDIRECT_TYPE_BROKEN_MRM) &&
136 cfg_data = hose->cfg_data + (offset & 3);
139 out_8(cfg_data, val);
151 static struct pci_ops indirect_pci_ops =
153 .read = indirect_read_config,
154 .write = indirect_write_config,
166 hose->cfg_addr = mbase + (cfg_addr & ~PAGE_MASK);
167 if ((cfg_data & PAGE_MASK) != base)
169 hose->cfg_data = mbase + (cfg_data & ~PAGE_MASK);
170 hose->
ops = &indirect_pci_ops;
171 hose->indirect_type =
flags;