summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-11-19 17:44:47 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-11-19 17:44:47 +0000
commitd96eaa85480684809efe79b3762157c7b20d6f8d (patch)
tree55184ecf80ab77a04682cb0ee9a625502612a5f3 /sys/dev
parentf03dd7883f9cd3874e22bd87104861247f1b4f05 (diff)
Use bus_space_mmap(9) instead of pmap_extract(9) to find out the physical
(CPU) address of the device. Pointed out by miod@ ok patrick@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fdt/if_mvpp.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/dev/fdt/if_mvpp.c b/sys/dev/fdt/if_mvpp.c
index 9ac7bccaefd..b95ca684ec7 100644
--- a/sys/dev/fdt/if_mvpp.c
+++ b/sys/dev/fdt/if_mvpp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mvpp.c,v 1.41 2020/11/14 14:11:08 kettenis Exp $ */
+/* $OpenBSD: if_mvpp.c,v 1.42 2020/11/19 17:44:46 kettenis Exp $ */
/*
* Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2017, 2020 Patrick Wildt <patrick@blueri.se>
@@ -457,13 +457,10 @@ mvpp2_attach(struct device *parent, struct device *self, void *aux)
}
sc->sc_iosize_base = faa->fa_reg[0].size;
- if (!pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_ioh_base,
- &sc->sc_ioh_paddr)) {
- printf(": can't extract address\n");
- bus_space_unmap(sc->sc_iot, sc->sc_ioh_base,
- sc->sc_iosize_base);
- return;
- }
+ sc->sc_ioh_paddr = bus_space_mmap(sc->sc_iot, faa->fa_reg[0].addr,
+ 0, PROT_READ | PROT_WRITE, 0);
+ KASSERT(sc->sc_ioh_paddr != -1);
+ sc->sc_ioh_paddr &= PMAP_PA_MASK;
if (bus_space_map(sc->sc_iot, faa->fa_reg[1].addr,
faa->fa_reg[1].size, 0, &sc->sc_ioh_iface)) {