Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64 Fix encoding of MMAP flags for generic_bs_mmap
details: https://anonhg.NetBSD.org/src/rev/b21cdae7219d
branches: trunk
changeset: 361028:b21cdae7219d
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Apr 09 22:26:15 2018 +0000
description:
Fix encoding of MMAP flags for generic_bs_mmap
diffstat:
sys/arch/aarch64/aarch64/bus_space.c | 12 ++++++++----
sys/arch/aarch64/include/pmap.h | 10 +++++-----
2 files changed, 13 insertions(+), 9 deletions(-)
diffs (57 lines):
diff -r 2995bf71ee82 -r b21cdae7219d sys/arch/aarch64/aarch64/bus_space.c
--- a/sys/arch/aarch64/aarch64/bus_space.c Mon Apr 09 20:17:33 2018 +0000
+++ b/sys/arch/aarch64/aarch64/bus_space.c Mon Apr 09 22:26:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.2 2018/04/01 04:35:03 ryo Exp $ */
+/* $NetBSD: bus_space.c,v 1.3 2018/04/09 22:26:15 jmcneill 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.2 2018/04/01 04:35:03 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.3 2018/04/09 22:26:15 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -615,8 +615,12 @@
{
paddr_t bus_flags = 0;
- if ((flags & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE)) != 0)
- bus_flags |= AARCH64_MMAP_WRITEBACK;
+ if ((flags & BUS_SPACE_MAP_CACHEABLE) != 0)
+ bus_flags |= (AARCH64_MMAP_WRITEBACK << AARCH64_MMAP_FLAG_SHIFT);
+ else if ((flags & BUS_SPACE_MAP_PREFETCHABLE) != 0)
+ bus_flags |= (AARCH64_MMAP_WRITECOMBINE << AARCH64_MMAP_FLAG_SHIFT);
+ else
+ bus_flags |= (AARCH64_MMAP_DEVICE << AARCH64_MMAP_FLAG_SHIFT);
return (atop(bpa + (offset << ((struct bus_space *)t)->bs_stride)) |
bus_flags);
diff -r 2995bf71ee82 -r b21cdae7219d sys/arch/aarch64/include/pmap.h
--- a/sys/arch/aarch64/include/pmap.h Mon Apr 09 20:17:33 2018 +0000
+++ b/sys/arch/aarch64/include/pmap.h Mon Apr 09 22:26:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.2 2018/04/01 04:35:03 ryo Exp $ */
+/* $NetBSD: pmap.h,v 1.3 2018/04/09 22:26:16 jmcneill Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -150,10 +150,10 @@
/* mmap cookie and flags */
#define AARCH64_MMAP_FLAG_SHIFT (64 - PGSHIFT)
#define AARCH64_MMAP_FLAG_MASK 0xf
-#define AARCH64_MMAP_WRITEBACK 0
-#define AARCH64_MMAP_NOCACHE 1
-#define AARCH64_MMAP_WRITECOMBINE 2
-#define AARCH64_MMAP_DEVICE 3
+#define AARCH64_MMAP_WRITEBACK 0UL
+#define AARCH64_MMAP_NOCACHE 1UL
+#define AARCH64_MMAP_WRITECOMBINE 2UL
+#define AARCH64_MMAP_DEVICE 3UL
#define ARM_MMAP_WRITECOMBINE AARCH64_MMAP_WRITECOMBINE
#define ARM_MMAP_WRITEBACK AARCH64_MMAP_WRITEBACK
Home |
Main Index |
Thread Index |
Old Index