Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
3a3181e
Documentation
LICENSES
arch
alpha
arc
arm
arm64
c6x
csky
h8300
hexagon
ia64
m68k
microblaze
mips
nds32
nios2
openrisc
parisc
powerpc
boot
configs
crypto
include
asm
book3s
nohash
8xx_immap.h
Kbuild
accounting.h
agp.h
archrandom.h
asm-compat.h
asm-const.h
asm-offsets.h
asm-prototypes.h
async_tx.h
atomic.h
backlight.h
barrier.h
bitops.h
bootx.h
btext.h
bug.h
bugs.h
cache.h
cacheflush.h
cell-pmu.h
cell-regs.h
checksum.h
cmpxchg.h
code-patching-asm.h
code-patching.h
compat.h
context_tracking.h
copro.h
cpm.h
cpm1.h
cpm2.h
cpu_has_feature.h
cpufeature.h
cpuidle.h
cputable.h
cputhreads.h
cputime.h
crashdump-ppc64.h
current.h
dbdma.h
dbell.h
dcr-generic.h
dcr-mmio.h
dcr-native.h
dcr-regs.h
dcr.h
debug.h
debugfs.h
delay.h
device.h
disassemble.h
dma-direct.h
dma.h
drmem.h
dt_cpu_ftrs.h
dtl.h
edac.h
eeh.h
eeh_event.h
ehv_pic.h
elf.h
elfnote.h
emergency-restart.h
emulated_ops.h
epapr_hcalls.h
exception-64e.h
exception-64s.h
exec.h
extable.h
fadump-internal.h
fadump.h
fb.h
feature-fixups.h
firmware.h
fixmap.h
floppy.h
fs_pd.h
fsl_85xx_cache_sram.h
fsl_gtm.h
fsl_hcalls.h
fsl_lbc.h
fsl_pamu_stash.h
fsl_pm.h
ftrace.h
futex.h
grackle.h
hardirq.h
head-64.h
heathrow.h
highmem.h
hmi.h
hugetlb.h
hvcall.h
hvconsole.h
hvcserver.h
hvsi.h
hw_breakpoint.h
hw_irq.h
hydra.h
i8259.h
ibmebus.h
icswx.h
ide.h
idle.h
ima.h
imc-pmu.h
immap_cpm2.h
inst.h
io-defs.h
io-workarounds.h
io.h
io_event_irq.h
iommu.h
ipic.h
irq.h
irq_work.h
irqflags.h
isa-bridge.h
jump_label.h
kasan.h
kdebug.h
kdump.h
kexec.h
kexec_ranges.h
keylargo.h
kgdb.h
kmap_types.h
kprobes.h
kup.h
kvm_asm.h
kvm_book3s.h
kvm_book3s_32.h
kvm_book3s_64.h
kvm_book3s_asm.h
kvm_book3s_uvmem.h
kvm_booke.h
kvm_booke_hv_asm.h
kvm_fpu.h
kvm_host.h
kvm_para.h
kvm_ppc.h
libata-portmap.h
linkage.h
livepatch.h
local.h
lppaca.h
lv1call.h
machdep.h
macio.h
mc146818rtc.h
mce.h
mediabay.h
mem_encrypt.h
membarrier.h
mm-arch-hooks.h
mman.h
mmiowb.h
mmu.h
mmu_context.h
mmzone.h
module.h
mpc5121.h
mpc52xx.h
mpc52xx_psc.h
mpc5xxx.h
mpc6xx.h
mpc8260.h
mpc85xx.h
mpic.h
mpic_msgr.h
mpic_timer.h
msi_bitmap.h
nmi.h
nvram.h
ohare.h
opal-api.h
opal.h
oprofile_impl.h
paca.h
page.h
page_32.h
page_64.h
paravirt.h
parport.h
pasemi_dma.h
pci-bridge.h
pci.h
percpu.h
perf_event.h
perf_event_fsl_emb.h
perf_event_server.h
pgalloc.h
pgtable-be-types.h
pgtable-types.h
pgtable.h
pkeys.h
plpar_wrappers.h
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
pmi.h
pnv-ocxl.h
pnv-pci.h
powernv.h
ppc-opcode.h
ppc-pci.h
ppc4xx.h
ppc_asm.h
probes.h
processor.h
prom.h
ps3.h
ps3av.h
ps3gpu.h
ps3stor.h
pte-walk.h
ptrace.h
qspinlock.h
qspinlock_paravirt.h
reg.h
reg_8xx.h
reg_a2.h
reg_booke.h
reg_fsl_emb.h
rheap.h
rio.h
rtas-types.h
rtas.h
runlatch.h
seccomp.h
sections.h
secure_boot.h
security_features.h
secvar.h
serial.h
setjmp.h
setup.h
sfp-machine.h
shmparam.h
signal.h
simple_spinlock.h
simple_spinlock_types.h
slice.h
smp.h
smu.h
sparsemem.h
spinlock.h
spinlock_types.h
spu.h
spu_csa.h
spu_info.h
spu_priv1.h
sstep.h
stackprotector.h
stacktrace.h
string.h
svm.h
swab.h
swiotlb.h
switch_to.h
synch.h
syscall.h
syscalls.h
task_size_32.h
task_size_64.h
tce.h
termios.h
thread_info.h
time.h
timex.h
tlb.h
tlbflush.h
tm.h
topology.h
trace.h
trace_clock.h
tsi108.h
tsi108_irq.h
tsi108_pci.h
types.h
uaccess.h
udbg.h
uic.h
ultravisor-api.h
ultravisor.h
unaligned.h
uninorth.h
unistd.h
uprobes.h
user.h
vas.h
vdso.h
vdso_datapage.h
vermagic.h
vga.h
vio.h
vmalloc.h
word-at-a-time.h
xics.h
xive-regs.h
xive.h
xmon.h
xor.h
xor_altivec.h
uapi
kernel
kexec
kvm
lib
math-emu
mm
net
oprofile
perf
platforms
purgatory
sysdev
tools
xmon
Kbuild
Kconfig
Kconfig.debug
Makefile
Makefile.postlink
riscv
s390
sh
sparc
um
x86
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
powerpc
/
include
/
asm
/
pci-bridge.h
Blame
Blame
Latest commit
History
History
304 lines (253 loc) · 9.28 KB
Breadcrumbs
linux
/
arch
/
powerpc
/
include
/
asm
/
pci-bridge.h
Top
File metadata and controls
Code
Blame
304 lines (253 loc) · 9.28 KB
Raw
/* SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef _ASM_POWERPC_PCI_BRIDGE_H #define _ASM_POWERPC_PCI_BRIDGE_H #ifdef __KERNEL__ /* */ #include <linux/pci.h> #include <linux/list.h> #include <linux/ioport.h> #include <linux/numa.h> struct device_node; /* * PCI controller operations */ struct pci_controller_ops { void (*dma_dev_setup)(struct pci_dev *pdev); void (*dma_bus_setup)(struct pci_bus *bus); bool (*iommu_bypass_supported)(struct pci_dev *pdev, u64 mask); int (*probe_mode)(struct pci_bus *bus); /* Called when pci_enable_device() is called. Returns true to * allow assignment/enabling of the device. */ bool (*enable_device_hook)(struct pci_dev *pdev); void (*disable_device)(struct pci_dev *pdev); void (*release_device)(struct pci_dev *pdev); /* Called during PCI resource reassignment */ resource_size_t (*window_alignment)(struct pci_bus *bus, unsigned long type); void (*setup_bridge)(struct pci_bus *bus, unsigned long type); void (*reset_secondary_bus)(struct pci_dev *pdev); #ifdef CONFIG_PCI_MSI int (*setup_msi_irqs)(struct pci_dev *pdev, int nvec, int type); void (*teardown_msi_irqs)(struct pci_dev *pdev); #endif void (*shutdown)(struct pci_controller *hose); }; /* * Structure of a PCI controller (host bridge) * * @irq_count: number of interrupt mappings * @irq_map: interrupt mappings */ struct pci_controller { struct pci_bus *bus; char is_dynamic; #ifdef CONFIG_PPC64 int node; #endif struct device_node *dn; struct list_head list_node; struct device *parent; int first_busno; int last_busno; int self_busno; struct resource busn; void __iomem *io_base_virt; #ifdef CONFIG_PPC64 void __iomem *io_base_alloc; #endif resource_size_t io_base_phys; resource_size_t pci_io_size; /* Some machines have a special region to forward the ISA * "memory" cycles such as VGA memory regions. Left to 0 * if unsupported */ resource_size_t isa_mem_phys; resource_size_t isa_mem_size; struct pci_controller_ops controller_ops; struct pci_ops *ops; unsigned int __iomem *cfg_addr; void __iomem *cfg_data; /* * Used for variants of PCI indirect handling and possible quirks: * SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1 * EXT_REG - provides access to PCI-e extended registers * SURPRESS_PRIMARY_BUS - we suppress the setting of PCI_PRIMARY_BUS * on Freescale PCI-e controllers since they used the PCI_PRIMARY_BUS * to determine which bus number to match on when generating type0 * config cycles * NO_PCIE_LINK - the Freescale PCI-e controllers have issues with * hanging if we don't have link and try to do config cycles to * anything but the PHB. Only allow talking to the PHB if this is * set. * BIG_ENDIAN - cfg_addr is a big endian register * BROKEN_MRM - the 440EPx/GRx chips have an errata that causes hangs on * the PLB4. Effectively disable MRM commands by setting this. * FSL_CFG_REG_LINK - Freescale controller version in which the PCIe * link status is in a RC PCIe cfg register (vs being a SoC register) */ #define PPC_INDIRECT_TYPE_SET_CFG_TYPE 0x00000001 #define PPC_INDIRECT_TYPE_EXT_REG 0x00000002 #define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS 0x00000004 #define PPC_INDIRECT_TYPE_NO_PCIE_LINK 0x00000008 #define PPC_INDIRECT_TYPE_BIG_ENDIAN 0x00000010 #define PPC_INDIRECT_TYPE_BROKEN_MRM 0x00000020 #define PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK 0x00000040 u32 indirect_type; /* Currently, we limit ourselves to 1 IO range and 3 mem * ranges since the common pci_bus structure can't handle more */ struct resource io_resource; struct resource mem_resources[3]; resource_size_t mem_offset[3]; int global_number; /* PCI domain number */ resource_size_t dma_window_base_cur; resource_size_t dma_window_size; #ifdef CONFIG_PPC64 unsigned long buid; struct pci_dn *pci_data; #endif /* CONFIG_PPC64 */ void *private_data; struct npu *npu; unsigned int irq_count; unsigned int *irq_map; }; /* These are used for config access before all the PCI probing has been done. */ extern int early_read_config_byte(struct pci_controller *hose, int bus, int dev_fn, int where, u8 *val); extern int early_read_config_word(struct pci_controller *hose, int bus, int dev_fn, int where, u16 *val); extern int early_read_config_dword(struct pci_controller *hose, int bus, int dev_fn, int where, u32 *val); extern int early_write_config_byte(struct pci_controller *hose, int bus, int dev_fn, int where, u8 val); extern int early_write_config_word(struct pci_controller *hose, int bus, int dev_fn, int where, u16 val); extern int early_write_config_dword(struct pci_controller *hose, int bus, int dev_fn, int where, u32 val); extern int early_find_capability(struct pci_controller *hose, int bus, int dev_fn, int cap); extern void setup_indirect_pci(struct pci_controller* hose, resource_size_t cfg_addr, resource_size_t cfg_data, u32 flags); extern int indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, int len, u32 *val); extern int __indirect_read_config(struct pci_controller *hose, unsigned char bus_number, unsigned int devfn, int offset, int len, u32 *val); extern int indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset, int len, u32 val); static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) { return bus->sysdata; } #ifndef CONFIG_PPC64 extern int pci_device_from_OF_node(struct device_node *node, u8 *bus, u8 *devfn); extern void pci_create_OF_bus_map(void); #else /* CONFIG_PPC64 */ /* * PCI stuff, for nodes representing PCI devices, pointed to * by device_node->data. */ struct iommu_table; struct pci_dn { int flags; #define PCI_DN_FLAG_IOV_VF 0x01 #define PCI_DN_FLAG_DEAD 0x02 /* Device has been hot-removed */ int busno; /* pci bus number */ int devfn; /* pci device and function number */ int vendor_id; /* Vendor ID */ int device_id; /* Device ID */ int class_code; /* Device class code */ struct pci_dn *parent; struct pci_controller *phb; /* for pci devices */ struct iommu_table_group *table_group; /* for phb's or bridges */ int pci_ext_config_space; /* for pci devices */ #ifdef CONFIG_EEH struct eeh_dev *edev; /* eeh device */ #endif #define IODA_INVALID_PE 0xFFFFFFFF unsigned int pe_number; #ifdef CONFIG_PCI_IOV u16 vfs_expanded; /* number of VFs IOV BAR expanded */ u16 num_vfs; /* number of VFs enabled*/ unsigned int *pe_num_map; /* PE# for the first VF PE or array */ bool m64_single_mode; /* Use M64 BAR in Single Mode */ #define IODA_INVALID_M64 (-1) int (*m64_map)[PCI_SRIOV_NUM_BARS]; /* Only used on powernv */ int last_allow_rc; /* Only used on pseries */ #endif /* CONFIG_PCI_IOV */ int mps; /* Maximum Payload Size */ struct list_head child_list; struct list_head list; struct resource holes[PCI_SRIOV_NUM_BARS]; }; /* Get the pointer to a device_node's pci_dn */ #define PCI_DN(dn) ((struct pci_dn *) (dn)->data) extern struct pci_dn *pci_get_pdn_by_devfn(struct pci_bus *bus, int devfn); extern struct pci_dn *pci_get_pdn(struct pci_dev *pdev); extern struct pci_dn *pci_add_device_node_info(struct pci_controller *hose, struct device_node *dn); extern void pci_remove_device_node_info(struct device_node *dn); #ifdef CONFIG_PCI_IOV struct pci_dn *add_sriov_vf_pdns(struct pci_dev *pdev); void remove_sriov_vf_pdns(struct pci_dev *pdev); #endif static inline int pci_device_from_OF_node(struct device_node *np, u8 *bus, u8 *devfn) { if (!PCI_DN(np)) return -ENODEV; *bus = PCI_DN(np)->busno; *devfn = PCI_DN(np)->devfn; return 0; } #if defined(CONFIG_EEH) static inline struct eeh_dev *pdn_to_eeh_dev(struct pci_dn *pdn) { return pdn ? pdn->edev : NULL; } #else #define pdn_to_eeh_dev(x) (NULL) #endif /** Find the bus corresponding to the indicated device node */ extern struct pci_bus *pci_find_bus_by_node(struct device_node *dn); /** Remove all of the PCI devices under this bus */ extern void pci_hp_remove_devices(struct pci_bus *bus); /** Discover new pci devices under this bus, and add them */ extern void pci_hp_add_devices(struct pci_bus *bus); extern int pcibios_unmap_io_space(struct pci_bus *bus); extern int pcibios_map_io_space(struct pci_bus *bus); #ifdef CONFIG_NUMA #define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE)) #else #define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE) #endif #endif /* CONFIG_PPC64 */ /* Get the PCI host controller for an OF device */ extern struct pci_controller *pci_find_hose_for_OF_device( struct device_node* node); extern struct pci_controller *pci_find_controller_for_domain(int domain_nr); /* Fill up host controller resources from the OF node */ extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, struct device_node *dev, int primary); /* Allocate & free a PCI host bridge structure */ extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev); extern void pcibios_free_controller(struct pci_controller *phb); extern void pcibios_free_controller_deferred(struct pci_host_bridge *bridge); #ifdef CONFIG_PCI extern int pcibios_vaddr_is_ioport(void __iomem *address); #else static inline int pcibios_vaddr_is_ioport(void __iomem *address) { return 0; } #endif /* CONFIG_PCI */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
You can’t perform that action at this time.