summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2017-03-16 18:13:43 +0000
committermiod <miod@openbsd.org>2017-03-16 18:13:43 +0000
commit3ce3daf243ba38066710ae82a80bdda2b5e7603e (patch)
treeff6b02a8bbad93d4015ec707393d22df0268b41c
parentFix passing entropy from boot loader to the kernel: (diff)
downloadwireguard-openbsd-3ce3daf243ba38066710ae82a80bdda2b5e7603e.tar.xz
wireguard-openbsd-3ce3daf243ba38066710ae82a80bdda2b5e7603e.zip
Use a power of two and left shift, rather than integer multiplication, for
the bus_space access stride. This allows better instruction scheduling by the compiler. ok aoyama@
-rw-r--r--sys/arch/luna88k/cbus/i82365_cbus.c14
-rw-r--r--sys/arch/luna88k/cbus/necsb.c4
-rw-r--r--sys/arch/luna88k/dev/spc.c4
-rw-r--r--sys/arch/luna88k/include/bus.h14
4 files changed, 18 insertions, 18 deletions
diff --git a/sys/arch/luna88k/cbus/i82365_cbus.c b/sys/arch/luna88k/cbus/i82365_cbus.c
index 39c1b08f412..9955a5a22ee 100644
--- a/sys/arch/luna88k/cbus/i82365_cbus.c
+++ b/sys/arch/luna88k/cbus/i82365_cbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i82365_cbus.c,v 1.3 2015/03/13 12:12:42 aoyama Exp $ */
+/* $OpenBSD: i82365_cbus.c,v 1.4 2017/03/16 18:13:43 miod Exp $ */
/* $NetBSD: i82365_isa.c,v 1.11 1998/06/09 07:25:00 thorpej Exp $ */
/*
@@ -100,18 +100,18 @@ void pcic_cbus_attach(struct device *, struct device *, void *);
/* bus space tag for pcic_cbus */
struct luna88k_bus_space_tag pcic_cbus_io_bst = {
- .bs_stride_1 = 1,
- .bs_stride_2 = 1,
- .bs_stride_4 = 1,
+ .bs_stride_1 = 0,
+ .bs_stride_2 = 0,
+ .bs_stride_4 = 0,
.bs_stride_8 = 0, /* not used */
.bs_offset = PCEXIO_BASE,
.bs_flags = TAG_LITTLE_ENDIAN
};
struct luna88k_bus_space_tag pcic_cbus_mem_bst = {
- .bs_stride_1 = 1,
- .bs_stride_2 = 1,
- .bs_stride_4 = 1,
+ .bs_stride_1 = 0,
+ .bs_stride_2 = 0,
+ .bs_stride_4 = 0,
.bs_stride_8 = 0, /* not used */
.bs_offset = PCEXMEM_BASE,
.bs_flags = TAG_LITTLE_ENDIAN
diff --git a/sys/arch/luna88k/cbus/necsb.c b/sys/arch/luna88k/cbus/necsb.c
index bcde11cfeae..34759ccbf88 100644
--- a/sys/arch/luna88k/cbus/necsb.c
+++ b/sys/arch/luna88k/cbus/necsb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: necsb.c,v 1.3 2015/02/18 22:42:04 aoyama Exp $ */
+/* $OpenBSD: necsb.c,v 1.4 2017/03/16 18:13:43 miod Exp $ */
/* $NecBSD: nec86_isa.c,v 1.9 1998/09/26 11:31:11 kmatsuda Exp $ */
/* $NetBSD$ */
@@ -63,7 +63,7 @@ struct cfdriver necsb_cd = {
/* bus space tag for necsb */
struct luna88k_bus_space_tag necsb_bst = {
- 1, /* when reading/writing 1 byte, the stride is 1. */
+ 0, /* when reading/writing 1 byte, no shift is needed. */
0,
0,
0,
diff --git a/sys/arch/luna88k/dev/spc.c b/sys/arch/luna88k/dev/spc.c
index ee7e3bb53a1..93c9f0bbb2c 100644
--- a/sys/arch/luna88k/dev/spc.c
+++ b/sys/arch/luna88k/dev/spc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spc.c,v 1.8 2015/02/14 14:54:13 aoyama Exp $ */
+/* $OpenBSD: spc.c,v 1.9 2017/03/16 18:13:44 miod Exp $ */
/* $NetBSD: spc.c,v 1.4 2003/07/05 19:00:17 tsutsui Exp $ */
/*-
@@ -68,7 +68,7 @@ struct scsi_adapter spc_switch = {
/* bus space tag for spc */
struct luna88k_bus_space_tag spc_bst = {
- 4, /* when reading/writing 1 byte, the stride is 4. */
+ 2, /* when reading/writing 1 byte, the stride is 4. */
0, /* not used */
0, /* not used */
0, /* not used */
diff --git a/sys/arch/luna88k/include/bus.h b/sys/arch/luna88k/include/bus.h
index 64ef603ccaf..d3fb42c9c0c 100644
--- a/sys/arch/luna88k/include/bus.h
+++ b/sys/arch/luna88k/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.10 2015/03/03 23:50:37 aoyama Exp $ */
+/* $OpenBSD: bus.h,v 1.11 2017/03/16 18:13:44 miod Exp $ */
/* $NetBSD: bus.h,v 1.9 1998/01/13 18:32:15 scottr Exp $ */
/*-
@@ -176,13 +176,13 @@ bus_space_free(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t size)
*/
#define bus_space_read_1(t, h, o) \
- (*(volatile u_int8_t *)((h) + (t->bs_stride_1) * (o)))
+ (*(volatile u_int8_t *)((h) + ((o) << (t->bs_stride_1))))
#define __bus_space_read_2(t, h, o) \
- (*(volatile u_int16_t *)((h) + (t->bs_stride_2) * (o)))
+ (*(volatile u_int16_t *)((h) + ((o) << (t->bs_stride_2))))
#define __bus_space_read_4(t, h, o) \
- (*(volatile u_int32_t *)((h) + (t->bs_stride_4) * (o)))
+ (*(volatile u_int32_t *)((h) + ((o) << (t->bs_stride_4))))
#define bus_space_read_2(t, h, o) \
((IS_TAG_LITTLE_ENDIAN(t)) ? \
@@ -311,13 +311,13 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
*/
#define bus_space_write_1(t, h, o, v) \
- ((void)(*(volatile u_int8_t *)((h) + (t->bs_stride_1) * (o)) = (v)))
+ ((void)(*(volatile u_int8_t *)((h) + ((o) << (t->bs_stride_1))) = (v)))
#define __bus_space_write_2(t, h, o, v) \
- ((void)(*(volatile u_int16_t *)((h) + (t->bs_stride_2) * (o)) = (v)))
+ ((void)(*(volatile u_int16_t *)((h) + ((o) << (t->bs_stride_2))) = (v)))
#define __bus_space_write_4(t, h, o, v) \
- ((void)(*(volatile u_int32_t *)((h) + (t->bs_stride_4) * (o)) = (v)))
+ ((void)(*(volatile u_int32_t *)((h) + ((o) << (t->bs_stride_4))) = (v)))
#define bus_space_write_2(t, h, o, v) \
__bus_space_write_2(t, h, o, \