If opening /dev/pciN read-write fails, try opening it read-only. This allows

X to run with machdep.allowaperture=0 on inteldrm(4) and radeondrm(4).

ok matthieu@
This commit is contained in:
kettenis 2014-02-15 09:48:07 +00:00
parent 9c3ab7569c
commit 6dbbb49403

View File

@ -599,8 +599,11 @@ pci_system_openbsd_create(void)
for (domain = 0; domain < sizeof(pcifd) / sizeof(pcifd[0]); domain++) { for (domain = 0; domain < sizeof(pcifd) / sizeof(pcifd[0]); domain++) {
snprintf(path, sizeof(path), "/dev/pci%d", domain); snprintf(path, sizeof(path), "/dev/pci%d", domain);
pcifd[domain] = open(path, O_RDWR | O_CLOEXEC); pcifd[domain] = open(path, O_RDWR | O_CLOEXEC);
if (pcifd[domain] == -1) if (pcifd[domain] == -1) {
break; pcifd[domain] = open(path, O_RDONLY | O_CLOEXEC);
if (pcifd[domain] == -1)
break;
}
ndomains++; ndomains++;
} }