1384740dcSRalf Baechle /* 2384740dcSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public 3384740dcSRalf Baechle * License. See the file "COPYING" in the main directory of this archive 4384740dcSRalf Baechle * for more details. 5384740dcSRalf Baechle */ 6384740dcSRalf Baechle #ifndef _ASM_PCI_H 7384740dcSRalf Baechle #define _ASM_PCI_H 8384740dcSRalf Baechle 9384740dcSRalf Baechle #include <linux/mm.h> 10384740dcSRalf Baechle 11384740dcSRalf Baechle #ifdef __KERNEL__ 12384740dcSRalf Baechle 13384740dcSRalf Baechle /* 14384740dcSRalf Baechle * This file essentially defines the interface between board 15384740dcSRalf Baechle * specific PCI code and MIPS common PCI code. Should potentially put 16384740dcSRalf Baechle * into include/asm/pci.h file. 17384740dcSRalf Baechle */ 18384740dcSRalf Baechle 19384740dcSRalf Baechle #include <linux/ioport.h> 2023dac14dSPaul Burton #include <linux/list.h> 21a48cf37aSJohn Crispin #include <linux/of.h> 22384740dcSRalf Baechle 23c5611df9SPaul Burton #ifdef CONFIG_PCI_DRIVERS_LEGACY 24c5611df9SPaul Burton 25384740dcSRalf Baechle /* 26384740dcSRalf Baechle * Each pci channel is a top-level PCI bus seem by CPU. A machine with 27384740dcSRalf Baechle * multiple PCI channels may have multiple PCI host controllers or a 28384740dcSRalf Baechle * single controller supporting multiple channels. 29384740dcSRalf Baechle */ 30384740dcSRalf Baechle struct pci_controller { 3123dac14dSPaul Burton struct list_head list; 32384740dcSRalf Baechle struct pci_bus *bus; 33a48cf37aSJohn Crispin struct device_node *of_node; 34384740dcSRalf Baechle 35384740dcSRalf Baechle struct pci_ops *pci_ops; 36384740dcSRalf Baechle struct resource *mem_resource; 37384740dcSRalf Baechle unsigned long mem_offset; 38384740dcSRalf Baechle struct resource *io_resource; 39384740dcSRalf Baechle unsigned long io_offset; 40384740dcSRalf Baechle unsigned long io_map_base; 41384740dcSRalf Baechle 4288555b48SPaul Burton #ifndef CONFIG_PCI_DOMAINS_GENERIC 43384740dcSRalf Baechle unsigned int index; 44384740dcSRalf Baechle /* For compatibility with current (as of July 2003) pciutils 45384740dcSRalf Baechle and XFree86. Eventually will be removed. */ 46384740dcSRalf Baechle unsigned int need_domain_info; 4788555b48SPaul Burton #endif 48384740dcSRalf Baechle 49384740dcSRalf Baechle /* Optional access methods for reading/writing the bus number 50384740dcSRalf Baechle of the PCI controller */ 51384740dcSRalf Baechle int (*get_busno)(void); 52384740dcSRalf Baechle void (*set_busno)(int busno); 53384740dcSRalf Baechle }; 54384740dcSRalf Baechle 55384740dcSRalf Baechle /* 56384740dcSRalf Baechle * Used by boards to register their PCI busses before the actual scanning. 57384740dcSRalf Baechle */ 58384740dcSRalf Baechle extern void register_pci_controller(struct pci_controller *hose); 59384740dcSRalf Baechle 60384740dcSRalf Baechle /* 61384740dcSRalf Baechle * board supplied pci irq fixup routine 62384740dcSRalf Baechle */ 63384740dcSRalf Baechle extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 64384740dcSRalf Baechle 65c5611df9SPaul Burton /* Do platform specific device initialization at pci_enable_device() time */ 66c5611df9SPaul Burton extern int pcibios_plat_dev_init(struct pci_dev *dev); 67c5611df9SPaul Burton 68c5611df9SPaul Burton extern char * (*pcibios_plat_setup)(char *str); 69c5611df9SPaul Burton 70c5611df9SPaul Burton #ifdef CONFIG_OF 71c5611df9SPaul Burton /* this function parses memory ranges from a device node */ 72c5611df9SPaul Burton extern void pci_load_of_ranges(struct pci_controller *hose, 73c5611df9SPaul Burton struct device_node *node); 74c5611df9SPaul Burton #else pci_load_of_ranges(struct pci_controller * hose,struct device_node * node)75c5611df9SPaul Burtonstatic inline void pci_load_of_ranges(struct pci_controller *hose, 76c5611df9SPaul Burton struct device_node *node) {} 77c5611df9SPaul Burton #endif 78c5611df9SPaul Burton 79c5611df9SPaul Burton #ifdef CONFIG_PCI_DOMAINS_GENERIC set_pci_need_domain_info(struct pci_controller * hose,int need_domain_info)80c5611df9SPaul Burtonstatic inline void set_pci_need_domain_info(struct pci_controller *hose, 81c5611df9SPaul Burton int need_domain_info) 82c5611df9SPaul Burton { 83c5611df9SPaul Burton /* nothing to do */ 84c5611df9SPaul Burton } 85c5611df9SPaul Burton #elif defined(CONFIG_PCI_DOMAINS) set_pci_need_domain_info(struct pci_controller * hose,int need_domain_info)86c5611df9SPaul Burtonstatic inline void set_pci_need_domain_info(struct pci_controller *hose, 87c5611df9SPaul Burton int need_domain_info) 88c5611df9SPaul Burton { 89c5611df9SPaul Burton hose->need_domain_info = need_domain_info; 90c5611df9SPaul Burton } 91c5611df9SPaul Burton #endif /* CONFIG_PCI_DOMAINS */ 92c5611df9SPaul Burton 93c5611df9SPaul Burton #endif 94384740dcSRalf Baechle 95384740dcSRalf Baechle /* Can be used to override the logic in pci_scan_bus for skipping 96384740dcSRalf Baechle already-configured bus numbers - to be used for buggy BIOSes 97384740dcSRalf Baechle or architectures with incomplete PCI setup by the loader */ pcibios_assign_all_busses(void)98ab96b031SPaul Burtonstatic inline unsigned int pcibios_assign_all_busses(void) 99ab96b031SPaul Burton { 100ab96b031SPaul Burton return 1; 101ab96b031SPaul Burton } 102384740dcSRalf Baechle 103384740dcSRalf Baechle extern unsigned long PCIBIOS_MIN_IO; 104384740dcSRalf Baechle extern unsigned long PCIBIOS_MIN_MEM; 105384740dcSRalf Baechle 106384740dcSRalf Baechle #define PCIBIOS_MIN_CARDBUS_IO 0x4000 107384740dcSRalf Baechle 10898873f53SRalf Baechle #define HAVE_PCI_MMAP 109*35368f80SDavid Woodhouse #define ARCH_GENERIC_PCI_MMAP_RESOURCE 1104c2924b7SWolfgang Grandegger 111384740dcSRalf Baechle /* 112384740dcSRalf Baechle * Dynamic DMA mapping stuff. 113384740dcSRalf Baechle * MIPS has everything mapped statically. 114384740dcSRalf Baechle */ 115384740dcSRalf Baechle 116384740dcSRalf Baechle #include <linux/types.h> 117384740dcSRalf Baechle #include <linux/slab.h> 11884be456fSChristoph Hellwig #include <linux/scatterlist.h> 119384740dcSRalf Baechle #include <linux/string.h> 120384740dcSRalf Baechle #include <asm/io.h> 121384740dcSRalf Baechle 12288555b48SPaul Burton #ifdef CONFIG_PCI_DOMAINS_GENERIC pci_proc_domain(struct pci_bus * bus)12388555b48SPaul Burtonstatic inline int pci_proc_domain(struct pci_bus *bus) 12488555b48SPaul Burton { 12588555b48SPaul Burton return pci_domain_nr(bus); 12688555b48SPaul Burton } 12788555b48SPaul Burton #elif defined(CONFIG_PCI_DOMAINS) 128384740dcSRalf Baechle #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 129384740dcSRalf Baechle pci_proc_domain(struct pci_bus * bus)130384740dcSRalf Baechlestatic inline int pci_proc_domain(struct pci_bus *bus) 131384740dcSRalf Baechle { 132384740dcSRalf Baechle struct pci_controller *hose = bus->sysdata; 133384740dcSRalf Baechle return hose->need_domain_info; 134384740dcSRalf Baechle } 1356fb8a163SZubair Lutfullah Kakakhel #endif /* CONFIG_PCI_DOMAINS */ 136384740dcSRalf Baechle 137384740dcSRalf Baechle #endif /* __KERNEL__ */ 138384740dcSRalf Baechle 139384740dcSRalf Baechle /* Do platform specific device initialization at pci_enable_device() time */ 140384740dcSRalf Baechle extern int pcibios_plat_dev_init(struct pci_dev *dev); 141384740dcSRalf Baechle 142384740dcSRalf Baechle #endif /* _ASM_PCI_H */ 143