Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 Adjust aarch64 bus_space tags to al...



details:   https://anonhg.NetBSD.org/src/rev/416f42caacaa
branches:  trunk
changeset: 954521:416f42caacaa
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sat Sep 05 16:44:54 2020 +0000

description:
Adjust aarch64 bus_space tags to also work on aarch64eb

diffstat:

 sys/arch/aarch64/aarch64/bus_space.c |  214 +++++++++++++++++-----------------
 1 files changed, 110 insertions(+), 104 deletions(-)

diffs (truncated from 405 to 300 lines):

diff -r 33c5f307db6b -r 416f42caacaa sys/arch/aarch64/aarch64/bus_space.c
--- a/sys/arch/aarch64/aarch64/bus_space.c      Sat Sep 05 16:30:10 2020 +0000
+++ b/sys/arch/aarch64/aarch64/bus_space.c      Sat Sep 05 16:44:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.9 2019/12/28 17:19:43 jmcneill Exp $ */
+/* $NetBSD: bus_space.c,v 1.10 2020/09/05 16:44:54 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.9 2019/12/28 17:19:43 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.10 2020/09/05 16:44:54 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -43,6 +43,12 @@
 bs_protos(generic)
 bs_protos(generic_dsb)
 
+#if __AARCH64EB__
+#define NSWAP(n)       n ## _swap
+#else
+#define NSWAP(n)       n
+#endif
+
 struct bus_space arm_generic_bs_tag = {
        .bs_cookie = &arm_generic_bs_tag,
 
@@ -60,27 +66,27 @@
 
        /* read */
        .bs_r_1 = generic_bs_r_1,
-       .bs_r_2 = generic_bs_r_2,
-       .bs_r_4 = generic_bs_r_4,
-       .bs_r_8 = generic_bs_r_8,
+       .bs_r_2 = NSWAP(generic_bs_r_2),
+       .bs_r_4 = NSWAP(generic_bs_r_4),
+       .bs_r_8 = NSWAP(generic_bs_r_8),
 
        /* write */
        .bs_w_1 = generic_bs_w_1,
-       .bs_w_2 = generic_bs_w_2,
-       .bs_w_4 = generic_bs_w_4,
-       .bs_w_8 = generic_bs_w_8,
+       .bs_w_2 = NSWAP(generic_bs_w_2),
+       .bs_w_4 = NSWAP(generic_bs_w_4),
+       .bs_w_8 = NSWAP(generic_bs_w_8),
 
        /* read region */
        .bs_rr_1 = generic_bs_rr_1,
-       .bs_rr_2 = generic_bs_rr_2,
-       .bs_rr_4 = generic_bs_rr_4,
-       .bs_rr_8 = generic_bs_rr_8,
+       .bs_rr_2 = NSWAP(generic_bs_rr_2),
+       .bs_rr_4 = NSWAP(generic_bs_rr_4),
+       .bs_rr_8 = NSWAP(generic_bs_rr_8),
 
        /* write region */
        .bs_wr_1 = generic_bs_wr_1,
-       .bs_wr_2 = generic_bs_wr_2,
-       .bs_wr_4 = generic_bs_wr_4,
-       .bs_wr_8 = generic_bs_wr_8,
+       .bs_wr_2 = NSWAP(generic_bs_wr_2),
+       .bs_wr_4 = NSWAP(generic_bs_wr_4),
+       .bs_wr_8 = NSWAP(generic_bs_wr_8),
 
        /* copy region */
        .bs_c_1 = generic_bs_c_1,
@@ -90,27 +96,27 @@
 
        /* set region */
        .bs_sr_1 = generic_bs_sr_1,
-       .bs_sr_2 = generic_bs_sr_2,
-       .bs_sr_4 = generic_bs_sr_4,
-       .bs_sr_8 = generic_bs_sr_8,
+       .bs_sr_2 = NSWAP(generic_bs_sr_2),
+       .bs_sr_4 = NSWAP(generic_bs_sr_4),
+       .bs_sr_8 = NSWAP(generic_bs_sr_8),
 
        /* read multi */
        .bs_rm_1 = generic_bs_rm_1,
