xref: /openbmc/linux/arch/microblaze/include/asm/pci.h (revision c4fa9a6a)
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Based on powerpc version
8  */
9 
10 #ifndef __ASM_MICROBLAZE_PCI_H
11 #define __ASM_MICROBLAZE_PCI_H
12 #ifdef __KERNEL__
13 
14 #include <linux/types.h>
15 #include <linux/slab.h>
16 #include <linux/string.h>
17 #include <linux/dma-mapping.h>
18 #include <linux/pci.h>
19 
20 #include <asm/scatterlist.h>
21 #include <asm/io.h>
22 #include <asm/prom.h>
23 #include <asm/pci-bridge.h>
24 
25 #include <asm-generic/pci-dma-compat.h>
26 
27 #define PCIBIOS_MIN_IO		0x1000
28 #define PCIBIOS_MIN_MEM		0x10000000
29 
30 /* Values for the `which' argument to sys_pciconfig_iobase syscall.  */
31 #define IOBASE_BRIDGE_NUMBER	0
32 #define IOBASE_MEMORY		1
33 #define IOBASE_IO		2
34 #define IOBASE_ISA_IO		3
35 #define IOBASE_ISA_MEM		4
36 
37 #define pcibios_scan_all_fns(a, b)	0
38 
39 /*
40  * Set this to 1 if you want the kernel to re-assign all PCI
41  * bus numbers (don't do that on ppc64 yet !)
42  */
43 #define pcibios_assign_all_busses()	0
44 
45 #ifdef CONFIG_PCI
46 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
47 					enum pci_dma_burst_strategy *strat,
48 					unsigned long *strategy_parameter)
49 {
50 	*strat = PCI_DMA_BURST_INFINITY;
51 	*strategy_parameter = ~0UL;
52 }
53 #endif
54 
55 extern int pci_domain_nr(struct pci_bus *bus);
56 
57 /* Decide whether to display the domain number in /proc */
58 extern int pci_proc_domain(struct pci_bus *bus);
59 
60 struct vm_area_struct;
61 /* Map a range of PCI memory or I/O space for a device into user space */
62 int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
63 			enum pci_mmap_state mmap_state, int write_combine);
64 
65 /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
66 #define HAVE_PCI_MMAP	1
67 
68 extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
69 			   size_t count);
70 extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
71 			   size_t count);
72 extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
73 				      struct vm_area_struct *vma,
74 				      enum pci_mmap_state mmap_state);
75 
76 #define HAVE_PCI_LEGACY	1
77 
78 /* The PCI address space does equal the physical memory
79  * address space (no IOMMU).  The IDE and SCSI device layers use
80  * this boolean for bounce buffer decisions.
81  */
82 #define PCI_DMA_BUS_IS_PHYS     (1)
83 
84 static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
85 			struct resource *res)
86 {
87 	struct resource *root = NULL;
88 
89 	if (res->flags & IORESOURCE_IO)
90 		root = &ioport_resource;
91 	if (res->flags & IORESOURCE_MEM)
92 		root = &iomem_resource;
93 
94 	return root;
95 }
96 
97 extern void pcibios_claim_one_bus(struct pci_bus *b);
98 
99 extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
100 
101 extern void pcibios_resource_survey(void);
102 
103 struct file;
104 extern pgprot_t	pci_phys_mem_access_prot(struct file *file,
105 					 unsigned long pfn,
106 					 unsigned long size,
107 					 pgprot_t prot);
108 
109 #define HAVE_ARCH_PCI_RESOURCE_TO_USER
110 extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
111 				 const struct resource *rsrc,
112 				 resource_size_t *start, resource_size_t *end);
113 
114 extern void pcibios_setup_bus_devices(struct pci_bus *bus);
115 extern void pcibios_setup_bus_self(struct pci_bus *bus);
116 
117 /* This part of code was originally in xilinx-pci.h */
118 #ifdef CONFIG_PCI_XILINX
119 extern void __init xilinx_pci_init(void);
120 #else
121 static inline void __init xilinx_pci_init(void) { return; }
122 #endif
123 
124 #endif	/* __KERNEL__ */
125 #endif /* __ASM_MICROBLAZE_PCI_H */
126