Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 1996 05:54:04 +0200 (MET DST)
From:      dan@obluda.kolej.mff.cuni.cz
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   i386/1288: Bad number of cyls detected by wd.c 
Message-ID:  <199606030354.FAA02280@dan.kolej.mff.cuni.cz>
Resent-Message-ID: <199606030420.VAA02165@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1288
>Category:       i386
>Synopsis:       wdgetctlr (wd.c) return incorrect number of cylinders
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun  2 21:20:01 PDT 1996
>Last-Modified:
>Originator:     Dan Lukes
>Organization:
Obludarium 
>Release:        FreeBSD 2.2-960501-SNAP i386
>Environment:
	i586+Triton chipset, HDD SyQuest

>Description:
	wdgetctlr function (part of wd.c) return incorrect number of cylinders

after obtaining drive parameters (via IDENTIFY DRIVE command), this
function return dn->dk_dd.dncylinders as wp->wpd_fixedcyl+wp->wpd_removcyl.

There are no reason to add these two values. Field wpd_remov is
declared as reserved by all ATA-x specifications (only very old drafts
of ATA-1 describe it as number of removable cylinders). 
ATA compliant drives (either removable or non-removable) should report
number of cylinders in wpd_fixedcyl field. Some removable drives report
number of cylinders in wpd_removcyl also (for compatibility with
old, pre-ATA drives) and wdgetctlr return number of cyls doubled.  

>How-To-Repeat:
	Attach any ATA compliant IDE disk with non-zero value on offset +2
	(word) of IDENTIFY DRIVE structure, boot FreeBSD and look for
	detected drive geometry.

>Fix:
Change wdgetctrl/wd.c line dn->dk_dd.dncylinders=wp->wpd_fixedcyl+wp->wpd_removcyl
to dn->dk_dd.dncylinders=wp_wpd_fixedcyl;      (strict ATA compliant)
or (more sophisticated and tolerant):
#define WD0_ISREMOVABLE 0x0080  /* removable drive flag on word 0 of IDENTIFY DRIVE table */
dn->dk_dd.dncylinders=((WD0_ISREMOVABLE & wp->wpd_config) && !(wp->wpd_fixed)) ? wp->wpd_removcyl : wp->wpd_fixedcyl;
e.g. only if drive is flagged as removable and apropriate ATA field is not filled use removable field else use field defined by ATA

>Audit-Trail:
>Unformatted:



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