1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_PCI_CHIP_H 28*0Sstevel@tonic-gate #define _SYS_PCI_CHIP_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate extern void pci_post_init_child(pci_t *pci_p, dev_info_t *child); 37*0Sstevel@tonic-gate extern void pci_post_uninit_child(pci_t *pci_p); 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate extern int pci_obj_setup(pci_t *pci_p); 40*0Sstevel@tonic-gate extern void pci_obj_destroy(pci_t *pci_p); 41*0Sstevel@tonic-gate extern void pci_obj_resume(pci_t *pci_p); 42*0Sstevel@tonic-gate extern void pci_obj_suspend(pci_t *pci_p); 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate extern void pci_kstat_init(void); 45*0Sstevel@tonic-gate extern void pci_kstat_fini(void); 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate extern void pci_add_pci_kstat(pci_t *pci_p); 48*0Sstevel@tonic-gate extern void pci_rem_pci_kstat(pci_t *pci_p); 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate extern void pci_add_upstream_kstat(pci_t *pci_p); 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gate extern void pci_fix_ranges(pci_ranges_t *rng_p, int rng_entries); 53*0Sstevel@tonic-gate extern int map_pci_registers(pci_t *pci_p, dev_info_t *dip); 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate extern uint_t pbm_disable_pci_errors(pbm_t *pbm_p); 56*0Sstevel@tonic-gate extern uintptr_t get_pbm_reg_base(pci_t *pci_p); 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate extern uint32_t ib_map_reg_get_cpu(volatile uint64_t reg); 59*0Sstevel@tonic-gate extern uint64_t *ib_intr_map_reg_addr(ib_t *ib_p, ib_ino_t ino); 60*0Sstevel@tonic-gate extern uint64_t *ib_clear_intr_reg_addr(ib_t *ib_p, ib_ino_t ino); 61*0Sstevel@tonic-gate extern void pci_pbm_intr_dist(pbm_t *pbm_p); 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate extern void pci_cb_setup(pci_t *pci_p); 64*0Sstevel@tonic-gate extern void pci_cb_teardown(pci_t *pci_p); 65*0Sstevel@tonic-gate extern int cb_register_intr(pci_t *pci_p); 66*0Sstevel@tonic-gate extern void cb_enable_intr(pci_t *pci_p); 67*0Sstevel@tonic-gate extern uint64_t cb_ino_to_map_pa(cb_t *cb_p, ib_ino_t ino); 68*0Sstevel@tonic-gate extern uint64_t cb_ino_to_clr_pa(cb_t *cb_p, ib_ino_t ino); 69*0Sstevel@tonic-gate extern int cb_remove_xintr(pci_t *pci_p, dev_info_t *dip, dev_info_t *rdip, 70*0Sstevel@tonic-gate ib_ino_t ino, ib_mondo_t mondo); 71*0Sstevel@tonic-gate extern uint32_t pci_xlate_intr(dev_info_t *dip, dev_info_t *rdip, 72*0Sstevel@tonic-gate ib_t *ib_p, uint32_t intr); 73*0Sstevel@tonic-gate extern uint32_t pci_intr_dist_cpuid(ib_t *ib_p, ib_ino_info_t *ino_p); 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate extern void pci_ecc_setup(ecc_t *ecc_p); 76*0Sstevel@tonic-gate extern ushort_t pci_ecc_get_synd(uint64_t afsr); 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate extern uintptr_t pci_iommu_setup(iommu_t *iommu_p); 79*0Sstevel@tonic-gate extern void pci_iommu_teardown(iommu_t *iommu_p); 80*0Sstevel@tonic-gate extern void pci_iommu_config(iommu_t *iommu_p, uint64_t iommu_ctl, 81*0Sstevel@tonic-gate uint64_t cfgpa); 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate extern dvma_context_t pci_iommu_get_dvma_context(iommu_t *iommu_p, 84*0Sstevel@tonic-gate dvma_addr_t dvma_pg_index); 85*0Sstevel@tonic-gate extern void pci_iommu_free_dvma_context(iommu_t *iommu_p, dvma_context_t ctx); 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate extern void pci_pbm_setup(pbm_t *pbm_p); 88*0Sstevel@tonic-gate extern void pci_pbm_teardown(pbm_t *pbm_p); 89*0Sstevel@tonic-gate extern void pci_pbm_dma_sync(pbm_t *pbm_p, ib_ino_t ino); 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate extern uint64_t pci_sc_configure(pci_t *pci_p); 92*0Sstevel@tonic-gate extern void pci_sc_setup(sc_t *sc_p); 93*0Sstevel@tonic-gate extern int pci_sc_ctx_inv(dev_info_t *dip, sc_t *sc_p, ddi_dma_impl_t *mp); 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate extern uintptr_t pci_ib_setup(ib_t *ib_p); 96*0Sstevel@tonic-gate extern int pci_get_numproxy(dev_info_t *dip); 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate extern int pci_ecc_add_intr(pci_t *pci_p, int inum, ecc_intr_info_t *eii_p); 99*0Sstevel@tonic-gate extern void pci_ecc_rem_intr(pci_t *pci_p, int inum, ecc_intr_info_t *eii_p); 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate extern int pci_pbm_err_handler(dev_info_t *dip, ddi_fm_error_t *derr, 102*0Sstevel@tonic-gate const void *impl_data, int caller); 103*0Sstevel@tonic-gate extern void pci_ecc_classify(uint64_t err, ecc_errstate_t *ecc_err_p); 104*0Sstevel@tonic-gate extern int pci_pbm_classify(pbm_errstate_t *pbm_err_p); 105*0Sstevel@tonic-gate extern void pci_format_addr(dev_info_t *dip, uint64_t *afar, uint64_t afsr); 106*0Sstevel@tonic-gate extern int pci_check_error(pci_t *pci_p); 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate extern int pci_pbm_add_intr(pci_t *pci_p); 109*0Sstevel@tonic-gate extern void pci_pbm_rem_intr(pci_t *pci_p); 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate extern void pci_pbm_suspend(pci_t *pci_p); 112*0Sstevel@tonic-gate extern void pci_pbm_resume(pci_t *pci_p); 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate extern int pci_bus_quiesce(pci_t *pci_p, dev_info_t *dip, void *arg); 115*0Sstevel@tonic-gate extern int pci_bus_unquiesce(pci_t *pci_p, dev_info_t *dip, void *arg); 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate extern void pci_vmem_free(iommu_t *iommu_p, ddi_dma_impl_t *mp, 118*0Sstevel@tonic-gate void *dvma_addr, size_t npages); 119*0Sstevel@tonic-gate 120*0Sstevel@tonic-gate #ifdef __cplusplus 121*0Sstevel@tonic-gate } 122*0Sstevel@tonic-gate #endif 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate #endif /* _SYS_PCI_CHIP_H */ 125