From 58ae486afb4855565ea982e9e02d89e2a623b85d Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 1 Jan 2011 20:32:19 +0000 Subject: Implement READ CAPACITY (16). --- sys/arch/sparc64/dev/vdsk.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/sparc64/dev/vdsk.c b/sys/arch/sparc64/dev/vdsk.c index 5dd6103a0f6..08f6305c552 100644 --- a/sys/arch/sparc64/dev/vdsk.c +++ b/sys/arch/sparc64/dev/vdsk.c @@ -1,6 +1,6 @@ -/* $OpenBSD: vdsk.c,v 1.25 2010/10/12 00:53:32 krw Exp $ */ +/* $OpenBSD: vdsk.c,v 1.26 2011/01/01 20:32:18 kettenis Exp $ */ /* - * Copyright (c) 2009 Mark Kettenis + * Copyright (c) 2009, 2011 Mark Kettenis * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -203,6 +203,7 @@ void vdsk_dev_free(struct scsi_link *); void vdsk_scsi_inq(struct scsi_xfer *); void vdsk_scsi_inquiry(struct scsi_xfer *); void vdsk_scsi_capacity(struct scsi_xfer *); +void vdsk_scsi_capacity16(struct scsi_xfer *); void vdsk_scsi_done(struct scsi_xfer *, int); int @@ -936,6 +937,9 @@ vdsk_scsi_cmd(struct scsi_xfer *xs) case READ_CAPACITY: vdsk_scsi_capacity(xs); return; + case READ_CAPACITY_16: + vdsk_scsi_capacity16(xs); + return; case TEST_UNIT_READY: case START_STOP: @@ -1108,6 +1112,22 @@ vdsk_scsi_capacity(struct scsi_xfer *xs) vdsk_scsi_done(xs, XS_NOERROR); } +void +vdsk_scsi_capacity16(struct scsi_xfer *xs) +{ + struct vdsk_softc *sc = xs->sc_link->adapter_softc; + struct scsi_read_cap_data_16 rcd; + + bzero(&rcd, sizeof(rcd)); + + _lto8b(sc->sc_vdisk_size - 1, rcd.addr); + _lto4b(sc->sc_vdisk_block_size, rcd.length); + + bcopy(&rcd, xs->data, MIN(sizeof(rcd), xs->datalen)); + + vdsk_scsi_done(xs, XS_NOERROR); +} + void vdsk_scsi_done(struct scsi_xfer *xs, int error) { -- cgit v1.2.3