diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-07-20 15:44:44 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-07-20 15:44:44 +0000 |
commit | 96f996368c371985db61f7b006ec85885c5439a1 (patch) | |
tree | 6b28ed3e7e85ae2b62adfb72f47ae2ad55724a82 /sys/dev/pci | |
parent | f34e81266c0de78c277a6704760893a6a55ccb39 (diff) |
Try to assign a secondary bus number if the BIOS left the CardBus bridge
unconfigured.
ok miod@, mlarkin@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/pccbb.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/dev/pci/pccbb.c b/sys/dev/pci/pccbb.c index d43a6e0f740..1a5bcfecbf1 100644 --- a/sys/dev/pci/pccbb.c +++ b/sys/dev/pci/pccbb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pccbb.c,v 1.94 2015/07/19 05:37:38 bcook Exp $ */ +/* $OpenBSD: pccbb.c,v 1.95 2015/07/20 15:44:43 kettenis Exp $ */ /* $NetBSD: pccbb.c,v 1.96 2004/03/28 09:49:31 nakayama Exp $ */ /* @@ -372,6 +372,7 @@ pccbbattach(struct device *parent, struct device *self, void *aux) pci_chipset_tag_t pc = pa->pa_pc; pci_intr_handle_t ih; const char *intrstr = NULL; + u_long busnum; int flags; pccbb_attach_hook(parent, self, pa); @@ -447,8 +448,19 @@ pccbbattach(struct device *parent, struct device *self, void *aux) printf(": %s", intrstr); /* - * When bus number isn't set correctly, give up using 32-bit CardBus - * mode. + * When the bus number isn't configured, try to allocate one + * ourselves. + */ + if ((sc->sc_busnum & 0x00ffff00) == 0 && pa->pa_busex && + extent_alloc(pa->pa_busex, 1, 1, 0, 0, EX_NOWAIT, &busnum) == 0) { + sc->sc_busnum |= (busnum << 8); + sc->sc_busnum |= (busnum << 16); + pci_conf_write(pc, pa->pa_tag, PCI_BUSNUM, sc->sc_busnum); + } + + /* + * When the bus number still isn't set correctly, give up + * using 32-bit CardBus mode. */ if (((sc->sc_busnum >> 8) & 0xff) == 0) { printf(", CardBus support disabled"); |