From owner-freebsd-current Thu Sep 21 11:35:08 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id LAA23928 for current-outgoing; Thu, 21 Sep 1995 11:35:08 -0700 Received: from crox.net.kiae.su (crox.net.kiae.su [144.206.130.72]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id LAA23911 for ; Thu, 21 Sep 1995 11:35:03 -0700 Received: by crox.net.kiae.su id WAA00880; (8.6.9/vak/1.8a) Thu, 21 Sep 1995 22:31:23 +0400 Date: Thu, 21 Sep 1995 22:31:16 +0400 (MSD) From: "Serge V.Vakulenko" To: current@freebsd.org Subject: [patch] more stable version of wdreset() Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@freebsd.org Precedence: bulk This patch is intended to solve the problem of broken IDE disks probing in the FreeBSD-current. For IDE disks it works the same the 2.0.5 did. For detecting ATAPI drives it tests for the ATAPI signature in cyl_hi/cyl_lo registers. Serge --- wd-c.c Thu Sep 21 21:55:31 1995 +++ wd.c Thu Sep 21 21:56:28 1995 @@ -1907,13 +1907,18 @@ outb(wdc + wd_ctlr, WDCTL_IDS | WDCTL_RST); DELAY(10 * 1000); outb(wdc + wd_ctlr, WDCTL_IDS); - if (wdwait(du, 0, TIMEOUT) != 0) - return (1); - du->dk_status = inb(wdc + wd_status); - du->dk_error = inb(wdc + wd_error); - if ((du->dk_status & ~(WDCS_READY | WDCS_SEEKCMPLT)) != 0 || - du->dk_error != 0x01) - return (1); + if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) == 0) { + /* IDE drive found */ + du->dk_error = inb(wdc + wd_error); + if (du->dk_error != 0x01) + return (1); + } else { + /* no IDE drive, test for ATAPI signature */ + int lo = inb(wdc + wd_cyl_lo); + int hi = inb(wdc + wd_cyl_hi); + if (lo != 0x14 || hi != 0xeb) + return (1); + } outb(wdc + wd_ctlr, WDCTL_4BIT); return (0); } --- Serge Vakulenko Cronyx Ltd., Moscow Unix consulting and custom programming phone: +7 (095) 939-23-23 FreeBSD support fax: +7 (095) 939-03-00 Relcom network development