Add functions which allow i/o memory to be accessed without forcing a

memory barrier (needed for XFree86 4.0).

Approved by: jkh
This commit is contained in:
Doug Rabson 2000-02-12 14:57:01 +00:00
parent 83f1e257e0
commit eb06360f04
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57164
3 changed files with 45 additions and 5 deletions

View File

@ -206,21 +206,21 @@ static void
bwx_writeb(void *handle, u_int32_t offset, u_int8_t val)
{
struct bwx_mem_handle *h = handle;
stb((vm_offset_t)h->virt1 + offset, val);
stb_nb((vm_offset_t)h->virt1 + offset, val);
}
static void
bwx_writew(void *handle, u_int32_t offset, u_int16_t val)
{
struct bwx_mem_handle *h = handle;
stw((vm_offset_t)h->virt2 + offset, val);
stw_nb((vm_offset_t)h->virt2 + offset, val);
}
static void
bwx_writel(void *handle, u_int32_t offset, u_int32_t val)
{
struct bwx_mem_handle *h = handle;
stl((vm_offset_t)h->virt4 + offset, val);
stl_nb((vm_offset_t)h->virt4 + offset, val);
}
struct io_ops bwx_io_ops = {

View File

@ -119,17 +119,38 @@ readl(void *handle, u_int32_t offset)
void
writeb(void *handle, u_int32_t offset, u_int8_t val)
{
return ops->writeb(handle, offset, val);
ops->writeb(handle, offset, val);
__asm__ __volatile__ ("mb");
}
void
writew(void *handle, u_int32_t offset, u_int16_t val)
{
return ops->writew(handle, offset, val);
ops->writew(handle, offset, val);
__asm__ __volatile__ ("mb");
}
void
writel(void *handle, u_int32_t offset, u_int32_t val)
{
ops->writel(handle, offset, val);
__asm__ __volatile__ ("mb");
}
void
writeb_nb(void *handle, u_int32_t offset, u_int8_t val)
{
return ops->writeb(handle, offset, val);
}
void
writew_nb(void *handle, u_int32_t offset, u_int16_t val)
{
return ops->writew(handle, offset, val);
}
void
writel_nb(void *handle, u_int32_t offset, u_int32_t val)
{
return ops->writel(handle, offset, val);
}

View File

@ -81,4 +81,23 @@ stl(vm_offset_t va, u_int64_t r)
__asm__ __volatile__ ("mb");
}
static __inline void
stb_nb(vm_offset_t va, u_int64_t r)
{
__asm__ __volatile__ ("stb %1,%0" : "=m"(*(u_int8_t*)va) : "r"(r));
}
static __inline void
stw_nb(vm_offset_t va, u_int64_t r)
{
__asm__ __volatile__ ("stw %1,%0" : "=m"(*(u_int16_t*)va) : "r"(r));
}
static __inline void
stl_nb(vm_offset_t va, u_int64_t r)
{
__asm__ __volatile__ ("stl %1,%0" : "=m"(*(u_int32_t*)va) : "r"(r));
}
#endif /* !_MACHINE_BWX_H_ */