Changeset b7068da in mainline for kernel/arch/arm32/src/mm/frame.c


Ignore:
Timestamp:
2012-02-09T20:35:12Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
591762c6
Parents:
7cede12c (diff), 3d4750f (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 edited

Legend:

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

    r7cede12c rb7068da  
    3939#include <config.h>
    4040#include <align.h>
     41#include <macros.h>
    4142
    42 /** Address of the last frame in the memory. */
    43 uintptr_t last_frame = 0;
     43static void frame_common_arch_init(bool low)
     44{
     45        uintptr_t base;
     46        size_t size;
    4447
    45 /** Creates memory zones. */
    46 void frame_arch_init(void)
     48        machine_get_memory_extents(&base, &size);
     49        base = ALIGN_UP(base, FRAME_SIZE);
     50        size = ALIGN_DOWN(size, FRAME_SIZE);
     51       
     52        if (!frame_adjust_zone_bounds(low, &base, &size))
     53                return;
     54
     55        if (low) {
     56                zone_create(ADDR2PFN(base), SIZE2FRAMES(size),
     57                    BOOT_PAGE_TABLE_START_FRAME +
     58                    BOOT_PAGE_TABLE_SIZE_IN_FRAMES,
     59                    ZONE_AVAILABLE | ZONE_LOWMEM);
     60        } else {
     61                pfn_t conf = zone_external_conf_alloc(SIZE2FRAMES(size));
     62                if (conf != 0)
     63                        zone_create(ADDR2PFN(base), SIZE2FRAMES(size), conf,
     64                            ZONE_AVAILABLE | ZONE_HIGHMEM);
     65        }
     66       
     67}
     68
     69/** Create low memory zones. */
     70void frame_low_arch_init(void)
    4771{
    48         uintptr_t mem_start, mem_size;
    49         uintptr_t first_frame;
    50         uintptr_t num_frames;
     72        frame_common_arch_init(true);
    5173
    52         machine_get_memory_extents(&mem_start, &mem_size);
    53         first_frame = ALIGN_UP(mem_start, FRAME_SIZE);
    54         last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE);
    55         num_frames = (last_frame - first_frame) >> FRAME_WIDTH;
    56        
    57         /* All memory as one zone */
    58         zone_create(first_frame >> FRAME_WIDTH, num_frames,
    59             BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0);
    60        
    6174        /* blacklist boot page table */
    6275        frame_mark_unavailable(BOOT_PAGE_TABLE_START_FRAME,
     
    6477
    6578        machine_frame_init();
     79}
     80
     81/** Create high memory zones. */
     82void frame_high_arch_init(void)
     83{
     84        frame_common_arch_init(false);
    6685}
    6786
Note: See TracChangeset for help on using the changeset viewer.