| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | #ifndef _ASM_POWERPC_PCI_BRIDGE_H |
|---|
| 2 | 3 | #define _ASM_POWERPC_PCI_BRIDGE_H |
|---|
| 3 | 4 | #ifdef __KERNEL__ |
|---|
| 4 | 5 | /* |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or |
|---|
| 6 | | - * modify it under the terms of the GNU General Public License |
|---|
| 7 | | - * as published by the Free Software Foundation; either version |
|---|
| 8 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | #include <linux/pci.h> |
|---|
| 11 | 8 | #include <linux/list.h> |
|---|
| 12 | 9 | #include <linux/ioport.h> |
|---|
| 10 | +#include <linux/numa.h> |
|---|
| 13 | 11 | |
|---|
| 14 | 12 | struct device_node; |
|---|
| 15 | 13 | |
|---|
| .. | .. |
|---|
| 19 | 17 | struct pci_controller_ops { |
|---|
| 20 | 18 | void (*dma_dev_setup)(struct pci_dev *pdev); |
|---|
| 21 | 19 | void (*dma_bus_setup)(struct pci_bus *bus); |
|---|
| 20 | + bool (*iommu_bypass_supported)(struct pci_dev *pdev, |
|---|
| 21 | + u64 mask); |
|---|
| 22 | 22 | |
|---|
| 23 | 23 | int (*probe_mode)(struct pci_bus *bus); |
|---|
| 24 | 24 | |
|---|
| .. | .. |
|---|
| 43 | 43 | void (*teardown_msi_irqs)(struct pci_dev *pdev); |
|---|
| 44 | 44 | #endif |
|---|
| 45 | 45 | |
|---|
| 46 | | - int (*dma_set_mask)(struct pci_dev *pdev, u64 dma_mask); |
|---|
| 47 | | - u64 (*dma_get_required_mask)(struct pci_dev *pdev); |
|---|
| 48 | | - |
|---|
| 49 | 46 | void (*shutdown)(struct pci_controller *hose); |
|---|
| 50 | 47 | }; |
|---|
| 51 | 48 | |
|---|
| .. | .. |
|---|
| 69 | 66 | |
|---|
| 70 | 67 | void __iomem *io_base_virt; |
|---|
| 71 | 68 | #ifdef CONFIG_PPC64 |
|---|
| 72 | | - void *io_base_alloc; |
|---|
| 69 | + void __iomem *io_base_alloc; |
|---|
| 73 | 70 | #endif |
|---|
| 74 | 71 | resource_size_t io_base_phys; |
|---|
| 75 | 72 | resource_size_t pci_io_size; |
|---|
| .. | .. |
|---|
| 129 | 126 | #endif /* CONFIG_PPC64 */ |
|---|
| 130 | 127 | |
|---|
| 131 | 128 | void *private_data; |
|---|
| 129 | + struct npu *npu; |
|---|
| 132 | 130 | }; |
|---|
| 133 | 131 | |
|---|
| 134 | 132 | /* These are used for config access before all the PCI probing |
|---|
| .. | .. |
|---|
| 185 | 183 | struct pci_dn { |
|---|
| 186 | 184 | int flags; |
|---|
| 187 | 185 | #define PCI_DN_FLAG_IOV_VF 0x01 |
|---|
| 186 | +#define PCI_DN_FLAG_DEAD 0x02 /* Device has been hot-removed */ |
|---|
| 188 | 187 | |
|---|
| 189 | 188 | int busno; /* pci bus number */ |
|---|
| 190 | 189 | int devfn; /* pci device and function number */ |
|---|
| .. | .. |
|---|
| 203 | 202 | #define IODA_INVALID_PE 0xFFFFFFFF |
|---|
| 204 | 203 | unsigned int pe_number; |
|---|
| 205 | 204 | #ifdef CONFIG_PCI_IOV |
|---|
| 206 | | - int vf_index; /* VF index in the PF */ |
|---|
| 207 | 205 | u16 vfs_expanded; /* number of VFs IOV BAR expanded */ |
|---|
| 208 | 206 | u16 num_vfs; /* number of VFs enabled*/ |
|---|
| 209 | 207 | unsigned int *pe_num_map; /* PE# for the first VF PE or array */ |
|---|
| .. | .. |
|---|
| 224 | 222 | extern struct pci_dn *pci_get_pdn_by_devfn(struct pci_bus *bus, |
|---|
| 225 | 223 | int devfn); |
|---|
| 226 | 224 | extern struct pci_dn *pci_get_pdn(struct pci_dev *pdev); |
|---|
| 227 | | -extern struct pci_dn *add_dev_pci_data(struct pci_dev *pdev); |
|---|
| 228 | | -extern void remove_dev_pci_data(struct pci_dev *pdev); |
|---|
| 229 | 225 | extern struct pci_dn *pci_add_device_node_info(struct pci_controller *hose, |
|---|
| 230 | 226 | struct device_node *dn); |
|---|
| 231 | 227 | extern void pci_remove_device_node_info(struct device_node *dn); |
|---|
| 228 | + |
|---|
| 229 | +#ifdef CONFIG_PCI_IOV |
|---|
| 230 | +struct pci_dn *add_sriov_vf_pdns(struct pci_dev *pdev); |
|---|
| 231 | +void remove_sriov_vf_pdns(struct pci_dev *pdev); |
|---|
| 232 | +#endif |
|---|
| 232 | 233 | |
|---|
| 233 | 234 | static inline int pci_device_from_OF_node(struct device_node *np, |
|---|
| 234 | 235 | u8 *bus, u8 *devfn) |
|---|
| .. | .. |
|---|
| 264 | 265 | #ifdef CONFIG_NUMA |
|---|
| 265 | 266 | #define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE)) |
|---|
| 266 | 267 | #else |
|---|
| 267 | | -#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1) |
|---|
| 268 | +#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE) |
|---|
| 268 | 269 | #endif |
|---|
| 269 | 270 | |
|---|
| 270 | 271 | #endif /* CONFIG_PPC64 */ |
|---|
| .. | .. |
|---|
| 273 | 274 | extern struct pci_controller *pci_find_hose_for_OF_device( |
|---|
| 274 | 275 | struct device_node* node); |
|---|
| 275 | 276 | |
|---|
| 277 | +extern struct pci_controller *pci_find_controller_for_domain(int domain_nr); |
|---|
| 278 | + |
|---|
| 276 | 279 | /* Fill up host controller resources from the OF node */ |
|---|
| 277 | 280 | extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, |
|---|
| 278 | 281 | struct device_node *dev, int primary); |
|---|