From owner-freebsd-current@FreeBSD.ORG Mon Apr 14 03:06:56 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D199137B401; Mon, 14 Apr 2003 03:06:56 -0700 (PDT) Received: from baraca.united.net.ua (vlan1.baraca.united.net.ua [195.234.212.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC3FA43F85; Mon, 14 Apr 2003 03:06:54 -0700 (PDT) (envelope-from max@vega.com) Received: from vega.vega.com (root@xDSL-2-2.united.net.ua [193.111.9.226]) h3EA6oTF067463; Mon, 14 Apr 2003 13:06:51 +0300 (EEST) (envelope-from max@vega.com) Received: from vega.vega.com (max@localhost.vega.com [127.0.0.1]) by vega.vega.com (8.12.6/8.12.5) with ESMTP id h3EA72PG022359; Mon, 14 Apr 2003 13:07:02 +0300 (EEST) (envelope-from sobomax@FreeBSD.org) Received: (from max@localhost) by vega.vega.com (8.12.6/8.12.5/Submit) id h3EA72C6022358; Mon, 14 Apr 2003 13:07:02 +0300 (EEST) Date: Mon, 14 Apr 2003 13:07:02 +0300 From: Maxim Sobolev To: sos@FreeBSD.org Message-ID: <20030414100702.GC22229@vega.vega.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="NzB8fVQJ5HfG6fxh" Content-Disposition: inline User-Agent: Mutt/1.4i X-Operating-System: FreeBSD 4.7-STABLE i386 cc: current@FreeBSD.org Subject: Workaround for some broken BIOSes that forgot to enable ATA channels [patch] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2003 10:06:57 -0000 --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Hi, Attached please find a patch, which workaround a bug found in some BIOSes, which forget to enable ATA channels properly. This results in ATA driver not attaching properly and inability to use disk devices. Thanks! -Maxim --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=koi8-r Content-Disposition: attachment; filename="ata.diff" Index: conf/NOTES =================================================================== RCS file: /home/ncvs/src/sys/conf/NOTES,v retrieving revision 1.1140 diff -d -u -r1.1140 NOTES --- conf/NOTES 22 Mar 2003 14:18:21 -0000 1.1140 +++ conf/NOTES 14 Apr 2003 09:59:48 -0000 @@ -1370,8 +1370,11 @@ # # ATA_STATIC_ID: controller numbering is static ie depends on location # else the device numbers are dynamically allocated. +# ATA_ENABLE_CHANNELS: forcefully enable channels if they appear disabled +# by BIOS. Some buggy BIOSes "forget" to enable them. options ATA_STATIC_ID +#options ATA_ENABLE_CHANNELS # # Standard floppy disk controllers and floppy tapes, supports Index: conf/options =================================================================== RCS file: /home/ncvs/src/sys/conf/options,v retrieving revision 1.383 diff -d -u -r1.383 options --- conf/options 25 Mar 2003 05:45:04 -0000 1.383 +++ conf/options 14 Apr 2003 09:59:49 -0000 @@ -299,6 +300,7 @@ # Options used in the 'ata' ATA/ATAPI driver ATA_STATIC_ID opt_ata.h +ATA_ENABLE_CHANNELS opt_ata.h ATA_NOPCI opt_ata.h DEV_ATADISK opt_ata.h DEV_ATAPICD opt_ata.h Index: dev/ata/ata-pci.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-pci.c,v retrieving revision 1.57 diff -d -u -r1.57 ata-pci.c --- dev/ata/ata-pci.c 25 Feb 2003 14:46:30 -0000 1.57 +++ dev/ata/ata-pci.c 14 Apr 2003 09:59:49 -0000 @@ -129,6 +129,13 @@ subclass = pci_get_subclass(dev); cmd = pci_read_config(dev, PCIR_COMMAND, 2); +#ifdef ATA_ENABLE_CHANNELS + if (!(cmd & PCIM_CMD_PORTEN)) { + pci_write_config(dev, PCIR_COMMAND, cmd | PCIM_CMD_PORTEN, 2); + cmd = pci_read_config(dev, PCIR_COMMAND, 2); + } +#endif + if (!(cmd & PCIM_CMD_PORTEN)) { device_printf(dev, "ATA channel disabled by BIOS\n"); return 0; --NzB8fVQJ5HfG6fxh--