[PATCH] Re: e820 memory detection fix for ThinkPad

From: Marc Joosen (mjoosen@us.ibm.com)
Date: Thu Dec 21 2000 - 20:04:02 EST


David Weinhall wrote:

> On Tue, Dec 19, 2000 at 07:16:40PM -0500, Marc Joosen wrote:
> >
> > This is a tiny patch to make the int15/e820 memory mapping work on
IBM
> > ThinkPads. Until now, I have had to give lilo a mem= option with one
meg
>
> If this simple patch solves your problem, great! But in that case,
> PLEASE add a note telling WHY the assignment is done for every
> iteration; else some smarthead will probably submit a patch someday
> in the future along the lines of "assigning this only once makes the
> loop faster"...
>
> Anyhow, good spotting!

  Thanks for the tip, David. I hope that whoever wants to move that line
out of the loop is aware that it is only executed ~10 times :) So I
hereby submit a second version of the patch, that includes a link to
the documentation and #defines the word SMAP (thanks to David Parsons
for that):

--- linux/arch/i386/boot/setup.S.orig Mon Oct 30 17:44:29 2000
+++ linux/arch/i386/boot/setup.S Thu Dec 21 19:37:12 2000
@@ -289,10 +289,11 @@
 # a whole bunch of different types, and allows memory holes and
 # everything. We scan through this memory map and build a list
 # of the first 32 memory areas, which we return at [E820MAP].
-#
+# This is documented at http://www.teleport.com/~acpi/acpihtml/topic245.htm
+
+#define SMAP 0x534d4150

 meme820:
- movl $0x534d4150, %edx # ascii `SMAP'
     xorl %ebx, %ebx # continuation counter
     movw $E820MAP, %di # point into the whitelist
                              # so we can have the bios
@@ -300,13 +301,15 @@

 jmpe820:
     movl $0x0000e820, %eax # e820, upper word zeroed
+ movl $SMAP, %edx # do this every time, some
+ # bioses are forgetful
     movl $20, %ecx # size of the e820rec
     pushw %ds # data record.
     popw %es
     int $0x15 # make the call
     jc bail820 # fall to e801 if it fails

- cmpl $0x534d4150, %eax # check the return is `SMAP'
+ cmpl $SMAP, %eax # check the return is `SMAP'
     jne bail820 # fall to e801 if it fails

 # cmpl $1, 16(%di) # is this usable memory?

  Again, please copy any comments to me (mjoosen@us.ibm.com), since
I'm not subscribed to linux-kernel.

--
  Marc Joosen
  Communication Link Design
  IBM T.J. Watson Research Center
  Yorktown Heights, NY

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



This archive was generated by hypermail 2b29 : Sat Dec 23 2000 - 21:00:30 EST