freebsd-dev/sys/amd64
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
amd64 Make the MTRR code a bit more defensive - this should help people 2002-04-14 20:13:08 +00:00
conf GC various bits and pieces of USERCONFIG from all over the place. 2002-04-09 11:18:46 +00:00
ia32 Initial support for executing IA-32 binaries. This will not compile 2002-04-10 19:34:51 +00:00
include Move do_cpuid into the correct place in this file and make 2002-04-10 21:18:46 +00:00
isa Move ICU_* defines into icu.h. 2002-04-06 08:25:05 +00:00
pci Major rework of the iicbus/smbus framework: 2002-03-23 15:49:15 +00:00
Makefile Update pathnames for creation of tags file. 2001-12-05 01:23:21 +00:00