xref: /illumos-gate/usr/src/uts/sun4v/sys/cnex.h (revision 4eaa471005973e11a6110b69fe990530b3b95a38)
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 2008 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_intr_map {
48 	ldc_dev_t	devclass;	/* LDC device class */
49 	uint32_t	pil;		/* PIL for device class */
50 	int32_t		weight;		/* Interrupt weight for device class */
51 };
52 
53 /*
54  * Channel interrupt information
55  */
56 typedef struct cnex_intr {
57 	uint64_t	ino;		/* dev intr number */
58 	uint64_t	cpuid;		/* Target CPU */
59 	uint64_t	icookie;	/* dev intr cookie */
60 	uint64_t	id;		/* LDC channel ID  */
61 	dev_info_t	*dip;		/* LDC channel devinfo */
62 	uint_t		(*hdlr)();	/* intr handler */
63 	caddr_t		arg1;		/* intr argument 1 */
64 	caddr_t		arg2;		/* intr argument 2 */
65 	int32_t		weight;		/* intr weight */
66 } cnex_intr_t;
67 
68 /* cnex interrupt types */
69 typedef enum {
70 	CNEX_TX_INTR = 1,		/* transmit interrupt */
71 	CNEX_RX_INTR			/* receive interrupt */
72 } cnex_intrtype_t;
73 
74 /*
75  * Channel information
76  */
77 typedef struct cnex_ldc {
78 	kmutex_t	lock;		/* Channel lock */
79 	struct cnex_ldc	*next;
80 
81 	uint64_t	id;
82 	ldc_dev_t 	devclass;	/* Device class channel belongs to */
83 
84 	cnex_intr_t	tx;		/* Transmit interrupt */
85 	cnex_intr_t	rx;		/* Receive interrupt */
86 	dev_info_t	*dip;		/* dip of the associated device */
87 } cnex_ldc_t;
88 
89 /*
90  * Channel nexus soft state pointer
91  */
92 typedef struct cnex_soft_state {
93 	dev_info_t 	*devi;
94 	uint64_t	cfghdl;		/* cnex config handle */
95 	kmutex_t	clist_lock;	/* lock to protect channel list */
96 	cnex_ldc_t	*clist;		/* list of registered channels */
97 } cnex_soft_state_t;
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* _CNEX_H */
104