Revise the arm bus_space implementation to avoid dereferencing the tag on
every operation to retrieve the bs_cookie value almost nothing actually uses. The bus_space struct contains a private data pointer (poorly named bs_cookie, now renamed to bs_privdata) which is used only by a few old armv4 xscale implementations. The bus_space functions were all defined to take this value as the first parameter instead of the bus_space_tag_t, requiring all the inline macro and function expansions to dereference the tag to pass it to another function, which never uses it. Now all the functions take the tag as the first parameter and retrieve the privdata if they need it. Also fix a couple bus_space_unmap() implementations that were calling kva_free() instead of pmap_unmapdev(). Discussed with: cognet
This commit is contained in:
parent
2d4ff62f00
commit
4098ccafa4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277460
@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
bs_protos(generic);
|
||||
|
||||
int
|
||||
generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
generic_bs_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
void *va;
|
||||
@ -74,7 +74,7 @@ generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
}
|
||||
|
||||
int
|
||||
generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
|
||||
generic_bs_alloc(bus_space_tag_t 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)
|
||||
{
|
||||
@ -84,21 +84,21 @@ generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
|
||||
|
||||
|
||||
void
|
||||
generic_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
generic_bs_unmap(bus_space_tag_t t, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
|
||||
pmap_unmapdev((vm_offset_t)h, size);
|
||||
}
|
||||
|
||||
void
|
||||
generic_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
generic_bs_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
|
||||
panic("generic_bs_free(): not implemented");
|
||||
}
|
||||
|
||||
int
|
||||
generic_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
generic_bs_subregion(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t size, bus_space_handle_t *nbshp)
|
||||
{
|
||||
|
||||
@ -107,7 +107,7 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
}
|
||||
|
||||
void
|
||||
generic_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
generic_bs_barrier(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t len, int flags)
|
||||
{
|
||||
|
||||
|
@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
|
||||
uint32_t at91_master_clock;
|
||||
|
||||
static int
|
||||
at91_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
at91_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
vm_paddr_t pa, endpa;
|
||||
@ -77,23 +77,18 @@ at91_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
}
|
||||
|
||||
static void
|
||||
at91_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
at91_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
vm_offset_t va, endva;
|
||||
vm_offset_t va;
|
||||
|
||||
if (t == 0)
|
||||
return;
|
||||
va = trunc_page((vm_offset_t)t);
|
||||
va = (vm_offset_t)h;
|
||||
if (va >= AT91_BASE && va <= AT91_BASE + 0xff00000)
|
||||
return;
|
||||
endva = round_page((vm_offset_t)t + size);
|
||||
|
||||
/* Free the kernel virtual mapping. */
|
||||
kva_free(va, endva - va);
|
||||
pmap_unmapdev(va, size);
|
||||
}
|
||||
|
||||
static int
|
||||
at91_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
at91_bs_subregion(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t size, bus_space_handle_t *nbshp)
|
||||
{
|
||||
|
||||
@ -102,7 +97,7 @@ at91_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
}
|
||||
|
||||
static void
|
||||
at91_barrier(void *t, bus_space_handle_t bsh, bus_size_t size, bus_size_t b,
|
||||
at91_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size, bus_size_t b,
|
||||
int a)
|
||||
{
|
||||
}
|
||||
|
@ -81,168 +81,168 @@
|
||||
|
||||
struct bus_space {
|
||||
/* cookie */
|
||||
void *bs_cookie;
|
||||
void *bs_privdata;
|
||||
|
||||
/* mapping/unmapping */
|
||||
int (*bs_map) (void *, bus_addr_t, bus_size_t,
|
||||
int (*bs_map) (bus_space_tag_t, bus_addr_t, bus_size_t,
|
||||
int, bus_space_handle_t *);
|
||||
void (*bs_unmap) (void *, bus_space_handle_t, bus_size_t);
|
||||
int (*bs_subregion) (void *, bus_space_handle_t,
|
||||
void (*bs_unmap) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
int (*bs_subregion) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, bus_size_t, bus_space_handle_t *);
|
||||
|
||||
/* allocation/deallocation */
|
||||
int (*bs_alloc) (void *, bus_addr_t, bus_addr_t,
|
||||
int (*bs_alloc) (bus_space_tag_t, bus_addr_t, bus_addr_t,
|
||||
bus_size_t, bus_size_t, bus_size_t, int,
|
||||
bus_addr_t *, bus_space_handle_t *);
|
||||
void (*bs_free) (void *, bus_space_handle_t,
|
||||
void (*bs_free) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t);
|
||||
|
||||
/* get kernel virtual address */
|
||||
/* barrier */
|
||||
void (*bs_barrier) (void *, bus_space_handle_t,
|
||||
void (*bs_barrier) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, bus_size_t, int);
|
||||
|
||||
/* read (single) */
|
||||
u_int8_t (*bs_r_1) (void *, bus_space_handle_t, bus_size_t);
|
||||
u_int16_t (*bs_r_2) (void *, bus_space_handle_t, bus_size_t);
|
||||
u_int32_t (*bs_r_4) (void *, bus_space_handle_t, bus_size_t);
|
||||
u_int64_t (*bs_r_8) (void *, bus_space_handle_t, bus_size_t);
|
||||
uint8_t (*bs_r_1) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
uint16_t (*bs_r_2) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
uint32_t (*bs_r_4) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
uint64_t (*bs_r_8) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
|
||||
/* read multiple */
|
||||
void (*bs_rm_1) (void *, bus_space_handle_t, bus_size_t,
|
||||
u_int8_t *, bus_size_t);
|
||||
void (*bs_rm_2) (void *, bus_space_handle_t, bus_size_t,
|
||||
u_int16_t *, bus_size_t);
|
||||
void (*bs_rm_4) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t *, bus_size_t);
|
||||
void (*bs_rm_8) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t *, bus_size_t);
|
||||
void (*bs_rm_1) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
uint8_t *, bus_size_t);
|
||||
void (*bs_rm_2) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
uint16_t *, bus_size_t);
|
||||
void (*bs_rm_4) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t *, bus_size_t);
|
||||
void (*bs_rm_8) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t *, bus_size_t);
|
||||
|
||||
/* read region */
|
||||
void (*bs_rr_1) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t *, bus_size_t);
|
||||
void (*bs_rr_2) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t *, bus_size_t);
|
||||
void (*bs_rr_4) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t *, bus_size_t);
|
||||
void (*bs_rr_8) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t *, bus_size_t);
|
||||
void (*bs_rr_1) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint8_t *, bus_size_t);
|
||||
void (*bs_rr_2) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint16_t *, bus_size_t);
|
||||
void (*bs_rr_4) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t *, bus_size_t);
|
||||
void (*bs_rr_8) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t *, bus_size_t);
|
||||
|
||||
/* write (single) */
|
||||
void (*bs_w_1) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t);
|
||||
void (*bs_w_2) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t);
|
||||
void (*bs_w_4) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t);
|
||||
void (*bs_w_8) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t);
|
||||
void (*bs_w_1) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint8_t);
|
||||
void (*bs_w_2) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint16_t);
|
||||
void (*bs_w_4) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t);
|
||||
void (*bs_w_8) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t);
|
||||
|
||||
/* write multiple */
|
||||
void (*bs_wm_1) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int8_t *, bus_size_t);
|
||||
void (*bs_wm_2) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int16_t *, bus_size_t);
|
||||
void (*bs_wm_4) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int32_t *, bus_size_t);
|
||||
void (*bs_wm_8) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int64_t *, bus_size_t);
|
||||
void (*bs_wm_1) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint8_t *, bus_size_t);
|
||||
void (*bs_wm_2) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint16_t *, bus_size_t);
|
||||
void (*bs_wm_4) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint32_t *, bus_size_t);
|
||||
void (*bs_wm_8) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint64_t *, bus_size_t);
|
||||
|
||||
/* write region */
|
||||
void (*bs_wr_1) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int8_t *, bus_size_t);
|
||||
void (*bs_wr_2) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int16_t *, bus_size_t);
|
||||
void (*bs_wr_4) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int32_t *, bus_size_t);
|
||||
void (*bs_wr_8) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int64_t *, bus_size_t);
|
||||
void (*bs_wr_1) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint8_t *, bus_size_t);
|
||||
void (*bs_wr_2) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint16_t *, bus_size_t);
|
||||
void (*bs_wr_4) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint32_t *, bus_size_t);
|
||||
void (*bs_wr_8) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint64_t *, bus_size_t);
|
||||
|
||||
/* set multiple */
|
||||
void (*bs_sm_1) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t, bus_size_t);
|
||||
void (*bs_sm_2) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t, bus_size_t);
|
||||
void (*bs_sm_4) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t, bus_size_t);
|
||||
void (*bs_sm_8) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t, bus_size_t);
|
||||
void (*bs_sm_1) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint8_t, bus_size_t);
|
||||
void (*bs_sm_2) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint16_t, bus_size_t);
|
||||
void (*bs_sm_4) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t, bus_size_t);
|
||||
void (*bs_sm_8) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t, bus_size_t);
|
||||
|
||||
/* set region */
|
||||
void (*bs_sr_1) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t, bus_size_t);
|
||||
void (*bs_sr_2) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t, bus_size_t);
|
||||
void (*bs_sr_4) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t, bus_size_t);
|
||||
void (*bs_sr_8) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t, bus_size_t);
|
||||
void (*bs_sr_1) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint8_t, bus_size_t);
|
||||
void (*bs_sr_2) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint16_t, bus_size_t);
|
||||
void (*bs_sr_4) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t, bus_size_t);
|
||||
void (*bs_sr_8) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t, bus_size_t);
|
||||
|
||||
/* copy */
|
||||
void (*bs_c_1) (void *, bus_space_handle_t, bus_size_t,
|
||||
void (*bs_c_1) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
void (*bs_c_2) (void *, bus_space_handle_t, bus_size_t,
|
||||
void (*bs_c_2) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
void (*bs_c_4) (void *, bus_space_handle_t, bus_size_t,
|
||||
void (*bs_c_4) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
void (*bs_c_8) (void *, bus_space_handle_t, bus_size_t,
|
||||
void (*bs_c_8) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
bus_space_handle_t, bus_size_t, bus_size_t);
|
||||
|
||||
/* read stream (single) */
|
||||
u_int8_t (*bs_r_1_s) (void *, bus_space_handle_t, bus_size_t);
|
||||
u_int16_t (*bs_r_2_s) (void *, bus_space_handle_t, bus_size_t);
|
||||
u_int32_t (*bs_r_4_s) (void *, bus_space_handle_t, bus_size_t);
|
||||
u_int64_t (*bs_r_8_s) (void *, bus_space_handle_t, bus_size_t);
|
||||
uint8_t (*bs_r_1_s) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
uint16_t (*bs_r_2_s) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
uint32_t (*bs_r_4_s) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
uint64_t (*bs_r_8_s) (bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||
|
||||
/* read multiple stream */
|
||||
void (*bs_rm_1_s) (void *, bus_space_handle_t, bus_size_t,
|
||||
u_int8_t *, bus_size_t);
|
||||
void (*bs_rm_2_s) (void *, bus_space_handle_t, bus_size_t,
|
||||
u_int16_t *, bus_size_t);
|
||||
void (*bs_rm_4_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t *, bus_size_t);
|
||||
void (*bs_rm_8_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t *, bus_size_t);
|
||||
void (*bs_rm_1_s) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
uint8_t *, bus_size_t);
|
||||
void (*bs_rm_2_s) (bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||
uint16_t *, bus_size_t);
|
||||
void (*bs_rm_4_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t *, bus_size_t);
|
||||
void (*bs_rm_8_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t *, bus_size_t);
|
||||
|
||||
/* read region stream */
|
||||
void (*bs_rr_1_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t *, bus_size_t);
|
||||
void (*bs_rr_2_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t *, bus_size_t);
|
||||
void (*bs_rr_4_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t *, bus_size_t);
|
||||
void (*bs_rr_8_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t *, bus_size_t);
|
||||
void (*bs_rr_1_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint8_t *, bus_size_t);
|
||||
void (*bs_rr_2_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint16_t *, bus_size_t);
|
||||
void (*bs_rr_4_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t *, bus_size_t);
|
||||
void (*bs_rr_8_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t *, bus_size_t);
|
||||
|
||||
/* write stream (single) */
|
||||
void (*bs_w_1_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int8_t);
|
||||
void (*bs_w_2_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int16_t);
|
||||
void (*bs_w_4_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int32_t);
|
||||
void (*bs_w_8_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, u_int64_t);
|
||||
void (*bs_w_1_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint8_t);
|
||||
void (*bs_w_2_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint16_t);
|
||||
void (*bs_w_4_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint32_t);
|
||||
void (*bs_w_8_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, uint64_t);
|
||||
|
||||
/* write multiple stream */
|
||||
void (*bs_wm_1_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int8_t *, bus_size_t);
|
||||
void (*bs_wm_2_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int16_t *, bus_size_t);
|
||||
void (*bs_wm_4_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int32_t *, bus_size_t);
|
||||
void (*bs_wm_8_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int64_t *, bus_size_t);
|
||||
void (*bs_wm_1_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint8_t *, bus_size_t);
|
||||
void (*bs_wm_2_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint16_t *, bus_size_t);
|
||||
void (*bs_wm_4_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint32_t *, bus_size_t);
|
||||
void (*bs_wm_8_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint64_t *, bus_size_t);
|
||||
|
||||
/* write region stream */
|
||||
void (*bs_wr_1_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int8_t *, bus_size_t);
|
||||
void (*bs_wr_2_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int16_t *, bus_size_t);
|
||||
void (*bs_wr_4_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int32_t *, bus_size_t);
|
||||
void (*bs_wr_8_s) (void *, bus_space_handle_t,
|
||||
bus_size_t, const u_int64_t *, bus_size_t);
|
||||
void (*bs_wr_1_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint8_t *, bus_size_t);
|
||||
void (*bs_wr_2_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint16_t *, bus_size_t);
|
||||
void (*bs_wr_4_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint32_t *, bus_size_t);
|
||||
void (*bs_wr_8_s) (bus_space_tag_t, bus_space_handle_t,
|
||||
bus_size_t, const uint64_t *, bus_size_t);
|
||||
};
|
||||
|
||||
|
||||
@ -253,19 +253,19 @@ struct bus_space {
|
||||
#define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size)
|
||||
|
||||
#define __bs_nonsingle(type, sz, t, h, o, a, c) \
|
||||
(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
|
||||
(*(t)->__bs_opname(type,sz))((t), h, o, a, c)
|
||||
#define __bs_set(type, sz, t, h, o, v, c) \
|
||||
(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c)
|
||||
(*(t)->__bs_opname(type,sz))((t), h, o, v, c)
|
||||
#define __bs_copy(sz, t, h1, o1, h2, o2, cnt) \
|
||||
(*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt)
|
||||
(*(t)->__bs_opname(c,sz))((t), h1, o1, h2, o2, cnt)
|
||||
|
||||
#define __bs_opname_s(op,size) __bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s)
|
||||
#define __bs_rs_s(sz, t, h, o) \
|
||||
(*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o)
|
||||
(*(t)->__bs_opname_s(r,sz))((t), h, o)
|
||||
#define __bs_ws_s(sz, t, h, o, v) \
|
||||
(*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v)
|
||||
(*(t)->__bs_opname_s(w,sz))((t), h, o, v)
|
||||
#define __bs_nonsingle_s(type, sz, t, h, o, a, c) \
|
||||
(*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
|
||||
(*(t)->__bs_opname_s(type,sz))((t), h, o, a, c)
|
||||
|
||||
|
||||
#define __generate_inline_bs_rs(IFN, MBR, TYP) \
|
||||
@ -276,7 +276,7 @@ struct bus_space {
|
||||
if (__predict_true(t->MBR == NULL)) \
|
||||
return (*(volatile TYP *)(h + o)); \
|
||||
else \
|
||||
return (t->MBR(t->bs_cookie, h, o)); \
|
||||
return (t->MBR(t, h, o)); \
|
||||
}
|
||||
|
||||
#define __generate_inline_bs_ws(IFN, MBR, TYP) \
|
||||
@ -287,34 +287,34 @@ struct bus_space {
|
||||
if (__predict_true(t->MBR == NULL)) \
|
||||
*(volatile TYP *)(h + o) = v; \
|
||||
else \
|
||||
t->MBR(t->bs_cookie, h, o, v); \
|
||||
t->MBR(t, h, o, v); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Mapping and unmapping operations.
|
||||
*/
|
||||
#define bus_space_map(t, a, s, c, hp) \
|
||||
(*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp))
|
||||
(*(t)->bs_map)((t), (a), (s), (c), (hp))
|
||||
#define bus_space_unmap(t, h, s) \
|
||||
(*(t)->bs_unmap)((t)->bs_cookie, (h), (s))
|
||||
(*(t)->bs_unmap)((t), (h), (s))
|
||||
#define bus_space_subregion(t, h, o, s, hp) \
|
||||
(*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
|
||||
(*(t)->bs_subregion)((t), (h), (o), (s), (hp))
|
||||
|
||||
|
||||
/*
|
||||
* Allocation and deallocation operations.
|
||||
*/
|
||||
#define bus_space_alloc(t, rs, re, s, a, b, c, ap, hp) \
|
||||
(*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b), \
|
||||
(*(t)->bs_alloc)((t), (rs), (re), (s), (a), (b), \
|
||||
(c), (ap), (hp))
|
||||
#define bus_space_free(t, h, s) \
|
||||
(*(t)->bs_free)((t)->bs_cookie, (h), (s))
|
||||
(*(t)->bs_free)((t), (h), (s))
|
||||
|
||||
/*
|
||||
* Bus barrier operations.
|
||||
*/
|
||||
#define bus_space_barrier(t, h, o, l, f) \
|
||||
(*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
|
||||
(*(t)->bs_barrier)((t), (h), (o), (l), (f))
|
||||
|
||||
#define BUS_SPACE_BARRIER_READ 0x01
|
||||
#define BUS_SPACE_BARRIER_WRITE 0x02
|
||||
@ -478,204 +478,204 @@ __generate_inline_bs_ws(bus_space_write_stream_8, bs_w_8_s, uint64_t);
|
||||
*/
|
||||
|
||||
#define bs_map_proto(f) \
|
||||
int __bs_c(f,_bs_map) (void *t, bus_addr_t addr, \
|
||||
int __bs_c(f,_bs_map) (bus_space_tag_t t, bus_addr_t addr, \
|
||||
bus_size_t size, int cacheable, bus_space_handle_t *bshp);
|
||||
|
||||
#define bs_unmap_proto(f) \
|
||||
void __bs_c(f,_bs_unmap) (void *t, bus_space_handle_t bsh, \
|
||||
void __bs_c(f,_bs_unmap) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t size);
|
||||
|
||||
#define bs_subregion_proto(f) \
|
||||
int __bs_c(f,_bs_subregion) (void *t, bus_space_handle_t bsh, \
|
||||
int __bs_c(f,_bs_subregion) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, bus_size_t size, \
|
||||
bus_space_handle_t *nbshp);
|
||||
|
||||
#define bs_alloc_proto(f) \
|
||||
int __bs_c(f,_bs_alloc) (void *t, bus_addr_t rstart, \
|
||||
int __bs_c(f,_bs_alloc) (bus_space_tag_t t, bus_addr_t rstart, \
|
||||
bus_addr_t rend, bus_size_t size, bus_size_t align, \
|
||||
bus_size_t boundary, int cacheable, bus_addr_t *addrp, \
|
||||
bus_space_handle_t *bshp);
|
||||
|
||||
#define bs_free_proto(f) \
|
||||
void __bs_c(f,_bs_free) (void *t, bus_space_handle_t bsh, \
|
||||
void __bs_c(f,_bs_free) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t size);
|
||||
|
||||
#define bs_mmap_proto(f) \
|
||||
int __bs_c(f,_bs_mmap) (struct cdev *, vm_offset_t, vm_paddr_t *, int);
|
||||
|
||||
#define bs_barrier_proto(f) \
|
||||
void __bs_c(f,_bs_barrier) (void *t, bus_space_handle_t bsh, \
|
||||
void __bs_c(f,_bs_barrier) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, bus_size_t len, int flags);
|
||||
|
||||
#define bs_r_1_proto(f) \
|
||||
u_int8_t __bs_c(f,_bs_r_1) (void *t, bus_space_handle_t bsh, \
|
||||
uint8_t __bs_c(f,_bs_r_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset);
|
||||
|
||||
#define bs_r_2_proto(f) \
|
||||
u_int16_t __bs_c(f,_bs_r_2) (void *t, bus_space_handle_t bsh, \
|
||||
uint16_t __bs_c(f,_bs_r_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset);
|
||||
|
||||
#define bs_r_4_proto(f) \
|
||||
u_int32_t __bs_c(f,_bs_r_4) (void *t, bus_space_handle_t bsh, \
|
||||
uint32_t __bs_c(f,_bs_r_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset);
|
||||
|
||||
#define bs_r_8_proto(f) \
|
||||
u_int64_t __bs_c(f,_bs_r_8) (void *t, bus_space_handle_t bsh, \
|
||||
uint64_t __bs_c(f,_bs_r_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset);
|
||||
|
||||
#define bs_r_1_s_proto(f) \
|
||||
u_int8_t __bs_c(f,_bs_r_1_s) (void *t, bus_space_handle_t bsh, \
|
||||
uint8_t __bs_c(f,_bs_r_1_s) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset);
|
||||
|
||||
#define bs_r_2_s_proto(f) \
|
||||
u_int16_t __bs_c(f,_bs_r_2_s) (void *t, bus_space_handle_t bsh, \
|
||||
uint16_t __bs_c(f,_bs_r_2_s) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset);
|
||||
|
||||
#define bs_r_4_s_proto(f) \
|
||||
u_int32_t __bs_c(f,_bs_r_4_s) (void *t, bus_space_handle_t bsh, \
|
||||
uint32_t __bs_c(f,_bs_r_4_s) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset);
|
||||
|
||||
#define bs_w_1_proto(f) \
|
||||
void __bs_c(f,_bs_w_1) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int8_t value);
|
||||
void __bs_c(f,_bs_w_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint8_t value);
|
||||
|
||||
#define bs_w_2_proto(f) \
|
||||
void __bs_c(f,_bs_w_2) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int16_t value);
|
||||
void __bs_c(f,_bs_w_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint16_t value);
|
||||
|
||||
#define bs_w_4_proto(f) \
|
||||
void __bs_c(f,_bs_w_4) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int32_t value);
|
||||
void __bs_c(f,_bs_w_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint32_t value);
|
||||
|
||||
#define bs_w_8_proto(f) \
|
||||
void __bs_c(f,_bs_w_8) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int64_t value);
|
||||
void __bs_c(f,_bs_w_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint64_t value);
|
||||
|
||||
#define bs_w_1_s_proto(f) \
|
||||
void __bs_c(f,_bs_w_1_s) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int8_t value);
|
||||
void __bs_c(f,_bs_w_1_s) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint8_t value);
|
||||
|
||||
#define bs_w_2_s_proto(f) \
|
||||
void __bs_c(f,_bs_w_2_s) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int16_t value);
|
||||
void __bs_c(f,_bs_w_2_s) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint16_t value);
|
||||
|
||||
#define bs_w_4_s_proto(f) \
|
||||
void __bs_c(f,_bs_w_4_s) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int32_t value);
|
||||
void __bs_c(f,_bs_w_4_s) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint32_t value);
|
||||
|
||||
#define bs_rm_1_proto(f) \
|
||||
void __bs_c(f,_bs_rm_1) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int8_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_rm_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint8_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_rm_2_proto(f) \
|
||||
void __bs_c(f,_bs_rm_2) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int16_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_rm_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint16_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_rm_4_proto(f) \
|
||||
void __bs_c(f,_bs_rm_4) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int32_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_rm_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint32_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_rm_8_proto(f) \
|
||||
void __bs_c(f,_bs_rm_8) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int64_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_rm_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint64_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wm_1_proto(f) \
|
||||
void __bs_c(f,_bs_wm_1) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int8_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_wm_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint8_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wm_2_proto(f) \
|
||||
void __bs_c(f,_bs_wm_2) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int16_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_wm_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint16_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wm_4_proto(f) \
|
||||
void __bs_c(f,_bs_wm_4) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int32_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_wm_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint32_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wm_8_proto(f) \
|
||||
void __bs_c(f,_bs_wm_8) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int64_t *addr, bus_size_t count);
|
||||
void __bs_c(f,_bs_wm_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint64_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_rr_1_proto(f) \
|
||||
void __bs_c(f, _bs_rr_1) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int8_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_rr_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint8_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_rr_2_proto(f) \
|
||||
void __bs_c(f, _bs_rr_2) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int16_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_rr_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint16_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_rr_4_proto(f) \
|
||||
void __bs_c(f, _bs_rr_4) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int32_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_rr_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint32_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_rr_8_proto(f) \
|
||||
void __bs_c(f, _bs_rr_8) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int64_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_rr_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint64_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wr_1_proto(f) \
|
||||
void __bs_c(f, _bs_wr_1) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int8_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_wr_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint8_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wr_2_proto(f) \
|
||||
void __bs_c(f, _bs_wr_2) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int16_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_wr_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint16_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wr_4_proto(f) \
|
||||
void __bs_c(f, _bs_wr_4) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int32_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_wr_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint32_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_wr_8_proto(f) \
|
||||
void __bs_c(f, _bs_wr_8) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const u_int64_t *addr, bus_size_t count);
|
||||
void __bs_c(f, _bs_wr_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, const uint64_t *addr, bus_size_t count);
|
||||
|
||||
#define bs_sm_1_proto(f) \
|
||||
void __bs_c(f,_bs_sm_1) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int8_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sm_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint8_t value, bus_size_t count);
|
||||
|
||||
#define bs_sm_2_proto(f) \
|
||||
void __bs_c(f,_bs_sm_2) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int16_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sm_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint16_t value, bus_size_t count);
|
||||
|
||||
#define bs_sm_4_proto(f) \
|
||||
void __bs_c(f,_bs_sm_4) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int32_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sm_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint32_t value, bus_size_t count);
|
||||
|
||||
#define bs_sm_8_proto(f) \
|
||||
void __bs_c(f,_bs_sm_8) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int64_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sm_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint64_t value, bus_size_t count);
|
||||
|
||||
#define bs_sr_1_proto(f) \
|
||||
void __bs_c(f,_bs_sr_1) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int8_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sr_1) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint8_t value, bus_size_t count);
|
||||
|
||||
#define bs_sr_2_proto(f) \
|
||||
void __bs_c(f,_bs_sr_2) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int16_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sr_2) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint16_t value, bus_size_t count);
|
||||
|
||||
#define bs_sr_4_proto(f) \
|
||||
void __bs_c(f,_bs_sr_4) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int32_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sr_4) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint32_t value, bus_size_t count);
|
||||
|
||||
#define bs_sr_8_proto(f) \
|
||||
void __bs_c(f,_bs_sr_8) (void *t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, u_int64_t value, bus_size_t count);
|
||||
void __bs_c(f,_bs_sr_8) (bus_space_tag_t t, bus_space_handle_t bsh, \
|
||||
bus_size_t offset, uint64_t value, bus_size_t count);
|
||||
|
||||
#define bs_c_1_proto(f) \
|
||||
void __bs_c(f,_bs_c_1) (void *t, bus_space_handle_t bsh1, \
|
||||
void __bs_c(f,_bs_c_1) (bus_space_tag_t t, bus_space_handle_t bsh1, \
|
||||
bus_size_t offset1, bus_space_handle_t bsh2, \
|
||||
bus_size_t offset2, bus_size_t count);
|
||||
|
||||
#define bs_c_2_proto(f) \
|
||||
void __bs_c(f,_bs_c_2) (void *t, bus_space_handle_t bsh1, \
|
||||
void __bs_c(f,_bs_c_2) (bus_space_tag_t t, bus_space_handle_t bsh1, \
|
||||
bus_size_t offset1, bus_space_handle_t bsh2, \
|
||||
bus_size_t offset2, bus_size_t count);
|
||||
|
||||
#define bs_c_4_proto(f) \
|
||||
void __bs_c(f,_bs_c_4) (void *t, bus_space_handle_t bsh1, \
|
||||
void __bs_c(f,_bs_c_4) (bus_space_tag_t t, bus_space_handle_t bsh1, \
|
||||
bus_size_t offset1, bus_space_handle_t bsh2, \
|
||||
bus_size_t offset2, bus_size_t count);
|
||||
|
||||
#define bs_c_8_proto(f) \
|
||||
void __bs_c(f,_bs_c_8) (void *t, bus_space_handle_t bsh1, \
|
||||
void __bs_c(f,_bs_c_8) (bus_space_tag_t t, bus_space_handle_t bsh1, \
|
||||
bus_size_t offset1, bus_space_handle_t bsh2, \
|
||||
bus_size_t offset2, bus_size_t count);
|
||||
|
||||
|
@ -46,7 +46,7 @@ bs_protos(generic_armv4);
|
||||
|
||||
struct bus_space _base_tag = {
|
||||
/* cookie */
|
||||
.bs_cookie = (void *) 0,
|
||||
.bs_privdata = (void *) 0,
|
||||
|
||||
/* mapping/unmapping */
|
||||
.bs_map = generic_bs_map,
|
||||
|
@ -46,7 +46,7 @@ bs_protos(generic_armv4);
|
||||
|
||||
struct bus_space _base_tag = {
|
||||
/* cookie */
|
||||
.bs_cookie = (void *) 0,
|
||||
.bs_privdata = (void *) 0,
|
||||
|
||||
/* mapping/unmapping */
|
||||
.bs_map = generic_bs_map,
|
||||
|
@ -182,7 +182,7 @@ i80321_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
|
||||
*bs = i80321_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
}
|
||||
|
||||
void
|
||||
@ -190,7 +190,7 @@ i80321_io_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
|
||||
*bs = i80321_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
|
||||
bs->bs_map = i80321_io_bs_map;
|
||||
bs->bs_unmap = i80321_io_bs_unmap;
|
||||
@ -204,7 +204,7 @@ i80321_mem_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
|
||||
*bs = i80321_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
|
||||
bs->bs_map = i80321_mem_bs_map;
|
||||
bs->bs_unmap = i80321_mem_bs_unmap;
|
||||
@ -216,7 +216,7 @@ i80321_mem_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
/* *** Routines shared by i80321, PCI IO, and PCI MEM. *** */
|
||||
|
||||
int
|
||||
i80321_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
i80321_bs_subregion(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t size, bus_space_handle_t *nbshp)
|
||||
{
|
||||
|
||||
@ -225,7 +225,7 @@ i80321_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
}
|
||||
|
||||
void
|
||||
i80321_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
i80321_bs_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t len, int flags)
|
||||
{
|
||||
|
||||
@ -236,7 +236,7 @@ i80321_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
|
||||
extern struct i80321_softc *i80321_softc;
|
||||
int
|
||||
i80321_io_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
i80321_io_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
struct i80321_softc *sc = i80321_softc;
|
||||
@ -264,14 +264,14 @@ i80321_io_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
}
|
||||
|
||||
void
|
||||
i80321_io_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
i80321_io_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
int
|
||||
i80321_io_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
i80321_io_bs_alloc(bus_space_tag_t tag, 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)
|
||||
{
|
||||
@ -280,7 +280,7 @@ i80321_io_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
}
|
||||
|
||||
void
|
||||
i80321_io_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
i80321_io_bs_free(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
|
||||
panic("i80321_io_bs_free(): not implemented");
|
||||
@ -290,33 +290,23 @@ i80321_io_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
/* *** Routines for PCI MEM. *** */
|
||||
extern int badaddr_read(void *, int, void *);
|
||||
int
|
||||
i80321_mem_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
i80321_mem_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
vm_paddr_t pa, endpa;
|
||||
|
||||
pa = trunc_page(bpa);
|
||||
endpa = round_page(bpa + size);
|
||||
|
||||
*bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa);
|
||||
|
||||
*bshp = (vm_offset_t)pmap_mapdev(bpa, size);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
i80321_mem_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
i80321_mem_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
vm_offset_t va, endva;
|
||||
|
||||
va = trunc_page((vm_offset_t)t);
|
||||
endva = va + round_page(size);
|
||||
|
||||
/* Free the kernel virtual mapping. */
|
||||
kva_free(va, endva - va);
|
||||
pmap_unmapdev((vm_offset_t)h, size);
|
||||
}
|
||||
|
||||
int
|
||||
i80321_mem_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
i80321_mem_bs_alloc(bus_space_tag_t tag, 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)
|
||||
{
|
||||
@ -325,7 +315,7 @@ i80321_mem_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
}
|
||||
|
||||
void
|
||||
i80321_mem_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
i80321_mem_bs_free(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
|
||||
panic("i80321_mem_bs_free(): not implemented");
|
||||
|
@ -183,7 +183,7 @@ i81342_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
|
||||
*bs = i81342_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
}
|
||||
|
||||
void
|
||||
@ -191,7 +191,7 @@ i81342_io_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
|
||||
*bs = i81342_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
|
||||
bs->bs_map = i81342_io_bs_map;
|
||||
bs->bs_unmap = i81342_io_bs_unmap;
|
||||
@ -205,7 +205,7 @@ i81342_mem_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
|
||||
*bs = i81342_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
|
||||
bs->bs_map = i81342_mem_bs_map;
|
||||
bs->bs_unmap = i81342_mem_bs_unmap;
|
||||
@ -217,7 +217,7 @@ i81342_mem_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
/* *** Routines shared by i81342, PCI IO, and PCI MEM. *** */
|
||||
|
||||
int
|
||||
i81342_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
i81342_bs_subregion(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t size, bus_space_handle_t *nbshp)
|
||||
{
|
||||
|
||||
@ -226,7 +226,7 @@ i81342_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
}
|
||||
|
||||
void
|
||||
i81342_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
i81342_bs_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t len, int flags)
|
||||
{
|
||||
|
||||
@ -236,7 +236,7 @@ i81342_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
/* *** Routines for PCI IO. *** */
|
||||
|
||||
int
|
||||
i81342_io_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
i81342_io_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
|
||||
@ -245,14 +245,14 @@ i81342_io_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
}
|
||||
|
||||
void
|
||||
i81342_io_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
i81342_io_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
int
|
||||
i81342_io_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
i81342_io_bs_alloc(bus_space_tag_t tag, 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)
|
||||
{
|
||||
@ -261,7 +261,7 @@ i81342_io_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
}
|
||||
|
||||
void
|
||||
i81342_io_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
i81342_io_bs_free(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
|
||||
panic("i81342_io_bs_free(): not implemented");
|
||||
@ -272,10 +272,10 @@ i81342_io_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
extern int badaddr_read(void *, int, void *);
|
||||
static vm_offset_t allocable = 0xe1000000;
|
||||
int
|
||||
i81342_mem_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
i81342_mem_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
struct i81342_pci_softc *sc = (struct i81342_pci_softc *)t;
|
||||
struct i81342_pci_softc *sc = (struct i81342_pci_softc *)tag->bs_privdata;
|
||||
struct i81342_pci_map *tmp;
|
||||
vm_offset_t addr, endaddr;
|
||||
vm_paddr_t paddr;
|
||||
@ -315,12 +315,12 @@ i81342_mem_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
}
|
||||
|
||||
void
|
||||
i81342_mem_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
i81342_mem_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
#if 0
|
||||
vm_offset_t va, endva;
|
||||
|
||||
va = trunc_page((vm_offset_t)t);
|
||||
va = trunc_page((vm_offset_t)h);
|
||||
endva = va + round_page(size);
|
||||
|
||||
/* Free the kernel virtual mapping. */
|
||||
@ -329,7 +329,7 @@ i81342_mem_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
}
|
||||
|
||||
int
|
||||
i81342_mem_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
i81342_mem_bs_alloc(bus_space_tag_t tag, 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)
|
||||
{
|
||||
@ -338,7 +338,7 @@ i81342_mem_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
}
|
||||
|
||||
void
|
||||
i81342_mem_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
i81342_mem_bs_free(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
|
||||
panic("i81342_mem_bs_free(): not implemented");
|
||||
|
@ -147,9 +147,9 @@ struct ata_avila_softc {
|
||||
|
||||
static void ata_avila_intr(void *);
|
||||
bs_protos(ata);
|
||||
static void ata_bs_rm_2_s(void *, bus_space_handle_t, bus_size_t,
|
||||
static void ata_bs_rm_2_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t,
|
||||
u_int16_t *, bus_size_t);
|
||||
static void ata_bs_wm_2_s(void *, bus_space_handle_t, bus_size_t,
|
||||
static void ata_bs_wm_2_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t,
|
||||
const u_int16_t *, bus_size_t);
|
||||
|
||||
static int
|
||||
@ -200,7 +200,7 @@ ata_avila_attach(device_t dev)
|
||||
* XXX probably should just make this generic for
|
||||
* accessing the expansion bus.
|
||||
*/
|
||||
sc->sc_expbus_tag.bs_cookie = sc; /* NB: backpointer */
|
||||
sc->sc_expbus_tag.bs_privdata = sc; /* NB: backpointer */
|
||||
/* read single */
|
||||
sc->sc_expbus_tag.bs_r_1 = ata_bs_r_1,
|
||||
sc->sc_expbus_tag.bs_r_2 = ata_bs_r_2,
|
||||
@ -355,25 +355,25 @@ disable_16(struct ata_avila_softc *sc)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
ata_bs_r_1(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
ata_bs_r_1(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
|
||||
return bus_space_read_1(sc->sc_iot, h, o);
|
||||
}
|
||||
|
||||
void
|
||||
ata_bs_w_1(void *t, bus_space_handle_t h, bus_size_t o, u_int8_t v)
|
||||
ata_bs_w_1(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o, u_int8_t v)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
|
||||
bus_space_write_1(sc->sc_iot, h, o, v);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ata_bs_r_2(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
ata_bs_r_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
uint16_t v;
|
||||
|
||||
enable_16(sc);
|
||||
@ -383,9 +383,9 @@ ata_bs_r_2(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
}
|
||||
|
||||
void
|
||||
ata_bs_w_2(void *t, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
ata_bs_w_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
|
||||
enable_16(sc);
|
||||
bus_space_write_2(sc->sc_iot, h, o, v);
|
||||
@ -393,10 +393,10 @@ ata_bs_w_2(void *t, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
}
|
||||
|
||||
void
|
||||
ata_bs_rm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
ata_bs_rm_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
|
||||
enable_16(sc);
|
||||
bus_space_read_multi_2(sc->sc_iot, h, o, d, c);
|
||||
@ -404,10 +404,10 @@ ata_bs_rm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
}
|
||||
|
||||
void
|
||||
ata_bs_wm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
ata_bs_wm_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
const u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
|
||||
enable_16(sc);
|
||||
bus_space_write_multi_2(sc->sc_iot, h, o, d, c);
|
||||
@ -417,10 +417,10 @@ ata_bs_wm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
/* XXX workaround ata driver by (incorrectly) byte swapping stream cases */
|
||||
|
||||
void
|
||||
ata_bs_rm_2_s(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
ata_bs_rm_2_s(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
uint16_t v;
|
||||
bus_size_t i;
|
||||
|
||||
@ -437,10 +437,10 @@ ata_bs_rm_2_s(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
}
|
||||
|
||||
void
|
||||
ata_bs_wm_2_s(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
ata_bs_wm_2_s(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
const u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct ata_avila_softc *sc = t;
|
||||
struct ata_avila_softc *sc = tag->bs_privdata;
|
||||
bus_size_t i;
|
||||
|
||||
enable_16(sc);
|
||||
|
@ -83,9 +83,9 @@ disable_16(struct ixp425_softc *sc, bus_size_t cs)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
cambria_bs_r_1(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
cambria_bs_r_1(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
uint8_t v;
|
||||
|
||||
@ -96,9 +96,9 @@ cambria_bs_r_1(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
}
|
||||
|
||||
static void
|
||||
cambria_bs_w_1(void *t, bus_space_handle_t h, bus_size_t o, u_int8_t v)
|
||||
cambria_bs_w_1(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o, u_int8_t v)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
|
||||
EXP_LOCK(exp);
|
||||
@ -107,9 +107,9 @@ cambria_bs_w_1(void *t, bus_space_handle_t h, bus_size_t o, u_int8_t v)
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
cambria_bs_r_2(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
cambria_bs_r_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
uint16_t v;
|
||||
|
||||
@ -122,9 +122,9 @@ cambria_bs_r_2(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
}
|
||||
|
||||
static void
|
||||
cambria_bs_w_2(void *t, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
cambria_bs_w_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
|
||||
EXP_LOCK(exp);
|
||||
@ -135,10 +135,10 @@ cambria_bs_w_2(void *t, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
}
|
||||
|
||||
static void
|
||||
cambria_bs_rm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
cambria_bs_rm_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
|
||||
EXP_LOCK(exp);
|
||||
@ -149,10 +149,10 @@ cambria_bs_rm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
}
|
||||
|
||||
static void
|
||||
cambria_bs_wm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
cambria_bs_wm_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
const u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
|
||||
EXP_LOCK(exp);
|
||||
@ -165,10 +165,10 @@ cambria_bs_wm_2(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
/* XXX workaround ata driver by (incorrectly) byte swapping stream cases */
|
||||
|
||||
static void
|
||||
cambria_bs_rm_2_s(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
cambria_bs_rm_2_s(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
uint16_t v;
|
||||
bus_size_t i;
|
||||
@ -188,10 +188,10 @@ cambria_bs_rm_2_s(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
}
|
||||
|
||||
static void
|
||||
cambria_bs_wm_2_s(void *t, bus_space_handle_t h, bus_size_t o,
|
||||
cambria_bs_wm_2_s(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o,
|
||||
const u_int16_t *d, bus_size_t c)
|
||||
{
|
||||
struct expbus_softc *exp = t;
|
||||
struct expbus_softc *exp = tag->bs_privdata;
|
||||
struct ixp425_softc *sc = exp->sc;
|
||||
bus_size_t i;
|
||||
|
||||
@ -244,7 +244,7 @@ cambria_exp_bus_init(struct ixp425_softc *sc)
|
||||
c3.sc = sc;
|
||||
c3.csoff = EXP_TIMING_CS3_OFFSET;
|
||||
EXP_LOCK_INIT(&c3);
|
||||
cambria_exp_bs_tag.bs_cookie = &c3;
|
||||
cambria_exp_bs_tag.bs_privdata = &c3;
|
||||
|
||||
cs3 = EXP_BUS_READ_4(sc, EXP_TIMING_CS3_OFFSET);
|
||||
/* XXX force slowest possible timings and byte mode */
|
||||
|
@ -66,7 +66,7 @@ bs_protos(generic_armv4);
|
||||
|
||||
struct bus_space ixp425_a4x_bs_tag = {
|
||||
/* cookie */
|
||||
.bs_cookie = (void *) 0,
|
||||
.bs_privdata = (void *) 0,
|
||||
|
||||
/* mapping/unmapping */
|
||||
.bs_map = generic_bs_map,
|
||||
|
@ -72,30 +72,30 @@ bs_protos(ixp425_pci_io);
|
||||
bs_protos(ixp425_pci_mem);
|
||||
|
||||
/* special I/O functions */
|
||||
static u_int8_t _pci_io_bs_r_1(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int16_t _pci_io_bs_r_2(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int32_t _pci_io_bs_r_4(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int8_t _pci_io_bs_r_1(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static u_int16_t _pci_io_bs_r_2(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static u_int32_t _pci_io_bs_r_4(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
|
||||
static void _pci_io_bs_w_1(void *, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static void _pci_io_bs_w_2(void *, bus_space_handle_t, bus_size_t, u_int16_t);
|
||||
static void _pci_io_bs_w_4(void *, bus_space_handle_t, bus_size_t, u_int32_t);
|
||||
static void _pci_io_bs_w_1(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static void _pci_io_bs_w_2(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int16_t);
|
||||
static void _pci_io_bs_w_4(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int32_t);
|
||||
|
||||
#ifdef __ARMEB__
|
||||
static u_int8_t _pci_io_bs_r_1_s(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int16_t _pci_io_bs_r_2_s(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int32_t _pci_io_bs_r_4_s(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int8_t _pci_io_bs_r_1_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static u_int16_t _pci_io_bs_r_2_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static u_int32_t _pci_io_bs_r_4_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
|
||||
static void _pci_io_bs_w_1_s(void *, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static void _pci_io_bs_w_2_s(void *, bus_space_handle_t, bus_size_t, u_int16_t);
|
||||
static void _pci_io_bs_w_4_s(void *, bus_space_handle_t, bus_size_t, u_int32_t);
|
||||
static void _pci_io_bs_w_1_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static void _pci_io_bs_w_2_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int16_t);
|
||||
static void _pci_io_bs_w_4_s(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int32_t);
|
||||
|
||||
static u_int8_t _pci_mem_bs_r_1(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int16_t _pci_mem_bs_r_2(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int32_t _pci_mem_bs_r_4(void *, bus_space_handle_t, bus_size_t);
|
||||
static u_int8_t _pci_mem_bs_r_1(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static u_int16_t _pci_mem_bs_r_2(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static u_int32_t _pci_mem_bs_r_4(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
|
||||
static void _pci_mem_bs_w_1(void *, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static void _pci_mem_bs_w_2(void *, bus_space_handle_t, bus_size_t, u_int16_t);
|
||||
static void _pci_mem_bs_w_4(void *, bus_space_handle_t, bus_size_t, u_int32_t);
|
||||
static void _pci_mem_bs_w_1(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static void _pci_mem_bs_w_2(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int16_t);
|
||||
static void _pci_mem_bs_w_4(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int32_t);
|
||||
#endif
|
||||
|
||||
struct bus_space ixp425_pci_io_bs_tag_template = {
|
||||
@ -146,7 +146,7 @@ void
|
||||
ixp425_io_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
*bs = ixp425_pci_io_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
}
|
||||
|
||||
struct bus_space ixp425_pci_mem_bs_tag_template = {
|
||||
@ -202,12 +202,12 @@ void
|
||||
ixp425_mem_bs_init(bus_space_tag_t bs, void *cookie)
|
||||
{
|
||||
*bs = ixp425_pci_mem_bs_tag_template;
|
||||
bs->bs_cookie = cookie;
|
||||
bs->bs_privdata = cookie;
|
||||
}
|
||||
|
||||
/* common routine */
|
||||
int
|
||||
ixp425_pci_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
ixp425_pci_bs_subregion(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t size, bus_space_handle_t *nbshp)
|
||||
{
|
||||
*nbshp = bsh + offset;
|
||||
@ -215,7 +215,7 @@ ixp425_pci_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
}
|
||||
|
||||
void
|
||||
ixp425_pci_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
ixp425_pci_bs_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
|
||||
bus_size_t len, int flags)
|
||||
{
|
||||
/* NULL */
|
||||
@ -223,7 +223,7 @@ ixp425_pci_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
|
||||
|
||||
/* io bs */
|
||||
int
|
||||
ixp425_pci_io_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
|
||||
ixp425_pci_io_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size,
|
||||
int cacheable, bus_space_handle_t *bshp)
|
||||
{
|
||||
*bshp = bpa;
|
||||
@ -231,13 +231,13 @@ ixp425_pci_io_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
|
||||
}
|
||||
|
||||
void
|
||||
ixp425_pci_io_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
ixp425_pci_io_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
int
|
||||
ixp425_pci_io_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
ixp425_pci_io_bs_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend,
|
||||
bus_size_t size, bus_size_t alignment, bus_size_t boundary, int cacheable,
|
||||
bus_addr_t *bpap, bus_space_handle_t *bshp)
|
||||
{
|
||||
@ -245,14 +245,14 @@ ixp425_pci_io_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
}
|
||||
|
||||
void
|
||||
ixp425_pci_io_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
ixp425_pci_io_bs_free(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
panic("ixp425_pci_io_bs_free(): not implemented\n");
|
||||
}
|
||||
|
||||
/* special I/O functions */
|
||||
static __inline u_int32_t
|
||||
_bs_r(void *v, bus_space_handle_t ioh, bus_size_t off, u_int32_t be)
|
||||
_bs_r(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off, u_int32_t be)
|
||||
{
|
||||
u_int32_t data;
|
||||
|
||||
@ -266,75 +266,75 @@ _bs_r(void *v, bus_space_handle_t ioh, bus_size_t off, u_int32_t be)
|
||||
}
|
||||
|
||||
static u_int8_t
|
||||
_pci_io_bs_r_1(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_io_bs_r_1(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~(1U << n)) << NP_CBE_SHIFT;
|
||||
data = _bs_r(v, ioh, off, be);
|
||||
data = _bs_r(tag, ioh, off, be);
|
||||
|
||||
return data >> (8 * n);
|
||||
}
|
||||
|
||||
static u_int16_t
|
||||
_pci_io_bs_r_2(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_io_bs_r_2(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~((1U << n) | (1U << (n + 1)))) << NP_CBE_SHIFT;
|
||||
data = _bs_r(v, ioh, off, be);
|
||||
data = _bs_r(tag, ioh, off, be);
|
||||
|
||||
return data >> (8 * n);
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
_pci_io_bs_r_4(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_io_bs_r_4(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
u_int32_t data;
|
||||
|
||||
data = _bs_r(v, ioh, off, 0);
|
||||
data = _bs_r(tag, ioh, off, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
#ifdef __ARMEB__
|
||||
static u_int8_t
|
||||
_pci_io_bs_r_1_s(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_io_bs_r_1_s(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~(1U << n)) << NP_CBE_SHIFT;
|
||||
data = _bs_r(v, ioh, off, be);
|
||||
data = _bs_r(tag, ioh, off, be);
|
||||
|
||||
return data >> (8 * n);
|
||||
}
|
||||
|
||||
static u_int16_t
|
||||
_pci_io_bs_r_2_s(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_io_bs_r_2_s(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~((1U << n) | (1U << (n + 1)))) << NP_CBE_SHIFT;
|
||||
data = _bs_r(v, ioh, off, be);
|
||||
data = _bs_r(tag, ioh, off, be);
|
||||
|
||||
return data >> (8 * n);
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
_pci_io_bs_r_4_s(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_io_bs_r_4_s(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
u_int32_t data;
|
||||
|
||||
data = _bs_r(v, ioh, off, 0);
|
||||
data = _bs_r(tag, ioh, off, 0);
|
||||
return le32toh(data);
|
||||
}
|
||||
#endif /* __ARMEB__ */
|
||||
|
||||
static __inline void
|
||||
_bs_w(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_bs_w(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int32_t be, u_int32_t data)
|
||||
{
|
||||
CSR_WRITE_4(PCI_NP_AD, (ioh + off) & ~3);
|
||||
@ -345,7 +345,7 @@ _bs_w(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_io_bs_w_1(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_io_bs_w_1(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int8_t val)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
@ -353,11 +353,11 @@ _pci_io_bs_w_1(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~(1U << n)) << NP_CBE_SHIFT;
|
||||
data = val << (8 * n);
|
||||
_bs_w(v, ioh, off, be, data);
|
||||
_bs_w(tag, ioh, off, be, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_io_bs_w_2(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_io_bs_w_2(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int16_t val)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
@ -365,19 +365,19 @@ _pci_io_bs_w_2(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~((1U << n) | (1U << (n + 1)))) << NP_CBE_SHIFT;
|
||||
data = val << (8 * n);
|
||||
_bs_w(v, ioh, off, be, data);
|
||||
_bs_w(tag, ioh, off, be, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_io_bs_w_4(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_io_bs_w_4(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int32_t val)
|
||||
{
|
||||
_bs_w(v, ioh, off, 0, val);
|
||||
_bs_w(tag, ioh, off, 0, val);
|
||||
}
|
||||
|
||||
#ifdef __ARMEB__
|
||||
static void
|
||||
_pci_io_bs_w_1_s(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_io_bs_w_1_s(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int8_t val)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
@ -385,11 +385,11 @@ _pci_io_bs_w_1_s(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~(1U << n)) << NP_CBE_SHIFT;
|
||||
data = val << (8 * n);
|
||||
_bs_w(v, ioh, off, be, data);
|
||||
_bs_w(tag, ioh, off, be, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_io_bs_w_2_s(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_io_bs_w_2_s(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int16_t val)
|
||||
{
|
||||
u_int32_t data, n, be;
|
||||
@ -397,46 +397,35 @@ _pci_io_bs_w_2_s(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
n = (ioh + off) % 4;
|
||||
be = (0xf & ~((1U << n) | (1U << (n + 1)))) << NP_CBE_SHIFT;
|
||||
data = val << (8 * n);
|
||||
_bs_w(v, ioh, off, be, data);
|
||||
_bs_w(tag, ioh, off, be, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_io_bs_w_4_s(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_io_bs_w_4_s(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int32_t val)
|
||||
{
|
||||
_bs_w(v, ioh, off, 0, htole32(val));
|
||||
_bs_w(tag, ioh, off, 0, htole32(val));
|
||||
}
|
||||
#endif /* __ARMEB__ */
|
||||
|
||||
/* mem bs */
|
||||
int
|
||||
ixp425_pci_mem_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
|
||||
ixp425_pci_mem_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size,
|
||||
int cacheable, bus_space_handle_t *bshp)
|
||||
{
|
||||
vm_paddr_t pa, endpa;
|
||||
|
||||
pa = trunc_page(bpa);
|
||||
endpa = round_page(bpa + size);
|
||||
|
||||
*bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa);
|
||||
|
||||
*bshp = (vm_offset_t)pmap_mapdev(bpa, size);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ixp425_pci_mem_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
|
||||
ixp425_pci_mem_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
|
||||
{
|
||||
vm_offset_t va, endva;
|
||||
|
||||
va = trunc_page((vm_offset_t)t);
|
||||
endva = va + round_page(size);
|
||||
|
||||
/* Free the kernel virtual mapping. */
|
||||
kva_free(va, endva - va);
|
||||
pmap_unmapdev((vm_offset_t)h, size);
|
||||
}
|
||||
|
||||
int
|
||||
ixp425_pci_mem_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
ixp425_pci_mem_bs_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend,
|
||||
bus_size_t size, bus_size_t alignment, bus_size_t boundary, int cacheable,
|
||||
bus_addr_t *bpap, bus_space_handle_t *bshp)
|
||||
{
|
||||
@ -444,52 +433,52 @@ ixp425_pci_mem_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
|
||||
}
|
||||
|
||||
void
|
||||
ixp425_pci_mem_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
|
||||
ixp425_pci_mem_bs_free(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
panic("ixp425_mem_bs_free(): not implemented\n");
|
||||
}
|
||||
|
||||
#ifdef __ARMEB__
|
||||
static u_int8_t
|
||||
_pci_mem_bs_r_1(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_mem_bs_r_1(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
return ixp425_pci_mem_bs_r_1(v, ioh, off);
|
||||
return ixp425_pci_mem_bs_r_1(tag, ioh, off);
|
||||
}
|
||||
|
||||
static u_int16_t
|
||||
_pci_mem_bs_r_2(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_mem_bs_r_2(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
return (ixp425_pci_mem_bs_r_2(v, ioh, off));
|
||||
return (ixp425_pci_mem_bs_r_2(tag, ioh, off));
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
_pci_mem_bs_r_4(void *v, bus_space_handle_t ioh, bus_size_t off)
|
||||
_pci_mem_bs_r_4(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off)
|
||||
{
|
||||
u_int32_t data;
|
||||
|
||||
data = ixp425_pci_mem_bs_r_4(v, ioh, off);
|
||||
data = ixp425_pci_mem_bs_r_4(tag, ioh, off);
|
||||
return (le32toh(data));
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_mem_bs_w_1(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_mem_bs_w_1(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int8_t val)
|
||||
{
|
||||
ixp425_pci_mem_bs_w_1(v, ioh, off, val);
|
||||
ixp425_pci_mem_bs_w_1(tag, ioh, off, val);
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_mem_bs_w_2(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_mem_bs_w_2(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int16_t val)
|
||||
{
|
||||
ixp425_pci_mem_bs_w_2(v, ioh, off, val);
|
||||
ixp425_pci_mem_bs_w_2(tag, ioh, off, val);
|
||||
}
|
||||
|
||||
static void
|
||||
_pci_mem_bs_w_4(void *v, bus_space_handle_t ioh, bus_size_t off,
|
||||
_pci_mem_bs_w_4(bus_space_tag_t tag, bus_space_handle_t ioh, bus_size_t off,
|
||||
u_int32_t val)
|
||||
{
|
||||
ixp425_pci_mem_bs_w_4(v, ioh, off, htole32(val));
|
||||
ixp425_pci_mem_bs_w_4(tag, ioh, off, htole32(val));
|
||||
}
|
||||
#endif /* __ARMEB__ */
|
||||
|
||||
|
@ -63,7 +63,7 @@ bs_protos(generic_armv4);
|
||||
|
||||
struct bus_space ixp425_bs_tag = {
|
||||
/* cookie */
|
||||
.bs_cookie = (void *) 0,
|
||||
.bs_privdata = (void *) 0,
|
||||
|
||||
/* mapping/unmapping */
|
||||
.bs_map = generic_bs_map,
|
||||
|
@ -145,7 +145,7 @@ pxa_obio_tag_init()
|
||||
{
|
||||
|
||||
bcopy(&_base_tag, &_obio_tag, sizeof(struct bus_space));
|
||||
_obio_tag.bs_cookie = (void *)PXA2X0_PERIPH_OFFSET;
|
||||
_obio_tag.bs_privdata = (void *)PXA2X0_PERIPH_OFFSET;
|
||||
obio_tag = &_obio_tag;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ pxa_bus_tag_alloc(bus_addr_t offset)
|
||||
}
|
||||
|
||||
bcopy(&_base_tag, tag, sizeof(struct bus_space));
|
||||
tag->bs_cookie = (void *)offset;
|
||||
tag->bs_privdata = (void *)offset;
|
||||
|
||||
return ((bus_space_tag_t)tag);
|
||||
}
|
||||
@ -169,11 +169,11 @@ pxa_bus_tag_alloc(bus_addr_t offset)
|
||||
|
||||
#define READ_SINGLE(type, proto, base) \
|
||||
type \
|
||||
proto(void *cookie, bus_space_handle_t bsh, bus_size_t offset) \
|
||||
proto(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset) \
|
||||
{ \
|
||||
bus_addr_t tag_offset; \
|
||||
type value; \
|
||||
tag_offset = (bus_addr_t)cookie; \
|
||||
tag_offset = (bus_addr_t)tag->bs_privdata; \
|
||||
value = base(NULL, bsh + tag_offset, offset); \
|
||||
return (value); \
|
||||
}
|
||||
@ -186,11 +186,11 @@ READ_SINGLE(u_int32_t, pxa_bs_r_4, generic_bs_r_4)
|
||||
|
||||
#define WRITE_SINGLE(type, proto, base) \
|
||||
void \
|
||||
proto(void *cookie, bus_space_handle_t bsh, bus_size_t offset, \
|
||||
proto(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, \
|
||||
type value) \
|
||||
{ \
|
||||
bus_addr_t tag_offset; \
|
||||
tag_offset = (bus_addr_t)cookie; \
|
||||
tag_offset = (bus_addr_t)tag->bs_privdata; \
|
||||
base(NULL, bsh + tag_offset, offset, value); \
|
||||
}
|
||||
|
||||
@ -202,11 +202,11 @@ WRITE_SINGLE(u_int32_t, pxa_bs_w_4, generic_bs_w_4)
|
||||
|
||||
#define READ_MULTI(type, proto, base) \
|
||||
void \
|
||||
proto(void *cookie, bus_space_handle_t bsh, bus_size_t offset, \
|
||||
proto(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, \
|
||||
type *dest, bus_size_t count) \
|
||||
{ \
|
||||
bus_addr_t tag_offset; \
|
||||
tag_offset = (bus_addr_t)cookie; \
|
||||
tag_offset = (bus_addr_t)tag->bs_privdata; \
|
||||
base(NULL, bsh + tag_offset, offset, dest, count); \
|
||||
}
|
||||
|
||||
@ -219,11 +219,11 @@ READ_MULTI(u_int8_t, pxa_bs_rr_1, generic_bs_rr_1)
|
||||
|
||||
#define WRITE_MULTI(type, proto, base) \
|
||||
void \
|
||||
proto(void *cookie, bus_space_handle_t bsh, bus_size_t offset, \
|
||||
proto(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, \
|
||||
const type *src, bus_size_t count) \
|
||||
{ \
|
||||
bus_addr_t tag_offset; \
|
||||
tag_offset = (bus_addr_t)cookie; \
|
||||
tag_offset = (bus_addr_t)tag->bs_privdata; \
|
||||
base(NULL, bsh + tag_offset, offset, src, count); \
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,12 @@ struct ixp_ehci_softc {
|
||||
static device_attach_t ehci_ixp_attach;
|
||||
static device_detach_t ehci_ixp_detach;
|
||||
|
||||
static uint8_t ehci_bs_r_1(void *, bus_space_handle_t, bus_size_t);
|
||||
static void ehci_bs_w_1(void *, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static uint16_t ehci_bs_r_2(void *, bus_space_handle_t, bus_size_t);
|
||||
static void ehci_bs_w_2(void *, bus_space_handle_t, bus_size_t, uint16_t);
|
||||
static uint32_t ehci_bs_r_4(void *, bus_space_handle_t, bus_size_t);
|
||||
static void ehci_bs_w_4(void *, bus_space_handle_t, bus_size_t, uint32_t);
|
||||
static uint8_t ehci_bs_r_1(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static void ehci_bs_w_1(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, u_int8_t);
|
||||
static uint16_t ehci_bs_r_2(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static void ehci_bs_w_2(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, uint16_t);
|
||||
static uint32_t ehci_bs_r_4(bus_space_tag_t tag, bus_space_handle_t, bus_size_t);
|
||||
static void ehci_bs_w_4(bus_space_tag_t tag, bus_space_handle_t, bus_size_t, uint32_t);
|
||||
|
||||
static int
|
||||
ehci_ixp_probe(device_t self)
|
||||
@ -132,7 +132,7 @@ ehci_ixp_attach(device_t self)
|
||||
* done with bus_space_subregion.
|
||||
*/
|
||||
isc->iot = rman_get_bustag(sc->sc_io_res);
|
||||
isc->tag.bs_cookie = isc->iot;
|
||||
isc->tag.bs_privdata = isc->iot;
|
||||
/* read single */
|
||||
isc->tag.bs_r_1 = ehci_bs_r_1,
|
||||
isc->tag.bs_r_2 = ehci_bs_r_2,
|
||||
@ -252,41 +252,41 @@ ehci_ixp_detach(device_t self)
|
||||
*/
|
||||
|
||||
static uint8_t
|
||||
ehci_bs_r_1(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
ehci_bs_r_1(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o)
|
||||
{
|
||||
return bus_space_read_1((bus_space_tag_t) t, h,
|
||||
return bus_space_read_1((bus_space_tag_t)tag->bs_privdata, h,
|
||||
0x100 + (o &~ 3) + (3 - (o & 3)));
|
||||
}
|
||||
|
||||
static void
|
||||
ehci_bs_w_1(void *t, bus_space_handle_t h, bus_size_t o, u_int8_t v)
|
||||
ehci_bs_w_1(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o, u_int8_t v)
|
||||
{
|
||||
panic("%s", __func__);
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
ehci_bs_r_2(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
ehci_bs_r_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o)
|
||||
{
|
||||
return bus_space_read_2((bus_space_tag_t) t, h,
|
||||
return bus_space_read_2((bus_space_tag_t)tag->bs_privdata, h,
|
||||
0x100 + (o &~ 3) + (2 - (o & 3)));
|
||||
}
|
||||
|
||||
static void
|
||||
ehci_bs_w_2(void *t, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
ehci_bs_w_2(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o, uint16_t v)
|
||||
{
|
||||
panic("%s", __func__);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
ehci_bs_r_4(void *t, bus_space_handle_t h, bus_size_t o)
|
||||
ehci_bs_r_4(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o)
|
||||
{
|
||||
return bus_space_read_4((bus_space_tag_t) t, h, 0x100 + o);
|
||||
return bus_space_read_4((bus_space_tag_t) tag->bs_privdata, h, 0x100 + o);
|
||||
}
|
||||
|
||||
static void
|
||||
ehci_bs_w_4(void *t, bus_space_handle_t h, bus_size_t o, uint32_t v)
|
||||
ehci_bs_w_4(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t o, uint32_t v)
|
||||
{
|
||||
bus_space_write_4((bus_space_tag_t) t, h, 0x100 + o, v);
|
||||
bus_space_write_4((bus_space_tag_t) tag->bs_privdata, h, 0x100 + o, v);
|
||||
}
|
||||
|
||||
static device_method_t ehci_methods[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user