From owner-freebsd-current@FreeBSD.ORG Wed Jan 12 15:54:15 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49C501065673; Wed, 12 Jan 2011 15:54:15 +0000 (UTC) (envelope-from imb@protected-networks.net) Received: from sarah.protected-networks.net (sarah.protected-networks.net [IPv6:2001:470:1f07:4e1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 0853F8FC14; Wed, 12 Jan 2011 15:54:15 +0000 (UTC) Received: from toshi.auburn.protected-networks.net (toshi.auburn.protected-networks.net [202.12.127.84]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "Iain Butler", Issuer "RSA Class 2 Personal CA" (verified OK)) (Authenticated sender: imb@protected-networks.net) by sarah.protected-networks.net (Postfix) with ESMTPSA id DDBEE60E2; Wed, 12 Jan 2011 10:54:13 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=protected-networks.net; s=200705; t=1294847654; bh=q04aMUazWHqQUfFog4ikDFGiKKW4B0a6DUJR+BT35Vc=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=FBeLjlLN6hQMjtS7tukOswUSHaHNMxBJL8g+bAMthCdFV5ZFxz8MyCQhNsItvIJDp +VRCEvDZqHYbx5r07WPtBaeHcubvhTuZ+g9TITkQ+SIeR4oYHiLquYaztV6gvg6 DomainKey-Signature: a=rsa-sha1; s=200509; d=protected-networks.net; c=nofws; q=dns; h=message-id:date:from:user-agent:mime-version:to:cc:subject: references:in-reply-to:x-enigmail-version:openpgp:content-type; b=Fkhe4HKc1+4/Tcl1Lu++bDMQG1fRSHdVStZ7oTd38DP3+0Te5y5urk3VkB52ARGPy WJ1eoRoBHP7wZMNS0JMdUGtNdzNIh9DV0mjQu5ZqzXNVLOLU/IpcT3KlejtxE+k Message-ID: <4D2DCEA4.3080206@protected-networks.net> Date: Wed, 12 Jan 2011 10:54:12 -0500 From: Michael Butler User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.13) Gecko/20101217 Thunderbird/3.1.7 MIME-Version: 1.0 To: Alexander Motin References: <4D2DCB3D.1030603@protected-networks.net> <4D2DCC66.50807@FreeBSD.org> In-Reply-To: <4D2DCC66.50807@FreeBSD.org> X-Enigmail-Version: 1.1.2 OpenPGP: id=0442D492 Content-Type: multipart/mixed; boundary="------------080701000709070807050808" Cc: freebsd-current@freebsd.org, Anton Yuzhaninov Subject: Re: AHCI on ICH7 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 12 Jan 2011 15:54:15 -0000 This is a multi-part message in MIME format. --------------080701000709070807050808 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 01/12/11 10:44, Alexander Motin wrote: [ .. snip .. ] > PCIR_BAR(5) is not set in this case, only 0-4. It won't help. Ugh! My bad .. the only other option is to adjust the entry in ahci.c for that chip-id, find a suitably "free" memory window and do something like the attached patch (set 'AHCI_MEM_HACK' to the base of whatever window you can allocate). I use this on a Toshiba A-105 laptop but, in the process, I lose the ability to talk to the PATA DVD-drive (the reason why the manufacturer set compatibility mode in the BIOS). On the other hand it gets me the (huge!) benefits of NCQ ;-) imb --------------080701000709070807050808 Content-Type: text/plain; name="ahci-ic7m-patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ahci-ic7m-patch" *** src/sys/dev/ahci/ahci.c Sat May 22 12:07:12 2010 --- src/sys/dev/ahci/ahci.c-patched Sat May 22 08:10:36 2010 *************** *** 129,134 **** --- 129,135 ---- {0x26838086, 0x00, "Intel ESB2", 0}, {0x27c18086, 0x00, "Intel ICH7", 0}, {0x27c38086, 0x00, "Intel ICH7", 0}, + {0x27c48086, 0x00, "Intel ICH7M", 0}, {0x27c58086, 0x00, "Intel ICH7M", 0}, {0x27c68086, 0x00, "Intel ICH7M", 0}, {0x28218086, 0x00, "Intel ICH8", 0}, *************** *** 324,334 **** --- 325,353 ---- ctlr->quirks = ahci_ids[i].quirks; resource_int_value(device_get_name(dev), device_get_unit(dev), "ccc", &ctlr->ccc); + + #define AHCI_MEM_HACK 0xF0D44400 /* 0xf0d443ff is the last used by others on Toshiba A105 */ + + /* Need to set the SCRAE bit and ensure SCRD not set */ + pci_write_config(dev, 0x94, (pci_read_config(dev, 0x94, 4) | 0x200) & ~0x4000, 4); + /* enable MSE */ + pci_write_config(dev, 0x4, (pci_read_config(dev, 0x4, 2) | 2), 2); + pci_write_config(dev, 0x24, AHCI_MEM_HACK, 4); + pci_write_config(dev, 0x90, 0x40, 1); /* AHCI + non-combined */ + + /* allocate a free memory window for BAR(5) */ + ctlr->r_rid = PCIR_BAR(5); + bus_set_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, AHCI_MEM_HACK, 0x400); + /* if we have a memory BAR(5) we are likely on an AHCI part */ ctlr->r_rid = PCIR_BAR(5); if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &ctlr->r_rid, RF_ACTIVE))) return ENXIO; + + /* enable ICH7M ports in AHCI space */ + ATA_OUTL(ctlr->r_mem, AHCI_PI, ATA_INL(ctlr->r_mem, AHCI_PI) | 5); + /* Setup our own memory management for channels. */ ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem); ctlr->sc_iomem.rm_end = rman_get_end(ctlr->r_mem); --------------080701000709070807050808--