Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jan 1999 21:00:01 -0800 (PST)
From:      Andrew Sherrod <yaldabaoth@geocities.com>
To:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: i386/9431: wd.c Does nto recognize certain LBA disks [patch attached]
Message-ID:  <199901130500.VAA10098@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/9431; it has been noted by GNATS.

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--
 

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



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