Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  */
0006 #ifndef _ASM_PCI_H
0007 #define _ASM_PCI_H
0008 
0009 #include <linux/mm.h>
0010 
0011 #ifdef __KERNEL__
0012 
0013 /*
0014  * This file essentially defines the interface between board
0015  * specific PCI code and MIPS common PCI code.  Should potentially put
0016  * into include/asm/pci.h file.
0017  */
0018 
0019 #include <linux/ioport.h>
0020 #include <linux/list.h>
0021 #include <linux/of.h>
0022 
0023 #ifdef CONFIG_PCI_DRIVERS_LEGACY
0024 
0025 /*
0026  * Each pci channel is a top-level PCI bus seem by CPU.  A machine  with
0027  * multiple PCI channels may have multiple PCI host controllers or a
0028  * single controller supporting multiple channels.
0029  */
0030 struct pci_controller {
0031     struct list_head list;
0032     struct pci_bus *bus;
0033     struct device_node *of_node;
0034 
0035     struct pci_ops *pci_ops;
0036     struct resource *mem_resource;
0037     unsigned long mem_offset;
0038     struct resource *io_resource;
0039     unsigned long io_offset;
0040     unsigned long io_map_base;
0041 
0042 #ifndef CONFIG_PCI_DOMAINS_GENERIC
0043     unsigned int index;
0044     /* For compatibility with current (as of July 2003) pciutils
0045        and XFree86. Eventually will be removed. */
0046     unsigned int need_domain_info;
0047 #endif
0048 
0049     /* Optional access methods for reading/writing the bus number
0050        of the PCI controller */
0051     int (*get_busno)(void);
0052     void (*set_busno)(int busno);
0053 };
0054 
0055 /*
0056  * Used by boards to register their PCI busses before the actual scanning.
0057  */
0058 extern void register_pci_controller(struct pci_controller *hose);
0059 
0060 /*
0061  * board supplied pci irq fixup routine
0062  */
0063 extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
0064 
0065 /* Do platform specific device initialization at pci_enable_device() time */
0066 extern int pcibios_plat_dev_init(struct pci_dev *dev);
0067 
0068 extern char * (*pcibios_plat_setup)(char *str);
0069 
0070 #ifdef CONFIG_OF
0071 /* this function parses memory ranges from a device node */
0072 extern void pci_load_of_ranges(struct pci_controller *hose,
0073                    struct device_node *node);
0074 #else
0075 static inline void pci_load_of_ranges(struct pci_controller *hose,
0076                       struct device_node *node) {}
0077 #endif
0078 
0079 #ifdef CONFIG_PCI_DOMAINS_GENERIC
0080 static inline void set_pci_need_domain_info(struct pci_controller *hose,
0081                         int need_domain_info)
0082 {
0083     /* nothing to do */
0084 }
0085 #elif defined(CONFIG_PCI_DOMAINS)
0086 static inline void set_pci_need_domain_info(struct pci_controller *hose,
0087                         int need_domain_info)
0088 {
0089     hose->need_domain_info = need_domain_info;
0090 }
0091 #endif /* CONFIG_PCI_DOMAINS */
0092 
0093 #endif
0094 
0095 /* Can be used to override the logic in pci_scan_bus for skipping
0096    already-configured bus numbers - to be used for buggy BIOSes
0097    or architectures with incomplete PCI setup by the loader */
0098 static inline unsigned int pcibios_assign_all_busses(void)
0099 {
0100     return 1;
0101 }
0102 
0103 extern unsigned long PCIBIOS_MIN_IO;
0104 extern unsigned long PCIBIOS_MIN_MEM;
0105 
0106 #define PCIBIOS_MIN_CARDBUS_IO  0x4000
0107 
0108 #define HAVE_PCI_MMAP
0109 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
0110 
0111 /*
0112  * Dynamic DMA mapping stuff.
0113  * MIPS has everything mapped statically.
0114  */
0115 
0116 #include <linux/types.h>
0117 #include <linux/slab.h>
0118 #include <linux/scatterlist.h>
0119 #include <linux/string.h>
0120 #include <asm/io.h>
0121 
0122 #ifdef CONFIG_PCI_DOMAINS_GENERIC
0123 static inline int pci_proc_domain(struct pci_bus *bus)
0124 {
0125     return pci_domain_nr(bus);
0126 }
0127 #elif defined(CONFIG_PCI_DOMAINS)
0128 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
0129 
0130 static inline int pci_proc_domain(struct pci_bus *bus)
0131 {
0132     struct pci_controller *hose = bus->sysdata;
0133     return hose->need_domain_info;
0134 }
0135 #endif /* CONFIG_PCI_DOMAINS */
0136 
0137 #endif /* __KERNEL__ */
0138 
0139 /* Do platform specific device initialization at pci_enable_device() time */
0140 extern int pcibios_plat_dev_init(struct pci_dev *dev);
0141 
0142 #endif /* _ASM_PCI_H */