summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/scsi/scsi_disk.h5
-rw-r--r--sys/scsi/sd.c4
-rw-r--r--sys/scsi/sd_scsi.c17
3 files changed, 16 insertions, 10 deletions
diff --git a/sys/scsi/scsi_disk.h b/sys/scsi/scsi_disk.h
index 00b137c15b0..cb93bcd8c30 100644
--- a/sys/scsi/scsi_disk.h
+++ b/sys/scsi/scsi_disk.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_disk.h,v 1.13 2002/12/15 20:53:33 krw Exp $ */
+/* $OpenBSD: scsi_disk.h,v 1.14 2003/06/24 22:42:07 mickey Exp $ */
/* $NetBSD: scsi_disk.h,v 1.10 1996/07/05 16:19:05 christos Exp $ */
/*
@@ -310,10 +310,9 @@ union scsi_disk_pages {
u_int8_t head_unload; /* head unload delay */
u_int8_t pin_34_2; /* pin 34 (6) pin 2 (7/11) definition */
u_int8_t pin_4_1; /* pin 4 (8/9) pin 1 (13) definition */
+ u_int8_t rpm[2]; /* media rotation speed */
u_int8_t reserved1;
u_int8_t reserved2;
- u_int8_t reserved3;
- u_int8_t reserved4;
} flex_geometry;
struct page_reduced_geometry {
u_int8_t pg_code; /* page code (should be 6) */
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 90e6850c52e..9b1b59f7d10 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.61 2003/05/21 23:43:58 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.62 2003/06/24 22:42:07 mickey Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -1023,7 +1023,7 @@ sdgetdisklabel(dev, sd, lp, clp, spoofonly)
bcopy(packname, lp->d_packname, len);
lp->d_secperunit = sd->params.disksize;
- lp->d_rpm = 3600;
+ lp->d_rpm = sd->params.rot_rate;
lp->d_interleave = 1;
lp->d_flags = 0;
diff --git a/sys/scsi/sd_scsi.c b/sys/scsi/sd_scsi.c
index de9d08e64ff..b43cbaac0f2 100644
--- a/sys/scsi/sd_scsi.c
+++ b/sys/scsi/sd_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd_scsi.c,v 1.4 2002/09/04 23:07:28 tdeval Exp $ */
+/* $OpenBSD: sd_scsi.c,v 1.5 2003/06/24 22:42:07 mickey Exp $ */
/* $NetBSD: sd_scsi.c,v 1.8 1998/10/08 20:21:13 thorpej Exp $ */
/*-
@@ -107,7 +107,7 @@ sd_scsibus_mode_sense(sd, scsi_sense, page, flags)
bzero(&scsi_cmd, sizeof(scsi_cmd));
scsi_cmd.opcode = MODE_SENSE;
scsi_cmd.page = page;
- scsi_cmd.length = 0x20;
+ scsi_cmd.length = sizeof(*scsi_sense);
/*
* If the command worked, use the results to fill out
* the parameter structure
@@ -179,10 +179,10 @@ sd_scsibus_get_parms(sd, dp, flags)
struct sd_scsibus_mode_sense_data scsi_sense;
union scsi_disk_pages *sense_pages;
u_long sectors;
- int page;
- int error;
+ int page, error;
+ u_int16_t rpm;
- dp->rot_rate = 3600; /* XXX any way of getting this? */
+ dp->rot_rate = 3600;
/*
* If offline, the SDEV_MEDIA_LOADED flag will be
@@ -213,6 +213,9 @@ sd_scsibus_get_parms(sd, dp, flags)
*/
dp->heads = sense_pages->rigid_geometry.nheads;
dp->cyls = _3btol(sense_pages->rigid_geometry.ncyl);
+ rpm = _2btol(scsi_sense.pages.rigid_geometry.rpm);
+ if (rpm)
+ dp->rot_rate = rpm;
if (scsi_sense.header.blk_desc_len >= 8)
dp->blksize = _3btol(scsi_sense.blk_desc.blklen);
else
@@ -239,6 +242,9 @@ sd_scsibus_get_parms(sd, dp, flags)
(size_t)scsi_sense.header.blk_desc_len);
dp->heads = sense_pages->flex_geometry.nheads;
dp->cyls = _2btol(sense_pages->flex_geometry.ncyl);
+ rpm = _2btol(scsi_sense.pages.flex_geometry.rpm);
+ if (rpm)
+ dp->rot_rate = rpm;
if (scsi_sense.header.blk_desc_len >= 8)
dp->blksize = _3btol(scsi_sense.blk_desc.blklen);
else
@@ -303,6 +309,7 @@ fake_it:
dp->cyls = sectors / (64 * 32);
dp->blksize = 512;
dp->disksize = sectors;
+
return (SDGP_RESULT_OK);
}