Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci need to set PCI_COMMAND_MASTER_ENABLE flag; fixe...



details:   https://anonhg.NetBSD.org/src/rev/8b7b35ad3c7c
branches:  trunk
changeset: 347814:8b7b35ad3c7c
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Sep 17 11:07:42 2016 +0000

description:
need to set PCI_COMMAND_MASTER_ENABLE flag; fixes the driver under QEMU

diffstat:

 sys/dev/pci/nvme_pci.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r a16ea43a8de2 -r 8b7b35ad3c7c sys/dev/pci/nvme_pci.c
--- a/sys/dev/pci/nvme_pci.c    Sat Sep 17 06:29:50 2016 +0000
+++ b/sys/dev/pci/nvme_pci.c    Sat Sep 17 11:07:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme_pci.c,v 1.8 2016/09/17 03:02:03 pgoyette Exp $    */
+/*     $NetBSD: nvme_pci.c,v 1.9 2016/09/17 11:07:42 jdolecek Exp $    */
 /*     $OpenBSD: nvme_pci.c,v 1.3 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.8 2016/09/17 03:02:03 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.9 2016/09/17 11:07:42 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -110,7 +110,7 @@
        struct nvme_pci_softc *psc = device_private(self);
        struct nvme_softc *sc = &psc->psc_nvme;
        struct pci_attach_args *pa = aux;
-       pcireg_t memtype;
+       pcireg_t memtype, reg;
        bus_addr_t memaddr;
        int flags, msixoff;
        int error;
@@ -124,6 +124,12 @@
 
        pci_aprint_devinfo(pa, NULL);
 
+       reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+       if ((reg & PCI_COMMAND_MASTER_ENABLE) == 0) {
+               reg |= PCI_COMMAND_MASTER_ENABLE;
+               pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, reg);
+       }
+
        /* Map registers */
        memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, NVME_PCI_BAR);
        if (PCI_MAPREG_TYPE(memtype) != PCI_MAPREG_TYPE_MEM) {



Home | Main Index | Thread Index | Old Index