diff -urN linux-2.1.99/Documentation/Configure.help linux/Documentation/Configure.help --- linux-2.1.99/Documentation/Configure.help Wed Apr 29 15:41:33 1998 +++ linux/Documentation/Configure.help Sat May 2 16:37:28 1998 @@ -6444,13 +6444,13 @@ MTRR control and configuration CONFIG_MTRR - On Intel Pentium Pro systems the Memory Type Range Registers (MTRRs) - may be used to control processor access to memory ranges. This is - most useful when you have a video (VGA) card on the PCI - bus. Enabling write-combining allows PCI write transfers to be - combined into a larger transfer before bursting over the PCI - bus. This can increase performance of image write operations 2.5 - times or more. + On Intel Pentium Pro/Pentium II systems the Memory Type Range + Registers (MTRRs) may be used to control processor access to memory + ranges. This is most useful when you have a video (VGA) card on a + PCI or AGP bus. Enabling write-combining allows bus write transfers + to be combined into a larger transfer before bursting over the + PCI/AGP bus. This can increase performance of image write operations + 2.5 times or more. This option creates a /proc/mtrr file which may be used to manipulate your MTRRs. Typically the X server should use this. This should have a reasonably generic interface so that similar control registers on @@ -6458,10 +6458,9 @@ This option also fixes a problem with buggy SMP BIOSes which only set the MTRRs for the boot CPU and not the secondary CPUs. This can lead to all sorts of problems. - In general you should compile this into the kernel, rather than as a - loadable module, because the BIOS fix needs to be done early in the - boot sequence. If you compile this as a module, the BIOS fix will be - delayed until when you load the module. You do this at your own risk. + Compiling this as a module is not available because the BIOS fix + needs to be done early in the boot sequence, otherwise your machine + could lock up. See Documentation/mtrr.txt for more information. Main CPU frequency, only for DEC alpha machine diff -urN linux-2.1.99/Documentation/mtrr.txt linux/Documentation/mtrr.txt --- linux-2.1.99/Documentation/mtrr.txt Wed Apr 29 15:41:33 1998 +++ linux/Documentation/mtrr.txt Sat May 2 16:43:51 1998 @@ -1,15 +1,15 @@ MTRR (Memory Type Range Register) control -17 Dec 1997 +2 May 1998 Richard Gooch - On Intel Pentium Pro systems the Memory Type Range Registers (MTRRs) - may be used to control processor access to memory ranges. This is - most useful when you have a video (VGA) card on the PCI - bus. Enabling write-combining allows PCI write transfers to be - combined into a larger transfer before bursting over the PCI - bus. This can increase performance of image write operations 2.5 - times or more. + On Intel Pentium Pro/Pentium II systems the Memory Type Range + Registers (MTRRs) may be used to control processor access to memory + ranges. This is most useful when you have a video (VGA) card on a + PCI or AGP bus. Enabling write-combining allows bus write transfers + to be combined into a larger transfer before bursting over the + PCI/AGP bus. This can increase performance of image write operations + 2.5 times or more. The CONFIG_MTRR option creates a /proc/mtrr file which may be used to manipulate your MTRRs. Typically the X server should use @@ -30,13 +30,40 @@ % cat /proc/mtrr reg00: base=0x00000000 ( 0MB), size= 128MB: write-back, count=1 reg01: base=0x08000000 ( 128MB), size= 64MB: write-back, count=1 -reg05: base=0x80000000 (2048MB), size= 4MB: write-combining, count=1 =============================================================================== Creating MTRRs from the shell: -% echo "base=0x80000000 size=0x400000 type=write-combining" >! /proc/mtrr +# echo "base=0xf8000000 size=0x400000 type=write-combining" >! /proc/mtrr + +And the result thereof: +% cat /proc/mtrr +reg00: base=0x00000000 ( 0MB), size= 128MB: write-back, count=1 +reg01: base=0x08000000 ( 128MB), size= 64MB: write-back, count=1 +reg02: base=0xf8000000 (3968MB), size= 4MB: write-combining, count=1 + +This is for videoram at base address 0xf8000000 and size 4 MBytes. To +find out your base address, you need to look at the output of your X +server, which tells you where the linear framebuffer address is. A +typical line that you may get is: + +(--) S3: PCI: 968 rev 0, Linear FB @ 0xf8000000 + +Note that you should only use the value from the X server, as it may +move the framebuffer base address, so the only value you can trust is +that reported by the X server. + +To find out the size of your framebuffer (what, you don't actually +know?), the following line will tell you: + +(--) S3: videoram: 4096k + +That's 4 MBytes, which is 0x400000 bytes (in hexadecimal). +A patch is being written for XFree86 which will make this automatic: +in other words the X server will manipulate /proc/mtrr using the +ioctl() interface, so users won't have to do anything. If you use a +commercial X server, lobby your vendor to add support for MTRRs. =============================================================================== Removing MTRRs from the shell: -% echo "disable=5" >! /proc/mtrr +% echo "disable=2" >! /proc/mtrr =============================================================================== Reading MTRRs from a C programme using ioctl()'s: @@ -44,7 +71,7 @@ Source file for mtrr-show (example programme to show MTRRs using ioctl()'s) - Copyright (C) 1997 Richard Gooch + Copyright (C) 1997-1998 Richard Gooch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -72,7 +99,7 @@ Written by Richard Gooch 17-DEC-1997 - Last updated by Richard Gooch 17-DEC-1997 + Last updated by Richard Gooch 2-MAY-1998 */ @@ -84,7 +111,7 @@ #include #include #define MTRR_NEED_STRINGS -#include +#include #define TRUE 1 #define FALSE 0 @@ -130,7 +157,7 @@ Source file for mtrr-add (example programme to add an MTRRs using ioctl()) - Copyright (C) 1997 Richard Gooch + Copyright (C) 1997-1998 Richard Gooch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -158,7 +185,7 @@ Written by Richard Gooch 17-DEC-1997 - Last updated by Richard Gooch 17-DEC-1997 + Last updated by Richard Gooch 2-MAY-1998 */ @@ -172,7 +199,7 @@ #include #include #define MTRR_NEED_STRINGS -#include +#include #define TRUE 1 #define FALSE 0 diff -urN linux-2.1.99/arch/i386/kernel/mtrr.c linux/arch/i386/kernel/mtrr.c --- linux-2.1.99/arch/i386/kernel/mtrr.c Wed Apr 29 15:41:33 1998 +++ linux/arch/i386/kernel/mtrr.c Sat May 2 16:46:21 1998 @@ -104,6 +104,12 @@ Moved register-setting macros into this file. Moved setup code from init/main.c to i386-specific areas. v1.18 + 19980502 Richard Gooch + Moved MTRR detection outside conditionals in . + v1.19 + 19980502 Richard Gooch + Documentation improvement: mention Pentium II and AGP. + v1.20 */ #include #include @@ -137,7 +143,7 @@ #include #include -#define MTRR_VERSION "1.18 (19980429)" +#define MTRR_VERSION "1.20 (19980502)" #define TRUE 1 #define FALSE 0 @@ -1193,8 +1199,8 @@ __initfunc(int mtrr_init(void)) #endif { -# if !defined(__SMP__) || defined(MODULE) if ( !(boot_cpu_data.x86_capability & X86_FEATURE_MTRR) ) return 0; +# if !defined(__SMP__) || defined(MODULE) printk("mtrr: v%s Richard Gooch (rgooch@atnf.csiro.au)\n", MTRR_VERSION); #endif