xref: /OK3568_Linux_fs/kernel/arch/microblaze/include/asm/pci.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Based on powerpc version
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #ifndef __ASM_MICROBLAZE_PCI_H
8*4882a593Smuzhiyun #define __ASM_MICROBLAZE_PCI_H
9*4882a593Smuzhiyun #ifdef __KERNEL__
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include <linux/types.h>
12*4882a593Smuzhiyun #include <linux/slab.h>
13*4882a593Smuzhiyun #include <linux/string.h>
14*4882a593Smuzhiyun #include <linux/dma-mapping.h>
15*4882a593Smuzhiyun #include <linux/pci.h>
16*4882a593Smuzhiyun #include <linux/scatterlist.h>
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #include <asm/io.h>
19*4882a593Smuzhiyun #include <asm/pci-bridge.h>
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #define PCIBIOS_MIN_IO		0x1000
22*4882a593Smuzhiyun #define PCIBIOS_MIN_MEM		0x10000000
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun /* Values for the `which' argument to sys_pciconfig_iobase syscall.  */
25*4882a593Smuzhiyun #define IOBASE_BRIDGE_NUMBER	0
26*4882a593Smuzhiyun #define IOBASE_MEMORY		1
27*4882a593Smuzhiyun #define IOBASE_IO		2
28*4882a593Smuzhiyun #define IOBASE_ISA_IO		3
29*4882a593Smuzhiyun #define IOBASE_ISA_MEM		4
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #define pcibios_scan_all_fns(a, b)	0
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun /*
34*4882a593Smuzhiyun  * Set this to 1 if you want the kernel to re-assign all PCI
35*4882a593Smuzhiyun  * bus numbers (don't do that on ppc64 yet !)
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun #define pcibios_assign_all_busses()	0
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun extern int pci_domain_nr(struct pci_bus *bus);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /* Decide whether to display the domain number in /proc */
42*4882a593Smuzhiyun extern int pci_proc_domain(struct pci_bus *bus);
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun struct vm_area_struct;
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun /* Tell PCI code what kind of PCI resource mappings we support */
47*4882a593Smuzhiyun #define HAVE_PCI_MMAP			1
48*4882a593Smuzhiyun #define ARCH_GENERIC_PCI_MMAP_RESOURCE	1
49*4882a593Smuzhiyun #define arch_can_pci_mmap_io()		1
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
52*4882a593Smuzhiyun 			   size_t count);
53*4882a593Smuzhiyun extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
54*4882a593Smuzhiyun 			   size_t count);
55*4882a593Smuzhiyun extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
56*4882a593Smuzhiyun 				      struct vm_area_struct *vma,
57*4882a593Smuzhiyun 				      enum pci_mmap_state mmap_state);
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun #define HAVE_PCI_LEGACY	1
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun extern void pcibios_resource_survey(void);
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun struct file;
64*4882a593Smuzhiyun extern pgprot_t	pci_phys_mem_access_prot(struct file *file,
65*4882a593Smuzhiyun 					 unsigned long pfn,
66*4882a593Smuzhiyun 					 unsigned long size,
67*4882a593Smuzhiyun 					 pgprot_t prot);
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /* This part of code was originally in xilinx-pci.h */
70*4882a593Smuzhiyun #ifdef CONFIG_PCI_XILINX
71*4882a593Smuzhiyun extern void __init xilinx_pci_init(void);
72*4882a593Smuzhiyun #else
xilinx_pci_init(void)73*4882a593Smuzhiyun static inline void __init xilinx_pci_init(void) { return; }
74*4882a593Smuzhiyun #endif
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun #endif	/* __KERNEL__ */
77*4882a593Smuzhiyun #endif /* __ASM_MICROBLAZE_PCI_H */
78