Module Name: src Committed By: ryo Date: Thu Sep 24 08:50:09 UTC 2020
Modified Files: src/sys/arch/arm/cortex: gicv3_its.c Log Message: need to swap on big endian machines. "The ITS command queue uses a little endian memory order model." (GIC Architecture Specification) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/cortex/gicv3_its.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/cortex/gicv3_its.c diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.27 src/sys/arch/arm/cortex/gicv3_its.c:1.28 --- src/sys/arch/arm/cortex/gicv3_its.c:1.27 Thu Feb 13 02:12:06 2020 +++ src/sys/arch/arm/cortex/gicv3_its.c Thu Sep 24 08:50:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: gicv3_its.c,v 1.27 2020/02/13 02:12:06 jmcneill Exp $ */ +/* $NetBSD: gicv3_its.c,v 1.28 2020/09/24 08:50:09 ryo Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #define _INTR_PRIVATE #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.27 2020/02/13 02:12:06 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.28 2020/09/24 08:50:09 ryo Exp $"); #include <sys/param.h> #include <sys/kmem.h> @@ -118,7 +118,13 @@ gits_command(struct gicv3_its *its, cons cwriter = gits_read_8(its, GITS_CWRITER); woff = cwriter & GITS_CWRITER_Offset; +#if _BYTE_ORDER == _BIG_ENDIAN + uint64_t *dw = (uint64_t *)(its->its_cmd.base + woff); + for (int i = 0; i < __arraycount(cmd->dw); i++) + dw[i] = htole64(cmd->dw[i]); +#else memcpy(its->its_cmd.base + woff, cmd->dw, sizeof(cmd->dw)); +#endif bus_dmamap_sync(its->its_dmat, its->its_cmd.map, woff, sizeof(cmd->dw), BUS_DMASYNC_PREWRITE); woff += sizeof(cmd->dw);