static int pcie_rd_conf_wa(struct pci_bus *bus, u32 devfn, int where, int size, u32 *val) { int ret; if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) { *val = 0xffffffff; return PCIBIOS_DEVICE_NOT_FOUND; } /* * We only support access to the non-extended configuration * space when using the WA access method (or we would have to * sacrifice 256M of CPU virtual address space.) */ if (where >= 0x100) { *val = 0xffffffff; return PCIBIOS_DEVICE_NOT_FOUND; } ret = orion_pcie_rd_conf_wa((void __iomem *)ORION5X_PCIE_WA_VIRT_BASE, bus, devfn, where, size, val); return ret; }
static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, int where, int size, u32 val) { unsigned long flags; int ret; if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) return PCIBIOS_DEVICE_NOT_FOUND; spin_lock_irqsave(&orion5x_pcie_lock, flags); ret = orion_pcie_wr_conf(PCIE_BASE, bus, devfn, where, size, val); spin_unlock_irqrestore(&orion5x_pcie_lock, flags); return ret; }
static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, int where, int size, u32 val) { struct pcie_port *pp = bus_to_port(bus->number); unsigned long flags; int ret; if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) return PCIBIOS_DEVICE_NOT_FOUND; spin_lock_irqsave(&pp->conf_lock, flags); ret = orion_pcie_wr_conf(pp->base, bus, devfn, where, size, val); spin_unlock_irqrestore(&pp->conf_lock, flags); return ret; }
static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, int size, u32 *val) { struct pci_sys_data *sys = bus->sysdata; struct pcie_port *pp = sys->private_data; unsigned long flags; int ret; if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) { *val = 0xffffffff; return PCIBIOS_DEVICE_NOT_FOUND; } spin_lock_irqsave(&pp->conf_lock, flags); ret = orion_pcie_rd_conf(pp->base, bus, devfn, where, size, val); spin_unlock_irqrestore(&pp->conf_lock, flags); return ret; }
static int pcie_rd_conf_wa(struct pci_bus *bus, u32 devfn, int where, int size, u32 *val) { int ret; if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) { *val = 0xffffffff; return PCIBIOS_DEVICE_NOT_FOUND; } if (where >= 0x100) { *val = 0xffffffff; return PCIBIOS_DEVICE_NOT_FOUND; } ret = orion_pcie_rd_conf_wa((void __iomem *)ORION5X_PCIE_WA_VIRT_BASE, bus, devfn, where, size, val); return ret; }