Re: [PATCH][RFC] AMD Elan patch

H. Peter Anvin
2002-01-01T22:04:14Z

Robert Schwebel wrote:

> diff -urN -X kernel-patches/dontdiff linux-2.4.17/arch/i386/boot/setup.S linux-2.4.17-rs/arch/i386/boot/setup.S
> --- linux-2.4.17/arch/i386/boot/setup.S Fri Nov 9 22:58:02 2001
> +++ linux-2.4.17-rs/arch/i386/boot/setup.S Mon Dec 31 17:20:17 2001
> @@ -42,6 +42,9 @@
> * if CX/DX have been changed in the e801 call and if so use AX/BX .
> * Michael Miller, April 2001 <michaelm@mjmm.org>
> *
> + * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes
> + * by Robert Schwebel, December 2001 <robert@schwebel.de>
> + *
> */
>
> #include <linux/config.h>
> @@ -646,7 +649,14 @@
> #
> # Enable A20. This is at the very best an annoying procedure.
> # A20 code ported from SYSLINUX 1.52-1.63 by H. Peter Anvin.
> +# AMD Elan bug fix by Robert Schwebel.
> #
> +
> +#if defined(CONFIG_MELAN)
> + inb $0xee, %al # reading 0xee enables A20
> + jmp a20_done
> +#endif
> +
>

Do you have documentation which verifies that A20 is enabled by the time
the IN instruction returns? If not, you probably don't want to jump to
a20_done, but rather fall into a loop like the following:

#if defined(CONFIG_MELAN)
inb $0xee, %al
a20_elan_wait:
call a20_test
jz a20_elan_wait
jmp a20_done
#endif

Furthermore, I would still like to argue that this does not belong into
"processor type and features", because all of these are *chipset*
issues; in fact, in this particular case you're more than anything
working around a BIOS bug (not having INT 15h AX=2401h do the right thing).

I'm also very uncomfortable with putting this where you do; I think it
should be put before a20_kbc instead. If the BIOS is implemented
correctly, it should be used.

-hpa