summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-06-23 00:31:45 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-06-23 00:31:45 +0000
commit9b0080d95ee3988b00d19db3bcff36d96a3d4d10 (patch)
treeacb9939b36ecc360d4ca7f37e0c45ae843bcb086 /sys/scsi
parent6c49b94d9c65ac022eac99a6d38f57df9d5a42b4 (diff)
Don't discard the blocksize information provided by the READ CAPACITY
command. Return it in a new parameter to scsi_size.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_base.c8
-rw-r--r--sys/scsi/scsiconf.h4
-rw-r--r--sys/scsi/sd_scsi.c4
3 files changed, 10 insertions, 6 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 530a23a0be5..051e46d9e74 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.84 2005/06/18 01:09:03 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.85 2005/06/23 00:31:44 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -219,9 +219,10 @@ scsi_make_xs(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
* Find out from the device what its capacity is.
*/
u_long
-scsi_size(sc_link, flags)
+scsi_size(sc_link, flags, blksize)
struct scsi_link *sc_link;
int flags;
+ u_int32_t *blksize;
{
struct scsi_read_capacity scsi_cmd;
struct scsi_read_cap_data rdcap;
@@ -247,6 +248,9 @@ scsi_size(sc_link, flags)
}
max_addr = _4btol(rdcap.addr);
+ if (blksize)
+ *blksize = _4btol(rdcap.length);
+
if (max_addr == 0xffffffffUL) {
/*
* The device is reporting it has more than 2^32-1 sectors. The
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 520a7c36f61..b593faaefe8 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.58 2005/06/05 21:27:07 krw Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.59 2005/06/23 00:31:44 krw Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -326,7 +326,7 @@ struct scsi_xfer *
scsi_get_xs(struct scsi_link *, int);
void scsi_free_xs(struct scsi_xfer *);
int scsi_execute_xs(struct scsi_xfer *);
-u_long scsi_size(struct scsi_link *, int);
+u_long scsi_size(struct scsi_link *, int, u_int32_t *);
int scsi_test_unit_ready(struct scsi_link *, int, int);
int scsi_inquire(struct scsi_link *, struct scsi_inquiry_data *, int);
int scsi_prevent(struct scsi_link *, int, int);
diff --git a/sys/scsi/sd_scsi.c b/sys/scsi/sd_scsi.c
index c1b5ce8d810..db0cf3bbe36 100644
--- a/sys/scsi/sd_scsi.c
+++ b/sys/scsi/sd_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd_scsi.c,v 1.17 2005/06/22 02:49:36 krw Exp $ */
+/* $OpenBSD: sd_scsi.c,v 1.18 2005/06/23 00:31:44 krw Exp $ */
/* $NetBSD: sd_scsi.c,v 1.8 1998/10/08 20:21:13 thorpej Exp $ */
/*-
@@ -142,7 +142,7 @@ sd_scsibus_get_parms(sd, dp, flags)
u_int16_t rpm = 0;
int page, error;
- dp->disksize = scsi_size(sd->sc_link, flags);
+ dp->disksize = scsi_size(sd->sc_link, flags, &blksize);
dp->rot_rate = 3600;
/*