Re: A20 Gate enable sequence (setup.S)

2000-10-16 Thread Robert Kaiser


In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Richard B. Johnson) writes:
> On Sun, 15 Oct 2000, Robert Kaiser wrote:
> 
>> > The AMD/Elan box snoops for the sequence sent to the keyboard
>> > controller to enable A<20>.
>> 
> Robert Kaiser didn't write this. I did. And yes. It makes no difference
> about the 'board' it's in the chip.

Well, if it is in the chip, then what ever is in there doesn't work properly:
I have seen several different AMD Elan boards that failed to boot Linux. Adding
the "fast A20 enable" via port 0x92 to setup.S fixed the problem in all cases.

>> > The AMD/Elan chip also comes to life after a hardware reset with
>> > A<20> enabled. So, if you don't turn it OFF, there won't be any
>> > problem during the protected-mode transition.
>> 
>> Sure, but whether you CAN leave it on depends on the board's BIOS.
>> Some of them are "smart" and won't let you configure the initial
>> A20 state. Adding the port 0x92 method to setup.S as I'm suggesting
>> would be safe in all cases (assuming it won't break anything else).
>> 
> 
> Many who use Linux in embeded systems write their own BIOS as I
> have done. Then you don't have to pay $10/box you ship to a BIOS
> vendor who ripped off all the code anyway.

I hope you are not seriously suggesting that everyone who uses Linux
in embedded systems should be prepared to write their own BIOS.

Of course it's nice if you don't have to pay BIOS royalties, but in
my experience, people who have a high enough volume so that writing
their own BIOS would make sense tend to go for a different architecture
(PPC, ARM, MIPS, SH) in the first place.

(BTW, is your BIOS under GPL perchance ?)


> FYI, the code that was submitted can't possibly work (it was backwards).
> If it made your board 'work' there is something else broken.

Yep, my fault: The code _did_ work in a 2.2.x kernel, but I applied the
change to the latest 2.4 kernel, not realizing that the assembly syntax
had been changed in the meantime. I should have at least tested it. See below
for a corrected version. This time I've tested it: the unmodified kernel fails
to boot on a JUMPtec DIMM-PC (with AMD Elan SC410), the patched kernel
does boot.

Some may argue that simply writing 0x02 to port 0x92 would do the job and
they may well be right (it does work that way on the DIMM-PC). My suggested code
makes sure to keep bits #7-#2 unmodified and it always clears bit #0 (CPU
reset). Call me paranoid, but I think this is worth two extra assembly
instructions :-).

diff -urN linux-2.4.0-test8/arch/i386/boot/setup.S linux/arch/i386/boot/setup.S
--- linux-2.4.0-test8/arch/i386/boot/setup.SWed Jul 19 07:00:33 2000
+++ linux/arch/i386/boot/setup.SMon Oct 16 15:27:48 2000
@@ -631,6 +631,16 @@
# appropriate
 
 # that was painless, now we enable a20
+
+# enable the "fast" A20 gate
+
+   inb $0x92, %al
+   orb $0x02, %al
+   andb$0xfe, %al
+   outb%al, $0x92
+
+# enable the keyboard controller A20 gate
+
callempty_8042
 
movb$0xD1, %al  # command write



Robert Kaiser email: [EMAIL PROTECTED]
SYSGO RTS GmbH
Am Pfaffenstein 14phone: (49) 6136 9948-762
D-55270 Klein-Winternheim / Germany   fax:   (49) 6136 9948-10
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-15 Thread davej


Richard B. Johnson wrote..

> Robert Kaiser didn't write this. I did.

You and a few hundred other embedded systems programmers.

> FYI, the code that was submitted can't possibly work (it was backwards).
> If it made your board 'work' there is something else broken.

What do you mean backwards?

The only broken part I see is that unlike the same routine in 2.2,
this one doesn't preserve the other bits.
(Which the 2.4 code really should be doing or very strange things
may happen on certain hardware)

regards,

Dave.

-- 
| Dave Jones <[EMAIL PROTECTED]>  http://www.suse.de/~davej
| SuSE Labs

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-15 Thread Richard B. Johnson

On Sun, 15 Oct 2000, Robert Kaiser wrote:

> > The AMD/Elan box snoops for the sequence sent to the keyboard
> > controller to enable A<20>.
> 
Robert Kaiser didn't write this. I did. And yes. It makes no difference
about the 'board' it's in the chip.

