Re: Ram problems

Michel LESPINASSE (walken@via.ecp.fr)
Sun, 14 Jul 1996 21:03:29 +0200 (MET DST)


After upgrading my memory from 16 to 32 MB, I had to pass the option
"mem=32M" to the linux kernel because this additionnal memory wasn't
correctly detected. Andrew R. Koepke had the same problem than me, with
the same brand of motherboards (SuperMicro)

You could say that this is not a big deal, but NT detects the whole 32 MB
without any problems, and passing options to the kernel can be a problem
if you change your configuration often : what happens if I go back to 16
MB and forget to remove the mem=32M option ??? I suppose I would get a
bad crash...

The current code for memory detection is just a BIOS call in setup.S,
but as someone pointed out to me in private email, this can give wrong
results with some BIOSes, that will never report more than 16 megabytes.
They do this to maintain compatibility with some 80286 programs (the '286
has only 24 address bits). The workaround is simple : we can read the
information from the CMOS clock instead. That's just the BIOS is supposed
to do. The addresses in the CMOS clock for this information are documented
in a lot of places, so this patch should work on every PC.

Here's my diff, to be patched in /usr/src/linux/arch/i386/boot :
--------------------------- cut here ---------------------------
*** setup.S.original Sat Jul 13 21:35:45 1996
--- setup.S Sun Jul 14 20:22:49 1996
***************
*** 26,31 ****
--- 26,34 ----
!
! Video handling moved to video.S by Martin Mares, March 1996
! <mj@k332.feld.cvut.cz>
+ !
+ ! Memory size detection changed by Michel Lespinasse, July 1996
+ ! <walken@via.ecp.fr>

! NOTE! These had better be the same as in bootsect.s!
#define __ASSEMBLY__
***************
*** 232,239 ****
--- 235,257 ----
loader_ok:
! Get memory size (extended mem, kB)

+ ! Some stupid BIOSes never report more than 16 MB
+ ! (they do it to be compatible with the 80286 which has only 24 address lines)
+ ! So we can read the information directly in the CMOS instead.
+ ! After all, that's just what the BIOS is supposed to do...
+
+ #if 0 /* use the BIOS function */
mov ah,#0x88
int 0x15
+ #else /* workaround : read the information directly from the CMOS clock */
+ mov al,#0x18
+ out #0x70,al
+ in al,#0x71
+ mov ah,al
+ mov al,#0x17
+ out #0x70,al
+ in al,#0x71
+ #endif
mov [2],ax

! Set the keyboard repeat rate to the max
--------------------------- cut here ---------------------------

On Wed, 10 Jul 1996, Michel LESPINASSE wrote:

> On Tue, 9 Jul 1996, Andrew R. Koepke wrote:
>
> > I have the new SuperMicro P55T2S motherboard with 40 MB EDO RAM and a 133MHz
> > Pentium. Using kernel 1.2.13, all the RAM appears to be usable for Linux.
> > However, when I switched to version 2.0.0 (I haven't installed any of the
> > patches yet), Linux seems to only see the first 16 MB. This information shows
> > up in the boot messages and in the file /proc/meminfo. Any ideas?
>
> I have a SuperMicro P55CMS, and I have the same problem too. When I
> upgraded to 32 MB, the linux boot sequence did not recognized the new
> memory. I fixed the problem by setting an append="mem=32M" in my
> /etc/lilo.conf. I works without problems now, but still this is not the
> normal behaviour according to the docs.

Michel "Walken" LESPINASSE - Student at Ecole Centrale Paris (France)
www PC demo coder & LiGNUx supporter
(o o) Email : walken@via.ecp.fr
------oOO--(_)--OOo--------------------------------------------------