From 4e0475b7dbf0859b1e07a98e05eb47c2854b57a4 Mon Sep 17 00:00:00 2001 From: kettenis Date: Mon, 20 Aug 2018 19:38:07 +0000 Subject: [PATCH] Implement bus_space_mmap(9). ok patrick@ --- sys/arch/arm64/dev/arm64_bus_space.c | 12 ++++++++++-- sys/arch/arm64/include/bus.h | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/arch/arm64/dev/arm64_bus_space.c b/sys/arch/arm64/dev/arm64_bus_space.c index c09ee5f4405..34c57e64c74 100644 --- a/sys/arch/arm64/dev/arm64_bus_space.c +++ b/sys/arch/arm64/dev/arm64_bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arm64_bus_space.c,v 1.6 2018/05/15 11:12:35 kettenis Exp $ */ +/* $OpenBSD: arm64_bus_space.c,v 1.7 2018/08/20 19:38:07 kettenis Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -56,7 +56,8 @@ bus_space_t arm64_bs_tag = { ._space_map = generic_space_map, ._space_unmap = generic_space_unmap, ._space_subregion = generic_space_region, - ._space_vaddr = generic_space_vaddr + ._space_vaddr = generic_space_vaddr, + ._space_mmap = generic_space_mmap }; bus_space_t *fdt_cons_bs_tag = &arm64_bs_tag; @@ -236,3 +237,10 @@ generic_space_vaddr(bus_space_tag_t t, bus_space_handle_t h) { return (void *)h; } + +paddr_t +generic_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t off, + int prot, int flags) +{ + return (addr + off); +} diff --git a/sys/arch/arm64/include/bus.h b/sys/arch/arm64/include/bus.h index d479faaaa76..0e2b68b4084 100644 --- a/sys/arch/arm64/include/bus.h +++ b/sys/arch/arm64/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.4 2018/05/15 11:12:35 kettenis Exp $ */ +/* $OpenBSD: bus.h,v 1.5 2018/08/20 19:38:07 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. * @@ -82,6 +82,8 @@ struct bus_space { int (*_space_subregion)(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, bus_space_handle_t *); void * (*_space_vaddr)(bus_space_tag_t, bus_space_handle_t); + paddr_t (*_space_mmap)(bus_space_tag_t, bus_addr_t, off_t, + int, int); }; #define bus_space_read_1(t, h, o) (*(t)->_space_read_1)((t), (h), (o)) @@ -119,6 +121,8 @@ struct bus_space { #define BUS_SPACE_MAP_PREFETCHABLE 0x08 #define bus_space_vaddr(t, h) (*(t)->_space_vaddr)((t), (h)) +#define bus_space_mmap(t, a, o, p, f) \ + (*(t)->_space_mmap)((t), (a), (o), (p), (f)) /*----------------------------------------------------------------------------*/ #define bus_space_read_multi(n,m) \ @@ -479,6 +483,7 @@ void generic_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); int generic_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, bus_space_handle_t *); void *generic_space_vaddr(bus_space_tag_t, bus_space_handle_t); +paddr_t generic_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); uint8_t generic_space_read_1(bus_space_tag_t, bus_space_handle_t, bus_size_t); uint16_t generic_space_read_2(bus_space_tag_t, bus_space_handle_t, bus_size_t); uint32_t generic_space_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t); -- 2.20.1