Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/footbridge Use devmap if available
details: https://anonhg.NetBSD.org/src/rev/e42103de3450
branches: trunk
changeset: 354360:e42103de3450
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Jun 13 15:23:17 2017 +0000
description:
Use devmap if available
diffstat:
sys/arch/arm/footbridge/footbridge_io.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (50 lines):
diff -r 082941fd78f6 -r e42103de3450 sys/arch/arm/footbridge/footbridge_io.c
--- a/sys/arch/arm/footbridge/footbridge_io.c Tue Jun 13 14:05:47 2017 +0000
+++ b/sys/arch/arm/footbridge/footbridge_io.c Tue Jun 13 15:23:17 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: footbridge_io.c,v 1.22 2014/02/22 20:33:00 matt Exp $ */
+/* $NetBSD: footbridge_io.c,v 1.23 2017/06/13 15:23:17 skrll Exp $ */
/*
* Copyright (c) 1997 Causality Limited
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.22 2014/02/22 20:33:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.23 2017/06/13 15:23:17 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -182,8 +182,8 @@
footbridge_mem_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
bus_space_handle_t *bshp)
{
- bus_addr_t startpa, endpa, pa;
- vaddr_t va;
+ paddr_t startpa, endpa, pa;
+ const struct pmap_devmap *pd;
/* Round the allocation to page boundries */
startpa = trunc_page(bpa);
@@ -200,12 +200,19 @@
return 0;
}
+ pa = bpa;
+ if ((pd = pmap_devmap_find_pa(pa, size)) != NULL) {
+ /* Device was statically mapped. */
+ *bshp = pd->pd_va + (pa - pd->pd_pa);
+ return 0;
+ }
+
/*
* Eventually this function will do the mapping check for overlapping /
* multiple mappings
*/
- va = uvm_km_alloc(kernel_map, endpa - startpa, 0,
+ vaddr_t va = uvm_km_alloc(kernel_map, endpa - startpa, 0,
UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
if (va == 0)
return ENOMEM;
Home |
Main Index |
Thread Index |
Old Index