Module Name: src Committed By: nakayama Date: Mon Jul 14 12:40:38 UTC 2014
Modified Files: src/sys/arch/sparc64/include: bus_funcs.h src/sys/arch/sparc64/sparc64: machdep.c Log Message: Make bus_space_barrier inline to avoid unnecessary argument handling. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/include/bus_funcs.h cvs rdiff -u -r1.277 -r1.278 src/sys/arch/sparc64/sparc64/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc64/include/bus_funcs.h diff -u src/sys/arch/sparc64/include/bus_funcs.h:1.2 src/sys/arch/sparc64/include/bus_funcs.h:1.3 --- src/sys/arch/sparc64/include/bus_funcs.h:1.2 Sun Jul 17 23:29:10 2011 +++ src/sys/arch/sparc64/include/bus_funcs.h Mon Jul 14 12:40:38 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_funcs.h,v 1.2 2011/07/17 23:29:10 dyoung Exp $ */ +/* $NetBSD: bus_funcs.h,v 1.3 2014/07/14 12:40:38 nakayama Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -125,6 +125,30 @@ bus_intr_establish(bus_space_tag_t t, in #define bus_space_vaddr(t, h) (PHYS_ASI((h)._asi) ? \ NULL : (void *)(vaddr_t)((h)._ptr)) +#define bus_space_barrier(t, h, o, s, f) \ + sparc_bus_space_barrier((t), (h), (o), (s), (f)) + +static __inline void +sparc_bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, + bus_size_t o, bus_size_t s, int f) +{ + /* + * We have a bit of a problem with the bus_space_barrier() + * interface. It defines a read barrier and a write barrier + * which really don't map to the 7 different types of memory + * barriers in the SPARC v9 instruction set. + */ + if (f == BUS_SPACE_BARRIER_READ) + /* A load followed by a load to the same location? */ + __asm volatile("membar #Lookaside"); + else if (f == BUS_SPACE_BARRIER_WRITE) + /* A store followed by a store? */ + __asm volatile("membar #StoreStore"); + else + /* A store followed by a load? */ + __asm volatile("membar #StoreLoad|#MemIssue|#Lookaside"); +} + /* * uintN_t bus_space_read_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset); Index: src/sys/arch/sparc64/sparc64/machdep.c diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.277 src/sys/arch/sparc64/sparc64/machdep.c:1.278 --- src/sys/arch/sparc64/sparc64/machdep.c:1.277 Tue May 13 19:39:40 2014 +++ src/sys/arch/sparc64/sparc64/machdep.c Mon Jul 14 12:40:38 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.277 2014/05/13 19:39:40 palle Exp $ */ +/* $NetBSD: machdep.c,v 1.278 2014/07/14 12:40:38 nakayama Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.277 2014/05/13 19:39:40 palle Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.278 2014/07/14 12:40:38 nakayama Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -1611,27 +1611,6 @@ static void sparc_bus_free(bus_space_tag struct extent *io_space = NULL; -void -bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, bus_size_t s, int f) -{ - /* - * We have a bit of a problem with the bus_space_barrier() - * interface. It defines a read barrier and a write barrier - * which really don't map to the 7 different types of memory - * barriers in the SPARC v9 instruction set. - */ - if (f == BUS_SPACE_BARRIER_READ) - /* A load followed by a load to the same location? */ - __asm volatile("membar #Lookaside"); - else if (f == BUS_SPACE_BARRIER_WRITE) - /* A store followed by a store? */ - __asm volatile("membar #StoreStore"); - else - /* A store followed by a load? */ - __asm volatile("membar #StoreLoad|#MemIssue|#Lookaside"); -} - int bus_space_alloc(bus_space_tag_t t, bus_addr_t rs, bus_addr_t re, bus_size_t s, bus_size_t a, bus_size_t b, int f, bus_addr_t *ap,