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