Skip to content

Commit a2912b4

Browse files
stffrdhrnbjorn-helgaas
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/lkml/CAK8P3a0JmPeczfmMBE__vn=Jbvf=nkbpVaZCycyv40pZNCJJXQ@mail.gmail.com/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stafford Horne <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Acked-by: Pierre Morel <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]>
1 parent f619d23 commit a2912b4

File tree

5 files changed

+40
-54
lines changed

5 files changed

+40
-54
lines changed

arch/arm64/include/asm/pci.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <asm/io.h>
1010

1111
#define PCIBIOS_MIN_IO 0x1000
12-
#define PCIBIOS_MIN_MEM 0
1312

1413
/*
1514
* Set to 1 if the kernel should re-assign all PCI bus numbers
@@ -18,13 +17,8 @@
1817
(pci_has_flag(PCI_REASSIGN_ALL_BUS))
1918

2019
#define arch_can_pci_mmap_wc() 1
21-
#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
2220

23-
#ifdef CONFIG_PCI
24-
static inline int pci_proc_domain(struct pci_bus *bus)
25-
{
26-
return 1;
27-
}
28-
#endif /* CONFIG_PCI */
21+
/* Generic PCI */
22+
#include <asm-generic/pci.h>
2923

3024
#endif /* __ASM_PCI_H */

arch/csky/include/asm/pci.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,7 @@
99

1010
#include <asm/io.h>
1111

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>
2714

2815
#endif /* __ASM_CSKY_PCI_H */

arch/riscv/include/asm/pci.h

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,7 @@
1212

1313
#include <asm/io.h>
1414

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)
3216
static inline int pcibus_to_node(struct pci_bus *bus)
3317
{
3418
return dev_to_node(&bus->dev);
@@ -38,8 +22,9 @@ static inline int pcibus_to_node(struct pci_bus *bus)
3822
cpu_all_mask : \
3923
cpumask_of_node(pcibus_to_node(bus)))
4024
#endif
41-
#endif /* CONFIG_NUMA */
25+
#endif /* defined(CONFIG_PCI) && defined(CONFIG_NUMA) */
4226

43-
#endif /* CONFIG_PCI */
27+
/* Generic PCI */
28+
#include <asm-generic/pci.h>
4429

4530
#endif /* _ASM_RISCV_PCI_H */

arch/um/include/asm/pci.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44
#include <linux/types.h>
55
#include <asm/io.h>
66

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>
199

2010
#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
2111
/*

include/asm-generic/pci.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 */

0 commit comments

Comments
 (0)