svn commit: r367327 - head/sys/arm64/arm64

Bjoern A. Zeeb bz at FreeBSD.org
Wed Nov 4 12:11:51 UTC 2020


Author: bz
Date: Wed Nov  4 12:11:50 2020
New Revision: 367327
URL: https://svnweb.freebsd.org/changeset/base/367327

Log:
  arm64: implement bs_sr_<N>
  
  Implement the bs_sr_<N> generic functions based on the generic
  mips implementation calling the generic bs_w_<N> functions in a loop.
  
  ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4()
  is NULL.  It seems ral(4) and ti(4) might be the only consumers of
  these functions I could find quickly so keeping them in C rather than asm.
  
  Reported by:	Steve Wheeler (https://redmine.pfsense.org/issues/11021)
  Reviewed by:	mmel
  MFC after:	3 days

Modified:
  head/sys/arm64/arm64/bus_machdep.c

Modified: head/sys/arm64/arm64/bus_machdep.c
==============================================================================
--- head/sys/arm64/arm64/bus_machdep.c	Wed Nov  4 12:07:33 2020	(r367326)
+++ head/sys/arm64/arm64/bus_machdep.c	Wed Nov  4 12:11:50 2020	(r367327)
@@ -128,6 +128,50 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, 
 	return (0);
 }
 
+/*
+ * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
+ * by tag/handle starting at `offset'.
+ */
+static void
+generic_bs_sr_1(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, uint8_t value, size_t count)
+{
+	bus_addr_t addr = bsh + offset;
+
+	for (; count != 0; count--, addr++)
+		generic_bs_w_1(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_2(void *t, bus_space_handle_t bsh,
+		       bus_size_t offset, uint16_t value, size_t count)
+{
+	bus_addr_t addr = bsh + offset;
+
+	for (; count != 0; count--, addr += 2)
+		generic_bs_w_2(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_4(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, uint32_t value, size_t count)
+{
+	bus_addr_t addr = bsh + offset;
+
+	for (; count != 0; count--, addr += 4)
+		generic_bs_w_4(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
+    uint64_t value, size_t count)
+{
+	bus_addr_t addr = bsh + offset;
+
+	for (; count != 0; count--, addr += 8)
+		generic_bs_w_8(t, bsh, addr, value);
+}
+
 struct bus_space memmap_bus = {
 	/* cookie */
 	.bs_cookie = NULL,
@@ -187,10 +231,10 @@ struct bus_space memmap_bus = {
 	.bs_sm_8 = NULL,
 
 	/* set region */
-	.bs_sr_1 = NULL,
-	.bs_sr_2 = NULL,
-	.bs_sr_4 = NULL,
-	.bs_sr_8 = NULL,
+	.bs_sr_1 =	generic_bs_sr_1,
+	.bs_sr_2 =	generic_bs_sr_2,
+	.bs_sr_4 =	generic_bs_sr_4,
+	.bs_sr_8 =	generic_bs_sr_8,
 
 	/* copy */
 	.bs_c_1 = NULL,


More information about the svn-src-all mailing list