xref: /titanic_44/usr/src/uts/common/sys/pci_intr_lib.h (revision 09b1eac246a4e627fcbd1ce5bf8005746cbe45ea)
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
520036fe5Segillett  * Common Development and Distribution License (the "License").
620036fe5Segillett  * 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 /*
22614edcaeSEvan Yan  * Copyright 2009 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_INTR_LIB_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PCI_INTR_LIB_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
33614edcaeSEvan Yan typedef struct pci_class_val {
34614edcaeSEvan Yan 	uint32_t class_code;
35614edcaeSEvan Yan 	uint32_t class_mask;
36614edcaeSEvan Yan 	uint32_t class_val;
37614edcaeSEvan Yan } pci_class_val_t;
38614edcaeSEvan Yan 
397c478bd9Sstevel@tonic-gate extern	int	pci_msi_get_cap(dev_info_t *rdip, int type, int *flagsp);
407c478bd9Sstevel@tonic-gate extern	int	pci_msi_configure(dev_info_t *rdip, int type, int count,
417c478bd9Sstevel@tonic-gate 		    int inum, uint64_t addr, uint64_t data);
427c478bd9Sstevel@tonic-gate extern	int	pci_msi_unconfigure(dev_info_t *rdip, int type, int inum);
437c478bd9Sstevel@tonic-gate extern	int	pci_is_msi_enabled(dev_info_t *rdip, int type);
4495003185Segillett extern	int	pci_msi_enable_mode(dev_info_t *rdip, int type);
45*09b1eac2SEvan Yan extern	int	pci_msi_disable_mode(dev_info_t *rdip, int type);
467c478bd9Sstevel@tonic-gate extern	int	pci_msi_set_mask(dev_info_t *rdip, int type, int inum);
477c478bd9Sstevel@tonic-gate extern	int	pci_msi_clr_mask(dev_info_t *rdip, int type, int inum);
487c478bd9Sstevel@tonic-gate extern	int	pci_msi_get_pending(dev_info_t *rdip, int type, int inum,
497c478bd9Sstevel@tonic-gate 		    int *pendingp);
507c478bd9Sstevel@tonic-gate extern	int	pci_msi_get_nintrs(dev_info_t *rdip, int type, int *nintrs);
517c478bd9Sstevel@tonic-gate extern	int	pci_msi_set_nintrs(dev_info_t *rdip, int type, int navail);
527c478bd9Sstevel@tonic-gate extern	int	pci_msi_get_supported_type(dev_info_t *rdip, int *typesp);
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate extern  ddi_intr_msix_t	*pci_msix_init(dev_info_t *rdip);
557c478bd9Sstevel@tonic-gate extern void	pci_msix_fini(ddi_intr_msix_t *msix_p);
5620036fe5Segillett extern int	pci_msix_dup(dev_info_t *rdip, int org_inum, int dup_inum);
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate extern	int	pci_intx_get_cap(dev_info_t *dip, int *flagsp);
597c478bd9Sstevel@tonic-gate extern int	pci_intx_set_mask(dev_info_t *dip);
607c478bd9Sstevel@tonic-gate extern int	pci_intx_clr_mask(dev_info_t *dip);
617c478bd9Sstevel@tonic-gate extern int	pci_intx_get_pending(dev_info_t *dip, int *pendingp);
627c478bd9Sstevel@tonic-gate extern ddi_intrspec_t	pci_intx_get_ispec(dev_info_t *dip, dev_info_t *rdip,
637c478bd9Sstevel@tonic-gate 			    int inum);
64614edcaeSEvan Yan extern uint32_t	pci_class_to_pil(dev_info_t *dip);
65614edcaeSEvan Yan extern int32_t	pci_class_to_intr_weight(dev_info_t *dip);
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
687c478bd9Sstevel@tonic-gate }
697c478bd9Sstevel@tonic-gate #endif
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #endif	/* _SYS_PCI_INTR_LIB_H */
72