xref: /illumos-gate/usr/src/uts/sun4u/sys/pci/pci_chip.h (revision 49f91442)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*49f91442Ssuha  * Common Development and Distribution License (the "License").
6*49f91442Ssuha  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*49f91442Ssuha  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_PCI_CHIP_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PCI_CHIP_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate extern void pci_post_init_child(pci_t *pci_p, dev_info_t *child);
367c478bd9Sstevel@tonic-gate extern void pci_post_uninit_child(pci_t *pci_p);
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate extern int pci_obj_setup(pci_t *pci_p);
397c478bd9Sstevel@tonic-gate extern void pci_obj_destroy(pci_t *pci_p);
407c478bd9Sstevel@tonic-gate extern void pci_obj_resume(pci_t *pci_p);
417c478bd9Sstevel@tonic-gate extern void pci_obj_suspend(pci_t *pci_p);
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate extern void pci_kstat_init(void);
447c478bd9Sstevel@tonic-gate extern void pci_kstat_fini(void);
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate extern void pci_add_pci_kstat(pci_t *pci_p);
477c478bd9Sstevel@tonic-gate extern void pci_rem_pci_kstat(pci_t *pci_p);
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate extern void pci_add_upstream_kstat(pci_t *pci_p);
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate extern void pci_fix_ranges(pci_ranges_t *rng_p, int rng_entries);
527c478bd9Sstevel@tonic-gate extern int map_pci_registers(pci_t *pci_p, dev_info_t *dip);
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate extern uint_t pbm_disable_pci_errors(pbm_t *pbm_p);
557c478bd9Sstevel@tonic-gate extern uintptr_t get_pbm_reg_base(pci_t *pci_p);
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate extern uint32_t ib_map_reg_get_cpu(volatile uint64_t reg);
587c478bd9Sstevel@tonic-gate extern uint64_t *ib_intr_map_reg_addr(ib_t *ib_p, ib_ino_t ino);
597c478bd9Sstevel@tonic-gate extern uint64_t *ib_clear_intr_reg_addr(ib_t *ib_p, ib_ino_t ino);
607c478bd9Sstevel@tonic-gate extern void pci_pbm_intr_dist(pbm_t *pbm_p);
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate extern void pci_cb_setup(pci_t *pci_p);
637c478bd9Sstevel@tonic-gate extern void pci_cb_teardown(pci_t *pci_p);
647c478bd9Sstevel@tonic-gate extern int cb_register_intr(pci_t *pci_p);
657c478bd9Sstevel@tonic-gate extern void cb_enable_intr(pci_t *pci_p);
667c478bd9Sstevel@tonic-gate extern uint64_t cb_ino_to_map_pa(cb_t *cb_p, ib_ino_t ino);
677c478bd9Sstevel@tonic-gate extern uint64_t cb_ino_to_clr_pa(cb_t *cb_p, ib_ino_t ino);
687c478bd9Sstevel@tonic-gate extern int cb_remove_xintr(pci_t *pci_p, dev_info_t *dip, dev_info_t *rdip,
697c478bd9Sstevel@tonic-gate 		ib_ino_t ino, ib_mondo_t mondo);
707c478bd9Sstevel@tonic-gate extern uint32_t pci_xlate_intr(dev_info_t *dip, dev_info_t *rdip,
717c478bd9Sstevel@tonic-gate 		ib_t *ib_p, uint32_t intr);
727c478bd9Sstevel@tonic-gate extern uint32_t pci_intr_dist_cpuid(ib_t *ib_p, ib_ino_info_t *ino_p);
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate extern void pci_ecc_setup(ecc_t *ecc_p);
757c478bd9Sstevel@tonic-gate extern ushort_t pci_ecc_get_synd(uint64_t afsr);
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate extern uintptr_t pci_iommu_setup(iommu_t *iommu_p);
787c478bd9Sstevel@tonic-gate extern void pci_iommu_teardown(iommu_t *iommu_p);
797c478bd9Sstevel@tonic-gate extern void pci_iommu_config(iommu_t *iommu_p, uint64_t iommu_ctl,
807c478bd9Sstevel@tonic-gate 		uint64_t cfgpa);
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate extern dvma_context_t pci_iommu_get_dvma_context(iommu_t *iommu_p,
837c478bd9Sstevel@tonic-gate 		dvma_addr_t dvma_pg_index);
847c478bd9Sstevel@tonic-gate extern void pci_iommu_free_dvma_context(iommu_t *iommu_p, dvma_context_t ctx);
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate extern void pci_pbm_setup(pbm_t *pbm_p);
877c478bd9Sstevel@tonic-gate extern void pci_pbm_teardown(pbm_t *pbm_p);
887c478bd9Sstevel@tonic-gate extern void pci_pbm_dma_sync(pbm_t *pbm_p, ib_ino_t ino);
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate extern uint64_t pci_sc_configure(pci_t *pci_p);
917c478bd9Sstevel@tonic-gate extern void pci_sc_setup(sc_t *sc_p);
927c478bd9Sstevel@tonic-gate extern int pci_sc_ctx_inv(dev_info_t *dip, sc_t *sc_p, ddi_dma_impl_t *mp);
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate extern uintptr_t pci_ib_setup(ib_t *ib_p);
957c478bd9Sstevel@tonic-gate extern int pci_get_numproxy(dev_info_t *dip);
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate extern int pci_ecc_add_intr(pci_t *pci_p, int inum, ecc_intr_info_t *eii_p);
987c478bd9Sstevel@tonic-gate extern void pci_ecc_rem_intr(pci_t *pci_p, int inum, ecc_intr_info_t *eii_p);
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate extern int pci_pbm_err_handler(dev_info_t *dip, ddi_fm_error_t *derr,
1017c478bd9Sstevel@tonic-gate 		const void *impl_data, int caller);
1027c478bd9Sstevel@tonic-gate extern void pci_ecc_classify(uint64_t err, ecc_errstate_t *ecc_err_p);
1037c478bd9Sstevel@tonic-gate extern int pci_pbm_classify(pbm_errstate_t *pbm_err_p);
1047c478bd9Sstevel@tonic-gate extern void pci_format_addr(dev_info_t *dip, uint64_t *afar, uint64_t afsr);
1057c478bd9Sstevel@tonic-gate extern int pci_check_error(pci_t *pci_p);
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate extern int pci_pbm_add_intr(pci_t *pci_p);
1087c478bd9Sstevel@tonic-gate extern void pci_pbm_rem_intr(pci_t *pci_p);
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate extern void pci_pbm_suspend(pci_t *pci_p);
1117c478bd9Sstevel@tonic-gate extern void pci_pbm_resume(pci_t *pci_p);
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate extern int pci_bus_quiesce(pci_t *pci_p, dev_info_t *dip, void *arg);
1147c478bd9Sstevel@tonic-gate extern int pci_bus_unquiesce(pci_t *pci_p, dev_info_t *dip, void *arg);
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate extern void pci_vmem_free(iommu_t *iommu_p, ddi_dma_impl_t *mp,
1177c478bd9Sstevel@tonic-gate 		void *dvma_addr, size_t npages);
1187c478bd9Sstevel@tonic-gate 
119*49f91442Ssuha extern dma_bypass_addr_t pci_iommu_bypass_end_configure(void);
120*49f91442Ssuha 
1217c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1227c478bd9Sstevel@tonic-gate }
1237c478bd9Sstevel@tonic-gate #endif
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #endif	/* _SYS_PCI_CHIP_H */
126