svn commit: r257066 - in head/sys/sparc64: include pci sbus sparc64

Marius Strobl marius at FreeBSD.org
Thu Oct 24 17:06:44 UTC 2013


Author: marius
Date: Thu Oct 24 17:06:41 2013
New Revision: 257066
URL: http://svnweb.freebsd.org/changeset/base/257066

Log:
  Move the implementation of bus_space_barrier(9) to the inline function in
  the header. Actually, there's only one version for all types of busses, so
  it doesn't make sense to walk up the hierarchy.

Modified:
  head/sys/sparc64/include/bus.h
  head/sys/sparc64/include/bus_private.h
  head/sys/sparc64/pci/fire.c
  head/sys/sparc64/pci/psycho.c
  head/sys/sparc64/pci/schizo.c
  head/sys/sparc64/sbus/sbus.c
  head/sys/sparc64/sparc64/bus_machdep.c

Modified: head/sys/sparc64/include/bus.h
==============================================================================
--- head/sys/sparc64/include/bus.h	Thu Oct 24 17:04:16 2013	(r257065)
+++ head/sys/sparc64/include/bus.h	Thu Oct 24 17:06:41 2013	(r257066)
@@ -58,7 +58,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * 	from: NetBSD: bus.h,v 1.58 2008/04/28 20:23:36 martin Exp
+ *	from: NetBSD: bus.h,v 1.58 2008/04/28 20:23:36 martin Exp
  *	and
  *	from: FreeBSD: src/sys/alpha/include/bus.h,v 1.9 2001/01/09
  *
@@ -104,11 +104,7 @@ extern const int bus_stream_asi[];
 
 struct bus_space_tag {
 	void		*bst_cookie;
-	bus_space_tag_t	bst_parent;
 	int		bst_type;
-
-	void		(*bst_bus_barrier)(bus_space_tag_t, bus_space_handle_t,
-			    bus_size_t, bus_size_t, int);
 };
 
 /*
@@ -131,23 +127,23 @@ int bus_space_map(bus_space_tag_t tag, b
 void bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t handle,
     bus_size_t size);
 
-/* This macro finds the first "upstream" implementation of method `f' */
-#define	_BS_CALL(t,f)							\
-	while (t->f == NULL)						\
-		t = t->bst_parent;					\
-	return (*(t)->f)
-
 static __inline void
-bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
-    bus_size_t s, int f)
+bus_space_barrier(bus_space_tag_t t __unused, bus_space_handle_t h __unused,
+    bus_size_t o __unused, bus_size_t s __unused, int f __unused)
 {
 
-	_BS_CALL(t, bst_bus_barrier)(t, h, o, s, f);
+	/*
+	 * We have lots of alternatives depending on whether we're
+	 * synchronizing loads with loads, loads with stores, stores
+	 * with loads, or stores with stores.  The only ones that seem
+	 * generic are #Sync and #MemIssue.  We use #Sync for safety.
+	 */
+	membar(Sync);
 }
 
 static __inline int
-bus_space_subregion(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
-    bus_size_t s, bus_space_handle_t *hp)
+bus_space_subregion(bus_space_tag_t t __unused, bus_space_handle_t h,
+    bus_size_t o __unused, bus_size_t s __unused, bus_space_handle_t *hp)
 {
 
 	*hp = h + o;

Modified: head/sys/sparc64/include/bus_private.h
==============================================================================
--- head/sys/sparc64/include/bus_private.h	Thu Oct 24 17:04:16 2013	(r257065)
+++ head/sys/sparc64/include/bus_private.h	Thu Oct 24 17:06:41 2013	(r257066)
@@ -40,8 +40,7 @@ int sparc64_bus_mem_map(bus_space_tag_t 
     int flags, vm_offset_t vaddr, bus_space_handle_t *hp);
 int sparc64_bus_mem_unmap(bus_space_tag_t tag, bus_space_handle_t handle,
     bus_size_t size);
-bus_space_tag_t sparc64_alloc_bus_tag(void *cookie,
-    struct bus_space_tag *ptag, int type, void *barrier);
+bus_space_tag_t sparc64_alloc_bus_tag(void *cookie, int type);
 bus_space_handle_t sparc64_fake_bustag(int space, bus_addr_t addr,
     struct bus_space_tag *ptag);
 

Modified: head/sys/sparc64/pci/fire.c
==============================================================================
--- head/sys/sparc64/pci/fire.c	Thu Oct 24 17:04:16 2013	(r257065)
+++ head/sys/sparc64/pci/fire.c	Thu Oct 24 17:06:41 2013	(r257066)
@@ -756,12 +756,10 @@ fire_attach(device_t dev)
 	free(range, M_OFWPROP);
 
 	/* Allocate our tags. */
-	sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, rman_get_bustag(
-	    sc->sc_mem_res[FIRE_PCI]), PCI_IO_BUS_SPACE, NULL);
+	sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, PCI_IO_BUS_SPACE);
 	if (sc->sc_pci_iot == NULL)
 		panic("%s: could not allocate PCI I/O tag", __func__);
