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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_VDSK_MAILBOX_H
28 #define	_VDSK_MAILBOX_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * This header file contains the private LDoms Virtual Disk (vDisk) mailbox
38  * definitions common to both the server (vds) and the client (vdc)
39  */
40 
41 #include <sys/vio_mailbox.h>
42 #include <sys/vio_common.h>
43 #include <sys/vdsk_common.h>
44 
45 /*
46  * Definition of the various states the vDisk state machine can
47  * be in during the handshake between vdc and vds.
48  */
49 typedef enum vd_state {
50 	VD_STATE_INIT = 0,
51 	VD_STATE_VER,
52 	VD_STATE_ATTR,
53 	VD_STATE_DRING,
54 	VD_STATE_RDX,
55 	VD_STATE_DATA
56 } vd_state_t;
57 
58 #define	VD_VER_MAJOR		0x1
59 #define	VD_VER_MINOR		0x0
60 
61 /*
62  * vDisk device attributes information message.
63  *
64  * tag.msgtype == VIO_TYPE_CTRL
65  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
66  * tag.subtype_env == VIO_ATTR_INFO
67  */
68 typedef struct vd_attr_msg {
69 	/* Common tag */
70 	vio_msg_tag_t 	tag;
71 
72 	/* vdisk-attribute-specific payload */
73 	uint8_t		xfer_mode;	/* data exchange method. */
74 	uint8_t		vdisk_type;	/* disk, slice, read-only, etc. */
75 	uint16_t	resv;		/* padding */
76 	uint32_t	vdisk_block_size;	/* bytes per disk block */
77 	uint64_t	operations;	/* bit-field of server supported ops */
78 	uint64_t	vdisk_size;	/* size for Nblocks property. */
79 	uint64_t	max_xfer_sz;	/* maximum block transfer size */
80 
81 	uint64_t	resv2[VIO_PAYLOAD_ELEMS - 4];	/* padding */
82 } vd_attr_msg_t;
83 
84 /*
85  * vDisk inband descriptor message.
86  *
87  * For clients that do not use descriptor rings, the descriptor contents
88  * are sent as part of an inband message.
89  */
90 typedef struct vd_dring_inband_msg {
91 	vio_inband_desc_msg_hdr_t	hdr;
92 	vd_dring_payload_t		payload;
93 } vd_dring_inband_msg_t;
94 
95 
96 #ifdef	__cplusplus
97 }
98 #endif
99 
100 #endif	/* _VDSK_MAILBOX_H */
101