xref: /onnv-gate/usr/src/uts/common/sys/pci_intr_lib.h (revision 10053:79ff8cfc9153)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51725Segillett  * Common Development and Distribution License (the "License").
61725Segillett  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
228535Sevan.yan@sun.com  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_PCI_INTR_LIB_H
270Sstevel@tonic-gate #define	_SYS_PCI_INTR_LIB_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
338535Sevan.yan@sun.com typedef struct pci_class_val {
348535Sevan.yan@sun.com 	uint32_t class_code;
358535Sevan.yan@sun.com 	uint32_t class_mask;
368535Sevan.yan@sun.com 	uint32_t class_val;
378535Sevan.yan@sun.com } pci_class_val_t;
388535Sevan.yan@sun.com 
390Sstevel@tonic-gate extern	int	pci_msi_get_cap(dev_info_t *rdip, int type, int *flagsp);
400Sstevel@tonic-gate extern	int	pci_msi_configure(dev_info_t *rdip, int type, int count,
410Sstevel@tonic-gate 		    int inum, uint64_t addr, uint64_t data);
420Sstevel@tonic-gate extern	int	pci_msi_unconfigure(dev_info_t *rdip, int type, int inum);
430Sstevel@tonic-gate extern	int	pci_is_msi_enabled(dev_info_t *rdip, int type);
442755Segillett extern	int	pci_msi_enable_mode(dev_info_t *rdip, int type);
45*10053SEvan.Yan@Sun.COM extern	int	pci_msi_disable_mode(dev_info_t *rdip, int type);
460Sstevel@tonic-gate extern	int	pci_msi_set_mask(dev_info_t *rdip, int type, int inum);
470Sstevel@tonic-gate extern	int	pci_msi_clr_mask(dev_info_t *rdip, int type, int inum);
480Sstevel@tonic-gate extern	int	pci_msi_get_pending(dev_info_t *rdip, int type, int inum,
490Sstevel@tonic-gate 		    int *pendingp);
500Sstevel@tonic-gate extern	int	pci_msi_get_nintrs(dev_info_t *rdip, int type, int *nintrs);
510Sstevel@tonic-gate extern	int	pci_msi_set_nintrs(dev_info_t *rdip, int type, int navail);
520Sstevel@tonic-gate extern	int	pci_msi_get_supported_type(dev_info_t *rdip, int *typesp);
530Sstevel@tonic-gate 
540Sstevel@tonic-gate extern  ddi_intr_msix_t	*pci_msix_init(dev_info_t *rdip);
550Sstevel@tonic-gate extern void	pci_msix_fini(ddi_intr_msix_t *msix_p);
561725Segillett extern int	pci_msix_dup(dev_info_t *rdip, int org_inum, int dup_inum);
570Sstevel@tonic-gate 
580Sstevel@tonic-gate extern	int	pci_intx_get_cap(dev_info_t *dip, int *flagsp);
590Sstevel@tonic-gate extern int	pci_intx_set_mask(dev_info_t *dip);
600Sstevel@tonic-gate extern int	pci_intx_clr_mask(dev_info_t *dip);
610Sstevel@tonic-gate extern int	pci_intx_get_pending(dev_info_t *dip, int *pendingp);
620Sstevel@tonic-gate extern ddi_intrspec_t	pci_intx_get_ispec(dev_info_t *dip, dev_info_t *rdip,
630Sstevel@tonic-gate 			    int inum);
648535Sevan.yan@sun.com extern uint32_t	pci_class_to_pil(dev_info_t *dip);
658535Sevan.yan@sun.com extern int32_t	pci_class_to_intr_weight(dev_info_t *dip);
660Sstevel@tonic-gate 
670Sstevel@tonic-gate #ifdef	__cplusplus
680Sstevel@tonic-gate }
690Sstevel@tonic-gate #endif
700Sstevel@tonic-gate 
710Sstevel@tonic-gate #endif	/* _SYS_PCI_INTR_LIB_H */
72