xfree86: Remove the memory of MTRR awareness

pciaccess does this for us, and none of our internal hooks really
remain.  This does remove a cleanup pass from the BSD code, but the case
it's covering (a previous server leaving MTRRs around) can't happen
anymore.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2014-05-02 13:00:21 -04:00
parent c42712ab4d
commit 2e21c081d3
7 changed files with 0 additions and 154 deletions

View File

@ -235,29 +235,6 @@ dnl fbdev header
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
dnl MTRR header
AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
if test "x$ac_cv_asm_mtrr_h" = xyes; then
HAVE_MTRR=yes
fi
dnl BSD MTRR header
AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
if test "x$ac_cv_memrange_h" = xyes; then
HAVE_MTRR=yes
fi
if test "x$HAVE_MTRR" = xyes; then
AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
fi
dnl A NetBSD MTRR header
AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
if test "x$ac_cv_machine_mtrr_h" = xyes; then
AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
support is available])
fi
dnl FreeBSD kldload support (sys/linker.h)
AC_CHECK_HEADERS([sys/linker.h],
[ac_cv_sys_linker_h=yes],

View File

@ -142,9 +142,6 @@ Here are the basic steps for kernel setup.
o Enable all chipsets' support for AGP
o It's recommended that you turn on MTRRs under Processor type and
Features, but not required.
o Configure the rest of the kernel as required for your system (i.e. Eth-
ernet, SCSI, etc)

View File

@ -231,7 +231,6 @@ DDC B C Enable/disable DDC
DDC1 B C Enable/disable DDC1
DDC2 B C Enable/disable DDC2
DPMS O C Enable DPMS
MTRR B C Enable/disable setting MTRRs
BaudRate I I Serial port baud rate
ButtonNumber I I Button number (for touch screen?)

View File

@ -2023,12 +2023,6 @@ Default: false.
Disables the Int10 module, a module that uses the int10 call to the BIOS
of the graphics card to initialize it.
Default: false.
.TP 7
.BI "Option \*qNoMTRR\*q"
Disables MTRR (Memory Type Range Register) support, a feature of modern
processors which can improve video performance by a factor of up to 2.5.
Some hardware has buggy MTRR support, and some video drivers have been
known to exhibit problems when MTRR's are used.
.PP
Each
.B Screen

View File

@ -34,27 +34,6 @@
#include <errno.h>
#include <sys/mman.h>
#ifdef HAS_MTRR_SUPPORT
#ifndef __NetBSD__
#include <sys/types.h>
#include <sys/memrange.h>
#else
#include "memrange.h"
#endif
#define X_MTRR_ID "XFree86"
#endif
#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
#include <machine/mtrr.h>
#include <machine/sysarch.h>
#include <sys/queue.h>
#ifdef __x86_64__
#define i386_set_mtrr x86_64_set_mtrr
#define i386_get_mtrr x86_64_get_mtrr
#define i386_iopl x86_64_iopl
#endif
#endif
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
@ -85,10 +64,6 @@ static int devMemFd = -1;
#define DEV_APERTURE "/dev/xf86"
#endif
#ifdef HAS_MTRR_SUPPORT
static Bool cleanMTRR(void);
#endif
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
* "warn" is TRUE.
@ -181,9 +156,6 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
pci_system_init_dev_mem(devMemFd);
#ifdef HAS_MTRR_SUPPORT
cleanMTRR();
#endif
pVidMem->initialised = TRUE;
}
@ -354,87 +326,3 @@ xf86SetRGBOut()
return;
}
#endif
#ifdef HAS_MTRR_SUPPORT
/* memory range (MTRR) support for FreeBSD */
/*
* This code is experimental. Some parts may be overkill, and other parts
* may be incomplete.
*/
/*
* getAllRanges returns the full list of memory ranges with attributes set.
*/
static struct mem_range_desc *
getAllRanges(int *nmr)
{
struct mem_range_desc *mrd;
struct mem_range_op mro;
/*
* Find how many ranges there are. If this fails, then the kernel
* probably doesn't have MTRR support.
*/
mro.mo_arg[0] = 0;
if (ioctl(devMemFd, MEMRANGE_GET, &mro))
return NULL;
*nmr = mro.mo_arg[0];
mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
mro.mo_arg[0] = *nmr;
mro.mo_desc = mrd;
if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
free(mrd);
return NULL;
}
return mrd;
}
/*
* cleanMTRR removes any memory attribute that may be left by a previous
* X server. Normally there won't be any, but this takes care of the
* case where a server crashed without being able finish cleaning up.
*/
static Bool
cleanMTRR()
{
struct mem_range_desc *mrd;
struct mem_range_op mro;
int nmr, i;
/* This shouldn't happen */
if (devMemFd < 0)
return FALSE;
if (!(mrd = getAllRanges(&nmr)))
return FALSE;
for (i = 0; i < nmr; i++) {
if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
(mrd[i].mr_flags & MDF_ACTIVE)) {
#ifdef DEBUG
ErrorF("Clean for (0x%lx,0x%lx)\n",
(unsigned long) mrd[i].mr_base,
(unsigned long) mrd[i].mr_len);
#endif
if (mrd[i].mr_flags & MDF_FIXACTIVE) {
mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
mrd[i].mr_flags = MDF_UNCACHEABLE;
}
else {
mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
}
mro.mo_desc = mrd + i;
ioctl(devMemFd, MEMRANGE_SET, &mro);
}
}
#ifdef DEBUG
sleep(10);
#endif
free(mrd);
return TRUE;
}
#endif /* HAS_MTRR_SUPPORT */

View File

@ -57,9 +57,6 @@
/* Support SHM */
#undef HAS_SHM
/* Define to 1 if you have the <asm/mtrr.h> header file. */
#undef HAVE_ASM_MTRR_H
/* Has backtrace support */
#undef HAVE_BACKTRACE

View File

@ -82,12 +82,6 @@
/* Building vgahw module */
#undef WITH_VGAHW
/* Define to 1 if NetBSD built-in MTRR support is available */
#undef HAS_MTRR_BUILTIN
/* Define to 1 if BSD MTRR support is available */
#undef HAS_MTRR_SUPPORT
/* NetBSD PIO alpha IO */
#undef USE_ALPHA_PIO