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;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to