From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 28 17:00:39 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B498D16A4BF for ; Thu, 28 Aug 2003 17:00:39 -0700 (PDT) Received: from smtp-out3.iol.cz (smtp-out3.iol.cz [194.228.2.91]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B39C43FAF for ; Thu, 28 Aug 2003 17:00:38 -0700 (PDT) (envelope-from dan@obluda.cz) Received: from obluda.cz (gprs5-166.eurotel.cz [160.218.176.166]) by smtp-out3.iol.cz (Internet on Line ESMP server) with ESMTP id 560BD341E8; Fri, 29 Aug 2003 02:00:32 +0200 (CEST) Message-ID: <3F4E9798.7020006@obluda.cz> Date: Fri, 29 Aug 2003 02:00:24 +0200 From: Dan Lukes User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: cs, sk, en MIME-Version: 1.0 To: Mikulas Patocka References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: Bug FreeBSD 4.8 ATA driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Aug 2003 00:00:39 -0000 Mikulas Patocka wrote: >>>I am reading FreeBSD ATA drivers because I want to use them as base for my >>>ATA driver and I found a total nonsence: in ata-dma.c in FreeBSD 4.8, >>>there is line >>> >>>if (!((pci_read_config(parent,0x40,4)>>(ch->unit<<8))&0x4000)) { >> Hm, it should be (IMHO) >>if (!((pci_read_config(parent,0x40,4)>>(ch->unit<<5))&0x4000)) > > > That is incorrect too --- if ch->unit is 1, ch->unit<<5 is 32 and you > can't shift 32-bit integer by 32 bits. My mistake. Configuration double-word at offset 64 (decimal) contain two word - one per unit. So, correct access to each word is if (!((pci_read_config(parent,0x40,4)>>(ch->unit<<4))&0x4000)) My theory about source of error ('8' key just above '5') is void, of course. >> A smel bych, uz asi mimo konferenci, vedet, proc si pises vlastni ATA >>ovladac ? > No, zatim to neni moc verejny projekt. OK. Ja jen, ze se pred nekolika malo lety na MFF obhajoval projekt OS kde take meli vlastni ATA ovladace (a psal jsem je do znacne miry ja) - tak me jen tak napadlo, ze uz se zase pise nejaky podobny projekt nebo diplomka. Sincerely Dan