Re: PCMCIA: unable to map memory

From: Ulrich Hansen (uhansen_at_mainz-online.de)
Date: 11/08/03

  • Next message: Bill Marcum: "Re: PCMCIA: unable to map memory"
    Date: Sat, 08 Nov 2003 19:37:18 +0100
    
    

    > Remove the first badram range and leave just the new one.

    Yes, I did so, and: it works great. I already
    thought about it, because the BadRAM solution
    worked OK with an excluded Ram area of 32kb
    before, so it shouldn't need 64kb now.

    Thanks for helping to work this out. I am really
    happy to have solved this nasty problem after days
    of confusion. :-)

    It's the best to write the solution down while the
    problem is still clear on mind. Therefore I add
    now a summary, so everybody who wants to run a
    recent linux on a compaq contura aero can profit
    from this. I also will add the following text to
    my website at http://ulihansen.kicks-ass.net/aero

    Please everybody correct me if I mixed something
    up or got something wrong.

    Thanks again, Dave
    Uli

    -----summary of the problem and solution--------

    Linux on the compaq contura aero may become
    unstable on machines that have been upgraded to 20
    MB RAM. This instability is caused by an invalid
    access to specific memory addresses above 16 MB.
    Linux conflicts here with the pcmcia-controller.

    As workaround it is possible to run linux stable
    if you limit the aeros RAM with "mem=16M" at boot
    or by disabling PCMCIA. This is not satisfying. So
      let's take a look at the problem.

    The invalid memory addresses can not be described
    as a fixed memory hole - it is more like a
    _shadow_, thrown by the controllers actually used
    memory adresses into an area above 16 MB.

    One aero-user, Donald Gordon suspects, that this
    behaviour is caused by "incomplete address
    decoding. Some parts of the system, including the
    PCMCIA controller, may ignore the top 8 address
    bits, thus causing a false image of (for instance)
    the memory-mapped area used by the PCMCIA
    controller to appear at 16mb + expected location".

    This 'false image' or shadow in the > 16 MB RAM
    adresses, thrown by the real memory addresses used
    by the pcmcia controller, was irrelevant with
    compaqs stock memory extension modules: They added
    only 4 or 8 MB to the aeros soldered in
    4MB-RAM-chips and gave it a max of 12 MB RAM.

    With the production of third party (Kingston)
    16-MB-RAM-Extension-Modules for the aero in the
    late 90's, which gave the machine a max of 20 MB
    RAM, this shadow became visible -and a problem for
    linux users.

    A problem that can be solved. Two things are here
    important:

    - An user-defined setting of the memory that
    should be used by the pcmcia-controller. This can
    be done with the line "include memory" in the
    configuration file "/etc/pcmcia/config.opts" of
    the pcmcia-cs-package by David Hinds. The package
    must be installed if you want to use pcmcia with
    kernel 2.2 or 2.4 and can be downloaded here:
    http://pcmcia-cs.sourceforge.net/

    - A patch for the kernel (2.2. or 2.4) called
    BadRAM by Rick van Rein (and it's successor BadMEM
    by Nico Schmoigl). It allows specifying the
    appropriate RAM-Adresses in the 'shadowed area'
    that should be avoided by linux.
    The BadRAM -patch can be downloaded from here:
    http://rick.vanrein.org/linux/badram/
    BadMEM is found here:
    http://badmem.sourceforge.net/
    Applied patches for redhat stock-kernels (2.4) can
    be found here:
    http://dynamicnetservices.com/~will/badram/

    1. Specifying the memory for the pcmcia-controller

    With kernel 2.2 I used with success the
    ram-addresses "0xb0000-0xb7fff". So try to specify
    the ports and the memory that the
    pcmcia-controller shall use in
    /etc/pcmcia/config.opts with the following values:

    include port 0x100-0x4ff, port 0xc00-0xcff
    include memory 0xb0000-0xb7fff

    All other "include memory"-statements must be
    outcommented.

    Kernel 2.4 (including BadRAM-patch) seems to react
    more sensitive to the ram-map provided by the
    aero's bios and reserves pages for the Video-RAM
    that formerly were available for kernel 2.2. That
    meant with kernel 2.4 we need to search a new free
    RAM-adress-range for the pcmcia-controller. This
    can be detected from /proc/iomem. So boot linux
    with pcmcia disabled and command in the shell:

    cat /proc/iomem

    For me this created the following output:

    00000000-0009efff : System RAM
    000a0000-000bffff : Video RAM area
    000c0000-000c7fff : Video ROM
    000f0000-000fffff : System ROM
    00100000-013fffff : System RAM
       00100000-00240c09 : Kernel code
       00240c0a-00283d5f : Kernel data

    Kernel 2.2 used the memory range 0xb0000-0xb7fff.
    Now, with Kernel 2.4 this range is reserved for
    Video RAM and can not be used. Still free seem to
    be the adress-range from Oxd0000 to 0xeffff. So
    lets try out these addresses:

    So set in /etc/pcmcia/config.opts

    include port 0x100-0x4ff, port 0xc00-0xcff
    include memory 0xd0000-0xd7fff

    All other "include memory"-statements must be
    outcommented. The above values work OK for me.

    2. Configuring BadRAM

    Now with specifying the memory-adresses for the
    pcmcia-controller the work is NOT done. We must
    keep in mind, that the memory range used by the
    controller throws a shadow of unusable
    ram-adresses into the > 16 MB range. These RAM
    adresses have to be excluded, otherwise linux will
    freeze if you enable pcmcia. This can be done with
    the kernel-patches BadRAM or BadMEM.

    Apply the appropriate BadRAM-patch for the kernel.
    The patch "BadRAM-2.2.19.A1.patch" also works for
    all above kernel 2.2-versions including 2.2.25.

    For kernel 2.4 there are patches from different
    contributers. I use the adapted version for the
    newest redhat stock - kernel-source 2.4.20-20.9.
    After patching the kernel you have a new
    kernel-configuration-option under General setup
    that is called
    CONFIG_BADRAM=y
    Please take care to enable that option.

    Now specify the RAM-adresses you don't want to use:
    either at boottime with the command
    linux badram=value1,value2
    or in lilo.conf with the line
    append="badram=value1,value2"

    The two values specify a so called V1-pattern.
    value1 is supposed to be the first RAM-address to
    exclude, value2 is a so called mask. So the second
    value is NOT the last address to exclude but (as I
    understand) a description of the geometrical form
    of the RAM area that should be excluded. This is
    OK for the original purpose of BadRAM: Using
    defunct RAM-Modules. Defect areas of a RAM bank
    don't stretch over a one coherent logical adress
    range, they stretch over a geometrical area on the
    physical ram-module.

    A description (unfortunately in german) of these
    patterns can be found in a report by Nico Schmoigl
    for the Linux Magazin:

    http://www.linux-magazin.de/Artikel/ausgabe/2001/11/badmem/badmem.html?print=y

    Now how to find out the correct values?

    The value2 was provided by Donald Gordon in his
    mail to the aero-usergroup. It is 0xffff8000.

    value1 depends on the address-range, specified in
    /etc/pcmcia/config.opts for the pcmcia-controller.
    If you used
    include memory 0xb0000-0xb7fff
    the correct value1 for BadRAM would be
    0x010b0000.

    So these are settings for Badram corresponding to
    the settings for the pcmcia-controller in
    /etc/pcmcia/config.opts:

    config.opts corresponding BadRAM-statement

    0xb0000-0xb7fff 0x010b0000,0xffff8000
    0xd0000-0xd7fff 0x010d0000,0xffff8000
    0xe0000-0xe7fff 0x010e0000,0xffff8000
    and so on.

    For instance with kernel 2.4 I have in
    /etc/pcmcia/config.opts the line:
    include memory 0xd0000-0xd7fff
    So in lilo.conf I must use the line
    append="badram=0x010d0000,0xffff8000"

    Now we paid respect to the 'shadow' the
    pcmcia-controller throws into the >16MB RAM-range,
    we exclude these areas with the help of BadRAM and
    can now (after a lilo -v) safely reboot the aero
    and use pcmcia.

    Conclusion

    Running Linux on laptops meant once again that
    users have to work around errors that were made by
    the manufactures, in this case compaq. On the
    other hand I can not blame them: They never
    thought that the contura aero would once run with
    more than 12 MB RAM and never dreamed of Red Hat 9
    installed on it instead of windows 3.1. ;-)

    My thanks go to David Hinds who helped with
    practical tips for finding the correct RAM-values.
    And to the linux-community for providing all the
    information, knowledge and software.

    Linux means learning. Thanks for helping. Hope
    this may help others.

    Uli


  • Next message: Bill Marcum: "Re: PCMCIA: unable to map memory"

    Relevant Pages

    • [PATCH 2.6.24] mm: BadRAM support for broken memory
      ... This is the latest version of the BadRAM patch, ... run Linux on broken memory. ... a new kernel appeared, ... the BadRAM subsystem dealing with statically challanged RAM modules. ...
      (Linux-Kernel)
    • Re: Newbie Setting up xserver
      ... Could be, but now that I know that low memory is causing the problem, I will ... The kernel gobbles up the rest of the physical memory huh. ... Actually my RAM is split into two ... >it could be that some of the processes related to setting the timezone ...
      (comp.os.linux.setup)
    • Re: [PATCH] reserve RAM below PHYSICAL_START
      ... The "reserved RAM" can be mapped by virtualization software with to ... You're right but the relocatable kernel only works if you relocate it ... only works up to address near 1G, we can't reserve more than 1G with ...
      (Linux-Kernel)
    • Re: [BUG] 2.6.26-rc1 lost half the RAM on UltraSPARC 5
      ... Top of RAM: 0x17f46000, Total RAM: 0xff40000 ... Memory hole size: 128MB ... Kernel: Using 1 locked TLB entries for main kernel image. ... Movable zone start PFN for each node ...
      (Linux-Kernel)
    • Re: After executing MDCreateThread data abort occurs
      ... This is almost always RAM configuration, memory map, or cache problems. ... target.The code under Startup and KernelStart routines are running fine ... So the Kernel is not letting this address 0xc2000000 to be programmed. ...
      (microsoft.public.windowsce.embedded)