Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Add a "bs_base" field to struct bus_space. If prese...
details: https://anonhg.NetBSD.org/src/rev/fc328d1338e7
branches: trunk
changeset: 445963:fc328d1338e7
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Nov 18 20:21:48 2018 +0000
description:
Add a "bs_base" field to struct bus_space. If present, use it to translate
mappings by appending the value to the pa passed to bus_space_map.
diffstat:
sys/arch/aarch64/aarch64/bus_space.c | 12 ++++++++++--
sys/arch/arm/arm32/armv7_generic_space.c | 8 ++++++--
sys/arch/arm/include/bus_defs.h | 3 ++-
3 files changed, 18 insertions(+), 5 deletions(-)
diffs (117 lines):
diff -r 86d55f41b449 -r fc328d1338e7 sys/arch/aarch64/aarch64/bus_space.c
--- a/sys/arch/aarch64/aarch64/bus_space.c Sun Nov 18 19:22:23 2018 +0000
+++ b/sys/arch/aarch64/aarch64/bus_space.c Sun Nov 18 20:21:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.5 2018/06/16 13:53:45 jmcneill Exp $ */
+/* $NetBSD: bus_space.c,v 1.6 2018/11/18 20:21:48 jmcneill Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.5 2018/06/16 13:53:45 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.6 2018/11/18 20:21:48 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -46,6 +46,7 @@
struct bus_space arm_generic_bs_tag = {
.bs_cookie = &arm_generic_bs_tag,
+ .bs_base = 0,
.bs_stride = 0,
.bs_flags = 0,
@@ -168,6 +169,7 @@
struct bus_space aarch64_generic_dsb_bs_tag = {
.bs_cookie = &aarch64_generic_dsb_bs_tag,
+ .bs_base = 0,
.bs_stride = 0,
.bs_flags = 0,
@@ -290,6 +292,7 @@
struct bus_space arm_generic_a4x_bs_tag = {
.bs_cookie = &arm_generic_a4x_bs_tag,
+ .bs_base = 0,
.bs_stride = 2,
.bs_flags = 0,
@@ -412,6 +415,7 @@
struct bus_space aarch64_generic_a4x_dsb_bs_tag = {
.bs_cookie = &aarch64_generic_a4x_dsb_bs_tag,
+ .bs_base = 0,
.bs_stride = 2,
.bs_flags = 0,
@@ -535,11 +539,15 @@
generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag,
bus_space_handle_t *bshp)
{
+ const struct bus_space *bs = t;
const struct pmap_devmap *pd;
paddr_t startpa, endpa, pa;
vaddr_t va;
int pmapflags;
+ if (bs)
+ bpa += bs->bs_base;
+
if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
*bshp = pd->pd_va + (bpa - pd->pd_pa);
return 0;
diff -r 86d55f41b449 -r fc328d1338e7 sys/arch/arm/arm32/armv7_generic_space.c
--- a/sys/arch/arm/arm32/armv7_generic_space.c Sun Nov 18 19:22:23 2018 +0000
+++ b/sys/arch/arm/arm32/armv7_generic_space.c Sun Nov 18 20:21:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: armv7_generic_space.c,v 1.8 2018/04/01 04:35:03 ryo Exp $ */
+/* $NetBSD: armv7_generic_space.c,v 1.9 2018/11/18 20:21:48 jmcneill Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: armv7_generic_space.c,v 1.8 2018/04/01 04:35:03 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: armv7_generic_space.c,v 1.9 2018/11/18 20:21:48 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -291,11 +291,15 @@
armv7_generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag,
bus_space_handle_t *bshp)
{
+ const struct bus_space *bs = t;
u_long startpa, endpa, pa;
const struct pmap_devmap *pd;
int pmapflags;
vaddr_t va;
+ if (bs)
+ bpa += bs->bs_base;
+
if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
/* Device was statically mapped. */
*bshp = pd->pd_va + (bpa - pd->pd_pa);
diff -r 86d55f41b449 -r fc328d1338e7 sys/arch/arm/include/bus_defs.h
--- a/sys/arch/arm/include/bus_defs.h Sun Nov 18 19:22:23 2018 +0000
+++ b/sys/arch/arm/include/bus_defs.h Sun Nov 18 20:21:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_defs.h,v 1.11 2018/04/01 04:35:04 ryo Exp $ */
+/* $NetBSD: bus_defs.h,v 1.12 2018/11/18 20:21:48 jmcneill Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -102,6 +102,7 @@
void *bs_cookie;
/* used for aarch64. require ".bs_cookie = bus_space" */
+ bus_addr_t bs_base;
int bs_stride; /* offset <<= bs_stride (if needed) */
int bs_flags;
Home |
Main Index |
Thread Index |
Old Index