Skip to content

Commit

Permalink
arm64: implement bs_sr_<N>
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bz authored and bz committed Nov 4, 2020
1 parent 65507f8 commit 48088ec
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions sys/arm64/arm64/bus_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,50 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 48088ec

Please sign in to comment.