vserver 1.9.5.x5
[linux-2.6.git] / include / asm-mips / pci.h
index 1af4e5b..987090e 100644 (file)
 
 #ifdef __KERNEL__
 
+/*
+ * This file essentially defines the interface between board
+ * specific PCI code and MIPS common PCI code.  Should potentially put
+ * into include/asm/pci.h file.
+ */
+
+#include <linux/ioport.h>
+
+/*
+ * Each pci channel is a top-level PCI bus seem by CPU.  A machine  with
+ * multiple PCI channels may have multiple PCI host controllers or a
+ * single controller supporting multiple channels.
+ */
+struct pci_controller {
+       struct pci_controller *next;
+       struct pci_bus *bus;
+
+       struct pci_ops *pci_ops;
+       struct resource *mem_resource;
+       unsigned long mem_offset;
+       struct resource *io_resource;
+       unsigned long io_offset;
+
+       unsigned int index;
+       /* For compatibility with current (as of July 2003) pciutils
+          and XFree86. Eventually will be removed. */
+       unsigned int need_domain_info;
+
+       int iommu;
+};
+
+/*
+ * Used by boards to register their PCI busses before the actual scanning.
+ */
+extern struct pci_controller * alloc_pci_controller(void);
+extern void register_pci_controller(struct pci_controller *hose);
+
+/*
+ * board supplied pci irq fixup routine
+ */
+extern int pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
+
+
 /* Can be used to override the logic in pci_scan_bus for skipping
    already-configured bus numbers - to be used for buggy BIOSes
    or architectures with incomplete PCI setup by the loader */
@@ -90,6 +133,25 @@ extern void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
 extern void pcibios_resource_to_bus(struct pci_dev *dev,
        struct pci_bus_region *region, struct resource *res);
 
+#ifdef CONFIG_PCI_DOMAINS
+
+#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
+
+static inline int
+pci_name_bus(char *name, struct pci_bus *bus)
+{
+       struct pci_controller *hose = bus->sysdata;
+
+       if (likely(hose->need_domain_info == 0)) {
+               sprintf(name, "%02x", bus->number);
+       } else {
+               sprintf(name, "%04x:%02x", hose->index, bus->number);
+       }
+       return 0;
+}
+
+#endif /* CONFIG_PCI_DOMAINS */
+
 #endif /* __KERNEL__ */
 
 /* implement the pci_ DMA API in terms of the generic device dma_ one */
@@ -99,4 +161,7 @@ static inline void pcibios_add_platform_entries(struct pci_dev *dev)
 {
 }
 
+/* Do platform specific device initialization at pci_enable_device() time */
+extern int pcibios_plat_dev_init(struct pci_dev *dev);
+
 #endif /* _ASM_PCI_H */