freebsd-skq/sys
David Malone b0f4bb511e 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 have seen one side effect of the fix, which is that ACPI calls
after X has been run seem to hang my machine. As running X would
previously panic the machine, this is still an improvement ;-)

I'd like to MFC this before the 4.6 code freeze - please let me
know if it causes any problems.

PR:		28418, 25958
Tested by:	jkh, Christopher Masto <chris@netmonger.net>
MFC after:	2 weeks
2002-04-14 20:19:13 +00:00
..
alpha Modernize SCM ID. 2002-04-14 07:07:09 +00:00
amd64 Make the MTRR code a bit more defensive - this should help people 2002-04-14 20:13:08 +00:00
arm Guard against redefining __gnuc_va_list. 2002-03-24 11:25:46 +00:00
boot Unbreak this as well. 2002-04-12 15:49:30 +00:00
cam Fix 3 of the four problems with my last indentation fix. ("fixing" the 2002-04-01 05:41:33 +00:00
coda Moved signal handling and rescheduling from userret() to ast() so that 2002-04-04 17:49:48 +00:00
compat Rework logic of syscalls that modify process credentials as described in 2002-04-13 23:11:23 +00:00
conf Add a filesystem driver for the Universal Disk Format. For more info, 2002-04-14 16:36:49 +00:00
contrib We don't need ip_ipsec_pxy.c in userland. 2002-03-26 13:42:09 +00:00
crypto Remove __P. 2002-03-20 05:14:42 +00:00
ddb Commented out locking that would be used in the ps command if locks were 2002-04-11 21:01:34 +00:00
dev Fix the play / record rate setting so that it actually works. 2002-04-14 10:39:59 +00:00
fs Actually add the UDF files! 2002-04-14 16:52:14 +00:00
geom Implement DIOCGFRONTSTUFF ioctl which reports how many bytes from the start 2002-04-09 15:43:32 +00:00
gnu Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
i4b Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
i386 Make the MTRR code a bit more defensive - this should help people 2002-04-14 20:13:08 +00:00
ia64 Dotting the i-s: 2002-04-14 05:37:18 +00:00
isa GC various bits and pieces of USERCONFIG from all over the place. 2002-04-09 11:18:46 +00:00
isofs/cd9660 Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
kern Don't allow one to trace an ancestor when already traced. 2002-04-14 17:12:55 +00:00
libkern Remove bogus include of <machine/ansi.h>. 2002-04-11 06:53:40 +00:00
modules Actually add the UDF files! 2002-04-14 16:52:14 +00:00
net Cosmetical change: remove empty line to reduce diffs to RELENG_4 2002-04-14 16:40:11 +00:00
netatalk Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
netatm Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
netgraph Use 'struct callout' instead of 'struct callout_handle' to avoid 2002-04-14 17:37:35 +00:00
netinet initialize local variable explicitly 2002-04-11 02:14:21 +00:00
netinet6 Unconditionalize the definition of INET_ADDRSTRLEN and 2002-04-10 11:59:02 +00:00
netipx Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
netkey Remove __P. 2002-03-20 02:39:27 +00:00
netnatm Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
netncp Change the suser() API to take advantage of td_ucred as well as do a 2002-04-01 21:31:13 +00:00
netns Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
netsmb Change callers of mtx_init() to pass in an appropriate lock type name. In 2002-04-04 21:03:38 +00:00
nfs Remove unused include. 2002-03-20 10:12:07 +00:00
nfsclient Change the suser() API to take advantage of td_ucred as well as do a 2002-04-01 21:31:13 +00:00
nfsserver Change the suser() API to take advantage of td_ucred as well as do a 2002-04-01 21:31:13 +00:00
pc98 MFi386: revision 1.517. 2002-04-11 09:45:41 +00:00
pccard Change the suser() API to take advantage of td_ucred as well as do a 2002-04-01 21:31:13 +00:00
pci Nortel Networks sells a RealTek 8139-based NIC that's basically 2002-04-11 06:12:51 +00:00
posix4 Remove __P. 2002-03-19 22:20:14 +00:00
powerpc Include <sys/cdefs.h> for definition of __BSD_VISIBLE. 2002-04-12 15:56:45 +00:00
rpc
security/lomac Use the proc lock to protect p_ucred while we read a few items from it. 2002-04-11 21:17:45 +00:00
sparc64 o Remove vm_map_growstack() and useracc() from sendsig(). Copyout() and 2002-04-13 19:17:49 +00:00
svr4
sys Make the MTRR code a bit more defensive - this should help people 2002-04-14 20:19:13 +00:00
tools constify 2002-04-01 19:22:04 +00:00
ufs Move generic disk ioctls from <sys/disklabel.h> to <sys/disk.h>. 2002-04-08 09:20:07 +00:00
vm Fix a witness warning when expanding a hash table. We were allocating the new 2002-04-14 13:47:10 +00:00
Makefile