-       .bs_rm_2 = generic_bs_rm_2,
-       .bs_rm_4 = generic_bs_rm_4,
-       .bs_rm_8 = generic_bs_rm_8,
+       .bs_rm_2 = NSWAP(generic_bs_rm_2),
+       .bs_rm_4 = NSWAP(generic_bs_rm_4),
+       .bs_rm_8 = NSWAP(generic_bs_rm_8),
 
        /* write multi */
        .bs_wm_1 = generic_bs_wm_1,
-       .bs_wm_2 = generic_bs_wm_2,
-       .bs_wm_4 = generic_bs_wm_4,
-       .bs_wm_8 = generic_bs_wm_8,
+       .bs_wm_2 = NSWAP(generic_bs_wm_2),
+       .bs_wm_4 = NSWAP(generic_bs_wm_4),
+       .bs_wm_8 = NSWAP(generic_bs_wm_8),
 
        /* set multi */
        .bs_sm_1 = generic_bs_sm_1,
-       .bs_sm_2 = generic_bs_sm_2,
-       .bs_sm_4 = generic_bs_sm_4,
-       .bs_sm_8 = generic_bs_sm_8,
+       .bs_sm_2 = NSWAP(generic_bs_sm_2),
+       .bs_sm_4 = NSWAP(generic_bs_sm_4),
+       .bs_sm_8 = NSWAP(generic_bs_sm_8),
 
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
        /* read stream */
@@ -182,27 +188,27 @@
 
        /* read */
        .bs_r_1 = generic_dsb_bs_r_1,
-       .bs_r_2 = generic_dsb_bs_r_2,
-       .bs_r_4 = generic_dsb_bs_r_4,
-       .bs_r_8 = generic_dsb_bs_r_8,
+       .bs_r_2 = NSWAP(generic_dsb_bs_r_2),
+       .bs_r_4 = NSWAP(generic_dsb_bs_r_4),
+       .bs_r_8 = NSWAP(generic_dsb_bs_r_8),
 
        /* write */
        .bs_w_1 = generic_dsb_bs_w_1,
-       .bs_w_2 = generic_dsb_bs_w_2,
-       .bs_w_4 = generic_dsb_bs_w_4,
-       .bs_w_8 = generic_dsb_bs_w_8,
+       .bs_w_2 = NSWAP(generic_dsb_bs_w_2),
+       .bs_w_4 = NSWAP(generic_dsb_bs_w_4),
+       .bs_w_8 = NSWAP(generic_dsb_bs_w_8),
 
        /* read region */
        .bs_rr_1 = generic_dsb_bs_rr_1,
-       .bs_rr_2 = generic_dsb_bs_rr_2,
-       .bs_rr_4 = generic_dsb_bs_rr_4,
-       .bs_rr_8 = generic_dsb_bs_rr_8,
+       .bs_rr_2 = NSWAP(generic_dsb_bs_rr_2),
+       .bs_rr_4 = NSWAP(generic_dsb_bs_rr_4),
+       .bs_rr_8 = NSWAP(generic_dsb_bs_rr_8),
 
        /* write region */
        .bs_wr_1 = generic_dsb_bs_wr_1,
-       .bs_wr_2 = generic_dsb_bs_wr_2,
-       .bs_wr_4 = generic_dsb_bs_wr_4,
-       .bs_wr_8 = generic_dsb_bs_wr_8,
+       .bs_wr_2 = NSWAP(generic_dsb_bs_wr_2),
+       .bs_wr_4 = NSWAP(generic_dsb_bs_wr_4),
+       .bs_wr_8 = NSWAP(generic_dsb_bs_wr_8),
 
        /* copy region */
        .bs_c_1 = generic_dsb_bs_c_1,
@@ -212,27 +218,27 @@
 
        /* set region */
        .bs_sr_1 = generic_dsb_bs_sr_1,
