Clean up various aspects of the MIPS generic busspace implementation:

1) Always implement missing bus space methods using a panic() stub rather
   than a NULL pointer.  This appeared not to trip up any existing device
   drivers, but due to the nature of the devices I'm supporting locally,
   I'm making use of some of the more obscure busspace methods, and
   panic() is a preferred failure mode.  For example, do this for the
   setregion methods.

2) Hook up several existing busspace method implementations that were
   provided in the file, but not actually present in the methods
   structure.  Especially, single-byte bus I/O routines.  This should
   allow bugs to be fixed in the Atheros 802.11 driver.

There are still some remaining unimplemented methods that would be
desirable to implement -- especially, 64-bit I/O calls that would
observably accelerate device performance on FPGA-based soft CPU cores
that are typically clocked an order of magnitude slower than
conventional hard core CPUs, but that remains for another day.

MFC after:	3 weeks
Discussed with:	jmallett, scottl
Sponsored by:	DARPA, AFRL
This commit is contained in:
Robert Watson 2012-05-02 08:23:53 +00:00
parent 79ee9286f2
commit e36985c9aa

View File

@ -99,8 +99,8 @@ static struct bus_space generic_space = {
generic_bs_subregion,
/* allocation/deallocation */
NULL,
NULL,
generic_bs_alloc,
generic_bs_free,
/* barrier */
generic_bs_barrier,
@ -109,91 +109,91 @@ static struct bus_space generic_space = {
generic_bs_r_1,
generic_bs_r_2,
generic_bs_r_4,
NULL,
generic_bs_r_8,
/* read multiple */
generic_bs_rm_1,
generic_bs_rm_2,
generic_bs_rm_4,
NULL,
generic_bs_rm_8,
/* read region */
generic_bs_rr_1,
generic_bs_rr_2,
generic_bs_rr_4,
NULL,
generic_bs_rr_8,
/* write (single) */
generic_bs_w_1,
generic_bs_w_2,
generic_bs_w_4,
NULL,
generic_bs_w_8,
/* write multiple */
generic_bs_wm_1,
generic_bs_wm_2,
generic_bs_wm_4,
NULL,
generic_bs_wm_8,
/* write region */
NULL,
generic_bs_wr_1,
generic_bs_wr_2,
generic_bs_wr_4,
NULL,
generic_bs_wr_8,
/* set multiple */
NULL,
NULL,
NULL,
NULL,
generic_bs_sm_1,
generic_bs_sm_2,
generic_bs_sm_4,
generic_bs_sm_8,
/* set region */
NULL,
generic_bs_sr_1,
generic_bs_sr_2,
generic_bs_sr_4,
NULL,
generic_bs_sr_8,
/* copy */
NULL,
generic_bs_c_1,
generic_bs_c_2,
NULL,
NULL,
generic_bs_c_4,
generic_bs_c_8,
/* read (single) stream */
generic_bs_r_1,
generic_bs_r_2,
generic_bs_r_4,
NULL,
generic_bs_r_8,
/* read multiple stream */
generic_bs_rm_1,
generic_bs_rm_2,
generic_bs_rm_4,
NULL,
generic_bs_rm_8,
/* read region stream */
generic_bs_rr_1,
generic_bs_rr_2,
generic_bs_rr_4,
NULL,
generic_bs_rr_8,
/* write (single) stream */
generic_bs_w_1,
generic_bs_w_2,
generic_bs_w_4,
NULL,
generic_bs_w_8,
/* write multiple stream */
generic_bs_wm_1,
generic_bs_wm_2,
generic_bs_wm_4,
NULL,
generic_bs_wm_8,
/* write region stream */
NULL,
generic_bs_wr_1,
generic_bs_wr_2,
generic_bs_wr_4,
NULL,
generic_bs_wr_8,
};
/* Ultra-gross kludge */
@ -253,6 +253,22 @@ generic_bs_subregion(void *t __unused, bus_space_handle_t handle,
return (0);
}
int
generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
bus_addr_t *bpap, bus_space_handle_t *bshp)
{
panic("%s: not implemented", __func__);
}
void
generic_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
{
panic("%s: not implemented", __func__);
}
uint8_t
generic_bs_r_1(void *t, bus_space_handle_t handle,
bus_size_t offset)
@ -277,6 +293,12 @@ generic_bs_r_4(void *t, bus_space_handle_t handle,
return (rd32(handle + offset));
}
uint64_t
generic_bs_r_8(void *t, bus_space_handle_t handle, bus_size_t offset)
{
panic("%s: not implemented", __func__);
}
void
generic_bs_rm_1(void *t, bus_space_handle_t bsh,
@ -307,6 +329,13 @@ generic_bs_rm_4(void *t, bus_space_handle_t bsh,
*addr++ = rd32(baddr);
}
void
generic_bs_rm_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
uint64_t *addr, size_t count)
{
panic("%s: not implemented", __func__);
}
/*
* Read `count' 1, 2, 4, or 8 byte quantities from bus space
@ -349,6 +378,14 @@ generic_bs_rr_4(void *t, bus_space_handle_t bsh,
}
}
void
generic_bs_rr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
uint64_t *addr, size_t count)
{
panic("%s: not implemented", __func__);
}
/*
* Write the 1, 2, 4, or 8 byte value `value' to bus space
* described by tag/handle/offset.
@ -377,6 +414,14 @@ generic_bs_w_4(void *t, bus_space_handle_t bsh,
wr32(bsh + offset, value);
}
void
generic_bs_w_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
uint64_t value)
{
panic("%s: not implemented", __func__);
}
/*
* Write `count' 1, 2, 4, or 8 byte quantities from the buffer
* provided to bus space described by tag/handle/offset.
@ -411,6 +456,14 @@ generic_bs_wm_4(void *t, bus_space_handle_t bsh,
wr32(baddr, *addr++);
}
void
generic_bs_wm_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
const uint64_t *addr, size_t count)
{
panic("%s: not implemented", __func__);
}
/*
* Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
* to bus space described by tag/handle starting at `offset'.
@ -451,6 +504,14 @@ generic_bs_wr_4(void *t, bus_space_handle_t bsh,
}
}
void
generic_bs_wr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
const uint64_t *addr, size_t count)
{
panic("%s: not implemented", __func__);
}
/*
* Write the 1, 2, 4, or 8 byte value `val' to bus space described
* by tag/handle/offset `count' times.
@ -485,6 +546,14 @@ generic_bs_sm_4(void *t, bus_space_handle_t bsh,
wr32(addr, value);
}
void
generic_bs_sm_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
uint64_t value, size_t count)
{
panic("%s: not implemented", __func__);
}
/*
* Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
* by tag/handle starting at `offset'.
@ -519,6 +588,14 @@ generic_bs_sr_4(void *t, bus_space_handle_t bsh,
wr32(addr, value);
}
void
generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
uint64_t value, size_t count)
{
panic("%s: not implemented", __func__);
}
/*
* Copy `count' 1, 2, 4, or 8 byte values from bus space starting
* at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
@ -583,6 +660,14 @@ generic_bs_c_4(void *t, bus_space_handle_t bsh1,
}
}
void
generic_bs_c_8(void *t, bus_space_handle_t bsh1, bus_size_t off1,
bus_space_handle_t bsh2, bus_size_t off2, size_t count)
{
panic("%s: not implemented", __func__);
}
void
generic_bs_barrier(void *t __unused,
bus_space_handle_t bsh __unused,