From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 14 12:47:55 2008 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 63D281065670; Thu, 14 Aug 2008 12:47:55 +0000 (UTC) (envelope-from jdc@parodius.com) Received: from mx01.sc1.parodius.com (mx01.sc1.parodius.com [72.20.106.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4AE2F8FC08; Thu, 14 Aug 2008 12:47:54 +0000 (UTC) (envelope-from jdc@parodius.com) Received: by mx01.sc1.parodius.com (Postfix, from userid 1000) id D863D1CC0BB; Thu, 14 Aug 2008 05:47:54 -0700 (PDT) Date: Thu, 14 Aug 2008 05:47:54 -0700 From: Jeremy Chadwick To: "Andrey V. Elsukov" Message-ID: <20080814124754.GA20195@eos.sc1.parodius.com> References: <48A3D034.9090809@gmail.com> <48A3D43E.2070101@yandex.ru> <48A3D771.5010601@gmail.com> <48A3DA54.9070803@FreeBSD.org> <48A3DC83.1080806@gmail.com> <48A3E0E4.3090909@yandex.ru> <48A3E25E.6050105@gmail.com> <48A3FBEE.5060302@yandex.ru> <48A40F85.3050509@gmail.com> <48A41D70.3000507@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48A41D70.3000507@yandex.ru> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-hackers@freebsd.org, Kris Kennaway , sam Subject: Re: kern/98388: [ata] FreeBSD 6.1 - WDC WD1200JS SATA II disks are seen as older SATA 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: Thu, 14 Aug 2008 12:47:55 -0000 On Thu, Aug 14, 2008 at 03:56:32PM +0400, Andrey V. Elsukov wrote: > sam wrote: >>> Can you apply attached patch, rebuild your kernel, reboot in verbose >>> mode and show /var/run/dmesg.boot ? >>> >> http://cs.udmvt.ru/files/temp/dmesg.boot_0814 > > It seems that driver couldn't allocate IO resource at BAR5 and > without this resource it can't read SATA Status register and > determine negotiated speed. I think the problem is in your BIOS. > If your BIOS doesn't have any AHCI or RAID specific options > I don't know how correctly fix this problem. Andrey, please correct me if I'm wrong here. I'm not familiar these kernel functions, but assuming pci_read_config() handles proper byte order, and device_printf() prints it in correct order, then I believe you may be missing something important. I haven't looked for any product Errata, but see Section 12.1 below (specific to ICH7): http://www.intel.com/assets/pdf/datasheet/307013.pdf Index 0x94 = SIR (SATA Index Register) Index 0xAC = SCAP1 (SATA Capability Register 1) I'm not sure why you called SIR "SCRD" in your device_printf(). For SIR's description, see Section 12.1.35. For SCAP1, see Section 12.1.39. The SIR value is 0x40000180, broken down into binary nibbles: %0100 0000 0000 0000 0000 0001 1000 0000 ^ ^ This indicates bit 30 is set. According to Intel's docs, bit 30 disables SCAP0 and SCAP1, thus will cause them to always return 0: Bit 30 SATA Capability Registers Disable (SCRD) When this bit is set, the SATA Capability Registers are disabled. That is, SATA Capability Registers 0 and 1 are both changed to Read Only with the value of 00000000h. Also, the Next Capability bits in the PCI Power Management Capability Information Register (D31:F2;Offset 70h bits 15:8) are changed to 00h, to indicate that the PCI Power Management Capability structure is the last PCI capability structure in the SATA controller. When this bit is cleared, the SATA Capability Registers are enabled. A quick glance seems to indicate we're not initialising some of the SATA registers at all, case in point. Someone should make a patch for the user that zeros out bit 30 of SIR, then check the xBAR and LBAR values; zeroing bit 30 might get him SATA300 support (I haven't looked at the rest of the FreeBSD ATA code yet). -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |