diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-04-14 17:35:29 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-04-14 17:35:29 +0000 |
commit | 13cd11a0bde24766429eb78cec7410c34681360f (patch) | |
tree | 1e12c73ab3136db6cbcbd0bb65a7706e2ff5289d /sys | |
parent | 666dd3dd6b6f22bf241fb4bd4fa7aa67e868a7f0 (diff) |
Fix some of the more esoteric bus_space functions. The
bus_space_read_region_n, bus_space_write_region_n and
bus_space_set_region_n functions were all broken.
Same fix as arm64; Thanks to patrick@ for noting that mips64 had the same
code.
ok visa@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/loongson/include/bus.h | 15 | ||||
-rw-r--r-- | sys/arch/octeon/include/bus.h | 15 | ||||
-rw-r--r-- | sys/arch/sgi/include/bus.h | 15 |
3 files changed, 24 insertions, 21 deletions
diff --git a/sys/arch/loongson/include/bus.h b/sys/arch/loongson/include/bus.h index 965418dd63f..c04c7711320 100644 --- a/sys/arch/loongson/include/bus.h +++ b/sys/arch/loongson/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.7 2017/05/08 00:27:45 dlg Exp $ */ +/* $OpenBSD: bus.h,v 1.8 2020/04/14 17:35:28 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. @@ -144,8 +144,10 @@ static __inline void \ CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \ { \ - while (cnt--) \ - *x++ = CAT(bus_space_read_,n)(bst, bsh, ba++); \ + while (cnt--) { \ + *x++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ + ba += (n); \ + } \ } bus_space_read_region(1,8) @@ -178,9 +180,8 @@ static __inline void \ CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_size_t o, const CAT3(u_int,m,_t) *x, size_t cnt) \ { \ - while (cnt--) { \ + while (cnt--) \ CAT(bus_space_write_,n)(bst, bsh, o, *x++); \ - } \ } bus_space_write_multi(1,8) @@ -196,7 +197,7 @@ CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ { \ while (cnt--) { \ CAT(bus_space_write_,n)(bst, bsh, ba, *x++); \ - ba += sizeof(x); \ + ba += (n); \ } \ } @@ -232,7 +233,7 @@ CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ { \ while (cnt--) { \ CAT(bus_space_write_,n)(bst, bsh, ba, x); \ - ba += sizeof(x); \ + ba += (n); \ } \ } diff --git a/sys/arch/octeon/include/bus.h b/sys/arch/octeon/include/bus.h index 3ae2273edf3..1dd54b3bc77 100644 --- a/sys/arch/octeon/include/bus.h +++ b/sys/arch/octeon/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.7 2017/05/08 00:27:45 dlg Exp $ */ +/* $OpenBSD: bus.h,v 1.8 2020/04/14 17:35:28 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. @@ -142,8 +142,10 @@ static __inline void \ CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \ { \ - while (cnt--) \ - *x++ = CAT(bus_space_read_,n)(bst, bsh, ba++); \ + while (cnt--) { \ + *x++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ + ba += (n); \ + } \ } bus_space_read_region(1,8) @@ -176,9 +178,8 @@ static __inline void \ CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_size_t o, const CAT3(u_int,m,_t) *x, size_t cnt) \ { \ - while (cnt--) { \ + while (cnt--) \ CAT(bus_space_write_,n)(bst, bsh, o, *x++); \ - } \ } bus_space_write_multi(1,8) @@ -194,7 +195,7 @@ CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ { \ while (cnt--) { \ CAT(bus_space_write_,n)(bst, bsh, ba, *x++); \ - ba += sizeof(x); \ + ba += (n); \ } \ } @@ -230,7 +231,7 @@ CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ { \ while (cnt--) { \ CAT(bus_space_write_,n)(bst, bsh, ba, x); \ - ba += sizeof(x); \ + ba += (n); \ } \ } diff --git a/sys/arch/sgi/include/bus.h b/sys/arch/sgi/include/bus.h index 4f431cd195c..82eca8966c8 100644 --- a/sys/arch/sgi/include/bus.h +++ b/sys/arch/sgi/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.28 2017/05/11 15:47:45 visa Exp $ */ +/* $OpenBSD: bus.h,v 1.29 2020/04/14 17:35:28 kettenis Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. @@ -143,8 +143,10 @@ static __inline void \ CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \ { \ - while (cnt--) \ - *x++ = CAT(bus_space_read_,n)(bst, bsh, ba++); \ + while (cnt--) { \ + *x++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ + ba += (n); \ + } \ } bus_space_read_region(1,8) @@ -177,9 +179,8 @@ static __inline void \ CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ bus_size_t o, const CAT3(u_int,m,_t) *x, size_t cnt) \ { \ - while (cnt--) { \ + while (cnt--) \ CAT(bus_space_write_,n)(bst, bsh, o, *x++); \ - } \ } bus_space_write_multi(1,8) @@ -195,7 +196,7 @@ CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ { \ while (cnt--) { \ CAT(bus_space_write_,n)(bst, bsh, ba, *x++); \ - ba += sizeof(x); \ + ba += (n); \ } \ } @@ -231,7 +232,7 @@ CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ { \ while (cnt--) { \ CAT(bus_space_write_,n)(bst, bsh, ba, x); \ - ba += sizeof(x); \ + ba += (n); \ } \ } |