xref: /openbmc/linux/arch/riscv/include/asm/pci.h (revision abb4970a)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2016 SiFive
4  */
5 
6 #ifndef _ASM_RISCV_PCI_H
7 #define _ASM_RISCV_PCI_H
8 
9 #include <linux/types.h>
10 #include <linux/slab.h>
11 #include <linux/dma-mapping.h>
12 
13 #include <asm/io.h>
14 
15 #define PCIBIOS_MIN_IO		0
16 #define PCIBIOS_MIN_MEM		0
17 
18 /* RISC-V shim does not initialize PCI bus */
19 #define pcibios_assign_all_busses() 1
20 
21 #define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
22 
23 #ifdef CONFIG_PCI
24 static inline int pci_proc_domain(struct pci_bus *bus)
25 {
26 	/* always show the domain in /proc */
27 	return 1;
28 }
29 
30 #ifdef	CONFIG_NUMA
31 
32 static inline int pcibus_to_node(struct pci_bus *bus)
33 {
34 	return dev_to_node(&bus->dev);
35 }
36 #ifndef cpumask_of_pcibus
37 #define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
38 				 cpu_all_mask :				\
39 				 cpumask_of_node(pcibus_to_node(bus)))
40 #endif
41 #endif	/* CONFIG_NUMA */
42 
43 #endif  /* CONFIG_PCI */
44 
45 #endif  /* _ASM_RISCV_PCI_H */
46