summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-04-11 08:02:19 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-04-11 08:02:19 +0000
commit90019933596e67f9f3983b055fe458d0ad32af02 (patch)
treea7dc51b82cb05d3ae6f35992ebe201056f48c282
parent3205e3f3fc34ebd1ddbb10ee8a36f144504cc3ee (diff)
Some (probably newer) re(4) cards don't have the 32-bit memory BAR that
we try to map first. Instead there's a 64-bit memory BAR in the follow- ing BAR. Since on the MACCHIATObin we currently do not support the IO space, we have to use the 64-bit memory BAR. Thus, try to map the 64- bit BAR before falling back to the 32-bit BAR and the IO bar. ok deraadt@ kettenis@
-rw-r--r--sys/dev/ic/rtl81x9reg.h3
-rw-r--r--sys/dev/pci/if_re_pci.c20
2 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/ic/rtl81x9reg.h b/sys/dev/ic/rtl81x9reg.h
index 8fc4a9a851d..547807d9bd0 100644
--- a/sys/dev/ic/rtl81x9reg.h
+++ b/sys/dev/ic/rtl81x9reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtl81x9reg.h,v 1.100 2016/11/16 01:27:45 dlg Exp $ */
+/* $OpenBSD: rtl81x9reg.h,v 1.101 2018/04/11 08:02:18 patrick Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -1061,6 +1061,7 @@ struct rl_softc {
#define RL_PCI_HEADER_TYPE 0x0E
#define RL_PCI_LOIO 0x10
#define RL_PCI_LOMEM 0x14
+#define RL_PCI_LOMEM64 0x18
#define RL_PCI_BIOSROM 0x30
#define RL_PCI_INTLINE 0x3C
#define RL_PCI_INTPIN 0x3D
diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c
index 84d1f3f2b04..d93caa3adbd 100644
--- a/sys/dev/pci/if_re_pci.c
+++ b/sys/dev/pci/if_re_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_re_pci.c,v 1.51 2017/06/12 03:00:26 kevlo Exp $ */
+/* $OpenBSD: if_re_pci.c,v 1.52 2018/04/11 08:02:18 patrick Exp $ */
/*
* Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org>
@@ -141,12 +141,18 @@ re_pci_attach(struct device *parent, struct device *self, void *aux)
/*
* Map control/status registers.
*/
- if (pci_mapreg_map(pa, RL_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0,
- &sc->rl_btag, &sc->rl_bhandle, NULL, &psc->sc_iosize, 0)) {
- if (pci_mapreg_map(pa, RL_PCI_LOIO, PCI_MAPREG_TYPE_IO, 0,
- &sc->rl_btag, &sc->rl_bhandle, NULL, &psc->sc_iosize, 0)) {
- printf(": can't map mem or i/o space\n");
- return;
+ if (pci_mapreg_map(pa, RL_PCI_LOMEM64, PCI_MAPREG_TYPE_MEM |
+ PCI_MAPREG_MEM_TYPE_64BIT, 0, &sc->rl_btag, &sc->rl_bhandle,
+ NULL, &psc->sc_iosize, 0)) {
+ if (pci_mapreg_map(pa, RL_PCI_LOMEM, PCI_MAPREG_TYPE_MEM |
+ PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->rl_btag, &sc->rl_bhandle,
+ NULL, &psc->sc_iosize, 0)) {
+ if (pci_mapreg_map(pa, RL_PCI_LOIO, PCI_MAPREG_TYPE_IO,
+ 0, &sc->rl_btag, &sc->rl_bhandle, NULL,
+ &psc->sc_iosize, 0)) {
+ printf(": can't map mem or i/o space\n");
+ return;
+ }
}
}