> Are you sure this is true of all boards using the AMD Elan ?
> So far, I've dealt with three different AMD Elan boards and only
> one of them (Jumptec DIMM-PC) seemed to have this feature. But even
> on that one, Linux wouldn't boot out of the box because of A20 problems
> (you had to reset the keyboard controller to make it work).
> 

The keyboard controller is in a seperate Super I/O chip. You can
'pretend' to go through the motions, but there is no connection
whatsoever (no pin, no trace) to connect the keyboard output bit
to A<20> enable. It's all done by the AMD internal snoop.

So if you write the right stuff to the right port, the bit is
enabled.

> > However, it also respects the port
> > 0x92 control.
> 
> The i386EX has port 0x92 built in (it does not have a built-in
> keyboard controller ..), so port 0x92 should work on all 386EX
> boards whereas the keyboard controller sequence may or may not work.
> 
> 
> > The AMD/Elan chip also comes to life after a hardware reset with
> > A<20> enabled. So, if you don't turn it OFF, there won't be any
> > problem during the protected-mode transition.
> 
> Sure, but whether you CAN leave it on depends on the board's BIOS.
> Some of them are "smart" and won't let you configure the initial
> A20 state. Adding the port 0x92 method to setup.S as I'm suggesting
> would be safe in all cases (assuming it won't break anything else).
> 

Many who use Linux in embeded systems write their own BIOS as I
have done. Then you don't have to pay $10/box you ship to a BIOS
vendor who ripped off all the code anyway.

FYI, the code that was submitted can't possibly work (it was backwards).
If it made your board 'work' there is something else broken.

Cheers,
Dick Johnson

Penguin : Linux version 2.2.17 on an i686 machine (801.18 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-15 Thread Robert Kaiser

> The AMD/Elan box snoops for the sequence sent to the keyboard
> controller to enable A<20>.

Are you sure this is true of all boards using the AMD Elan ?
So far, I've dealt with three different AMD Elan boards and only
one of them (Jumptec DIMM-PC) seemed to have this feature. But even
on that one, Linux wouldn't boot out of the box because of A20 problems
(you had to reset the keyboard controller to make it work).

> However, it also respects the port
> 0x92 control.

The i386EX has port 0x92 built in (it does not have a built-in
keyboard controller ..), so port 0x92 should work on all 386EX
boards whereas the keyboard controller sequence may or may not work.


> The AMD/Elan chip also comes to life after a hardware reset with
> A<20> enabled. So, if you don't turn it OFF, there won't be any
> problem during the protected-mode transition.

Sure, but whether you CAN leave it on depends on the board's BIOS.
Some of them are "smart" and won't let you configure the initial
A20 state. Adding the port 0x92 method to setup.S as I'm suggesting
would be safe in all cases (assuming it won't break anything else).

Rob


Robert Kaiser email: [EMAIL PROTECTED]
SYSGO RTS GmbH
Am Pfaffenstein 14http://www.elinos.com
D-55270 Klein-Winternheim / Germany   http://www.sysgo.de


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-15 Thread Robert Kaiser



On Fri, 13 Oct 2000, Albert Cranford wrote:

> Robert Kaiser wrote:
> > 
> > On Fre, 13 Okt 2000 you wrote:
> > > > Some boards (especially in the embedded PC area) implement only the
> > > > latter method (some don't even _have_ a keyboard controller).
> > > > With these boards, Linux fails to boot.
> > >
> > > Try the current 2.2.18pre. This has fast A20 too and I suspect will boot
> > > on your box. Its had no problems on 2.2.18pre reported against it so far. I've
> > > not done a 2.4 test patch but yours seems to be the sam ething
> > 
> > Thanks for the hint, I hadn't checked that version 
> > 
> > >
> > > AMD ELAN ?
> > 
> > Actually several different boards, some using AMD ELAN, some 386 EX.
> > 
> > Rob
> > 
> 
> Here is a wroking 2.4.0 version, which is from Randy Dunlaps patch.
> Later,
> Albert


Thanks Albert! Actually I was aware of this patch (saw it in the
archives), but, it seemed to me that this patch hadn't made it into
the standard kernel (2.4.0-test8 didn't have it), so I thought I might
bring up this issue once more. I just learned from Alan, that he added
it in 2.2.18pre, so I'll test that one and if it works, I'll be all
happy :-).

Rob


Robert Kaiser   email: [EMAIL PROTECTED]
SYSGO RTS GmbH
Am Pfaffenstein 14  http://www.elinos.com
D-55270 Klein-Winternheim / Germany http://www.sysgo.de

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Richard B. Johnson

On Fri, 13 Oct 2000, Alan Cox wrote:

> > Some boards (especially in the embedded PC area) implement only the
> > latter method (some don't even _have_ a keyboard controller).
> > With these boards, Linux fails to boot.
> 
> Try the current 2.2.18pre. This has fast A20 too and I suspect will boot
> on your box. Its had no problems on 2.2.18pre reported against it so far. I've
> not done a 2.4 test patch but yours seems to be the sam ething
> 
> AMD ELAN ?

The AMD/Elan box snoops for the sequence sent to the keyboard
controller to enable A<20>. However, it also respects the port
0x92 control. Linux-2.2.17 doesn't have the 0x92 control so
it must have been added recently.

The AMD/Elan chip also comes to life after a hardware reset with
A<20> enabled. So, if you don't turn it OFF, there won't be any
problem during the protected-mode transition.


Cheers,
Dick Johnson

Penguin : Linux version 2.2.17 on an i686 machine (801.18 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Albert Cranford

Robert Kaiser wrote:
> 
> On Fre, 13 Okt 2000 you wrote:
> > > Some boards (especially in the embedded PC area) implement only the
> > > latter method (some don't even _have_ a keyboard controller).
> > > With these boards, Linux fails to boot.
> >
> > Try the current 2.2.18pre. This has fast A20 too and I suspect will boot
> > on your box. Its had no problems on 2.2.18pre reported against it so far. I've
> > not done a 2.4 test patch but yours seems to be the sam ething
> 
> Thanks for the hint, I hadn't checked that version 
> 
> >
> > AMD ELAN ?
> 
> Actually several different boards, some using AMD ELAN, some 386 EX.
> 
> Rob
> 
> 
> Robert Kaiser email: [EMAIL PROTECTED]
> SYSGO RTS GmbH
> Am Pfaffenstein 14phone: (49) 6136 9948-762
> D-55270 Klein-Winternheim / Germany   fax:   (49) 6136 9948-10
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [EMAIL PROTECTED]
> Please read the FAQ at http://www.tux.org/lkml/

Here is a wroking 2.4.0 version, which is from Randy Dunlaps patch.
Later,
Albert

--- linux-2.4.0/arch/i386/boot/setup.S.orig Mon Jul 17 20:32:00 2000
+++ linux/arch/i386/boot/setup.SMon Jul 17 20:35:10 2000
@@ -640,6 +640,8 @@
movb$0xDF, %al  # A20 on
outb%al, $0x60
callempty_8042
+   movb$0x2, %al   # Gate A20 functionality is achieved
+   outb%al, $0x92  # via port 0x92, bit 1.
 
 # wait until a20 really *is* enabled; it can take a fair amount of
 # time on certain systems; Toshiba Tecras are known to have this
---
From: "Dunlap, Randy" <[EMAIL PROTECTED]>
To: "'Agust Karlsson'" <[EMAIL PROTECTED]>,
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>,
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
Subject: RE: A20 gate control question.
Date:   Mon, 17 Jul 2000 09:46:17 -0700
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8BIT
Sender: [EMAIL PROTECTED]
Precedence: bulk
X-Loop: [EMAIL PROTECTED]
X-Mozilla-Status: 8011
X-Mozilla-Status2: 
X-UIDL: a4b217d6c05a8b4bb97c23a40bca51e7

> Hi.

Jesse Off ([EMAIL PROTECTED]) posted a patch to do
this on Oct. 26, 1999.  His patch needs to be added
to setup.S IMO, along with the current gating of A20.



The company I work for, NewMonics, does a lot of work on embedded systems
and we've recently ported our product (a lightweight realtime Java virtual
machine) to Linux.  On some of the embedded systems/PLC's we work with
(specifically, those based on the AMD Elan SC310 and SC300 386
microcontrollers) Linux fails to boot because the keyboard controller is
not there to set the A20 bit.  These machines are headless, keyboardless,
and diskless (except for a small PCMCIA flash card).  With the following
patch, we were able to get our virtual machine running on
Linux under this hardware via a serial port console.

--- setup.S Mon Aug  9 12:04:38 1999
+++ setup.S.patched Tue Oct 26 10:50:36 1999
@@ -553,6 +553,15 @@
out #0x60,al
callempty_8042
 
+! The AMD 386 Elan SC300 and SC310 microcontrollers which
+! are used in some embedded systems don't have
+! a keyboard controller; we have to do things different on 
+! these chips.  Jesse Off, NewMonics, Inc. <[EMAIL PROTECTED]> 
+
+   mov al,#0x2 ! GATEA20 functionality is acheived
+   out #0x92, al   ! via port 0x92, bit 1.
+
+
 ! wait until a20 really *is* enabled; it can take a fair amount of
 ! time on certain systems; Toshiba Tecras are known to have this
 ! problem.  The memory location used here is the int 0x1f vector,
-



This applies to newer Intel systems also.  I asked
internally if port 0x92 might have conflicts with
other chipsets and the answer I got was "no."


Also, from other email on this subject, is there
an implication here that the timeout (counter) in
"empty_8042" doesn't work (on systems that don't
have an 8042 controller)?

~Randy
___
|Randy Dunlap Intel Corp., DALSr. SW Engr.|
|randy.dunlap.at.intel.com503-696-2055|
|NOTE:  Any views presented here are mine alone   |
|and may not represent the views of my employer.  |
|_|


-- 
Albert Cranford Deerfield Beach FL USA
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Robert Kaiser

On Fre, 13 Okt 2000 you wrote:
> > Some boards (especially in the embedded PC area) implement only the
> > latter method (some don't even _have_ a keyboard controller).
> > With these boards, Linux fails to boot.
> 
> Try the current 2.2.18pre. This has fast A20 too and I suspect will boot
> on your box. Its had no problems on 2.2.18pre reported against it so far. I've
> not done a 2.4 test patch but yours seems to be the sam ething

Thanks for the hint, I hadn't checked that version 

> 
> AMD ELAN ?

Actually several different boards, some using AMD ELAN, some 386 EX.

Rob
 

Robert Kaiser email: [EMAIL PROTECTED]
SYSGO RTS GmbH
Am Pfaffenstein 14phone: (49) 6136 9948-762
D-55270 Klein-Winternheim / Germany   fax:   (49) 6136 9948-10
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Tigran Aivazian

On Fri, 13 Oct 2000, Robert Kaiser wrote:
> +
> +# enable the "fast" A20 gate
> +
> + in  al,#0x92
> + or  al,#2
> + and al,#0xfe
> + out #0x92,al
> +

this is not a valid AT assembler but looks like some ancient Intel
syntax. Linux kernel is written using AT syntax (thanks to Chris Noe who
did the translation). Please rewrite it and re-submit for everyone to
test, e.g. in should be inb, the arguments are in the wrong order etc etc.

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Alan Cox

> Some boards (especially in the embedded PC area) implement only the
> latter method (some don't even _have_ a keyboard controller).
> With these boards, Linux fails to boot.

Try the current 2.2.18pre. This has fast A20 too and I suspect will boot
on your box. Its had no problems on 2.2.18pre reported against it so far. I've
not done a 2.4 test patch but yours seems to be the sam ething

AMD ELAN ?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Alan Cox

 Some boards (especially in the embedded PC area) implement only the
 latter method (some don't even _have_ a keyboard controller).
 With these boards, Linux fails to boot.

Try the current 2.2.18pre. This has fast A20 too and I suspect will boot
on your box. Its had no problems on 2.2.18pre reported against it so far. I've
not done a 2.4 test patch but yours seems to be the sam ething

AMD ELAN ?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Tigran Aivazian

On Fri, 13 Oct 2000, Robert Kaiser wrote:
 +
 +# enable the "fast" A20 gate
 +
 + in  al,#0x92
 + or  al,#2
 + and al,#0xfe
 + out #0x92,al
 +

this is not a valid ATT assembler but looks like some ancient Intel
syntax. Linux kernel is written using ATT syntax (thanks to Chris Noe who
did the translation). Please rewrite it and re-submit for everyone to
test, e.g. in should be inb, the arguments are in the wrong order etc etc.

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: A20 Gate enable sequence (setup.S)

2000-10-13 Thread Robert Kaiser

On Fre, 13 Okt 2000 you wrote:
  Some boards (especially in the embedded PC area) implement only the
  latter method (some don't even _have_ a keyboard controller).
  With these boards, Linux fails to boot.
 
 Try the current 2.2.18pre. This has fast A20 too and I suspect will boot
 on your box. Its had no problems on 2.2.18pre reported against it so far. I've
 not done a 2.4 test patch but yours seems to be the sam ething

Thanks for the hint, I hadn't checked that version 

 
 AMD ELAN ?

Actually several different boards, some using AMD ELAN, some 386 EX.

Rob
 

Robert Kaiser email: [EMAIL PROTECTED]
SYSGO RTS GmbH
Am Pfaffenstein 14phone: (49) 6136 9948-762
D-55270 Klein-Winternheim / Germany   fax:   (49) 6136 9948-10
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/