From owner-freebsd-bugs Sun Jun 2 21:20:13 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id VAA02171 for bugs-outgoing; Sun, 2 Jun 1996 21:20:13 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id VAA02165; Sun, 2 Jun 1996 21:20:07 -0700 (PDT) Resent-Date: Sun, 2 Jun 1996 21:20:07 -0700 (PDT) Resent-Message-Id: <199606030420.VAA02165@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, dan@obluda.kolej.mff.cuni.cz Received: from mail.barrnet.net (mail.barrnet.net [131.119.246.7]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id VAA01927 for ; Sun, 2 Jun 1996 21:15:49 -0700 (PDT) Received: from dan.kolej.mff.cuni.cz (dan.kolej.mff.cuni.cz [193.84.91.70]) by mail.barrnet.net (8.7.5/MAIL-RELAY-LEN) with ESMTP id VAA01438 for ; Sun, 2 Jun 1996 21:15:33 -0700 (PDT) Received: (from root@localhost) by dan.kolej.mff.cuni.cz (8.7.5/8.7.3) id FAA02280; Mon, 3 Jun 1996 05:54:04 +0200 (MET DST) Message-Id: <199606030354.FAA02280@dan.kolej.mff.cuni.cz> Date: Mon, 3 Jun 1996 05:54:04 +0200 (MET DST) From: dan@obluda.kolej.mff.cuni.cz Reply-To: dan@obluda.kolej.mff.cuni.cz To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: i386/1288: Bad number of cyls detected by wd.c Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >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: