xref: /onnv-gate/usr/src/uts/sun4v/sys/vdsk_mailbox.h (revision 5365:e9a7403eebeb)
11991Sheppo /*
21991Sheppo  * CDDL HEADER START
31991Sheppo  *
41991Sheppo  * The contents of this file are subject to the terms of the
51991Sheppo  * Common Development and Distribution License (the "License").
61991Sheppo  * You may not use this file except in compliance with the License.
71991Sheppo  *
81991Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91991Sheppo  * or http://www.opensolaris.org/os/licensing.
101991Sheppo  * See the License for the specific language governing permissions
111991Sheppo  * and limitations under the License.
121991Sheppo  *
131991Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
141991Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151991Sheppo  * If applicable, add the following below this CDDL HEADER, with the
161991Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
171991Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
181991Sheppo  *
191991Sheppo  * CDDL HEADER END
201991Sheppo  */
211991Sheppo 
221991Sheppo /*
23*5365Slm66018  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
241991Sheppo  * Use is subject to license terms.
251991Sheppo  */
261991Sheppo 
271991Sheppo #ifndef	_VDSK_MAILBOX_H
281991Sheppo #define	_VDSK_MAILBOX_H
291991Sheppo 
301991Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
311991Sheppo 
321991Sheppo #ifdef __cplusplus
331991Sheppo extern "C" {
341991Sheppo #endif
351991Sheppo 
361991Sheppo /*
371991Sheppo  * This header file contains the private LDoms Virtual Disk (vDisk) mailbox
381991Sheppo  * definitions common to both the server (vds) and the client (vdc)
391991Sheppo  */
401991Sheppo 
411991Sheppo #include <sys/vio_mailbox.h>
421991Sheppo #include <sys/vio_common.h>
431991Sheppo #include <sys/vdsk_common.h>
441991Sheppo 
451991Sheppo /*
461991Sheppo  * Definition of the various states the vDisk state machine can
471991Sheppo  * be in during the handshake between vdc and vds.
481991Sheppo  */
491991Sheppo typedef enum vd_state {
501991Sheppo 	VD_STATE_INIT = 0,
511991Sheppo 	VD_STATE_VER,
521991Sheppo 	VD_STATE_ATTR,
531991Sheppo 	VD_STATE_DRING,
541991Sheppo 	VD_STATE_RDX,
551991Sheppo 	VD_STATE_DATA
561991Sheppo } vd_state_t;
571991Sheppo 
581991Sheppo #define	VD_VER_MAJOR		0x1
591991Sheppo #define	VD_VER_MINOR		0x0
601991Sheppo 
611991Sheppo /*
62*5365Slm66018  * Definition of the various types of media that can be exported by
63*5365Slm66018  * the vDisk server. If we cannot work out what the media type is
64*5365Slm66018  * we default to calling it VD_MEDIA_FIXED.
65*5365Slm66018  */
66*5365Slm66018 typedef enum vd_media {
67*5365Slm66018 	VD_MEDIA_FIXED = 1,		/* default */
68*5365Slm66018 	VD_MEDIA_CD,
69*5365Slm66018 	VD_MEDIA_DVD
70*5365Slm66018 } vd_media_t;
71*5365Slm66018 
72*5365Slm66018 /*
731991Sheppo  * vDisk device attributes information message.
741991Sheppo  *
751991Sheppo  * tag.msgtype == VIO_TYPE_CTRL
761991Sheppo  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
771991Sheppo  * tag.subtype_env == VIO_ATTR_INFO
781991Sheppo  */
791991Sheppo typedef struct vd_attr_msg {
801991Sheppo 	/* Common tag */
811991Sheppo 	vio_msg_tag_t 	tag;
821991Sheppo 
831991Sheppo 	/* vdisk-attribute-specific payload */
841991Sheppo 	uint8_t		xfer_mode;	/* data exchange method. */
851991Sheppo 	uint8_t		vdisk_type;	/* disk, slice, read-only, etc. */
86*5365Slm66018 	uint8_t		vdisk_media;	/* info about physical media */
87*5365Slm66018 	uint8_t		resv1;		/* padding */
881991Sheppo 	uint32_t	vdisk_block_size;	/* bytes per disk block */
891991Sheppo 	uint64_t	operations;	/* bit-field of server supported ops */
901991Sheppo 	uint64_t	vdisk_size;	/* size for Nblocks property. */
911991Sheppo 	uint64_t	max_xfer_sz;	/* maximum block transfer size */
921991Sheppo 
931991Sheppo 	uint64_t	resv2[VIO_PAYLOAD_ELEMS - 4];	/* padding */
941991Sheppo } vd_attr_msg_t;
951991Sheppo 
961991Sheppo /*
971991Sheppo  * vDisk inband descriptor message.
981991Sheppo  *
991991Sheppo  * For clients that do not use descriptor rings, the descriptor contents
1001991Sheppo  * are sent as part of an inband message.
1011991Sheppo  */
1021991Sheppo typedef struct vd_dring_inband_msg {
1031991Sheppo 	vio_inband_desc_msg_hdr_t	hdr;
1041991Sheppo 	vd_dring_payload_t		payload;
1051991Sheppo } vd_dring_inband_msg_t;
1061991Sheppo 
1071991Sheppo 
1081991Sheppo #ifdef	__cplusplus
1091991Sheppo }
1101991Sheppo #endif
1111991Sheppo 
1121991Sheppo #endif	/* _VDSK_MAILBOX_H */
113