Subject: Changes to XF4 to support aperture driver by default
To: None <tech-x11@netbsd.org>
From: Johnny C. Lam <lamj@stat.cmu.edu>
List: tech-x11
Date: 01/17/2001 01:01:51
The NetBSD aperture driver does two things:

	(1) Allows root process to access /dev/mem in restricted
	    fashion through /dev/xf86 if securelevel >= 0.

	(2) Provide MTRR support.

I think we should change XFree86-4.0.x to build X servers that support
(1) by default, as the XF-3.3.6 servers did, but not (2) unless
explicitly demanded.  Then users would again have the option of
installing pkgsrc/sysutils/aperture to allow using our X server
without running an INSECURE kernel.

The patch below rearranges some statements to decouple (1) and (2) in
the XF-4.0.x server build for NetBSD.  Changing the default setting
for "HasNetBSDApertureDriver" to "YES" in NetBSD.cf on i386 causes the
compiled X server to check opening /dev/xf86 if opening /dev/mem
fails.  Users compiling their own XFree86 distribution and wanting
MTRR support can define "HasMTRRSupport" to "YES" in host.def prior to
building.

I also modify "NetBSDApertureDir" to default to "/usr/pkg", which is
the location for the pkgsrc sysutils/aperture driver.

Can I commit this?

     -- Johnny C. Lam <lamj@stat.cmu.edu>
        Department of Statistics, Carnegie Mellon University
        http://www.stat.cmu.edu/~lamj/

--- xfree/xc/config/cf/NetBSD.cf.orig	Sun Jan 14 08:23:03 2001
+++ xfree/xc/config/cf/NetBSD.cf
@@ -297,11 +297,7 @@
  */
 #if defined(i386Architecture)
 # ifndef HasNetBSDApertureDriver
-#  define HasNetBSDApertureDriver	NO
-   /* Where the aperture driver is installed */
-#  ifndef NetBSDApertureDir
-#   define NetBSDApertureDir		/usr/local/aperture
-#  endif
+#  define HasNetBSDApertureDriver	YES
 # endif
 
  /*
@@ -309,7 +305,11 @@
   */
 # if HasNetBSDApertureDriver
 #  ifndef HasMTRRSupport
-#   define HasMTRRSupport	YES
+#   define HasMTRRSupport	NO
+    /* Where the aperture driver headers (include/memrange.h) are installed */
+#   ifndef NetBSDApertureDir
+#    define NetBSDApertureDir	/usr/pkg
+#   endif
 #  endif
 # endif
 #endif /* i386Architecture */

--- xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile.orig	Sun Jan 14 08:26:21 2001
+++ xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile
@@ -126,9 +126,11 @@
 RESDEFINES = -DUSESTDRES
 
 #if HasNetBSDApertureDriver
-APDIR = NetBSDApertureDir
 APDEFINES = -DHAS_APERTURE_DRV
+#if HasMTRRSupport
+APDIR = NetBSDApertureDir
 APINCLUDES = -I$(APDIR)/include
+#endif
 #endif
 
 DEFINES = $(CONSDEFINES) $(APDEFINES) $(IOPERMDEFINES) $(RESDEFINES) \