-       .bs_sr_2 = generic_dsb_bs_sr_2,
-       .bs_sr_4 = generic_dsb_bs_sr_4,
-       .bs_sr_8 = generic_dsb_bs_sr_8,
+       .bs_sr_2 = NSWAP(generic_dsb_bs_sr_2),
+       .bs_sr_4 = NSWAP(generic_dsb_bs_sr_4),
+       .bs_sr_8 = NSWAP(generic_dsb_bs_sr_8),
 
        /* read multi */
        .bs_rm_1 = generic_dsb_bs_rm_1,
-       .bs_rm_2 = generic_dsb_bs_rm_2,
-       .bs_rm_4 = generic_dsb_bs_rm_4,
-       .bs_rm_8 = generic_dsb_bs_rm_8,
+       .bs_rm_2 = NSWAP(generic_dsb_bs_rm_2),
+       .bs_rm_4 = NSWAP(generic_dsb_bs_rm_4),
+       .bs_rm_8 = NSWAP(generic_dsb_bs_rm_8),
 
        /* write multi */
        .bs_wm_1 = generic_dsb_bs_wm_1,
-       .bs_wm_2 = generic_dsb_bs_wm_2,
-       .bs_wm_4 = generic_dsb_bs_wm_4,
-       .bs_wm_8 = generic_dsb_bs_wm_8,
+       .bs_wm_2 = NSWAP(generic_dsb_bs_wm_2),
+       .bs_wm_4 = NSWAP(generic_dsb_bs_wm_4),
+       .bs_wm_8 = NSWAP(generic_dsb_bs_wm_8),
 
        /* set multi */
        .bs_sm_1 = generic_dsb_bs_sm_1,
-       .bs_sm_2 = generic_dsb_bs_sm_2,
-       .bs_sm_4 = generic_dsb_bs_sm_4,
-       .bs_sm_8 = generic_dsb_bs_sm_8,
+       .bs_sm_2 = NSWAP(generic_dsb_bs_sm_2),
+       .bs_sm_4 = NSWAP(generic_dsb_bs_sm_4),
+       .bs_sm_8 = NSWAP(generic_dsb_bs_sm_8),
 
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
        /* read stream */
@@ -304,27 +310,27 @@
 
        /* read */
        .bs_r_1 = generic_bs_r_1,
-       .bs_r_2 = generic_bs_r_2,
-       .bs_r_4 = generic_bs_r_4,
-       .bs_r_8 = generic_bs_r_8,
+       .bs_r_2 = NSWAP(generic_bs_r_2),
+       .bs_r_4 = NSWAP(generic_bs_r_4),
+       .bs_r_8 = NSWAP(generic_bs_r_8),
 
        /* write */
        .bs_w_1 = generic_bs_w_1,
-       .bs_w_2 = generic_bs_w_2,
-       .bs_w_4 = generic_bs_w_4,
-       .bs_w_8 = generic_bs_w_8,
+       .bs_w_2 = NSWAP(generic_bs_w_2),
+       .bs_w_4 = NSWAP(generic_bs_w_4),
+       .bs_w_8 = NSWAP(generic_bs_w_8),
 
        /* read region */
        .bs_rr_1 = generic_bs_rr_1,
-       .bs_rr_2 = generic_bs_rr_2,
-       .bs_rr_4 = generic_bs_rr_4,
-       .bs_rr_8 = generic_bs_rr_8,
+       .bs_rr_2 = NSWAP(generic_bs_rr_2),
+       .bs_rr_4 = NSWAP(generic_bs_rr_4),
+       .bs_rr_8 = NSWAP(generic_bs_rr_8),
 
        /* write region */
        .bs_wr_1 = generic_bs_wr_1,
-       .bs_wr_2 = generic_bs_wr_2,
-       .bs_wr_4 = generic_bs_wr_4,
-       .bs_wr_8 = generic_bs_wr_8,
+       .bs_wr_2 = NSWAP(generic_bs_wr_2),
+       .bs_wr_4 = NSWAP(generic_bs_wr_4),
+       .bs_wr_8 = NSWAP(generic_bs_wr_8),
 
        /* copy region */
        .bs_c_1 = generic_bs_c_1,
