xref: /titanic_41/usr/src/uts/sun4v/sys/cnex.h (revision d29b2c4438482eb00488be49a1f5d6835f455546)
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 2007 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	cpuid;		/* Target CPU */
58 	uint64_t	icookie;	/* dev intr cookie */
59 	uint_t		(*hdlr)();	/* intr handler */
60 	caddr_t		arg1;		/* intr argument 1 */
61 	caddr_t		arg2;		/* intr argument 2 */
62 	struct cnex_ldc *cldcp;		/* back pointer to the ldc */
63 } cnex_intr_t;
64 
65 /* cnex interrupt types */
66 typedef enum {
67 	CNEX_TX_INTR = 1,		/* transmit interrupt */
68 	CNEX_RX_INTR			/* receive interrupt */
69 } cnex_intrtype_t;
70 
71 /*
72  * Channel information
73  */
74 typedef struct cnex_ldc {
75 	kmutex_t	lock;		/* Channel lock */
76 	struct cnex_ldc	*next;
77 
78 	uint64_t	id;
79 	ldc_dev_t 	devclass;	/* Device class channel belongs to */
80 
81 	cnex_intr_t	tx;		/* Transmit interrupt */
82 	cnex_intr_t	rx;		/* Receive interrupt */
83 	dev_info_t	*dip;		/* dip of the associated device */
84 } cnex_ldc_t;
85 
86 /*
87  * Channel nexus soft state pointer
88  */
89 typedef struct cnex_soft_state {
90 	dev_info_t 	*devi;
91 	uint64_t	cfghdl;		/* cnex config handle */
92 	kmutex_t	clist_lock;	/* lock to protect channel list */
93 	cnex_ldc_t	*clist;		/* list of registered channels */
94 } cnex_soft_state_t;
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /* _CNEX_H */
101