From owner-svn-src-head@FreeBSD.ORG Tue Jan 13 00:11:57 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B30A8B9B; Tue, 13 Jan 2015 00:11:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84E9C377; Tue, 13 Jan 2015 00:11:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0D0BvLw026056; Tue, 13 Jan 2015 00:11:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0D0BvRD026054; Tue, 13 Jan 2015 00:11:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201501130011.t0D0BvRD026054@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 13 Jan 2015 00:11:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277100 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jan 2015 00:11:57 -0000 Author: kib Date: Tue Jan 13 00:11:56 2015 New Revision: 277100 URL: https://svnweb.freebsd.org/changeset/base/277100 Log: Add quirk to override default BAR(5) rid for AHCI. Use it for Cavium AHCI. Submitted by: Michaе┌ Stanek Reviewed by: imp (previous version) MFC after: 1 week Modified: head/sys/dev/ahci/ahci.h head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Tue Jan 13 00:04:22 2015 (r277099) +++ head/sys/dev/ahci/ahci.h Tue Jan 13 00:11:56 2015 (r277100) @@ -572,6 +572,7 @@ enum ahci_err_type { #define AHCI_Q_ATI_PMP_BUG 0x2000 #define AHCI_Q_MAXIO_64K 0x4000 #define AHCI_Q_SATA1_UNIT0 0x8000 /* need better method for this */ +#define AHCI_Q_ABAR0 0x10000 #define AHCI_Q_BIT_STRING \ "\020" \ Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Tue Jan 13 00:04:22 2015 (r277099) +++ head/sys/dev/ahci/ahci_pci.c Tue Jan 13 00:11:56 2015 (r277100) @@ -287,6 +287,7 @@ static const struct { {0x11841039, 0x00, "SiS 966", 0}, {0x11851039, 0x00, "SiS 968", 0}, {0x01861039, 0x00, "SiS 968", 0}, + {0xa01c177d, 0x00, "ThunderX SATA", AHCI_Q_ABAR0}, {0x00000000, 0x00, NULL, 0} }; @@ -386,12 +387,16 @@ ahci_pci_attach(device_t dev) pci_get_subvendor(dev) == 0x1043 && pci_get_subdevice(dev) == 0x81e4) ctlr->quirks |= AHCI_Q_SATA1_UNIT0; - /* if we have a memory BAR(5) we are likely on an AHCI part */ ctlr->vendorid = pci_get_vendor(dev); ctlr->deviceid = pci_get_device(dev); ctlr->subvendorid = pci_get_subvendor(dev); ctlr->subdeviceid = pci_get_subdevice(dev); - ctlr->r_rid = PCIR_BAR(5); + + /* Default AHCI Base Address is BAR(5), Cavium uses BAR(0) */ + if (ctlr->quirks & AHCI_Q_ABAR0) + ctlr->r_rid = PCIR_BAR(0); + else + 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;