@@ -334,27 +340,27 @@
 
        /* set region */
        .bs_sr_1 = generic_bs_sr_1,
-       .bs_sr_2 = generic_bs_sr_2,
-       .bs_sr_4 = generic_bs_sr_4,
-       .bs_sr_8 = generic_bs_sr_8,
+       .bs_sr_2 = NSWAP(generic_bs_sr_2),
+       .bs_sr_4 = NSWAP(generic_bs_sr_4),
+       .bs_sr_8 = NSWAP(generic_bs_sr_8),
 
        /* read multi */
        .bs_rm_1 = generic_bs_rm_1,
-       .bs_rm_2 = generic_bs_rm_2,
-       .bs_rm_4 = generic_bs_rm_4,
-       .bs_rm_8 = generic_bs_rm_8,
+       .bs_rm_2 = NSWAP(generic_bs_rm_2),
+       .bs_rm_4 = NSWAP(generic_bs_rm_4),
+       .bs_rm_8 = NSWAP(generic_bs_rm_8),
 
        /* write multi */
        .bs_wm_1 = generic_bs_wm_1,
-       .bs_wm_2 = generic_bs_wm_2,
-       .bs_wm_4 = generic_bs_wm_4,
-       .bs_wm_8 = generic_bs_wm_8,
+       .bs_wm_2 = NSWAP(generic_bs_wm_2),
+       .bs_wm_4 = NSWAP(generic_bs_wm_4),
+       .bs_wm_8 = NSWAP(generic_bs_wm_8),
 
        /* set multi */
        .bs_sm_1 = generic_bs_sm_1,
-       .bs_sm_2 = generic_bs_sm_2,
-       .bs_sm_4 = generic_bs_sm_4,
-       .bs_sm_8 = generic_bs_sm_8,
+       .bs_sm_2 = NSWAP(generic_bs_sm_2),
+       .bs_sm_4 = NSWAP(generic_bs_sm_4),
+       .bs_sm_8 = NSWAP(generic_bs_sm_8),
 
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
        /* read stream */
@@ -426,27 +432,27 @@
 
        /* read */
        .bs_r_1 = generic_dsb_bs_r_1,
-       .bs_r_2 = generic_dsb_bs_r_2,
-       .bs_r_4 = generic_dsb_bs_r_4,
-       .bs_r_8 = generic_dsb_bs_r_8,
+       .bs_r_2 = NSWAP(generic_dsb_bs_r_2),
+       .bs_r_4 = NSWAP(generic_dsb_bs_r_4),
+       .bs_r_8 = NSWAP(generic_dsb_bs_r_8),
 
        /* write */
        .bs_w_1 = generic_dsb_bs_w_1,
-       .bs_w_2 = generic_dsb_bs_w_2,
-       .bs_w_4 = generic_dsb_bs_w_4,
-       .bs_w_8 = generic_dsb_bs_w_8,
+       .bs_w_2 = NSWAP(generic_dsb_bs_w_2),
+       .bs_w_4 = NSWAP(generic_dsb_bs_w_4),
+       .bs_w_8 = NSWAP(generic_dsb_bs_w_8),
 
        /* read region */
        .bs_rr_1 = generic_dsb_bs_rr_1,
-       .bs_rr_2 = generic_dsb_bs_rr_2,
-       .bs_rr_4 = generic_dsb_bs_rr_4,
-       .bs_rr_8 = generic_dsb_bs_rr_8,
+       .bs_rr_2 = NSWAP(generic_dsb_bs_rr_2),
+       .bs_rr_4 = NSWAP(generic_dsb_bs_rr_4),
+       .bs_rr_8 = NSWAP(generic_dsb_bs_rr_8),
 



Home | Main Index | Thread Index | Old Index