summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-11-21 21:20:14 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-11-21 21:20:14 +0000
commit6474b392866b23098be6b1dd1cba3d1bf9f761b9 (patch)
tree3104964c4ef45662f113b58ea865630a70fbf376 /sys
parenta90c19afd00727bef1fa7c952b417be93134006b (diff)
Try to negotiate version 1.1 of the vDisk protocol such that we can get
the vdisk media type and fake a CD-ROM drive.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/dev/vdsk.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/sys/arch/sparc64/dev/vdsk.c b/sys/arch/sparc64/dev/vdsk.c
index 8d58cf77686..9dd03d0eeea 100644
--- a/sys/arch/sparc64/dev/vdsk.c
+++ b/sys/arch/sparc64/dev/vdsk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vdsk.c,v 1.30 2012/10/26 20:57:08 kettenis Exp $ */
+/* $OpenBSD: vdsk.c,v 1.31 2012/11/21 21:20:13 kettenis Exp $ */
/*
* Copyright (c) 2009, 2011 Mark Kettenis
*
@@ -111,10 +111,10 @@ struct vdsk_dring *vdsk_dring_alloc(bus_dma_tag_t, int);
void vdsk_dring_free(bus_dma_tag_t, struct vdsk_dring *);
/*
- * For now, we only support vDisk 1.0.
+ * We support vDisk 1.0 and 1.1.
*/
#define VDSK_MAJOR 1
-#define VDSK_MINOR 0
+#define VDSK_MINOR 1
struct vdsk_soft_desc {
int vsd_map_idx[MAXPHYS / PAGE_SIZE];
@@ -162,6 +162,7 @@ struct vdsk_softc {
uint32_t sc_vdisk_block_size;
uint64_t sc_vdisk_size;
+ uint8_t sc_vd_mtype;
};
int vdsk_match(struct device *, void *, void *);
@@ -562,6 +563,10 @@ vdsk_rx_vio_attr_info(struct vdsk_softc *sc, struct vio_msg_tag *tag)
sc->sc_vdisk_block_size = ai->vdisk_block_size;
sc->sc_vdisk_size = ai->vdisk_size;
+ if (sc->sc_major > 1 || sc->sc_minor >= 1)
+ sc->sc_vd_mtype = ai->vd_mtype;
+ else
+ sc->sc_vd_mtype = VD_MEDIA_TYPE_FIXED;
sc->sc_vio_state |= VIO_ACK_ATTR_INFO;
break;
@@ -1079,7 +1084,18 @@ vdsk_scsi_inquiry(struct scsi_xfer *xs)
bzero(&inq, sizeof(inq));
- inq.device = T_DIRECT;
+ switch (sc->sc_vd_mtype) {
+ case VD_MEDIA_TYPE_CD:
+ case VD_MEDIA_TYPE_DVD:
+ inq.device = T_CDROM;
+ break;
+
+ case VD_MEDIA_TYPE_FIXED:
+ default:
+ inq.device = T_DIRECT;
+ break;
+ }
+
inq.version = 0x05; /* SPC-3 */
inq.response_format = 2;
inq.additional_length = 32;