Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/mm/sun4v/frame.c

    rfb150d78 r46c20c8  
    3636#include <mm/frame.h>
    3737#include <arch/boot/boot.h>
    38 #include <arch/types.h>
     38#include <typedefs.h>
    3939#include <config.h>
    4040#include <align.h>
    4141#include <macros.h>
    4242
    43 uintptr_t last_frame = NULL;
    44 
    45 /** Create memory zones according to information stored in bootinfo.
     43/** Create memory zones according to information stored in memmap.
    4644 *
    47  * Walk the bootinfo memory map and create frame zones according to it.
     45 * Walk the memory map and create frame zones according to it.
    4846 */
    4947void frame_arch_init(void)
    5048{
    51         unsigned int i;
    52         pfn_t confdata;
    53 
    5449        if (config.cpu_active == 1) {
    55                 for (i = 0; i < bootinfo.memmap.count; i++) {
    56                         uintptr_t start = bootinfo.memmap.zones[i].start;
    57                         size_t size = bootinfo.memmap.zones[i].size;
    58 
     50                unsigned int i;
     51               
     52                for (i = 0; i < memmap.cnt; i++) {
     53                        /* To be safe, make the available zone possibly smaller */
     54                        uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start,
     55                            FRAME_SIZE);
     56                        size_t new_size = ALIGN_DOWN(memmap.zones[i].size -
     57                            (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
     58                       
    5959                        /*
    6060                         * The memmap is created by HelenOS boot loader.
    6161                         * It already contains no holes.
    6262                         */
    63 
    64                         confdata = ADDR2PFN(start);
     63                       
     64                        pfn_t confdata = ADDR2PFN(new_start);
     65                       
    6566                        if (confdata == ADDR2PFN(KA2PA(PFN2ADDR(0))))
    6667                                confdata = ADDR2PFN(KA2PA(PFN2ADDR(2)));
    67                         zone_create(ADDR2PFN(start),
    68                             SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)),
     68                       
     69                        zone_create(ADDR2PFN(new_start), SIZE2FRAMES(new_size),
    6970                            confdata, 0);
    70                         last_frame = max(last_frame, start + ALIGN_UP(size,
    71                             FRAME_SIZE));
    7271                }
    73 
     72               
    7473                /*
    7574                 * On sparc64, physical memory can start on a non-zero address.
     
    8079                frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
    8180        }
    82 
    83         end_of_identity = PA2KA(last_frame);
    8481}
    8582
Note: See TracChangeset for help on using the changeset viewer.