162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * c 2001 PPC 64 Team, IBM Corp 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci#ifndef _ASM_POWERPC_PPC_PCI_H 662306a36Sopenharmony_ci#define _ASM_POWERPC_PPC_PCI_H 762306a36Sopenharmony_ci#ifdef __KERNEL__ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifdef CONFIG_PCI 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/pci.h> 1262306a36Sopenharmony_ci#include <asm/pci-bridge.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciextern unsigned long isa_io_base; 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciextern struct list_head hose_list; 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciextern struct pci_dev *isa_bridge_pcidev; /* may be NULL if no ISA bus */ 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci/** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */ 2162306a36Sopenharmony_ci#define BUID_HI(buid) upper_32_bits(buid) 2262306a36Sopenharmony_ci#define BUID_LO(buid) lower_32_bits(buid) 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci/* PCI device_node operations */ 2562306a36Sopenharmony_cistruct device_node; 2662306a36Sopenharmony_cistruct pci_dn; 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_civoid *pci_traverse_device_nodes(struct device_node *start, 2962306a36Sopenharmony_ci void *(*fn)(struct device_node *, void *), 3062306a36Sopenharmony_ci void *data); 3162306a36Sopenharmony_ciextern void pci_devs_phb_init_dynamic(struct pci_controller *phb); 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#if defined(CONFIG_IOMMU_API) && (defined(CONFIG_PPC_PSERIES) || \ 3462306a36Sopenharmony_ci defined(CONFIG_PPC_POWERNV)) 3562306a36Sopenharmony_ciextern void ppc_iommu_register_device(struct pci_controller *phb); 3662306a36Sopenharmony_ciextern void ppc_iommu_unregister_device(struct pci_controller *phb); 3762306a36Sopenharmony_ci#else 3862306a36Sopenharmony_cistatic inline void ppc_iommu_register_device(struct pci_controller *phb) { } 3962306a36Sopenharmony_cistatic inline void ppc_iommu_unregister_device(struct pci_controller *phb) { } 4062306a36Sopenharmony_ci#endif 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* From rtas_pci.h */ 4462306a36Sopenharmony_ciextern void init_pci_config_tokens (void); 4562306a36Sopenharmony_ciextern unsigned long get_phb_buid (struct device_node *); 4662306a36Sopenharmony_ciextern int rtas_setup_phb(struct pci_controller *phb); 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#ifdef CONFIG_EEH 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_civoid eeh_addr_cache_insert_dev(struct pci_dev *dev); 5162306a36Sopenharmony_civoid eeh_addr_cache_rmv_dev(struct pci_dev *dev); 5262306a36Sopenharmony_cistruct eeh_dev *eeh_addr_cache_get_dev(unsigned long addr); 5362306a36Sopenharmony_civoid eeh_slot_error_detail(struct eeh_pe *pe, int severity); 5462306a36Sopenharmony_ciint eeh_pci_enable(struct eeh_pe *pe, int function); 5562306a36Sopenharmony_ciint eeh_pe_reset_full(struct eeh_pe *pe, bool include_passed); 5662306a36Sopenharmony_civoid eeh_save_bars(struct eeh_dev *edev); 5762306a36Sopenharmony_ciint rtas_write_config(struct pci_dn *, int where, int size, u32 val); 5862306a36Sopenharmony_ciint rtas_read_config(struct pci_dn *, int where, int size, u32 *val); 5962306a36Sopenharmony_civoid eeh_pe_state_mark(struct eeh_pe *pe, int state); 6062306a36Sopenharmony_civoid eeh_pe_mark_isolated(struct eeh_pe *pe); 6162306a36Sopenharmony_civoid eeh_pe_state_clear(struct eeh_pe *pe, int state, bool include_passed); 6262306a36Sopenharmony_civoid eeh_pe_state_mark_with_cfg(struct eeh_pe *pe, int state); 6362306a36Sopenharmony_civoid eeh_pe_dev_mode_mark(struct eeh_pe *pe, int mode); 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_civoid eeh_sysfs_add_device(struct pci_dev *pdev); 6662306a36Sopenharmony_civoid eeh_sysfs_remove_device(struct pci_dev *pdev); 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci#endif /* CONFIG_EEH */ 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#ifdef CONFIG_FSL_ULI1575 7162306a36Sopenharmony_civoid __init uli_init(void); 7262306a36Sopenharmony_ci#endif /* CONFIG_FSL_ULI1575 */ 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci#define PCI_BUSNO(bdfn) ((bdfn >> 8) & 0xff) 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#else /* CONFIG_PCI */ 7762306a36Sopenharmony_cistatic inline void init_pci_config_tokens(void) { } 7862306a36Sopenharmony_ci#endif /* !CONFIG_PCI */ 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#if !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575) 8162306a36Sopenharmony_cistatic inline void __init uli_init(void) {} 8262306a36Sopenharmony_ci#endif /* !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575) */ 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#endif /* __KERNEL__ */ 8562306a36Sopenharmony_ci#endif /* _ASM_POWERPC_PPC_PCI_H */ 86