Module Name: src
Committed By: jdolecek
Date: Sat Sep 17 11:07:42 UTC 2016
Modified Files:
src/sys/dev/pci: nvme_pci.c
Log Message:
need to set PCI_COMMAND_MASTER_ENABLE flag; fixes the driver under QEMU
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/nvme_pci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/nvme_pci.c
diff -u src/sys/dev/pci/nvme_pci.c:1.8 src/sys/dev/pci/nvme_pci.c:1.9
--- src/sys/dev/pci/nvme_pci.c:1.8 Sat Sep 17 03:02:03 2016
+++ src/sys/dev/pci/nvme_pci.c Sat Sep 17 11:07:42 2016
@@ -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 @@ nvme_pci_attach(device_t parent, device_
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 @@ nvme_pci_attach(device_t parent, device_
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) {