From d7a7be7765ca5b820a6d21b382bd4d7f6821819b Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 16 Feb 2022 22:24:43 +0000 Subject: [PATCH] powerpc: Implement bus_space_barrier as eieio. --- sys/arch/evbppc/virtex/dcr.c | 7 +++++++ sys/arch/evbppc/virtex/dcr.h | 2 ++ sys/arch/powerpc/include/bus_defs.h | 3 +++ sys/arch/powerpc/include/bus_funcs.h | 2 +- sys/arch/powerpc/powerpc/bus_space.c | 10 ++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/arch/evbppc/virtex/dcr.c b/sys/arch/evbppc/virtex/dcr.c index 64cb434d9223..4c0eba66467c 100644 --- a/sys/arch/evbppc/virtex/dcr.c +++ b/sys/arch/evbppc/virtex/dcr.c @@ -66,3 +66,10 @@ dcr_subregion(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t offset, return (0); } + +void +dcr_barrier(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t offset, + bus_size_t size, int flags) +{ + /* XXX EIEIO? */ +} diff --git a/sys/arch/evbppc/virtex/dcr.h b/sys/arch/evbppc/virtex/dcr.h index 3180a5aec215..78e21bccda3e 100644 --- a/sys/arch/evbppc/virtex/dcr.h +++ b/sys/arch/evbppc/virtex/dcr.h @@ -52,6 +52,8 @@ int dcr_subregion(bus_space_tag_t, bus_space_handle_t, bus_size_t, int dcr_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *); void dcr_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); +void dcr_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t, + bus_size_t, int); /* Bus space tag contents, one tag per DCR device. */ #define DCR_BST_BODY(base, read, write) \ diff --git a/sys/arch/powerpc/include/bus_defs.h b/sys/arch/powerpc/include/bus_defs.h index bf5afb0c2318..3395380cb995 100644 --- a/sys/arch/powerpc/include/bus_defs.h +++ b/sys/arch/powerpc/include/bus_defs.h @@ -220,6 +220,9 @@ struct powerpc_bus_space { const struct powerpc_bus_space_set *pbs_set; const struct powerpc_bus_space_set *pbs_set_stream; const struct powerpc_bus_space_copy *pbs_copy; + + void (*pbs_barrier)(bus_space_tag_t, bus_space_handle_t, bus_size_t, + bus_size_t, int); }; #define _BUS_SPACE_STRIDE(t, o) \ diff --git a/sys/arch/powerpc/include/bus_funcs.h b/sys/arch/powerpc/include/bus_funcs.h index 61dfa8723ab2..12c3215bb3aa 100644 --- a/sys/arch/powerpc/include/bus_funcs.h +++ b/sys/arch/powerpc/include/bus_funcs.h @@ -485,7 +485,7 @@ void bus_space_mallocok(void); * */ #define bus_space_barrier(t, h, o, l, f) \ - ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f))) + ((*(t)->pbs_barrier)((t), (h), (o), (l), (f))) #endif /* !__HAVE_LOCAL_BUS_SPACE */ diff --git a/sys/arch/powerpc/powerpc/bus_space.c b/sys/arch/powerpc/powerpc/bus_space.c index b82eb03857b0..ef30a506d373 100644 --- a/sys/arch/powerpc/powerpc/bus_space.c +++ b/sys/arch/powerpc/powerpc/bus_space.c @@ -395,6 +395,8 @@ static void memio_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); static int memio_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t, bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *); static void memio_free(bus_space_tag_t, bus_space_handle_t, bus_size_t); +static void memio_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t, + bus_size_t, int); static int extent_flags; @@ -416,6 +418,7 @@ bus_space_init(struct powerpc_bus_space *t, const char *extent_name, t->pbs_unmap = memio_unmap; t->pbs_alloc = memio_alloc; t->pbs_free = memio_free; + t->pbs_barrier = memio_barrier; if (t->pbs_flags & _BUS_SPACE_STRIDE_MASK) { t->pbs_scalar_stream = scalar_strided_ops; @@ -763,3 +766,10 @@ memio_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) /* memio_unmap() does all that we need to do. */ memio_unmap(t, bsh, size); } + +void +memio_barrier(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size, + bus_size_t offset, int flags) +{ + __asm volatile("eieio" ::: "memory"); +}