diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2013-01-29 01:15:58 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2013-01-29 01:15:58 +0000 |
commit | 0ca8a6aa1dbde8c1d492b6a2824b3febe978abb1 (patch) | |
tree | faad3b82dfa800a33f452a4f8eace97bb5ce5504 /sys/arch/amd64/include | |
parent | e7781db457bec7a21a0ce5468cd81e5a7f29aafb (diff) |
the bus_space api implies that there's a bus endianness that it will
swap for you to the hosts endianness. sometimes you dont want this hand
holding and just want raw access to the registers. bus_space does have
stuff to do this already, but they deal with buffers which can be awkward
if you just want to get or set a single register.
this adds the following to i386 and amd64:
bus_space_read_raw_2() bus_space_read_raw_4() bus_space_read_raw_8()
bus_space_write_raw_2() bus_space_write_raw_4() bus_space_write_raw_8()
sparc64 already implements this, even though it wasnt part of the
official api. how handy.
i'll do other archs as i can.
kettenis@ and miod@ seem ok with this
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r-- | sys/arch/amd64/include/bus.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/arch/amd64/include/bus.h b/sys/arch/amd64/include/bus.h index 0ee92b63f07..4cd23ba63ad 100644 --- a/sys/arch/amd64/include/bus.h +++ b/sys/arch/amd64/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.27 2013/01/18 01:54:40 dlg Exp $ */ +/* $OpenBSD: bus.h,v 1.28 2013/01/29 01:15:57 dlg Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -143,6 +143,10 @@ struct x86_bus_space_ops { #define bus_space_read_4(_t, _h, _o) ((_t)->read_4((_h), (_o))) #define bus_space_read_8(_t, _h, _o) ((_t)->read_8((_h), (_o))) +#define bus_space_read_raw_2(_t, _h, _o) ((_t)->read_2((_h), (_o))) +#define bus_space_read_raw_4(_t, _h, _o) ((_t)->read_4((_h), (_o))) +#define bus_space_read_raw_8(_t, _h, _o) ((_t)->read_8((_h), (_o))) + /* * void bus_space_read_multi_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, @@ -258,6 +262,13 @@ struct x86_bus_space_ops { #define bus_space_write_8(_t, _h, _o, _v) \ ((_t)->write_8((_h), (_o), (_v))) +#define bus_space_write_raw_2(_t, _h, _o, _v) \ + ((_t)->write_2((_h), (_o), (_v))) +#define bus_space_write_raw_4(_t, _h, _o, _v) \ + ((_t)->write_4((_h), (_o), (_v))) +#define bus_space_write_raw_8(_t, _h, _o, _v) \ + ((_t)->write_8((_h), (_o), (_v))) + /* * void bus_space_write_multi_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, |