Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Nov 2002 08:36:34 +0200 (SAT)
From:      John Hay <jhay@icomtek.csir.co.za>
To:        imp@bsdimp.com (M. Warner Losh)
Cc:        current@FreeBSD.ORG, n_hibma@FreeBSD.ORG
Subject:   umass CF geometry problems, was Re: fdisk -BI ob clean disk broken
Message-ID:  <200211040636.gA46aYDA089784@zibbi.icomtek.csir.co.za>
In-Reply-To: <20021102.122842.35978977.imp@bsdimp.com> from "M. Warner Losh" at "Nov 2, 2002 12:28:42 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> : Hmmm. I just noticed that the disks probe with zero values for the
> : heads, sectors/track and cylinders. I have tried two different USB
> : CF readers and both do it. On 4.x it probes with the correct values
> : on the same machine and the same devices. So why do they probe
> : wrong?
> 
> Don't know.  I've had problems with CF readers returning the wrong
> geometry values in 4.3, but never 0's

Ok, I found it. It is part of the rev 1.61 change to umass.c. It was
made in June. :-/ The relevant piece is this:

###########
Index: umass.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/umass.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- umass.c	11 Apr 2002 21:09:41 -0000	1.60
+++ umass.c	16 Jun 2002 20:53:35 -0000	1.61
...
@@ -2445,35 +2441,16 @@
 	}
 	case XPT_CALC_GEOMETRY:
 	{
+#ifdef UMASS_DEBUG
 		struct ccb_calc_geometry *ccg = &ccb->ccg;
-
+#endif
 		DPRINTF(UDMASS_SCSI, ("%s:%d:%d:%d:XPT_CALC_GEOMETRY: "
-			"Volume size = %d\n",
+			"Volume size = %d (unimplemented)\n",
 			USBDEVNAME(sc->sc_dev), cam_sim_path(umass_sim),
 			ccb->ccb_h.target_id, ccb->ccb_h.target_lun,
 			ccg->volume_size));
 
-		/* XXX We should probably ask the drive for the details
-		 *     instead of cluching them up ourselves
-		 */
-		if (sc->drive == ZIP_100) {
-			ccg->heads = 64;
-			ccg->secs_per_track = 32;
-			ccg->cylinders = ccg->volume_size / ccg->heads
-					  / ccg->secs_per_track;
-			ccb->ccb_h.status = CAM_REQ_CMP;
-			break;
-		} else if (sc->proto & PROTO_UFI) {
-			ccg->heads = 2;
-			if (ccg->volume_size == 2880)
-				ccg->secs_per_track = 18;
-			else
-				ccg->secs_per_track = 9;
-			ccg->cylinders = 80;
-			break;
-		} else {
-			ccb->ccb_h.status = CAM_REQ_CMP_ERR;
-		}
+		ccb->ccb_h.status = CAM_REQ_CMP_ERR;
 
 		xpt_done(ccb);
 		break;
..
###########

If I understand this correctly, it means it just faked the geometry, which
explains Warner's comment that it didn't get the geometry always right.

So the question now is do we just leave umass like this, which means we
can't do low level disk stuff on umass devices, or do we add something
like this back or is there another way? Is there a way to get the real
geometry of the device?

John
-- 
John Hay -- John.Hay@icomtek.csir.co.za / jhay@FreeBSD.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211040636.gA46aYDA089784>