freebsd-dev/sys/i386
David Malone 7376ec0dd7 Make the MTRR code a bit more defensive - this should help people
trying to run X on some Athlon systems where the BIOS does odd things
(mines an ASUS A7A266, but it seems to also help on other systems).

Here's a description of the problem and my fix:

	The problem with the old MTRR code is that it only expects
	to find documented values in the bytes of MTRR registers.
	To convert the MTRR byte into a FreeBSD "Memory Range Type"
	(mrt) it uses the byte value and looks it up in an array.
	If the value is not in range then the mrt value ends up
	containing random junk.

	This isn't an immediate problem. The mrt value is only used
	later when rewriting the MTRR registers. When we finally
	go to write a value back again, the function i686_mtrrtype()
	searches for the junk value and returns -1 when it fails
	to find it. This is converted to a byte (0xff) and written
	back to the register, causing a GPF as 0xff is an illegal
	value for a MTRR byte.

	To work around this problem I've added a new mrt flag
	MDF_UNKNOWN.  We set this when we read a MTRR byte which
	we do not understand.  If we try to convert a MDF_UNKNOWN
	back into a MTRR value, then the new function, i686_mrt2mtrr,
	just returns the old value of the MTRR byte. This leaves
	the memory range type unchanged.

I'd like to merge this before the 4.6 code freeze, so if people
can test this with XFree 4 that would be very useful.

PR:		28418, 25958
Tested by:	jkh, Christopher Masto <chris@netmonger.net>
MFC after:	2 weeks
2002-04-14 20:13:08 +00:00
..
acpica Fix typo in function name. 2002-01-10 03:26:46 +00:00
apm Remove __P. 2002-03-20 05:48:58 +00:00
bios Remove __P. 2002-03-20 05:48:58 +00:00
compile Don't need the .keep_me files. Obrien and I committed past each other. 2001-07-01 23:35:44 +00:00
conf Round 2 of munging the MI/MD split in NOTES. Put almost all the device 2002-04-09 18:26:58 +00:00
i386 Make the MTRR code a bit more defensive - this should help people 2002-04-14 20:13:08 +00:00
ibcs2 Moved signal handling and rescheduling from userret() to ast() so that 2002-04-04 17:49:48 +00:00
include Move do_cpuid into the correct place in this file and make 2002-04-10 21:18:46 +00:00
isa GC various bits and pieces of USERCONFIG from all over the place. 2002-04-09 11:18:46 +00:00
linux Spell "separate" correctly. 2002-04-05 00:04:56 +00:00
pci Major rework of the iicbus/smbus framework: 2002-03-23 15:49:15 +00:00
svr4 Moved signal handling and rescheduling from userret() to ast() so that 2002-04-04 17:49:48 +00:00
Makefile Update pathnames for creation of tags file. 2001-12-05 01:23:21 +00:00