-	sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, rman_get_bustag(
-	    sc->sc_mem_res[FIRE_PCI]), PCI_CONFIG_BUS_SPACE, NULL);
+	sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, PCI_CONFIG_BUS_SPACE);
 	if (sc->sc_pci_cfgt == NULL)
 		panic("%s: could not allocate PCI configuration space tag",
 		    __func__);
@@ -2072,8 +2070,7 @@ fire_activate_resource(device_t bus, dev
 		return (bus_generic_activate_resource(bus, child, type, rid,
 		    r));
 	case SYS_RES_MEMORY:
-		tag = sparc64_alloc_bus_tag(r, rman_get_bustag(
-		    sc->sc_mem_res[FIRE_PCI]), PCI_MEMORY_BUS_SPACE, NULL);
+		tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE);
 		if (tag == NULL)
 			return (ENOMEM);
 		rman_set_bustag(r, tag);

Modified: head/sys/sparc64/pci/psycho.c
==============================================================================
--- head/sys/sparc64/pci/psycho.c	Thu Oct 24 17:04:16 2013	(r257065)
+++ head/sys/sparc64/pci/psycho.c	Thu Oct 24 17:06:41 2013	(r257066)
@@ -573,12 +573,10 @@ psycho_attach(device_t dev)
 	}
 
 	/* Allocate our tags. */
-	sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, rman_get_bustag(
-	    sc->sc_mem_res), PCI_IO_BUS_SPACE, NULL);
+	sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, PCI_IO_BUS_SPACE);
 	if (sc->sc_pci_iot == NULL)
 		panic("%s: could not allocate PCI I/O tag", __func__);
-	sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, rman_get_bustag(
-	    sc->sc_mem_res), PCI_CONFIG_BUS_SPACE, NULL);
+	sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, PCI_CONFIG_BUS_SPACE);
 	if (sc->sc_pci_cfgt == NULL)
 		panic("%s: could not allocate PCI configuration space tag",
 		    __func__);
@@ -1236,8 +1234,7 @@ psycho_activate_resource(device_t bus, d
 		return (bus_generic_activate_resource(bus, child, type, rid,
 		    r));
 	case SYS_RES_MEMORY:
-		tag = sparc64_alloc_bus_tag(r, rman_get_bustag(
-		    sc->sc_mem_res), PCI_MEMORY_BUS_SPACE, NULL);
+		tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE);
 		if (tag == NULL)
 			return (ENOMEM);
 		rman_set_bustag(r, tag);

Modified: head/sys/sparc64/pci/schizo.c
==============================================================================
--- head/sys/sparc64/pci/schizo.c	Thu Oct 24 17:04:16 2013	(r257065)
+++ head/sys/sparc64/pci/schizo.c	Thu Oct 24 17:06:41 2013	(r257066)
@@ -580,12 +580,10 @@ schizo_attach(device_t dev)
 	SLIST_INSERT_HEAD(&schizo_softcs, sc, sc_link);
 
 	/* Allocate our tags. */
-	sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, rman_get_bustag(
-	    sc->sc_mem_res[STX_PCI]), PCI_IO_BUS_SPACE, NULL);
+	sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, PCI_IO_BUS_SPACE);
 	if (sc->sc_pci_iot == NULL)
 		panic("%s: could not allocate PCI I/O tag", __func__);
-	sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, rman_get_bustag(
-	    sc->sc_mem_res[STX_PCI]), PCI_CONFIG_BUS_SPACE, NULL);
+	sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, PCI_CONFIG_BUS_SPACE);
 	if (sc->sc_pci_cfgt == NULL)
 		panic("%s: could not allocate PCI configuration space tag",
 		    __func__);
