Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Explicitly enable PCI_COMMAND_MASTER_ENABLE and ...



details:   https://anonhg.NetBSD.org/src/rev/60c592b40243
branches:  trunk
changeset: 359566:60c592b40243
user:      uwe <uwe%NetBSD.org@localhost>
date:      Thu Feb 15 19:05:10 2018 +0000

description:
Explicitly enable PCI_COMMAND_MASTER_ENABLE and PCI_COMMAND_IO_ENABLE.
Recent versions of VirtualBox do not enable bus-mastering by default -
this will be fixed, but it doesn't hurt to do it ourselves too.

diffstat:

 sys/dev/pci/virtio_pci.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 8f7e480f0a98 -r 60c592b40243 sys/dev/pci/virtio_pci.c
--- a/sys/dev/pci/virtio_pci.c  Thu Feb 15 19:02:06 2018 +0000
+++ b/sys/dev/pci/virtio_pci.c  Thu Feb 15 19:05:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.1 2017/08/02 08:39:14 cherry Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.2 2018/02/15 19:05:10 uwe Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -94,6 +94,7 @@
        pcitag_t tag = pa->pa_tag;
        int revision;
        pcireg_t id;
+       pcireg_t csr;
 
        revision = PCI_REVISION(pa->pa_class);
        if (revision != 0) {
@@ -111,6 +112,10 @@
                           virtio_device_name[PCI_SUBSYS_ID(id)] : "Unknown"),
                          revision);
 
+       csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+       csr |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE;
+       pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
+
        sc->sc_dev = self;
        sc->sc_pc = pc;
        sc->sc_tag = tag;



Home | Main Index | Thread Index | Old Index