Module Name: src
Committed By: jmcneill
Date: Sat Oct 17 21:06:42 UTC 2015
Modified Files:
src/sys/external/bsd/drm2/linux: linux_writecomb.c
Log Message:
only use mtrr api if options MTRR is present and we are on x86
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/linux/linux_writecomb.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/external/bsd/drm2/linux/linux_writecomb.c
diff -u src/sys/external/bsd/drm2/linux/linux_writecomb.c:1.3 src/sys/external/bsd/drm2/linux/linux_writecomb.c:1.4
--- src/sys/external/bsd/drm2/linux/linux_writecomb.c:1.3 Thu Jan 1 01:15:43 2015
+++ src/sys/external/bsd/drm2/linux/linux_writecomb.c Sat Oct 17 21:06:42 2015
@@ -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 @@ linux_writecomb_fini(void)
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 @@ fail1: KASSERT(id < 0);
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 @@ arch_phys_wc_del(int id)
KASSERT(n == 1);
kmem_free(mtrr, sizeof(*mtrr));
}
+#endif
}
int