summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-02-15 09:48:08 +0100
committerMatthieu Herrb <matthieu@herrb.eu>2018-11-25 19:19:56 +0100
commitb9633259738d66a1987b783f688b9b4d70348391 (patch)
treeee568705e96d5a9ca6035f5cc4891b7794962f20 /src
parentae4ca86c99698dc85d95ce2adc0e7a912bfd3482 (diff)
If opening /dev/pciN read-write fails, try opening it read-only. This allow
X to run with machdep.allowaperture=0 on inteldrm(4) and radeondrm(4). ok matthieu@
Diffstat (limited to 'src')
-rw-r--r--src/openbsd_pci.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/openbsd_pci.c b/src/openbsd_pci.c
index fa58d7a..f97d841 100644
--- a/src/openbsd_pci.c
+++ b/src/openbsd_pci.c
@@ -628,8 +628,11 @@ pci_system_openbsd_create(void)
for (domain = 0; domain < sizeof(pcifd) / sizeof(pcifd[0]); domain++) {
snprintf(path, sizeof(path), "/dev/pci%d", domain);
pcifd[domain] = open(path, O_RDWR | O_CLOEXEC);
- if (pcifd[domain] == -1)
- break;
+ if (pcifd[domain] == -1) {
+ pcifd[domain] = open(path, O_RDONLY | O_CLOEXEC);
+ if (pcifd[domain] == -1)
+ break;
+ }
ndomains++;
}