Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/include/asm Don't use memset as memset...



details:   https://anonhg.NetBSD.org/src/rev/cb57ae04ff87
branches:  trunk
changeset: 467220:cb57ae04ff87
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jan 17 20:28:59 2020 +0000

description:
Don't use memset as memset_io on aarch64. With c=0 it uses the "dc zva"
cache maintenance instruction as an optimization which does not work on
device memory.

diffstat:

 sys/external/bsd/drm2/include/asm/io.h |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 858ae35c76a0 -r cb57ae04ff87 sys/external/bsd/drm2/include/asm/io.h
--- a/sys/external/bsd/drm2/include/asm/io.h    Fri Jan 17 20:28:14 2020 +0000
+++ b/sys/external/bsd/drm2/include/asm/io.h    Fri Jan 17 20:28:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.h,v 1.4 2015/02/25 14:56:17 riastradh Exp $ */
+/*     $NetBSD: io.h,v 1.5 2020/01/17 20:28:59 jmcneill Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -46,7 +46,22 @@
 
 #define        memcpy_fromio   memcpy
 #define        memcpy_toio     memcpy
+
+#if defined(__NetBSD__) && defined(__aarch64__)
+static inline void *
+memset_io(void *b, int c, size_t len)
+{
+       uint32_t *ptr = b;
+       while (len >= 4) {
+               *ptr++ = c;
+               len -= 4;
+       }
+       KASSERT(len == 0);
+       return b;
+}
+#else
 #define        memset_io       memset
+#endif
 
 /* XXX wrong place */
 #define        __force



Home | Main Index | Thread Index | Old Index