From b6220884d9e71d7c4fc1c2a22ade374fc023c831 Mon Sep 17 00:00:00 2001 From: Michal Stanek Date: Fri, 9 Jan 2015 17:20:38 +0100 Subject: [PATCH] Add quirk for Cavium AHCI BAR location --- sys/dev/ahci/ahci_pci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index 43723a6..dce4acb 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -373,7 +373,6 @@ ahci_pci_attach(device_t dev) int error, i; uint32_t devid = pci_get_devid(dev); uint8_t revid = pci_get_revid(dev); - struct pci_map *map; i = 0; while (ahci_ids[i].id != 0 && @@ -392,11 +391,9 @@ ahci_pci_attach(device_t dev) ctlr->subvendorid = pci_get_subvendor(dev); ctlr->subdeviceid = pci_get_subdevice(dev); - /* AHCI Base Address is BAR(5) by default, unless BARs are 64-bit */ - map = pci_find_bar(dev, PCIR_BAR(4)); - if (map != NULL && - ((map->pm_value & PCIM_BAR_MEM_TYPE) == PCIM_BAR_MEM_64)) - ctlr->r_rid = PCIR_BAR(4); + /* Default AHCI Base Address is BAR(5), Cavium uses BAR(0) */ + if (ctlr->vendorid == 0x177d && ctlr->deviceid == 0xa01c) + 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, -- 2.2.1