dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) { struct pci_dev *pdev = to_pci_dev(dev); struct bridge_controller *bc = BRIDGE_CONTROLLER(pdev->bus); return bc->baddr + paddr; }
struct page *pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr) { struct bridge_controller *bc = BRIDGE_CONTROLLER(pdev->bus); return pfn_to_page((dma_addr - bc->baddr) >> PAGE_SHIFT); }
static inline void pci_disable_swapping(struct pci_dev *dev) { struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); bridge_t *bridge = bc->base; int slot = PCI_SLOT(dev->devfn); /* Turn off byte swapping */ bridge->b_device[slot].reg &= ~BRIDGE_DEV_SWAP_DIR; bridge->b_widget.w_tflush; /* Flush */ }
/* * All observed requests have pin == 1. We could have a global here, that * gets incremented and returned every time - unfortunately, pci_map_irq * may be called on the same device over and over, and need to return the * same value. On O2000, pin can be 0 or 1, and PCI slots can be [0..7]. * * A given PCI device, in general, should be able to intr any of the cpus * on any one of the hubs connected to its xbow. */ int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) { struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); int irq = bc->pci_int[slot]; if (irq == -1) { irq = bc->pci_int[slot] = request_bridge_irq(bc); if (irq < 0) panic("Can't allocate interrupt for PCI device %s\n", pci_name(dev)); } irq_to_bridge[irq] = bc; irq_to_slot[irq] = slot; return irq; }
/* Do platform specific device initialization at pci_enable_device() time */ int pcibios_plat_dev_init(struct pci_dev *dev) { struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); struct pci_dev *rdev = bridge_root_dev(dev); int slot = PCI_SLOT(rdev->devfn); int irq; irq = bc->pci_int[slot]; if (irq == -1) { irq = request_bridge_irq(bc); if (irq < 0) return irq; bc->pci_int[slot] = irq; } irq_to_bridge[irq] = bc; irq_to_slot[irq] = slot; dev->irq = irq; return 0; }
int pcibus_to_node(struct pci_bus *bus) { struct bridge_controller *bc = BRIDGE_CONTROLLER(bus); return bc->nasid; }