From nobody  Sun Jan 10 18:32:03 1999
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id SAA18087;
          Sun, 10 Jan 1999 18:32:03 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199901110232.SAA18087@hub.freebsd.org>
Date: Sun, 10 Jan 1999 18:32:03 -0800 (PST)
From: ixkatl@yahoo.com
To: freebsd-gnats-submit@freebsd.org
Subject: wd.c Does nto recognize certain LBA disks [patch attached]
X-Send-Pr-Version: www-1.0

>Number:         9431
>Category:       i386
>Synopsis:       wd.c Does nto recognize certain LBA disks [patch attached]
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    dcs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 10 18:40:00 PST 1999
>Closed-Date:    Mon Nov 8 01:20:46 PST 1999
>Last-Modified:  Mon Nov  8 01:22:12 PST 1999
>Originator:     Andrew Sherrod
>Release:        2.2.8 / 3.0.0 (Patch diff for 3.0.0, but works on 2.8.8 as well.)
>Organization:
>Environment:
>Description:
My email to -current:


I think I found a problem in the wd.ccode which makes it unable to recognize certain LBA disks.

The code assumes any LBA disk will return 16383 as the number of cylinders. In my case, at least (Award BIOS on a Tyan Trinity motherboard) two of the three disks do NOT return this number, so the disk size is underestimated by the kernel probes. [Yes, I DID fix this by putting on a DOS partition, but wouldn'tit be nice to not have to rely on DOS partitions for disk geometry?]

Well, I don't know if this fixes any other disk geometry problems, as I haven't tried it out very extensively, but this patch does make dmesg (and the boot time probes) return the correct number of sectors.

Could anyone tell me if this breaks anything? And what the reasoning was behind the 16383 restriction. (After all, it only reaches that line of code if the LBA flag is set anyway. So we already know it is in LBA mode. The 16383 seems superfluous.)

Andrew Sherrod

>How-To-Repeat:

>Fix:
*** wd.c	Sun Jan 10 21:27:38 1999
--- wd.c.original	Sun Jan 10 21:27:22 1999
***************
*** 1949,1955 ****
  			du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
  		du->dk_dd.d_secperunit =   
  			du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
! 		if(du->dk_dd.d_secperunit < wp->wdp_lbasize) {  
  			du->dk_dd.d_secperunit = wp->wdp_lbasize;  
  			du->dk_dd.d_ncylinders =   
  				du->dk_dd.d_secperunit / du->dk_dd.d_secpercyl;  
--- 1949,1956 ----
  			du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
  		du->dk_dd.d_secperunit =   
  			du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
! 		if (wp->wdp_cylinders == 16383 &&  
! 		    du->dk_dd.d_secperunit < wp->wdp_lbasize) {  
  			du->dk_dd.d_secperunit = wp->wdp_lbasize;  
  			du->dk_dd.d_ncylinders =   
  				du->dk_dd.d_secperunit / du->dk_dd.d_secpercyl;  

>Release-Note:
>Audit-Trail:

From: Andrew Sherrod <yaldabaoth@geocities.com>
To: freebsd-gnats-submit@freebsd.org, ixkatl@yahoo.com
Cc:  
Subject: [Modified Patch] Re: i386/9431: wd.c Does nto recognize certain LBA disks [patch attached]
Date: Mon, 11 Jan 1999 21:11:24 -0500

 This is a multi-part message in MIME format.
 --------------8FCCD93F6580F4F426E50F0A
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Correcting my own mistake here. (Never try to patch something too late
 at night.)
 
 The piece of code I changed was NOT inside the LBA flag portion.
 Insterad, it was in the "else" part
 of the "if lba_flag" code.
 
 The reason? It seems Award BIOS (at least some versions) do not return
 any flags when LBA is active.
 So, the patch still stands, it simply needs a better explanation.
 
 (I could really use the input of some disk gurus here. Any idea why the
 Award BIOS would NOT return
 any flags? And, more important, if LBA is not enabled, will any lba_size
 value be returned?Or if LBA is off
 is a null or 0 returned?)
 
 Proposed patches for 2.2.8 and 3.0.0 follow:
 
 
 --------------8FCCD93F6580F4F426E50F0A
 Content-Type: text/plain; charset=us-ascii; name="diff228.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diff228.txt"
 
 *** wd.c.2_2_8	Mon Jan 11 20:59:44 1999
 --- wd.c.original.2_2_8	Mon Jan 11 20:41:01 1999
 ***************
 *** 1727,1740 ****
   	du->dk_dd.d_nsectors = wp->wdp_sectors;  
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
 !         /* It appears that Award BIOSes (At least the more recent
 !            versions) do not return an LBA flag when probed. However,
 !            as an LBA size should not be returned when LBA mode is not
 !            active, this hack seems safe.
 ! 
 !            A. Sherrod 01/11/1998   */
 ! 
 !         if(du->dk_dd.d_secperunit < wp->wdp_lbasize) {   
           	du->dk_dd.d_secperunit = wp->wdp_lbasize;  
           	du->dk_dd.d_ncylinders =   
   			du->dk_dd.d_secperunit / du->dk_dd.d_secpercyl;   
 --- 1727,1734 ----
   	du->dk_dd.d_nsectors = wp->wdp_sectors;  
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
 ! 	if (wp->wdp_cylinders == 16383 &&  
 !             du->dk_dd.d_secperunit < wp->wdp_lbasize) {   
           	du->dk_dd.d_secperunit = wp->wdp_lbasize;  
           	du->dk_dd.d_ncylinders =   
   			du->dk_dd.d_secperunit / du->dk_dd.d_secpercyl;   
 
 --------------8FCCD93F6580F4F426E50F0A
 Content-Type: text/plain; charset=us-ascii; name="diff300.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diff300.txt"
 
 *** wd.c.3_0	Mon Jan 11 21:01:30 1999
 --- wd.c.original.3_0	Sun Jan 10 21:27:22 1999
 ***************
 *** 1949,1964 ****
   			du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
   		du->dk_dd.d_secperunit =   
   			du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
 !                
 ! 		/* It appears that certain Award BIOSes (newer versions
 ! 		   apparently) do not return LBA flags when LBA is
 ! 		  active. Hwoever, as LBA size should not be returned
 ! 		  when LBA is off, this hack should be safe.
 ! 
 ! 		  A. Sherrod 01/11/1998   */
 ! 
 ! 
 ! 		if(du->dk_dd.d_secperunit < wp->wdp_lbasize) {  
   			du->dk_dd.d_secperunit = wp->wdp_lbasize;  
   			du->dk_dd.d_ncylinders =   
   				du->dk_dd.d_secperunit / du->dk_dd.d_secpercyl;  
 --- 1949,1956 ----
   			du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
   		du->dk_dd.d_secperunit =   
   			du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
 ! 		if (wp->wdp_cylinders == 16383 &&  
 ! 		    du->dk_dd.d_secperunit < wp->wdp_lbasize) {  
   			du->dk_dd.d_secperunit = wp->wdp_lbasize;  
   			du->dk_dd.d_ncylinders =   
   				du->dk_dd.d_secperunit / du->dk_dd.d_secpercyl;  
 
 --------------8FCCD93F6580F4F426E50F0A--
 

From: Andrew Sherrod <yaldabaoth@geocities.com>
To: freebsd-gnats-submit@freebsd.org, ixkatl@yahoo.com
Cc:  
Subject: Re: i386/9431: wd.c Does nto recognize certain LBA disks [patch attached]
Date: Tue, 12 Jan 1999 23:53:21 -0500

 This is a multi-part message in MIME format.
 --------------EA0B0D592E66D6840BD205D9
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Having looked into this further, it seems that the following is a better
 set of patches.
 
 Basically, if the user specifies flags, then they are used. If not (for
 example when doing an initial installation) the
 BIOS flags are used to determine whether LBA is supported. Thus, for
 some BIOSes which do not report
 the correct CHS values, the LBA value will be used instead. This seems
 to eliminate the need to use a DOS
 partition to establish geometry on my Award BIOS. (version 4.51PG). (And
 I have heard of many problems
 getting correct disk geometry from newer Award BIOSes, so I do not think
 I am alone.In fact, just
 check the number of FAQs regarding incorrect reporting of disk
 geometry.)
 
 It should not break any current software, as the user can override it in
 a kernel configuration.
 (If the user wants to set no options, but still not use BIOS flags,  set
 options equal to 0x8000 or 0x4000, which are both unused reserved bits,
 per ASC X3T10 Working Draft X3T10/0948D). If necessary, these values
 could be #defined as (for example) WDOPT_NOBIOS or somthing similar, to
 make it easier for the user to
 disable the BIOS flags. (This could even be the default, with a comment
 instructing the user on how to
 enable BIOS flags for certain BIOSes, though initial installation should
 probably use BIOS flags, as
 the user can't set options prior to installation.)
 
 The only problem I can forsee is that for older drives/BIOSes these
 flags may not be set properly, or may return
 meaningless values. However, as some newer drives/BIOSes  give
 meaningless CHS values when these flags
 are not used, it seems to me it is a trade-off between supporting the
 quirks of older drives and BIOSes and the quirks of newer drives and
 BIOSes.
 
 Well, let me know if there are any other problems with these changes. I
 am still digging through the kernel code, so
 I am well aware that there is a huge body of code about which I know
 little or nothing. So any input is appreciated.
 
 Thanks.
 
 Andrew Sherrod
 
 
 --------------EA0B0D592E66D6840BD205D9
 Content-Type: text/plain; charset=us-ascii; name="diffc2.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diffc2.txt"
 
 *** wd.c.2_2_8	Tue Jan 12 23:40:13 1999
 --- wd.c.original.2_2_8	Mon Jan 11 20:41:01 1999
 ***************
 *** 112,119 ****
   #define WDOPT_SLEEPHACK	0x4000  
   #define WDOPT_FORCEHD(x)	(((x)&0x0f00)>>8)  
   #define WDOPT_MULTIMASK	0x00ff  
 ! #define WDOPT_LBA 	0x0200  
 ! 
   /*  
    * This biotab field doubles as a field for the physical unit number on  
    * the controller.  
 --- 112,118 ----
   #define WDOPT_SLEEPHACK	0x4000  
   #define WDOPT_FORCEHD(x)	(((x)&0x0f00)>>8)  
   #define WDOPT_MULTIMASK	0x00ff  
 !   
   /*  
    * This biotab field doubles as a field for the physical unit number on  
    * the controller.  
 ***************
 *** 1686,1710 ****
   	}  
     
   	bcopy(tb, wp, sizeof(struct wdparams));  
 ! 
 !        /* If user has not defined du->cfg_flags (eg.
 !           if they are doing a new install) then use actual
 ! 	  BIOS flags. This should allow kernel to pick up
 ! 	  the actual disk geometry without recourse to 
 ! 	  the DOS partition work-around.  -A. Sherrod 01/12/1999*/
 ! 
 !         /* NOTE: This DOES NOT require the drive to use the LBA
 ! 	  addressing. It only means that for certain difficult
 ! 	  BIOSes (e.g. Award), large disks will report the
 ! 	  correct disk size. (As CHS does not give the correct
 ! 	  number of sectors while LBA size does) */
 ! 
 ! 	if(!du->cfg_flags){ 
 !        		du->cfg_flags=wp->wdp_capability;
 ! 		du->cfg_flags=du->cfg_flags<<8;
 ! 		du->cfg_flags+=wp->wdp_cap_validate;
 ! 		}
 !  
   	/* shuffle string byte order */  
   	for (i = 0; i < sizeof(wp->wdp_model); i += 2) {  
   		u_short *p;  
 --- 1685,1691 ----
   	}  
     
   	bcopy(tb, wp, sizeof(struct wdparams));  
 !   
   	/* shuffle string byte order */  
   	for (i = 0; i < sizeof(wp->wdp_model); i += 2) {  
   		u_short *p;  
 ***************
 *** 1746,1754 ****
   	du->dk_dd.d_nsectors = wp->wdp_sectors;  
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
 ! #line 1
 ! 	if (((wp->wdp_cylinders == 16383)||
 !              (du->cfg_flags&WDOPT_LBA)) &&  
               du->dk_dd.d_secperunit < wp->wdp_lbasize) {   
           	du->dk_dd.d_secperunit = wp->wdp_lbasize;  
           	du->dk_dd.d_ncylinders =   
 --- 1727,1733 ----
   	du->dk_dd.d_nsectors = wp->wdp_sectors;  
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;  
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;  
 ! 	if (wp->wdp_cylinders == 16383 &&  
               du->dk_dd.d_secperunit < wp->wdp_lbasize) {   
           	du->dk_dd.d_secperunit = wp->wdp_lbasize;  
           	du->dk_dd.d_ncylinders =   
 
 --------------EA0B0D592E66D6840BD205D9
 Content-Type: text/plain; charset=us-ascii; name="diffc3.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diffc3.txt"
 
 *** wd.c.3_0	Tue Jan 12 23:39:32 1999
 --- wd.c.original.3_0	Tue Jan 12 22:22:52 1999
 ***************
 *** 1861,1885 ****
   	}  
     
   	bcopy(tb, wp, sizeof(struct wdparams));  
 !  
 !  	/*If user has not defined cfg_flags (eg. if they are doing
 ! 	  a new install) then use actual BIOS flags. This should allow
 ! 	  kernel to pick up the actual disk geometry without
 ! 	  recourse to the DOS partition work-around.
 ! 	  -A. Sherrod 01/12/1999 */
 ! 
 ! 	/* NOTE: This DOES NOT require the drive to use the LBA
 ! 	  addressing. It only means that for certain difficult
 ! 	  BIOSes (e.g. Award), large disks will report the
 ! 	  correct disk size. (As CHS does not give the correct
 ! 	  number of sectors while LBA size does.) */
 ! 
 ! 	if(!du->cfg_flags){
 ! 		du->cfg_flags=wp->wdp_capability;
 ! 		du->cfg_flags=du->cfg_flags<<8;
 ! 		du->cfg_flag+=wp->wdp_cap_validate;
 ! 		}
 !  
   	/* shuffle string byte order */  
   	for (i = 0; (unsigned)i < sizeof(wp->wdp_model); i += 2) {  
   		u_short *p;  
 --- 1861,1867 ----
   	}  
     
   	bcopy(tb, wp, sizeof(struct wdparams));  
 !   
   	/* shuffle string byte order */  
   	for (i = 0; (unsigned)i < sizeof(wp->wdp_model); i += 2) {  
   		u_short *p;  
 
 --------------EA0B0D592E66D6840BD205D9--
 

From: Andrew Sherrod <yaldabaoth@geocities.com>
To: freebsd-gnats-submit@FreeBSD.ORG, ixkatl@yahoo.com
Cc:  
Subject: Re: i386/9431: wd.c Does nto recognize certain LBA disks [patch attached]
Date: Wed, 13 Jan 1999 21:33:10 -0500

 This is a multi-part message in MIME format.
 --------------2FF1204F491A06667FA6982B
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Okay. My last set of patches may have been a bit premature. As
 advertised, the 2.2.8 patch did not
 force LBA mode (since 2.2.8 doesn't use LBA), but it had the unfortunate
 side effect of forcing DMA
 on if supported by the drive, regardless of the user's config
 settings.And, of course, the 3.0 patch,
 despite my claims, DID force LBA mode. And, to be honest, they both were
 a bit over-programmed.
 
 So, here are two slimmed down patches. One for 2.2.8 and one for 3.0.
 Neither changes the user's
 flags, nor does the 3.0 force the use of LBA mode. They both simply
 check if LBA is supported according
 to the BIOS flags, and uses the LBA size if it is larger than the CHS
 size. (As stated previously, this fixes
 some of the problems with determining disk geometry. And, in case anyone
 doubts that this problem exists
 or that this patch fixes them, I have included 2 dmesg outputs, the
 first before the 2.2.8 patch and the
 second after.)
 
 If anyone can find a problem (before I do) let me know.
 
 Thanks again.
 
 Andrew Sherrod
 
 --------------2FF1204F491A06667FA6982B
 Content-Type: text/plain; charset=us-ascii; name="diffc2a.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diffc2a.txt"
 
 *** wd.c.2_2_8	Wed Jan 13 21:07:30 1999
 --- wd.c.original.2_2_8	Wed Jan 13 21:08:24 1999
 ***************
 *** 113,122 ****
   #define WDOPT_FORCEHD(x)	(((x)&0x0f00)>>8) 
   #define WDOPT_MULTIMASK	0x00ff 
    
 - /* This bit mask is used to determine if the drive supports LBA addressing. */ 
 -  
 - #define WDCAP_LBA		0x02 
 -  
   /* 
    * This biotab field doubles as a field for the physical unit number on 
    * the controller. 
 --- 113,118 ----
 ***************
 *** 1731,1745 ****
   	du->dk_dd.d_nsectors = wp->wdp_sectors; 
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors; 
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders; 
 !  
 !        /* Check for BIOS LBA flag. This should allow kernel to determine 
 ! 	   actual disk geometry for diffiuclt BIOSes.   
 !  	   This will likely only be of use during initial installation, or 
 !  	   perhaps when configuring a new drive. Otherwise, the disk geometry 
 !  	   should already be known. -A. Sherrod 01/13/1999*/ 
 !  
 ! 	if ( ( (wp->wdp_capability&WDCAP_LBA) || 
 !            (wp->wdp_cylinders == 16383 ) ) && 
               du->dk_dd.d_secperunit < wp->wdp_lbasize) {  
           	du->dk_dd.d_secperunit = wp->wdp_lbasize; 
           	du->dk_dd.d_ncylinders =  
 --- 1727,1733 ----
   	du->dk_dd.d_nsectors = wp->wdp_sectors; 
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors; 
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders; 
 ! 	if (wp->wdp_cylinders == 16383 && 
               du->dk_dd.d_secperunit < wp->wdp_lbasize) {  
           	du->dk_dd.d_secperunit = wp->wdp_lbasize; 
           	du->dk_dd.d_ncylinders =  
 
 --------------2FF1204F491A06667FA6982B
 Content-Type: text/plain; charset=us-ascii; name="diffc3a.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diffc3a.txt"
 
 *** wd.c.3_0	Wed Jan 13 21:05:38 1999
 --- wd.c.original.3_0	Wed Jan 13 21:06:11 1999
 ***************
 *** 201,208 ****
   	struct devstat dk_stats;	/* devstat entry */ 
   }; 
    
 - #define WDCAP_LBA	0x02 
 -  
   #define WD_COUNT_RETRIES 
   static int wdtest = 0; 
    
 --- 201,206 ----
 ***************
 *** 1916,1933 ****
   	       wp->wdp_buffersize, wp->wdp_model); 
   #endif 
    
 -       /* If no cfg_flags are set, check for BIOS LBA flag, but don't force 
 - 	   use of LBA. This should allow kernel to determine actual disk 
 - 	   geometry for diffiuclt BIOSes without forcing user to enter LBA 
 - 	   mode.   
 - 	   This will likely only be of use during initial installation, or 
 - 	   perhaps when configuring a new drive. Otherwise, the disk geometry 
 - 	   should already be known. -A. Sherrod 01/13/1999*/ 
 -  
   	/* update disklabel given drive information */ 
   	du->dk_dd.d_secsize = DEV_BSIZE; 
 ! 	if ( ( (wp->wdp_capability&WDCAP_LBA) || 
 !           (du->cfg_flags & WDOPT_LBA) ) && wp->wdp_lbasize) { 
   		du->dk_dd.d_nsectors = 63; 
   		if (wp->wdp_lbasize < 16*63*1024) {		/* <=528.4 MB */ 
   			du->dk_dd.d_ntracks = 16; 
 --- 1914,1922 ----
   	       wp->wdp_buffersize, wp->wdp_model); 
   #endif 
    
   	/* update disklabel given drive information */ 
   	du->dk_dd.d_secsize = DEV_BSIZE; 
 ! 	if ((du->cfg_flags & WDOPT_LBA) && wp->wdp_lbasize) { 
   		du->dk_dd.d_nsectors = 63; 
   		if (wp->wdp_lbasize < 16*63*1024) {		/* <=528.4 MB */ 
   			du->dk_dd.d_ntracks = 16; 
 ***************
 *** 1950,1961 ****
   		du->dk_dd.d_secpercyl= du->dk_dd.d_ntracks*du->dk_dd.d_nsectors; 
   		du->dk_dd.d_ncylinders = wp->wdp_lbasize/du->dk_dd.d_secpercyl; 
   		du->dk_dd.d_secperunit = wp->wdp_lbasize; 
 ! 		 
 ! 		/* Do not force LBA if only specified in BIOS -A. Sherrod 01/13/1999 */	 
 !  
 ! 		if(du->cfg_flags & WDOPT_LBA) { 
 ! 			du->dk_flags |= DKFL_LBA; 
 ! 		} 
   	} 
   	else { 
   		du->dk_dd.d_ncylinders = wp->wdp_cylinders;	/* +- 1 */ 
 --- 1939,1945 ----
   		du->dk_dd.d_secpercyl= du->dk_dd.d_ntracks*du->dk_dd.d_nsectors; 
   		du->dk_dd.d_ncylinders = wp->wdp_lbasize/du->dk_dd.d_secpercyl; 
   		du->dk_dd.d_secperunit = wp->wdp_lbasize; 
 ! 		du->dk_flags |= DKFL_LBA; 
   	} 
   	else { 
   		du->dk_dd.d_ncylinders = wp->wdp_cylinders;	/* +- 1 */ 
 
 --------------2FF1204F491A06667FA6982B
 Content-Type: text/plain; charset=us-ascii; name="dmesg1.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="dmesg1.txt"
 
 Copyright (c) 1992-1998 FreeBSD Inc.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 	The Regents of the University of California.  All rights reserved.
 
 FreeBSD 2.2.8-RELEASE #6: Wed Jan 13 21:11:20 EST 1999
     root@HAL9000.yaldabaoth.com:/usr/src/sys/compile/HAL
 CPU: AMD-K6(tm) 3D processor (350.80-MHz 586-class CPU)
   Origin = "AuthenticAMD"  Id = 0x580  Stepping=0
   Features=0x8001bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,MMX>
 real memory  = 201326592 (196608K bytes)
 avail memory = 194924544 (190356K bytes)
 Probing for devices on PCI bus 0:
 chip0 <generic PCI bridge (vendor=1106 device=0597 subclass=0)> rev 4 on pci0:0:0
 chip1 <generic PCI bridge (vendor=1106 device=8598 subclass=4)> rev 0 on pci0:1:0
 chip2 <generic PCI bridge (vendor=1106 device=0586 subclass=1)> rev 65 on pci0:7:0
 pci0:7:1: VIA Technologies, device=0x0571, class=storage (ide) [no driver assigned]
 chip3 <generic PCI bridge (vendor=1106 device=3040 subclass=0)> rev 16 on pci0:7:3
 xl0 <3Com 3c905B Fast Etherlink XL 10/100BaseTX> rev 48 int a irq 11 on pci0:10:0
 xl0: Ethernet address: 00:10:5a:20:9b:68
 xl0: autoneg not complete, no carrier (forcing half-duplex, 10Mbps)
 Probing for devices on PCI bus 1:
 Probing for devices on the ISA bus:
 sc0 at 0x60-0x6f irq 1 on motherboard
 sc0: VGA color <16 virtual consoles, flags=0x0>
 sio0: configured irq 4 not in bitmap of probed irqs 0
 sio0 at 0x3f8-0x3ff irq 4 on isa
 sio0: type 8250
 sio1 at 0x2f8-0x2ff irq 3 on isa
 sio1: type 16550A
 lpt0 at 0x378-0x37f irq 7 on isa
 lpt0: Interrupt-driven port
 lp0: TCP/IP capable interface
 psm0 at 0x60-0x64 irq 12 on motherboard
 psm0: model Generic PS/2 mouse, device ID 0
 fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
 fdc0: FIFO enabled, 8 bytes threshold
 fd0: 1.44MB 3.5in
 wdc0 at 0x1f0-0x1f7 irq 14 on isa
 wdc0: unit 0 (wd0): <QUANTUM FIREBALL SE8.4A>
 wd0: 8063MB (16514064 sectors), 16383 cyls, 16 heads, 63 S/T, 512 B/S
 wdc0: unit 1 (wd1): <WDC AC33100H>
 wd1: 2014MB (4124736 sectors), 4092 cyls, 16 heads, 63 S/T, 512 B/S
 wdc1 at 0x170-0x177 irq 15 on isa
 wdc1: unit 0 (wd2): <Maxtor 84320D4>
 wd2: 1888MB (3866940 sectors), 4092 cyls, 15 heads, 63 S/T, 512 B/S
 wdc1: unit 1 (atapi): <FX322M/w03>, removable, intr, dma, iordis
 wcd0: 5512KB/sec, 256KB cache, audio play, 255 volume levels, ejectable tray
 wcd0: no disc inside, unlocked
 mcd0 not found at 0x300
 npx0 flags 0x1 on motherboard
 npx0: INT 16 interface
 
 --------------2FF1204F491A06667FA6982B
 Content-Type: text/plain; charset=us-ascii; name="dmesg2.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="dmesg2.txt"
 
 Copyright (c) 1992-1998 FreeBSD Inc.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 	The Regents of the University of California.  All rights reserved.
 
 FreeBSD 2.2.8-RELEASE #7: Wed Jan 13 21:26:09 EST 1999
     root@HAL9000.yaldabaoth.com:/usr/src/sys/compile/HAL
 CPU: AMD-K6(tm) 3D processor (350.80-MHz 586-class CPU)
   Origin = "AuthenticAMD"  Id = 0x580  Stepping=0
   Features=0x8001bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,MMX>
 real memory  = 201326592 (196608K bytes)
 avail memory = 194924544 (190356K bytes)
 Probing for devices on PCI bus 0:
 chip0 <generic PCI bridge (vendor=1106 device=0597 subclass=0)> rev 4 on pci0:0:0
 chip1 <generic PCI bridge (vendor=1106 device=8598 subclass=4)> rev 0 on pci0:1:0
 chip2 <generic PCI bridge (vendor=1106 device=0586 subclass=1)> rev 65 on pci0:7:0
 pci0:7:1: VIA Technologies, device=0x0571, class=storage (ide) [no driver assigned]
 chip3 <generic PCI bridge (vendor=1106 device=3040 subclass=0)> rev 16 on pci0:7:3
 xl0 <3Com 3c905B Fast Etherlink XL 10/100BaseTX> rev 48 int a irq 11 on pci0:10:0
 xl0: Ethernet address: 00:10:5a:20:9b:68
 xl0: autoneg not complete, no carrier (forcing half-duplex, 10Mbps)
 Probing for devices on PCI bus 1:
 Probing for devices on the ISA bus:
 sc0 at 0x60-0x6f irq 1 on motherboard
 sc0: VGA color <16 virtual consoles, flags=0x0>
 sio0: configured irq 4 not in bitmap of probed irqs 0
 sio0 at 0x3f8-0x3ff irq 4 on isa
 sio0: type 8250
 sio1 at 0x2f8-0x2ff irq 3 on isa
 sio1: type 16550A
 lpt0 at 0x378-0x37f irq 7 on isa
 lpt0: Interrupt-driven port
 lp0: TCP/IP capable interface
 psm0 at 0x60-0x64 irq 12 on motherboard
 psm0: model Generic PS/2 mouse, device ID 0
 fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
 fdc0: FIFO enabled, 8 bytes threshold
 fd0: 1.44MB 3.5in
 wdc0 at 0x1f0-0x1f7 irq 14 on isa
 wdc0: unit 0 (wd0): <QUANTUM FIREBALL SE8.4A>
 wd0: 8063MB (16514064 sectors), 16383 cyls, 16 heads, 63 S/T, 512 B/S
 wdc0: unit 1 (wd1): <WDC AC33100H>
 wd1: 3020MB (6185088 sectors), 6136 cyls, 16 heads, 63 S/T, 512 B/S
 wdc1 at 0x170-0x177 irq 15 on isa
 wdc1: unit 0 (wd2): <Maxtor 84320D4>
 wd2: 4120MB (8439184 sectors), 8930 cyls, 15 heads, 63 S/T, 512 B/S
 wdc1: unit 1 (atapi): <FX322M/w03>, removable, intr, dma, iordis
 wcd0: 5512KB/sec, 256KB cache, audio play, 255 volume levels, ejectable tray
 wcd0: no disc inside, unlocked
 mcd0 not found at 0x300
 npx0 flags 0x1 on motherboard
 npx0: INT 16 interface
 
 --------------2FF1204F491A06667FA6982B--
 

From: Andrew Sherrod <btiags@ui.uis.doleta.gov>
To: freebsd-gnats-submit@freebsd.org, ixkatl@yahoo.com
Cc:  
Subject: Re: i386/9431: wd.c Does nto recognize certain LBA disks [patch attached]
Date: Thu, 14 Jan 1999 09:35:50 -0500

 This is a multi-part message in MIME format.
 --------------EA0D5F70CF578339B1589242
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Sorry. Wrong copy of the version 3.0 diff.
 This should have been attached above.
 (Actually, reposting both. THESE are the final versions.)
 
 Apologies for any confusion.
 
 Andrew Sherrod
 
 --------------EA0D5F70CF578339B1589242
 Content-Type: text/plain; charset=us-ascii; name="diffc2a.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diffc2a.txt"
 
 *** wd.c.2_2_8	Wed Jan 13 11:45:04 1999
 --- wd.c.original.2_2_8	Wed Jan 13 11:45:04 1999
 ***************
 *** 113,122 ****
   #define WDOPT_FORCEHD(x)	(((x)&0x0f00)>>8)
   #define WDOPT_MULTIMASK	0x00ff
   
 - /* This bit mask is used to determine if the drive supports LBA addressing. */
 - 
 - #define WDCAP_LBA		0x02
 - 
   /*
    * This biotab field doubles as a field for the physical unit number on
    * the controller.
 --- 113,118 ----
 ***************
 *** 1731,1745 ****
   	du->dk_dd.d_nsectors = wp->wdp_sectors;
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;
 ! 
 !        /* Check for BIOS LBA flag. This should allow kernel to determine
 ! 	   actual disk geometry for diffiuclt BIOSes.  
 !  	   This will likely only be of use during initial installation, or
 !  	   perhaps when configuring a new drive. Otherwise, the disk geometry
 !  	   should already be known. -A. Sherrod 01/13/1999*/
 ! 
 ! 	if ( ( (wp->wdp_capability&WDCAP_LBA) ||
 !            (wp->wdp_cylinders == 16383 ) ) &&
               du->dk_dd.d_secperunit < wp->wdp_lbasize) { 
           	du->dk_dd.d_secperunit = wp->wdp_lbasize;
           	du->dk_dd.d_ncylinders = 
 --- 1727,1733 ----
   	du->dk_dd.d_nsectors = wp->wdp_sectors;
   	du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;
   	du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;
 ! 	if (wp->wdp_cylinders == 16383 &&
               du->dk_dd.d_secperunit < wp->wdp_lbasize) { 
           	du->dk_dd.d_secperunit = wp->wdp_lbasize;
           	du->dk_dd.d_ncylinders = 
 
 --------------EA0D5F70CF578339B1589242
 Content-Type: text/plain; charset=us-ascii; name="diffc3a.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="diffc3a.txt"
 
 *** wd.c.3_0	Wed Jan 13 12:07:46 1999
 --- wd.c.original.3_0	Wed Jan 13 11:17:54 1999
 ***************
 *** 130,140 ****
    */
   #define	id_physid id_scsiid
   
 - /* This bitmask is used to determine if the BIOS flags showing LBA support
 -    are active or inactive */
 -    
 - #define WDCAP_LBA	0x02
 - 
   /*
    * Drive states.  Used to initialize drive.
    */
 --- 130,135 ----
 ***************
 *** 1954,1973 ****
   			du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;
   		du->dk_dd.d_secperunit = 
   			du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;
 ! 			
 ! 		/* If BIOS specifies LBA mode is supported, but LBA flags
 ! 		   are not set, check if wdp_lbasize is larger than
 ! 		   CHS size. If so, use the lba_size. 
 ! 		   This should fix problems with certain BIOSes (e.g. Award)
 ! 		   which do not report the correct size when using only
 ! 		   CHS calculations.
 ! 		   This will not force the use of LBA mode. It is only
 ! 		   used to determine disk geometry.
 ! 		   
 ! 		   			-A. Sherrod 01/13/1999 */			
 ! 			
 ! 		if ( ( (wp->wdp_capabilities & WDCAP_LBA) ||
 ! 		     (wp->wdp_cylinders == 16383) ) &&
   		    du->dk_dd.d_secperunit < wp->wdp_lbasize) {
   			du->dk_dd.d_secperunit = wp->wdp_lbasize;
   			du->dk_dd.d_ncylinders = 
 --- 1949,1955 ----
   			du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;
   		du->dk_dd.d_secperunit = 
   			du->dk_dd.d_secpercyl * du->dk_dd.d_ncylinders;
 ! 		if (wp->wdp_cylinders == 16383 &&
   		    du->dk_dd.d_secperunit < wp->wdp_lbasize) {
   			du->dk_dd.d_secperunit = wp->wdp_lbasize;
   			du->dk_dd.d_ncylinders = 
 
 --------------EA0D5F70CF578339B1589242--
 
Responsible-Changed-From-To: freebsd-bugs->dcs 
Responsible-Changed-By: dcs 
Responsible-Changed-When: Mon Nov 8 01:19:49 PST 1999 
Responsible-Changed-Why:  
See i386/10862. 
State-Changed-From-To: open->closed 
State-Changed-By: dcs 
State-Changed-When: Mon Nov 8 01:20:46 PST 1999 
State-Changed-Why:  
Obsoleted by i386/10862. 
>Unformatted:
