xref: /titanic_53/usr/src/uts/sun4v/sys/cnex.h (revision 1ae0874509b6811fdde1dfd46f0d93fd09867a3f)
1*1ae08745Sheppo /*
2*1ae08745Sheppo  * CDDL HEADER START
3*1ae08745Sheppo  *
4*1ae08745Sheppo  * The contents of this file are subject to the terms of the
5*1ae08745Sheppo  * Common Development and Distribution License (the "License").
6*1ae08745Sheppo  * You may not use this file except in compliance with the License.
7*1ae08745Sheppo  *
8*1ae08745Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1ae08745Sheppo  * or http://www.opensolaris.org/os/licensing.
10*1ae08745Sheppo  * See the License for the specific language governing permissions
11*1ae08745Sheppo  * and limitations under the License.
12*1ae08745Sheppo  *
13*1ae08745Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
14*1ae08745Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1ae08745Sheppo  * If applicable, add the following below this CDDL HEADER, with the
16*1ae08745Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
17*1ae08745Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1ae08745Sheppo  *
19*1ae08745Sheppo  * CDDL HEADER END
20*1ae08745Sheppo  */
21*1ae08745Sheppo 
22*1ae08745Sheppo /*
23*1ae08745Sheppo  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*1ae08745Sheppo  * Use is subject to license terms.
25*1ae08745Sheppo  */
26*1ae08745Sheppo 
27*1ae08745Sheppo #ifndef _CNEX_H
28*1ae08745Sheppo #define	_CNEX_H
29*1ae08745Sheppo 
30*1ae08745Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*1ae08745Sheppo 
32*1ae08745Sheppo #ifdef __cplusplus
33*1ae08745Sheppo extern "C" {
34*1ae08745Sheppo #endif
35*1ae08745Sheppo 
36*1ae08745Sheppo /*
37*1ae08745Sheppo  * Channel nexus "reg" spec
38*1ae08745Sheppo  */
39*1ae08745Sheppo typedef struct cnex_regspec {
40*1ae08745Sheppo 	uint64_t physaddr;
41*1ae08745Sheppo 	uint64_t size;
42*1ae08745Sheppo } cnex_regspec_t;
43*1ae08745Sheppo 
44*1ae08745Sheppo /*
45*1ae08745Sheppo  * Channel nexus interrupt map
46*1ae08745Sheppo  */
47*1ae08745Sheppo struct cnex_pil_map {
48*1ae08745Sheppo 	ldc_dev_t	devclass;	/* LDC device class */
49*1ae08745Sheppo 	uint32_t	pil;		/* PIL for device class */
50*1ae08745Sheppo };
51*1ae08745Sheppo 
52*1ae08745Sheppo /*
53*1ae08745Sheppo  * Channel interrupt information
54*1ae08745Sheppo  */
55*1ae08745Sheppo typedef struct cnex_intr {
56*1ae08745Sheppo 	uint64_t	ino;		/* dev intr number */
57*1ae08745Sheppo 	uint64_t	icookie;	/* dev intr cookie */
58*1ae08745Sheppo 	uint_t		(*hdlr)();	/* intr handler */
59*1ae08745Sheppo 	caddr_t		arg1;		/* intr argument 1 */
60*1ae08745Sheppo 	caddr_t		arg2;		/* intr argument 2 */
61*1ae08745Sheppo 	void		*ssp;		/* back ptr to soft state */
62*1ae08745Sheppo } cnex_intr_t;
63*1ae08745Sheppo 
64*1ae08745Sheppo /* cnex interrupt types */
65*1ae08745Sheppo typedef enum {
66*1ae08745Sheppo 	CNEX_TX_INTR = 1,		/* transmit interrupt */
67*1ae08745Sheppo 	CNEX_RX_INTR			/* receive interrupt */
68*1ae08745Sheppo } cnex_intrtype_t;
69*1ae08745Sheppo 
70*1ae08745Sheppo /*
71*1ae08745Sheppo  * Channel information
72*1ae08745Sheppo  */
73*1ae08745Sheppo typedef struct cnex_ldc {
74*1ae08745Sheppo 	kmutex_t	lock;		/* Channel lock */
75*1ae08745Sheppo 	struct cnex_ldc	*next;
76*1ae08745Sheppo 
77*1ae08745Sheppo 	uint64_t	id;
78*1ae08745Sheppo 	ldc_dev_t 	devclass;	/* Device class channel belongs to */
79*1ae08745Sheppo 
80*1ae08745Sheppo 	cnex_intr_t	tx;		/* Transmit interrupt */
81*1ae08745Sheppo 	cnex_intr_t	rx;		/* Receive interrupt */
82*1ae08745Sheppo } cnex_ldc_t;
83*1ae08745Sheppo 
84*1ae08745Sheppo /*
85*1ae08745Sheppo  * Channel nexus soft state pointer
86*1ae08745Sheppo  */
87*1ae08745Sheppo typedef struct cnex_soft_state {
88*1ae08745Sheppo 	dev_info_t 	*devi;
89*1ae08745Sheppo 	uint64_t	cfghdl;		/* cnex config handle */
90*1ae08745Sheppo 	kmutex_t	clist_lock;	/* lock to protect channel list */
91*1ae08745Sheppo 	cnex_ldc_t	*clist;		/* list of registered channels */
92*1ae08745Sheppo } cnex_soft_state_t;
93*1ae08745Sheppo 
94*1ae08745Sheppo #ifdef __cplusplus
95*1ae08745Sheppo }
96*1ae08745Sheppo #endif
97*1ae08745Sheppo 
98*1ae08745Sheppo #endif /* _CNEX_H */
99