xref: /onnv-gate/usr/src/uts/sun4u/opl/sys/scfd/scfdscpif.h (revision 1772:78cca3d2cc4b)
1*1772Sjl139090 /*
2*1772Sjl139090  * CDDL HEADER START
3*1772Sjl139090  *
4*1772Sjl139090  * The contents of this file are subject to the terms of the
5*1772Sjl139090  * Common Development and Distribution License (the "License").
6*1772Sjl139090  * You may not use this file except in compliance with the License.
7*1772Sjl139090  *
8*1772Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1772Sjl139090  * or http://www.opensolaris.org/os/licensing.
10*1772Sjl139090  * See the License for the specific language governing permissions
11*1772Sjl139090  * and limitations under the License.
12*1772Sjl139090  *
13*1772Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
14*1772Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1772Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
16*1772Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
17*1772Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1772Sjl139090  *
19*1772Sjl139090  * CDDL HEADER END
20*1772Sjl139090  */
21*1772Sjl139090 /*
22*1772Sjl139090  * All Rights Reserved, Copyright (c) FUJITSU LIMITED 2005
23*1772Sjl139090  */
24*1772Sjl139090 
25*1772Sjl139090 #ifndef _SCFDSCPIF_H
26*1772Sjl139090 #define	_SCFDSCPIF_H
27*1772Sjl139090 
28*1772Sjl139090 #pragma ident	"%Z%%M%	%I%	%E% SMI"
29*1772Sjl139090 
30*1772Sjl139090 #ifdef __cplusplus
31*1772Sjl139090 extern "C" {
32*1772Sjl139090 #endif
33*1772Sjl139090 
34*1772Sjl139090 typedef uint32_t mkey_t;	/* Data type for mailbox key */
35*1772Sjl139090 typedef uint32_t target_id_t;	/* Target ID specifying the peer */
36*1772Sjl139090 
37*1772Sjl139090 /*
38*1772Sjl139090  * Mailbox event types are defined as below.
39*1772Sjl139090  */
40*1772Sjl139090 typedef enum {
41*1772Sjl139090 	SCF_MB_CONN_OK,		/* Connection OK event */
42*1772Sjl139090 	SCF_MB_MSG_DATA,	/* A new message has received */
43*1772Sjl139090 	SCF_MB_SPACE,		/* Mailbox has space */
44*1772Sjl139090 	SCF_MB_DISC_ERROR	/* Disconnect error */
45*1772Sjl139090 } scf_event_t;
46*1772Sjl139090 
47*1772Sjl139090 #define	SCF_EVENT_PRI	DDI_SOFTINT_LOW	/* Event handler priority */
48*1772Sjl139090 
49*1772Sjl139090 /*
50*1772Sjl139090  * A scatter/gather data structure used for sending/receiving mailbox
51*1772Sjl139090  * messages.
52*1772Sjl139090  */
53*1772Sjl139090 typedef struct mscat_gath {
54*1772Sjl139090 	caddr_t		msc_dptr; /* pointer to the data buffer */
55*1772Sjl139090 	uint32_t	msc_len;  /* Length of data in the data buffer */
56*1772Sjl139090 } mscat_gath_t;
57*1772Sjl139090 
58*1772Sjl139090 
59*1772Sjl139090 /*
60*1772Sjl139090  * Mailbox Flush types.
61*1772Sjl139090  */
62*1772Sjl139090 typedef enum {
63*1772Sjl139090 	MB_FLUSH_SEND = 0x01,	/* Flush all messages on the send side */
64*1772Sjl139090 	MB_FLUSH_RECEIVE,	/* Flush all messages on the recieve side */
65*1772Sjl139090 	MB_FLUSH_ALL		/* Flush messages on the both sides */
66*1772Sjl139090 } mflush_type_t;
67*1772Sjl139090 
68*1772Sjl139090 int scf_mb_init(target_id_t target_id, mkey_t mkey,
69*1772Sjl139090     void (*event_handler)(scf_event_t mevent, void *arg), void *arg);
70*1772Sjl139090 
71*1772Sjl139090 int scf_mb_fini(target_id_t target_id, mkey_t mkey);
72*1772Sjl139090 
73*1772Sjl139090 int scf_mb_putmsg(target_id_t target_id, mkey_t mkey, uint32_t data_len,
74*1772Sjl139090     uint32_t num_sg, mscat_gath_t *sgp, clock_t timeout);
75*1772Sjl139090 
76*1772Sjl139090 int scf_mb_canget(target_id_t target_id, mkey_t mkey, uint32_t *data_lenp);
77*1772Sjl139090 
78*1772Sjl139090 int scf_mb_getmsg(target_id_t target_id, mkey_t mkey, uint32_t data_len,
79*1772Sjl139090     uint32_t num_sg, mscat_gath_t *sgp, clock_t timeout);
80*1772Sjl139090 
81*1772Sjl139090 int scf_mb_flush(target_id_t target_id, uint32_t key, mflush_type_t flush_type);
82*1772Sjl139090 
83*1772Sjl139090 int scf_mb_ctrl(target_id_t target_id, uint32_t key, uint32_t op, void *arg);
84*1772Sjl139090 
85*1772Sjl139090 
86*1772Sjl139090 /*
87*1772Sjl139090  * The following are the operations defined for scf_mb_ctrl().
88*1772Sjl139090  */
89*1772Sjl139090 
90*1772Sjl139090 /*
91*1772Sjl139090  * Return the maximum message length which could be received/transmitted
92*1772Sjl139090  * on the specified mailbox. The value is returned via the argument(arg),
93*1772Sjl139090  * which will be treated as a pointer to an uint32_t.
94*1772Sjl139090  */
95*1772Sjl139090 #define	SCF_MBOP_MAXMSGSIZE 0x00000001
96*1772Sjl139090 
97*1772Sjl139090 #define	DSCP_KEY	('D' << 24 | 'S' << 16 | 'C' << 8 | 'P')
98*1772Sjl139090 #define	DKMD_KEY	('D' << 24 | 'K' << 16 | 'M' << 8 | 'D')
99*1772Sjl139090 
100*1772Sjl139090 #ifdef	__cplusplus
101*1772Sjl139090 }
102*1772Sjl139090 #endif
103*1772Sjl139090 
104*1772Sjl139090 #endif	/* _SCFDSCPIF_H */
105