summaryrefslogtreecommitdiffstats
path: root/sys/scsi/sd.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1997-12-28 07:10:54 +0000
committerjulian <julian@FreeBSD.org>1997-12-28 07:10:54 +0000
commite8593c05aa92182d0da5ef0f14ab3b0fe6d159b4 (patch)
tree93d7f87629b40d2b111943dca85042b3095600f5 /sys/scsi/sd.c
parentc4f9529d8c1018432e22bec63a19ce3fed84da1d (diff)
downloadFreeBSD-src-e8593c05aa92182d0da5ef0f14ab3b0fe6d159b4.zip
FreeBSD-src-e8593c05aa92182d0da5ef0f14ab3b0fe6d159b4.tar.gz
Move the sector size check to the right place,
also cope with some drives that return funny values. The correct fix will come in a few days.
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r--sys/scsi/sd.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index fd6be1c..37ff30d 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -15,7 +15,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
- * $Id: sd.c,v 1.115 1997/12/02 21:07:03 phk Exp $
+ * $Id: sd.c,v 1.116 1997/12/06 14:27:56 bde Exp $
*/
#include "opt_bounce.h"
@@ -318,18 +318,6 @@ sd_open(dev, mode, fmt, p, sc_link)
*/
if(errcode = sd_get_parms(unit, 0)) /* sets SDEV_MEDIA_LOADED */
goto bad;
- switch (sd->params.secsiz) {
- case 512:
- case 1024:
- case 2048:
- break;
- default:
- printf("sd%ld: Can't deal with %d bytes logical blocks\n",
- unit, sd->params.secsiz);
- Debugger("sd");
- errcode = ENXIO;
- goto bad;
- }
SC_DEBUG(sc_link, SDEV_DB3, ("Params loaded "));
@@ -423,7 +411,7 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
/*
* check it's not too big a transfer for our adapter
*/
- scsi_minphys(bp,&sd_switch);
+ scsi_minphys(bp,&sd_switch);
/*
* Odd number of bytes or negative offset
@@ -849,6 +837,29 @@ sd_get_parms(unit, flags)
disk_parms->cyls = scsi_3btou(&scsi_sense.pages.rigid_geometry.ncyl_2);
disk_parms->secsiz = scsi_3btou(scsi_sense.blk_desc.blklen);
+ switch (sd->params.secsiz) {
+ case 528:/*
+ * This is not the correct fix but will do till
+ * I get to my scsi docs. Some drives return this value
+ * for physical size when actually presenting
+ * a 512 byte logical sector size. The correct
+ * fix involves figuring out what hte correct
+ * command sequence is to get teh logical blocksize,
+ * and figuring out what to do if it doesn't
+ * work on an old drive. Possibly only do this
+ * if the value here is not a power of 2.
+ */
+ sd->params.secsiz = 512;
+ case 512:
+ case 1024:
+ case 2048:
+ break;
+ default:
+ printf("sd%ld: Can't deal with %d byte blocks\n",
+ unit, sd->params.secsiz);
+ Debugger("sd");
+ return (ENXIO);
+ }
sectors = sd_size(unit, flags);
disk_parms->disksize = sectors;
/* Check if none of these values are zero */
OpenPOWER on IntegriCloud