xref: /titanic_44/usr/src/uts/sun4v/sys/vdsk_mailbox.h (revision 4a6ec905b96eb96a398c346f59e034a90ce8ad37)
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	_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  * Definition of the various types of media that can be exported by
63  * the vDisk server. If we cannot work out what the media type is
64  * we default to calling it VD_MEDIA_FIXED.
65  */
66 typedef enum vd_media {
67 	VD_MEDIA_FIXED = 1,		/* default */
68 	VD_MEDIA_CD,
69 	VD_MEDIA_DVD
70 } vd_media_t;
71 
72 /*
73  * vDisk device attributes information message.
74  *
75  * tag.msgtype == VIO_TYPE_CTRL
76  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
77  * tag.subtype_env == VIO_ATTR_INFO
78  */
79 typedef struct vd_attr_msg {
80 	/* Common tag */
81 	vio_msg_tag_t 	tag;
82 
83 	/* vdisk-attribute-specific payload */
84 	uint8_t		xfer_mode;	/* data exchange method. */
85 	uint8_t		vdisk_type;	/* disk, slice, read-only, etc. */
86 	uint8_t		vdisk_media;	/* info about physical media */
87 	uint8_t		resv1;		/* padding */
88 	uint32_t	vdisk_block_size;	/* bytes per disk block */
89 	uint64_t	operations;	/* bit-field of server supported ops */
90 	uint64_t	vdisk_size;	/* size for Nblocks property. */
91 	uint64_t	max_xfer_sz;	/* maximum block transfer size */
92 
93 	uint64_t	resv2[VIO_PAYLOAD_ELEMS - 4];	/* padding */
94 } vd_attr_msg_t;
95 
96 /*
97  * vDisk inband descriptor message.
98  *
99  * For clients that do not use descriptor rings, the descriptor contents
100  * are sent as part of an inband message.
101  */
102 typedef struct vd_dring_inband_msg {
103 	vio_inband_desc_msg_hdr_t	hdr;
104 	vd_dring_payload_t		payload;
105 } vd_dring_inband_msg_t;
106 
107 
108 #ifdef	__cplusplus
109 }
110 #endif
111 
112 #endif	/* _VDSK_MAILBOX_H */
113