xref: /titanic_44/usr/src/uts/sun4v/sys/vdsk_mailbox.h (revision 17cadca83cc82e37ff517ea2783eb4bfcc07b950)
11ae08745Sheppo /*
21ae08745Sheppo  * CDDL HEADER START
31ae08745Sheppo  *
41ae08745Sheppo  * The contents of this file are subject to the terms of the
51ae08745Sheppo  * Common Development and Distribution License (the "License").
61ae08745Sheppo  * You may not use this file except in compliance with the License.
71ae08745Sheppo  *
81ae08745Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91ae08745Sheppo  * or http://www.opensolaris.org/os/licensing.
101ae08745Sheppo  * See the License for the specific language governing permissions
111ae08745Sheppo  * and limitations under the License.
121ae08745Sheppo  *
131ae08745Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
141ae08745Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151ae08745Sheppo  * If applicable, add the following below this CDDL HEADER, with the
161ae08745Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
171ae08745Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
181ae08745Sheppo  *
191ae08745Sheppo  * CDDL HEADER END
201ae08745Sheppo  */
211ae08745Sheppo 
221ae08745Sheppo /*
23*17cadca8Slm66018  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
241ae08745Sheppo  * Use is subject to license terms.
251ae08745Sheppo  */
261ae08745Sheppo 
271ae08745Sheppo #ifndef	_VDSK_MAILBOX_H
281ae08745Sheppo #define	_VDSK_MAILBOX_H
291ae08745Sheppo 
301ae08745Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
311ae08745Sheppo 
321ae08745Sheppo #ifdef __cplusplus
331ae08745Sheppo extern "C" {
341ae08745Sheppo #endif
351ae08745Sheppo 
361ae08745Sheppo /*
371ae08745Sheppo  * This header file contains the private LDoms Virtual Disk (vDisk) mailbox
381ae08745Sheppo  * definitions common to both the server (vds) and the client (vdc)
391ae08745Sheppo  */
401ae08745Sheppo 
411ae08745Sheppo #include <sys/vio_mailbox.h>
421ae08745Sheppo #include <sys/vio_common.h>
431ae08745Sheppo #include <sys/vdsk_common.h>
441ae08745Sheppo 
451ae08745Sheppo /*
461ae08745Sheppo  * Definition of the various states the vDisk state machine can
471ae08745Sheppo  * be in during the handshake between vdc and vds.
481ae08745Sheppo  */
491ae08745Sheppo typedef enum vd_state {
501ae08745Sheppo 	VD_STATE_INIT = 0,
511ae08745Sheppo 	VD_STATE_VER,
521ae08745Sheppo 	VD_STATE_ATTR,
531ae08745Sheppo 	VD_STATE_DRING,
541ae08745Sheppo 	VD_STATE_RDX,
551ae08745Sheppo 	VD_STATE_DATA
561ae08745Sheppo } vd_state_t;
571ae08745Sheppo 
581ae08745Sheppo #define	VD_VER_MAJOR		0x1
591ae08745Sheppo #define	VD_VER_MINOR		0x0
601ae08745Sheppo 
611ae08745Sheppo /*
62*17cadca8Slm66018  * Definition of the various types of media that can be exported by
63*17cadca8Slm66018  * the vDisk server. If we cannot work out what the media type is
64*17cadca8Slm66018  * we default to calling it VD_MEDIA_FIXED.
65*17cadca8Slm66018  */
66*17cadca8Slm66018 typedef enum vd_media {
67*17cadca8Slm66018 	VD_MEDIA_FIXED = 1,		/* default */
68*17cadca8Slm66018 	VD_MEDIA_CD,
69*17cadca8Slm66018 	VD_MEDIA_DVD
70*17cadca8Slm66018 } vd_media_t;
71*17cadca8Slm66018 
72*17cadca8Slm66018 /*
731ae08745Sheppo  * vDisk device attributes information message.
741ae08745Sheppo  *
751ae08745Sheppo  * tag.msgtype == VIO_TYPE_CTRL
761ae08745Sheppo  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
771ae08745Sheppo  * tag.subtype_env == VIO_ATTR_INFO
781ae08745Sheppo  */
791ae08745Sheppo typedef struct vd_attr_msg {
801ae08745Sheppo 	/* Common tag */
811ae08745Sheppo 	vio_msg_tag_t 	tag;
821ae08745Sheppo 
831ae08745Sheppo 	/* vdisk-attribute-specific payload */
841ae08745Sheppo 	uint8_t		xfer_mode;	/* data exchange method. */
851ae08745Sheppo 	uint8_t		vdisk_type;	/* disk, slice, read-only, etc. */
86*17cadca8Slm66018 	uint8_t		vdisk_media;	/* info about physical media */
87*17cadca8Slm66018 	uint8_t		resv1;		/* padding */
881ae08745Sheppo 	uint32_t	vdisk_block_size;	/* bytes per disk block */
891ae08745Sheppo 	uint64_t	operations;	/* bit-field of server supported ops */
901ae08745Sheppo 	uint64_t	vdisk_size;	/* size for Nblocks property. */
911ae08745Sheppo 	uint64_t	max_xfer_sz;	/* maximum block transfer size */
921ae08745Sheppo 
931ae08745Sheppo 	uint64_t	resv2[VIO_PAYLOAD_ELEMS - 4];	/* padding */
941ae08745Sheppo } vd_attr_msg_t;
951ae08745Sheppo 
961ae08745Sheppo /*
971ae08745Sheppo  * vDisk inband descriptor message.
981ae08745Sheppo  *
991ae08745Sheppo  * For clients that do not use descriptor rings, the descriptor contents
1001ae08745Sheppo  * are sent as part of an inband message.
1011ae08745Sheppo  */
1021ae08745Sheppo typedef struct vd_dring_inband_msg {
1031ae08745Sheppo 	vio_inband_desc_msg_hdr_t	hdr;
1041ae08745Sheppo 	vd_dring_payload_t		payload;
1051ae08745Sheppo } vd_dring_inband_msg_t;
1061ae08745Sheppo 
1071ae08745Sheppo 
1081ae08745Sheppo #ifdef	__cplusplus
1091ae08745Sheppo }
1101ae08745Sheppo #endif
1111ae08745Sheppo 
1121ae08745Sheppo #endif	/* _VDSK_MAILBOX_H */
113