@@ -1412,8 +1410,7 @@ schizo_activate_resource(device_t bus, d
 		return (bus_generic_activate_resource(bus, child, type, rid,
 		    r));
 	case SYS_RES_MEMORY:
-		tag = sparc64_alloc_bus_tag(r, rman_get_bustag(
-		    sc->sc_mem_res[STX_PCI]), PCI_MEMORY_BUS_SPACE, NULL);
+		tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE);
 		if (tag == NULL)
 			return (ENOMEM);
 		rman_set_bustag(r, tag);

Modified: head/sys/sparc64/sbus/sbus.c
==============================================================================
--- head/sys/sparc64/sbus/sbus.c	Thu Oct 24 17:04:16 2013	(r257065)
+++ head/sys/sparc64/sbus/sbus.c	Thu Oct 24 17:06:41 2013	(r257066)
@@ -803,9 +803,7 @@ sbus_activate_resource(device_t bus, dev
 		for (i = 0; i < sc->sc_nrange; i++) {
 			if (rman_is_region_manager(r,
 			    &sc->sc_rd[i].rd_rman) != 0) {
-				tag = sparc64_alloc_bus_tag(r,
-				    rman_get_bustag(sc->sc_sysio_res),
-				    SBUS_BUS_SPACE, NULL);
+				tag = sparc64_alloc_bus_tag(r, SBUS_BUS_SPACE);
 				if (tag == NULL)
 					return (ENOMEM);
 				rman_set_bustag(r, tag);

Modified: head/sys/sparc64/sparc64/bus_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/bus_machdep.c	Thu Oct 24 17:04:16 2013	(r257065)
+++ head/sys/sparc64/sparc64/bus_machdep.c	Thu Oct 24 17:06:41 2013	(r257066)
@@ -119,9 +119,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/smp.h>
 #include <machine/tlb.h>
 
-static void nexus_bus_barrier(bus_space_tag_t, bus_space_handle_t,
-    bus_size_t, bus_size_t, int);
-
 /* ASIs for bus access */
 const int bus_type_asi[] = {
 	ASI_PHYS_BYPASS_EC_WITH_EBIT,		/* nexus */
@@ -715,18 +712,15 @@ sparc64_fake_bustag(int space, bus_addr_
 {
 
 	ptag->bst_cookie = NULL;
-	ptag->bst_parent = NULL;
 	ptag->bst_type = space;
-	ptag->bst_bus_barrier = nexus_bus_barrier;
 	return (addr);
 }
 
 /*
- * Allocate a bus tag.
+ * Allocate a bus tag
  */
 bus_space_tag_t
-sparc64_alloc_bus_tag(void *cookie, struct bus_space_tag *ptag, int type,
-    void *barrier)
+sparc64_alloc_bus_tag(void *cookie, int type)
 {
 	bus_space_tag_t bt;
 
@@ -734,42 +728,11 @@ sparc64_alloc_bus_tag(void *cookie, stru
 	if (bt == NULL)
 		return (NULL);
 	bt->bst_cookie = cookie;
-	bt->bst_parent = ptag;
 	bt->bst_type = type;
-	bt->bst_bus_barrier = barrier;
 	return (bt);
 }
 
-/*
- * Base bus space handlers.
- */
-
-static void
-nexus_bus_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
-    bus_size_t size, int flags)
-{
-
-	/*
-	 * We have lots of alternatives depending on whether we're
-	 * synchronizing loads with loads, loads with stores, stores
-	 * with loads, or stores with stores.  The only ones that seem
-	 * generic are #Sync and #MemIssue.  I'll use #Sync for safety.
-	 */
-	switch(flags) {
-	case BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE:
-	case BUS_SPACE_BARRIER_READ:
-	case BUS_SPACE_BARRIER_WRITE:
-		membar(Sync);
-		break;
-	default:
-		panic("%s: unknown flags", __func__);
-	}
-	return;
-}
-
 struct bus_space_tag nexus_bustag = {
 	NULL,				/* cookie */
-	NULL,				/* parent bus tag */
-	NEXUS_BUS_SPACE,		/* type */
-	nexus_bus_barrier,		/* bus_space_barrier */
+	NEXUS_BUS_SPACE			/* type */
 };


More information about the svn-src-head mailing list