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
This commit is contained in:
Konstantin Belousov 2015-01-13 00:11:56 +00:00
parent a161398ab8
commit 378c532c1f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277100
2 changed files with 8 additions and 2 deletions

View File

@ -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" \

View File

@ -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;