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