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/linux only use mtrr api if options MTR...



details:   https://anonhg.NetBSD.org/src/rev/ac7d0b681124
branches:  trunk
changeset: 341077:ac7d0b681124
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Oct 17 21:06:42 2015 +0000

description:
only use mtrr api if options MTRR is present and we are on x86

diffstat:

 sys/external/bsd/drm2/linux/linux_writecomb.c |  18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diffs (66 lines):

diff -r b3a6543ce217 -r ac7d0b681124 sys/external/bsd/drm2/linux/linux_writecomb.c
--- a/sys/external/bsd/drm2/linux/linux_writecomb.c     Sat Oct 17 21:05:57 2015 +0000
+++ b/sys/external/bsd/drm2/linux/linux_writecomb.c     Sat Oct 17 21:06:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_writecomb.c,v 1.3 2015/01/01 01:15:43 mrg Exp $  */
+/*     $NetBSD: linux_writecomb.c,v 1.4 2015/10/17 21:06:42 jmcneill Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,16 +30,22 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_writecomb.c,v 1.3 2015/01/01 01:15:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_writecomb.c,v 1.4 2015/10/17 21:06:42 jmcneill Exp $");
 
-#ifdef _KERNEL_OPT
+#if defined(__i386__) || defined(__x86_64__)
+#define HAS_MTRR 1
+#endif
+
+#if defined(_KERNEL_OPT) && defined(HAS_MTRR)
 #include "opt_mtrr.h"
 #endif
 
 #include <sys/kmem.h>
 #include <sys/mutex.h>
 
+#if defined(MTRR)
 #include <machine/mtrr.h>
+#endif
 
 #include <linux/idr.h>
 #include <linux/io.h>
@@ -71,6 +77,7 @@
 int
 arch_phys_wc_add(unsigned long base, unsigned long size)
 {
+#if defined(MTRR)
        struct mtrr *mtrr;
        int n = 1;
        int id;
@@ -111,11 +118,15 @@
 fail0: KASSERT(ret < 0);
        kmem_free(mtrr, sizeof(*mtrr));
        return ret;
+#else
+       return -1;
+#endif
 }
 
 void
 arch_phys_wc_del(int id)
 {
+#if defined(MTRR)
        struct mtrr *mtrr;
        int n;
        int ret __diagused;
@@ -136,6 +147,7 @@
                KASSERT(n == 1);
                kmem_free(mtrr, sizeof(*mtrr));
        }
+#endif
 }
 
 int



Home | Main Index | Thread Index | Old Index