Lines Matching full:bridge

8  * PCI bridge when the HW doesn't provide such a root port PCI
9 * bridge.
11 * It emulates a PCI bridge by providing a fake PCI configuration
21 #include "pci-bridge-emul.h"
70 * bridge that is not capable of a burst transfer of more than
76 * BIST register: implemented as read-only, as "A bridge that
146 * are RO, and bridge control (31:16) are a mix of RW, RO,
255 * bridge configuration space. The caller needs to have initialized
260 int pci_bridge_emul_init(struct pci_bridge_emul *bridge, in pci_bridge_emul_init() argument
263 bridge->conf.class_revision |= cpu_to_le32(PCI_CLASS_BRIDGE_PCI << 16); in pci_bridge_emul_init()
264 bridge->conf.header_type = PCI_HEADER_TYPE_BRIDGE; in pci_bridge_emul_init()
265 bridge->conf.cache_line_size = 0x10; in pci_bridge_emul_init()
266 bridge->conf.status = cpu_to_le16(PCI_STATUS_CAP_LIST); in pci_bridge_emul_init()
267 bridge->pci_regs_behavior = kmemdup(pci_regs_behavior, in pci_bridge_emul_init()
270 if (!bridge->pci_regs_behavior) in pci_bridge_emul_init()
273 if (bridge->has_pcie) { in pci_bridge_emul_init()
274 bridge->conf.capabilities_pointer = PCI_CAP_PCIE_START; in pci_bridge_emul_init()
275 bridge->pcie_conf.cap_id = PCI_CAP_ID_EXP; in pci_bridge_emul_init()
277 bridge->pcie_conf.cap = in pci_bridge_emul_init()
280 bridge->pcie_cap_regs_behavior = in pci_bridge_emul_init()
284 if (!bridge->pcie_cap_regs_behavior) { in pci_bridge_emul_init()
285 kfree(bridge->pci_regs_behavior); in pci_bridge_emul_init()
291 bridge->pci_regs_behavior[PCI_PREF_MEMORY_BASE / 4].ro = ~0; in pci_bridge_emul_init()
292 bridge->pci_regs_behavior[PCI_PREF_MEMORY_BASE / 4].rw = 0; in pci_bridge_emul_init()
303 void pci_bridge_emul_cleanup(struct pci_bridge_emul *bridge) in pci_bridge_emul_cleanup() argument
305 if (bridge->has_pcie) in pci_bridge_emul_cleanup()
306 kfree(bridge->pcie_cap_regs_behavior); in pci_bridge_emul_cleanup()
307 kfree(bridge->pci_regs_behavior); in pci_bridge_emul_cleanup()
313 * configuration space of the fake bridge. It will call back the
316 int pci_bridge_emul_conf_read(struct pci_bridge_emul *bridge, int where, in pci_bridge_emul_conf_read() argument
321 pci_bridge_emul_read_status_t (*read_op)(struct pci_bridge_emul *bridge, in pci_bridge_emul_conf_read()
326 if (bridge->has_pcie && reg >= PCI_CAP_PCIE_END) { in pci_bridge_emul_conf_read()
331 if (!bridge->has_pcie && reg >= PCI_BRIDGE_CONF_END) { in pci_bridge_emul_conf_read()
336 if (bridge->has_pcie && reg >= PCI_CAP_PCIE_START) { in pci_bridge_emul_conf_read()
338 read_op = bridge->ops->read_pcie; in pci_bridge_emul_conf_read()
339 cfgspace = (__le32 *) &bridge->pcie_conf; in pci_bridge_emul_conf_read()
340 behavior = bridge->pcie_cap_regs_behavior; in pci_bridge_emul_conf_read()
342 read_op = bridge->ops->read_base; in pci_bridge_emul_conf_read()
343 cfgspace = (__le32 *) &bridge->conf; in pci_bridge_emul_conf_read()
344 behavior = bridge->pci_regs_behavior; in pci_bridge_emul_conf_read()
348 ret = read_op(bridge, reg, value); in pci_bridge_emul_conf_read()
375 * configuration space of the fake bridge. It will call back the
378 int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where, in pci_bridge_emul_conf_write() argument
383 void (*write_op)(struct pci_bridge_emul *bridge, int reg, in pci_bridge_emul_conf_write()
388 if (bridge->has_pcie && reg >= PCI_CAP_PCIE_END) in pci_bridge_emul_conf_write()
391 if (!bridge->has_pcie && reg >= PCI_BRIDGE_CONF_END) in pci_bridge_emul_conf_write()
405 ret = pci_bridge_emul_conf_read(bridge, reg, 4, &old); in pci_bridge_emul_conf_write()
409 if (bridge->has_pcie && reg >= PCI_CAP_PCIE_START) { in pci_bridge_emul_conf_write()
411 write_op = bridge->ops->write_pcie; in pci_bridge_emul_conf_write()
412 cfgspace = (__le32 *) &bridge->pcie_conf; in pci_bridge_emul_conf_write()
413 behavior = bridge->pcie_cap_regs_behavior; in pci_bridge_emul_conf_write()
415 write_op = bridge->ops->write_base; in pci_bridge_emul_conf_write()
416 cfgspace = (__le32 *) &bridge->conf; in pci_bridge_emul_conf_write()
417 behavior = bridge->pci_regs_behavior; in pci_bridge_emul_conf_write()
432 write_op(bridge, reg, old, new, mask); in pci_bridge_emul_conf_write()