Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

asm-generic: Add new pci.h and use it

The asm/pci.h used for many newer architectures share similar definitions.
Move the common parts to asm-generic/pci.h to allow for sharing code.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/lkml/CAK8P3a0JmPeczfmMBE__vn=Jbvf=nkbpVaZCycyv40pZNCJJXQ@mail.gmail.com/
Link: https://lore.kernel.org/r/20220722214944.831438-5-shorne@gmail.com
Signed-off-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Pierre Morel <pmorel@linux.ibm.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

authored by

Stafford Horne and committed by
Bjorn Helgaas
a2912b45 f619d235

+40 -54
+2 -8
arch/arm64/include/asm/pci.h
··· 9 9 #include <asm/io.h> 10 10 11 11 #define PCIBIOS_MIN_IO 0x1000 12 - #define PCIBIOS_MIN_MEM 0 13 12 14 13 /* 15 14 * Set to 1 if the kernel should re-assign all PCI bus numbers ··· 17 18 (pci_has_flag(PCI_REASSIGN_ALL_BUS)) 18 19 19 20 #define arch_can_pci_mmap_wc() 1 20 - #define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 21 21 22 - #ifdef CONFIG_PCI 23 - static inline int pci_proc_domain(struct pci_bus *bus) 24 - { 25 - return 1; 26 - } 27 - #endif /* CONFIG_PCI */ 22 + /* Generic PCI */ 23 + #include <asm-generic/pci.h> 28 24 29 25 #endif /* __ASM_PCI_H */
+2 -15
arch/csky/include/asm/pci.h
··· 9 9 10 10 #include <asm/io.h> 11 11 12 - #define PCIBIOS_MIN_IO 0 13 - #define PCIBIOS_MIN_MEM 0 14 - 15 - /* C-SKY shim does not initialize PCI bus */ 16 - #define pcibios_assign_all_busses() 1 17 - 18 - #define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 19 - 20 - #ifdef CONFIG_PCI 21 - static inline int pci_proc_domain(struct pci_bus *bus) 22 - { 23 - /* always show the domain in /proc */ 24 - return 1; 25 - } 26 - #endif /* CONFIG_PCI */ 12 + /* Generic PCI */ 13 + #include <asm-generic/pci.h> 27 14 28 15 #endif /* __ASM_CSKY_PCI_H */
+4 -19
arch/riscv/include/asm/pci.h
··· 12 12 13 13 #include <asm/io.h> 14 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 - 15 + #if defined(CONFIG_PCI) && defined(CONFIG_NUMA) 32 16 static inline int pcibus_to_node(struct pci_bus *bus) 33 17 { 34 18 return dev_to_node(&bus->dev); ··· 22 38 cpu_all_mask : \ 23 39 cpumask_of_node(pcibus_to_node(bus))) 24 40 #endif 25 - #endif /* CONFIG_NUMA */ 41 + #endif /* defined(CONFIG_PCI) && defined(CONFIG_NUMA) */ 26 42 27 - #endif /* CONFIG_PCI */ 43 + /* Generic PCI */ 44 + #include <asm-generic/pci.h> 28 45 29 46 #endif /* _ASM_RISCV_PCI_H */
+2 -12
arch/um/include/asm/pci.h
··· 4 4 #include <linux/types.h> 5 5 #include <asm/io.h> 6 6 7 - #define PCIBIOS_MIN_IO 0 8 - #define PCIBIOS_MIN_MEM 0 9 - 10 - #define pcibios_assign_all_busses() 1 11 - 12 - #ifdef CONFIG_PCI_DOMAINS 13 - static inline int pci_proc_domain(struct pci_bus *bus) 14 - { 15 - /* always show the domain in /proc */ 16 - return 1; 17 - } 18 - #endif /* CONFIG_PCI */ 7 + /* Generic PCI */ 8 + #include <asm-generic/pci.h> 19 9 20 10 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN 21 11 /*
+30
include/asm-generic/pci.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + 3 + #ifndef __ASM_GENERIC_PCI_H 4 + #define __ASM_GENERIC_PCI_H 5 + 6 + #ifndef PCIBIOS_MIN_IO 7 + #define PCIBIOS_MIN_IO 0 8 + #endif 9 + 10 + #ifndef PCIBIOS_MIN_MEM 11 + #define PCIBIOS_MIN_MEM 0 12 + #endif 13 + 14 + #ifndef pcibios_assign_all_busses 15 + /* For bootloaders that do not initialize the PCI bus */ 16 + #define pcibios_assign_all_busses() 1 17 + #endif 18 + 19 + /* Enable generic resource mapping code in drivers/pci/ */ 20 + #define ARCH_GENERIC_PCI_MMAP_RESOURCE 21 + 22 + #ifdef CONFIG_PCI_DOMAINS 23 + static inline int pci_proc_domain(struct pci_bus *bus) 24 + { 25 + /* always show the domain in /proc */ 26 + return 1; 27 + } 28 + #endif /* CONFIG_PCI_DOMAINS */ 29 + 30 + #endif /* __ASM_GENERIC_PCI_H */