Subject: sd.c patch for large (>3.5GB) drives
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Adrian Hall <adrian@lemmings.cursci.com>
List: netbsd-bugs
Date: 01/03/1994 10:33:47
System:		 lemmings.cursci.com: NetBSD 0.9a: Thu Dec 30 17:20:41 EST 1993
Problem:	SCSI sd probe reports wrong drive size when drive size
		is greater than 3.5GB.
Fix:		Given below

Before Fix:	My probe reports :-

sd0 at aha0 targ 0 lun 0: -295MB 3055 cyl, 26 head, 98 sec, 512 byte/sec

After Fix:	My probe reports :-

sd0 at aha0 targ 0 lun 0: 3800MB 3055 cyl, 26 head, 98 sec, 512 byte/sec

Patch:		(I hope Ive done this the right way!!!)

*** sd.c~	Mon Jan  3 10:23:39 1994
--- sd.c	Mon Jan  3 10:24:00 1994
***************
*** 135,145 ****
  	 * request must specify this.
  	 */
  	sd_get_parms(*unit,  SCSI_NOSLEEP |  SCSI_NOMASK);
! 	printf("sd%d at %s%d targ %d lun %d: %dMB %d cyl, %d head, %d sec, %d byte/sec\n",
! 		*unit, sw->name, masunit, targ, lun,
! 		(dp->cyls*dp->heads*dp->sectors*dp->secsiz)/ (1024*1024),
! 		dp->cyls, dp->heads, dp->sectors, dp->secsiz);
  
  	sd->flags |= SDINIT;
  	return 1;
  }
--- 135,148 ----
  	 * request must specify this.
  	 */
  	sd_get_parms(*unit,  SCSI_NOSLEEP |  SCSI_NOMASK);
! 	{
! 		unsigned long sod ;		/* size of disk */
  
+ 		sod = ((unsigned long)dp->cyls * (unsigned long)dp->heads * (unsigned long)dp->sectors * (unsigned long)dp->secsiz) / (1024 * 1024) ;
+ 		printf("sd%d at %s%d targ %d lun %d: %uMB %d cyl, %d head, %d sec, %d byte/sec\n",
+ 			*unit, sw->name, masunit, targ, lun, (unsigned int)sod, 
+ 			dp->cyls, dp->heads, dp->sectors, dp->secsiz);
+ 	}
  	sd->flags |= SDINIT;
  	return 1;
  }

--
Adrian Hall				20 North Third Street
Communications Manager			Philadelphia, PA 19106
The Current Science Group		Tel: (215) 574 2227


------------------------------------------------------------------------------