inline uint64_t
__BS(read_8)(void *v, bus_space_handle_t h, bus_size_t off)
{
	volatile uint64_t *ptr;

	ptr = (void *)(h + CHIP_OFF64(off));
	return CHIP_SWAP64(*ptr);
}
inline void
__BS(write_8)(void *v, bus_space_handle_t h, bus_size_t off, uint64_t val)
{
	volatile uint64_t *ptr;

	ptr = (void *)(h + CHIP_OFF64(off));
	*ptr = CHIP_SWAP64(val);
}
static uint64_t
__BS(read_stream_8)(void *v, bus_space_handle_t h, bus_size_t off)
{
#ifdef MIPS3_64BIT
	h += CHIP_OFF64(off);
	return mips3_ld(h);
#else
	panic("%s: not implemented!", __func__);
#endif
}
static void
__BS(write_stream_8)(void *v, bus_space_handle_t h, bus_size_t off,
		     uint64_t val)
{
#ifdef MIPS3_64BIT
	h += CHIP_OFF64(off);
	mips3_sd(h, val);
#else
	panic("%s: not implemented!", __func__);
#endif
}
static void
__BS(write_8)(void *v, bus_space_handle_t h, bus_size_t off, uint64_t val)
{
#ifdef MIPS3_64BIT
	KASSERT((h & 7) == 0);
	KASSERT((off & 7) == 0);

	h += CHIP_OFF64(off);
	mips3_sd(h, CHIP_SWAP64(val));
#else
	panic("%s: not implemented!", __func__);
#endif
}
static uint64_t
__BS(read_8)(void *v, bus_space_handle_t h, bus_size_t off)
{
#ifdef MIPS3_64BIT
	KASSERT((off & 7) == 0);
	h += CHIP_OFF64(off);
	const int shift = (h & (CHIP_ACCESS_SIZE - 1)) * 8;
	h &= ~((bus_space_handle_t)(CHIP_ACCESS_SIZE - 1));
	const uint64_t r = CHIP_SWAP64(mips3_ld(h) >> shift);

	return r;
#else
	panic("%s: not implemented!", __func__);
#endif
}