From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 5 18:16:31 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 745C81065672 for ; Wed, 5 Jan 2011 18:16:31 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 021F38FC08 for ; Wed, 5 Jan 2011 18:16:30 +0000 (UTC) Received: by fxm16 with SMTP id 16so15166436fxm.13 for ; Wed, 05 Jan 2011 10:16:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Rkr0ygLofps2BFFHC/ZKSVaJ8rRgM7BcmeG+o+WGm0E=; b=xnWcpxEKxny68PDZyKe72NYYkU17kJCGwvbM0eDz4oLdDiFhZFtz8eikaciolFc75p 4unMDwGtps/McDynxRT8SxgllSI8ACqACcpMY3k0/EKkeVT2V62OdPy+qiVzAC/weOHe CFjQ/rsSCous2P8rW8bLco8aOOhc2gYRTvshg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=X4RJX3oTfKZjib6eT3MB0DN5uCKPnJND9es4H0HLbSyIniV4GctGSTpKrRMknBnp0R vMi2Ly4dao392YcrOH358pTKexegrQIgVREDwtN0tpb9d+jE/9DK61CxAo2JurEw8c3M mLSj8ZWMsTuRFH8b97blGr0F6D9dRk6pHIiZw= Received: by 10.223.113.73 with SMTP id z9mr1620320fap.41.1294251389887; Wed, 05 Jan 2011 10:16:29 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id n3sm5578362fax.31.2011.01.05.10.16.28 (version=SSLv3 cipher=RC4-MD5); Wed, 05 Jan 2011 10:16:29 -0800 (PST) Sender: Alexander Motin Message-ID: <4D24B576.1090509@FreeBSD.org> Date: Wed, 05 Jan 2011 20:16:22 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101104 Thunderbird/3.1.6 MIME-Version: 1.0 To: Darmawan Salihun References: <736116.58130.qm@web76816.mail.sg1.yahoo.com> In-Reply-To: <736116.58130.qm@web76816.mail.sg1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: PCI IDE Controller Base Address Register setting X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2011 18:16:31 -0000 On 05.01.2011 19:25, Darmawan Salihun wrote: > --- On Wed, 1/5/11, Alexander Motin wrote: > >> From: Alexander Motin >> Subject: Re: PCI IDE Controller Base Address Register setting >> To: "Darmawan Salihun" >> Cc: "John Baldwin", freebsd-hackers@freebsd.org >> Date: Wednesday, January 5, 2011, 9:56 AM >> Darmawan Salihun wrote: >>> I get the following log message upon booting with >> "boot -Dv": >>> ============================== >>> ata0: on atapci0 >>> ata0: reset tp1 mask=03 ostat0=50 ostat1=50 >>> ata0: stat0=0x80 err=0x00 lsb=0x00 msb=0x00 >>> ata0: stat0=0x50 err=0x01 lsb=0x00 msb=0x00 >>> ata0: stat1=0x50 err=0x01 lsb=0x00 msb=0x00 >>> ata0: reset tp2 stat0=50 stat1=50 devices=0x3 >>> ... >>> ata0: Identifying devices: 00000003 >>> ata0: New devices: 00000003 >>> ... >>> ata0-slave: pio=PIO4 wdma=WDMA2 udma=UDMA100 cable=80 >> wire >>> ata0-master: pio=PIO1 wdma=UNSUPPORTED >> udma=UNSUPPORTED cable=40 wire >>> ... >>> ad0: FAILURE setting PIO1 on CS5536 chip >>> ad0: 488MB at >> ata0-master BIOSPIO >>> ... >>> GEOM: newdisk ad0 >>> ad0: Adaptec check1 failed >>> ad0: LSI(v3) check1 failed >>> ad0: FAILURE - READ status=51 >> error=c4 LBA=0 >>> ... >>> ad1: setting PIO4 on CS5536 chip >>> ad1: setting UDMA100 on CS5536 chip >>> ad1: 38150MB at >> ata0-slave UDMA100 >>> ... >>> GEOM: newdisk ad1 >>> ... >>> ad1: FAILURE - READ_DMA >> status=51 >> error=84 LBA=78132575 >>> ad1: FAILURE - READ_DMA >> status=51 >> error=84 LBA=78132591 >>> ... >>> ====================== >>> I have several questions: >>> 1. How FreeBSD sets the PIO mode on the target IDE >> controller? >>> what could've caused it to fail like the message >> above? >> >> Looking to your messages I would suggest you are running >> something like >> FreeBSD 8.0. At that time controller-specific method first >> set mode on >> device and then programmed the chip. Most likely this error >> returned by >> device. Some very old devices not supporting more then PIO3 >> may not >> support mode setting command. >> >> Mode setting code was significantly rewritten between 8.0 >> and 8.1. I >> would recommend you to take newer version of FreeBSD for >> experiments. > > The device is a CF-card. Do I need to add some sort of CFA-specific > initialization code to the BIOS? Some CF devices AFAIR may wish power-up command before they will be able to access media, but I have never seen such ones, suppose it was applicable only to some old microdrives. AFAIR in all other points CF specification only extends ATA without additional requirements. > I'm using FreeBSD 8.0 as the test bed for the log message above. > I have FreeBSD 8.1 DVD to do further tests. Will report later. OK. >>> 2. It seems to me that setting the UDMA100 in the >>> AMD CS5536 IDE controller went just fine (in the log >> above). >>> But, FreeBSD fails when it tries to read something >> from the drive. >>> Does it mean the UDMA100 "mode" failed to be set >> correctly >>> in the IDE controller? >> >> It can be. For UDMA transfer rate is driven by transmitting >> side (for >> reading - by device), but there is always a chance to do >> something >> wrong. :) I don't have CS5536 board, so can't be completely >> sure how >> correct is the code. > > Does it require chipset-specific support code on the OS > (say a device driver) or setting via PCI Bus Master registers > is enough? There is no standard for setting I/O mode on ATA controllers. Most of vendors have own ways for setting it. Most of controllers have some additional registers, accessible via PCI configuration space. So for most of controllers FreeBSD has specific sub-drivers inside ata(4). If no matching sub-driver found - controller handled as "Generic" and mode setting is assumed to be done by BIOS, but it is a last resort. >>> 3. As I'm currently trying to fix the bug in the BIOS >> for the particular >>> board used to boot FreeBSD, what would you suggest to >> fix it? >> >> Try latest FreeBSD -- 8.2 is now in RC state. >> Try to disconnect devices one by one. >> Try to limit initial mode via loader tunables (note that >> some of them >> were added not so long ago and may be missing on 8.0). > > A question about the loader tunable: is it enough to pass it through > the "boot" command, similar to the "-Dv" in "boot -Dv"? You can use `set ...` command at the same loader command line before typing `boot ...`. To make it permanent - you can add wanted options to /boot/loader.conf file. -- Alexander Motin