xref: /titanic_51/usr/src/uts/sun4u/opl/sys/scfd/scfdscpif.h (revision dd51520e127b452179a2ce4ea3bd8dee949f9afe)
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  * All Rights Reserved, Copyright (c) FUJITSU LIMITED 2005
23  */
24 
25 #ifndef _SCFDSCPIF_H
26 #define	_SCFDSCPIF_H
27 
28 #pragma ident	"%Z%%M%	%I%	%E% SMI"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef uint32_t mkey_t;	/* Data type for mailbox key */
35 typedef uint32_t target_id_t;	/* Target ID specifying the peer */
36 
37 /*
38  * Mailbox event types are defined as below.
39  */
40 typedef enum {
41 	SCF_MB_CONN_OK,		/* Connection OK event */
42 	SCF_MB_MSG_DATA,	/* A new message has received */
43 	SCF_MB_SPACE,		/* Mailbox has space */
44 	SCF_MB_DISC_ERROR	/* Disconnect error */
45 } scf_event_t;
46 
47 #define	SCF_EVENT_PRI	DDI_SOFTINT_LOW	/* Event handler priority */
48 
49 /*
50  * A scatter/gather data structure used for sending/receiving mailbox
51  * messages.
52  */
53 typedef struct mscat_gath {
54 	caddr_t		msc_dptr; /* pointer to the data buffer */
55 	uint32_t	msc_len;  /* Length of data in the data buffer */
56 } mscat_gath_t;
57 
58 
59 /*
60  * Mailbox Flush types.
61  */
62 typedef enum {
63 	MB_FLUSH_SEND = 0x01,	/* Flush all messages on the send side */
64 	MB_FLUSH_RECEIVE,	/* Flush all messages on the recieve side */
65 	MB_FLUSH_ALL		/* Flush messages on the both sides */
66 } mflush_type_t;
67 
68 int scf_mb_init(target_id_t target_id, mkey_t mkey,
69     void (*event_handler)(scf_event_t mevent, void *arg), void *arg);
70 
71 int scf_mb_fini(target_id_t target_id, mkey_t mkey);
72 
73 int scf_mb_putmsg(target_id_t target_id, mkey_t mkey, uint32_t data_len,
74     uint32_t num_sg, mscat_gath_t *sgp, clock_t timeout);
75 
76 int scf_mb_canget(target_id_t target_id, mkey_t mkey, uint32_t *data_lenp);
77 
78 int scf_mb_getmsg(target_id_t target_id, mkey_t mkey, uint32_t data_len,
79     uint32_t num_sg, mscat_gath_t *sgp, clock_t timeout);
80 
81 int scf_mb_flush(target_id_t target_id, uint32_t key, mflush_type_t flush_type);
82 
83 int scf_mb_ctrl(target_id_t target_id, uint32_t key, uint32_t op, void *arg);
84 
85 
86 /*
87  * The following are the operations defined for scf_mb_ctrl().
88  */
89 
90 /*
91  * Return the maximum message length which could be received/transmitted
92  * on the specified mailbox. The value is returned via the argument(arg),
93  * which will be treated as a pointer to an uint32_t.
94  */
95 #define	SCF_MBOP_MAXMSGSIZE 0x00000001
96 
97 #define	DSCP_KEY	('D' << 24 | 'S' << 16 | 'C' << 8 | 'P')
98 #define	DKMD_KEY	('D' << 24 | 'K' << 16 | 'M' << 8 | 'D')
99 
100 #ifdef	__cplusplus
101 }
102 #endif
103 
104 #endif	/* _SCFDSCPIF_H */
105