summaryrefslogtreecommitdiff
path: root/src/openbsd_pci.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-02-20 21:29:08 +0100
committerMatthieu Herrb <matthieu@herrb.eu>2018-11-25 19:19:56 +0100
commit71bc95ce79462f0ab66c819d47a37a94e85c6258 (patch)
tree4584afd050c8b32f553525911bc8678336b180eb /src/openbsd_pci.c
parentb9633259738d66a1987b783f688b9b4d70348391 (diff)
We don't need the VGA arbiter if direct hardware access has been disabled.
ok matthieu@
Diffstat (limited to 'src/openbsd_pci.c')
-rw-r--r--src/openbsd_pci.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/openbsd_pci.c b/src/openbsd_pci.c
index f97d841..603bdaa 100644
--- a/src/openbsd_pci.c
+++ b/src/openbsd_pci.c
@@ -22,6 +22,8 @@
#include <sys/memrange.h>
#include <sys/mman.h>
#include <sys/pciio.h>
+#include <sys/sysctl.h>
+#include <machine/cpu.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
@@ -748,6 +750,22 @@ pci_device_vgaarb_init(void)
struct pci_vga pv;
int err;
+#ifdef CPU_ALLOWAPERTURE
+ int mib[2];
+ int allowaperture;
+ size_t len;
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_ALLOWAPERTURE;
+ len = sizeof(allowaperture);
+ if (sysctl(mib, 2, &allowaperture, &len, NULL, 0) == 0 &&
+ allowaperture == 0) {
+ /* No direct hardware access allowed. */
+ pci_sys->vga_count = 0;
+ return 0;
+ }
+#endif
+
pv.pv_sel.pc_bus = 0;
pv.pv_sel.pc_dev = 0;
pv.pv_sel.pc_func = 0;