Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 2015 00:11:57 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277100 - head/sys/dev/ahci
Message-ID:  <201501130011.t0D0BvRD026054@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501130011.t0D0BvRD026054>