Subject: Re: noncontiguous memory question
To: Arthur Isaenko <isartw@yahoo.com>
From: Jeremy Cooper <jeremy@baymoo.org>
List: port-arm32
Date: 09/03/2002 08:21:20
On Tue, 3 Sep 2002, Arthur Isaenko wrote:

> I'm playing with NetBSD kernel and going to port on
> Psion Revo plus (ARM710 based).
> It has two RAM banks and I have found nothing related
> to noncontiguous memory
> support in arch/arm/arm32/pmap.c.

Non-contiguous memory support is handled not in the pmap layer but in the
bootstrap process that initializes the higher "UVM" layer.  I will admit,
however, that this bootstrap function is traditionally performed in a
port's pmap.c.

The sun3x port has banked memory and you can see this initialization
process in arch/sun3/sun3x/pmap.c:pmap_page_upload().  I'll include it
here just for simplicity:

        /* Supply the memory in segments. */
        for (i = 0; i < SUN3X_NPHYS_RAM_SEGS; i++) {
                a = atop(avail_mem[i].pmem_start);
                b = atop(avail_mem[i].pmem_end);
                if (i == 0)
                        a = atop(avail_start);
                if (avail_mem[i].pmem_end > avail_end)
                        b = atop(avail_end);

                uvm_page_physload(a, b, a, b, VM_FREELIST_DEFAULT);

                if (avail_mem[i].pmem_next == NULL)
                        break;
        }

The array 'avail_mem' is provided by the sun3x boot PROM.  Each entry
in it contains information about a single contiguous block of RAM -- its
starting and ending addresses.

The variables 'avail_start' and 'avail_end' appear in this loop only to
keep two critical sections of memory from being managed by the UVM system:
the static part of the loaded kernel image, and the blocks of memory
reserved for the boot PROM.  They were initialized earlier in the
bootstrap process.

-J