ddi_intr_impl.h revision d12abe7ce2663ac39e686a14960eb4febf560195
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DDI_INTR_IMPL_H
#define _SYS_DDI_INTR_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Sun DDI interrupt implementation specific definitions
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/*
* Typedef for interrupt ops
*/
typedef enum {
DDI_INTROP_NINTRS, /* 2 get num of interrupts supported */
DDI_INTROP_ALLOC, /* 3 allocate interrupt handle */
DDI_INTROP_GETPRI, /* 4 get priority */
DDI_INTROP_SETPRI, /* 5 set priority */
DDI_INTROP_ADDISR, /* 6 add interrupt handler */
DDI_INTROP_DUPVEC, /* 7 duplicate interrupt handler */
DDI_INTROP_ENABLE, /* 8 enable interrupt */
DDI_INTROP_BLOCKENABLE, /* 9 block enable interrupts */
DDI_INTROP_BLOCKDISABLE, /* 10 block disable interrupts */
DDI_INTROP_DISABLE, /* 11 disable interrupt */
DDI_INTROP_REMISR, /* 12 remove interrupt handler */
DDI_INTROP_FREE, /* 13 free interrupt handle */
DDI_INTROP_GETCAP, /* 14 get capacity */
DDI_INTROP_SETCAP, /* 15 set capacity */
DDI_INTROP_SETMASK, /* 16 set mask */
DDI_INTROP_CLRMASK, /* 17 clear mask */
DDI_INTROP_GETPENDING, /* 18 get pending interrupt */
DDI_INTROP_NAVAIL /* 19 get num of available interrupts */
/* Version number used in the handles */
#define DDI_INTR_VERSION_1 1
#define DDI_INTR_VERSION DDI_INTR_VERSION_1
/*
* One such data structure is allocated per ddi_intr_handle_t
* This is the incore copy of the regular interrupt info.
*/
typedef struct ddi_intr_handle_impl {
void *ih_cb_arg1;
void *ih_cb_arg2;
/*
* The following 3 members are used to support MSI-X specific features
*/
struct ddi_intr_handle_impl *ih_main;
/* pntr to the main vector */
/*
* The next set of members are for 'scratch' purpose only.
* The DDI interrupt framework uses them internally and their
* interpretation is left to the framework. For now,
* scratch1 - used to send NINTRs information
* to various nexus drivers.
* scratch2 - used to send 'behavior' flag
* information to the nexus drivers
* from ddi_intr_alloc(). It is also
* used to send 'h_array' to the nexus drivers
* for ddi_intr_block_enable/disable() on x86.
* private - On X86 it usually carries a pointer to
* ihdl_plat_t. Not used on SPARC platforms.
*/
void *ih_private; /* Platform specific data */
void *ih_scratch2; /* Scratch2: flag/h_array */
/* values for ih_state (strictly for interrupt handle) */
/* ddi_intr_add_handler() called */
#define DDI_INTR_IS_MSI_OR_MSIX(type) \
/* values for ih_flags */
struct av_softinfo;
/*
* One such data structure is allocated per ddi_soft_intr_handle
* This is the incore copy of the softint info.
*/
typedef struct ddi_softint_hdl_impl {
/* cb function for soft ints */
void *ih_cb_arg1; /* arg1 of callback function */
void *ih_cb_arg2; /* arg2 passed to "trigger" */
/*
* The next member is for 'scratch' purpose only.
* The DDI interrupt framework uses it internally and its
* interpretation is left to the framework.
* private - used by the DDI framework to pass back
* and forth 'softid' information on SPARC
* side only. Not used on X86 platform.
*/
void *ih_private; /* Platform specific data */
/* Softint internal implementation defines */
#define DDI_SOFT_INTR_PRI_M 4
#define DDI_SOFT_INTR_PRI_H 6
/*
* One such data structure is allocated for MSI-X enabled
* device. If no MSI-X is enabled then it is NULL
*/
typedef struct ddi_intr_msix {
/* MSI-X Table related information */
/* MSI-X PBA Table related information */
/*
* One such data structure is allocated for each dip.
* It has interrupt related information that can be
*/
typedef struct devinfo_intr {
/* These three fields show what the device is capable of */
/* Next three fields show current status for the device */
/* Save the PCI config space handle */
int devi_cap_ptr; /* MSI or MSI-X cap pointer */
#endif
#define NEXUS_HAS_INTR_OP(dip) \
int i_ddi_trigger_softint(ddi_softint_hdl_impl_t *, void *);
#endif
#ifdef DEBUG
#define I_DDI_VERIFY_MSIX_HANDLE(hdlp) \
}
#else
#define I_DDI_VERIFY_MSIX_HANDLE(hdlp)
#endif
#else /* _KERNEL */
typedef struct devinfo_intr devinfo_intr_t;
#endif /* _KERNEL */
/*
* Used only by old DDI interrupt interfaces.
*/
/*
* This structure represents one interrupt possible from the given
* device. It is used in an array for devices with multiple interrupts.
*/
struct intrspec {
/* If (uint_t (*)()) 0, none. */
/* If (uint_t (*)()) 1, then */
};
#ifdef _KERNEL
/*
* NOTE:
* The following 4 busops entry points are obsoleted with version
* 9 or greater. Use i_ddi_intr_op interface in place of these
* obsolete interfaces.
*
* Remove these busops entry points and all related data structures
*/
typedef enum {DDI_INTR_CTLOPS_NONE} ddi_intr_ctlop_t;
/* The following are the obsolete interfaces */
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DDI_INTR_IMPL_H */