diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-06-16 03:07:22 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-06-16 03:07:22 +0000 |
commit | 587016bbab30c6eac8d7b9ad4e1abe505c5922bb (patch) | |
tree | 032390297f9c7f4b93f3d331fe6c6e7687a4ba8d /sys/scsi/sd.c | |
parent | 13504ad958d6c727d842b1f2bda7f17b50c877e8 (diff) |
NetBSD PR#2535: add mode sense 5 and floppy support in our framework.
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r-- | sys/scsi/sd.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index f715be74e6d..55cf4821a2f 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.14 1996/06/10 07:31:20 deraadt Exp $ */ +/* $OpenBSD: sd.c,v 1.15 1996/06/16 03:07:21 downsj Exp $ */ /* $NetBSD: sd.c,v 1.100.4.1 1996/06/04 23:14:08 thorpej Exp $ */ /* @@ -901,10 +901,38 @@ sd_get_parms(sd, flags) sectors /= (dp->heads * dp->cyls); dp->sectors = sectors; /* XXX dubious on SCSI */ return 0; - } - else - printf("%s: could not mode sense (4)", sd->sc_dev.dv_xname); + } else { + /* + * do a "mode sense page 5" + */ + scsi_cmd.opcode = MODE_SENSE; + scsi_cmd.page = 5; + scsi_cmd.length = 0x20; + if (scsi_scsi_cmd(sd->sc_link, (struct scsi_generic *)&scsi_cmd, + sizeof(scsi_cmd), (u_char *)&scsi_sense, sizeof(scsi_sense), + SDRETRIES, 6000, NULL, + flags | SCSI_DATA_IN | SCSI_SILENT) == 0) { + dp->heads = scsi_sense.pages.flex_geometry.nheads; + dp->cyls = + scsi_sense.pages.flex_geometry.ncyl_1 * 256 + + scsi_sense.pages.flex_geometry.ncyl_0; + dp->blksize = _3btol(scsi_sense.blk_desc.blklen); + dp->sectors = scsi_sense.pages.flex_geometry.ph_sec_t; + dp->disksize = dp->heads * dp->cyls * dp->sectors; + if (dp->heads == 0 || dp->cyls == 0 + || dp->sectors == 0) { + printf("%s: mode sense (5) returned nonsense", + sd->sc_dev.dv_xname); + goto fake_it; + } + if (dp->blksize == 0) + dp->blksize = 512; + + return 0; + } else + printf("%s: could not mode sense (4/5)", sd->sc_dev.dv_xname); + } fake_it: /* |