Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef _ASM_X86_PCI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define _ASM_X86_PCI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/mm.h> /* for struct page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/scatterlist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/numa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <asm/memtype.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <asm/x86_init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct pci_sysdata {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	int		domain;		/* PCI domain */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	int		node;		/* NUMA node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #ifdef CONFIG_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	struct acpi_device *companion;	/* ACPI companion device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	void		*iommu;		/* IOMMU private data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	void		*fwnode;	/* IRQ domain for MSI assignment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #if IS_ENABLED(CONFIG_VMD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	struct pci_dev	*vmd_dev;	/* VMD Device if in Intel VMD domain */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) extern int pci_routeirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) extern int noioapicquirk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) extern int noioapicreroute;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) static inline struct pci_sysdata *to_pci_sysdata(const struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	return bus->sysdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #ifdef CONFIG_PCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #ifdef CONFIG_PCI_DOMAINS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) static inline int pci_domain_nr(struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	return to_pci_sysdata(bus)->domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) static inline int pci_proc_domain(struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	return pci_domain_nr(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	return to_pci_sysdata(bus)->fwnode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define pci_root_bus_fwnode	_pci_root_bus_fwnode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #if IS_ENABLED(CONFIG_VMD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static inline bool is_vmd(struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	return to_pci_sysdata(bus)->vmd_dev != NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define is_vmd(bus)		false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #endif /* CONFIG_VMD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) /* Can be used to override the logic in pci_scan_bus for skipping
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)    already-configured bus numbers - to be used for buggy BIOSes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)    or architectures with incomplete PCI setup by the loader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) extern unsigned int pcibios_assign_all_busses(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) extern int pci_legacy_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) static inline int pcibios_assign_all_busses(void) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) extern unsigned long pci_mem_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define PCIBIOS_MIN_IO		0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #define PCIBIOS_MIN_MEM		(pci_mem_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define PCIBIOS_MIN_CARDBUS_IO	0x4000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) extern int pcibios_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) void pcibios_scan_root(int bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) struct irq_routing_table *pcibios_get_irq_routing_table(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define HAVE_PCI_MMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define arch_can_pci_mmap_wc()	pat_enabled()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #define ARCH_GENERIC_PCI_MMAP_RESOURCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #ifdef CONFIG_PCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) extern void early_quirks(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) static inline void early_quirks(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) extern void pci_iommu_alloc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /* generic pci stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #include <asm-generic/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #ifdef CONFIG_NUMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* Returns the node based on pci bus */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static inline int __pcibus_to_node(const struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	return to_pci_sysdata(bus)->node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static inline const struct cpumask *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) cpumask_of_pcibus(const struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	int node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	node = __pcibus_to_node(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	return (node == NUMA_NO_NODE) ? cpu_online_mask :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			      cpumask_of_node(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct pci_setup_rom {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	struct setup_data data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	uint16_t vendor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	uint16_t devid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	uint64_t pcilen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	unsigned long segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	unsigned long bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	unsigned long device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	unsigned long function;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	uint8_t romdata[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #endif /* _ASM_X86_PCI_H */