Changeset 25c51c8 in mainline for kernel/arch/ia64/src/mm/frame.c


Ignore:
Timestamp:
2011-11-21T22:40:36Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50177dcd
Parents:
7978177c
Message:

Add ia64 support for frame_low/high_arch_init().

File:
1 edited

Legend:

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

    r7978177c r25c51c8  
    5151#define MINCONF 1
    5252
     53// XXX: remove me
    5354uintptr_t last_frame = 0;
     55
     56static void frame_common_arch_init(bool low)
     57{
     58        unsigned int i;
     59
     60        for (i = 0; i < bootinfo->memmap_items; i++) {
     61                if (bootinfo->memmap[i].type != MEMMAP_FREE_MEM)
     62                        continue;
     63
     64                uintptr_t base = bootinfo->memmap[i].base;
     65                size_t size = bootinfo->memmap[i].size;
     66                uintptr_t abase = ALIGN_UP(base, FRAME_SIZE);
     67
     68                if (size > FRAME_SIZE)
     69                        size -= abase - base;
     70
     71                // FIXME: remove me
     72                if (abase + size > last_frame)
     73                        last_frame = abase + size;
     74
     75                if (!frame_adjust_zone_bounds(low, &abase, &size))
     76                        continue;
     77
     78                if (size > MIN_ZONE_SIZE) {
     79                        pfn_t pfn = ADDR2PFN(abase);
     80                        size_t count = SIZE2FRAMES(size);
     81
     82                        if (low) {
     83                                zone_create(pfn, count, max(MINCONF, pfn),
     84                                    ZONE_AVAILABLE | ZONE_LOWMEM);
     85                        } else {
     86                                pfn_t conf;
     87
     88                                conf = zone_external_conf_alloc(count);
     89                                zone_create(pfn, count, conf,
     90                                    ZONE_AVAILABLE | ZONE_HIGHMEM);
     91                        }
     92                }
     93        }
     94}
    5495
    5596void frame_low_arch_init(void)
    5697{
    57         if (config.cpu_active == 1) {
    58                 unsigned int i;
    59                 for (i = 0; i < bootinfo->memmap_items; i++) {
    60                         if (bootinfo->memmap[i].type == MEMMAP_FREE_MEM) {
    61                                 uint64_t base = bootinfo->memmap[i].base;
    62                                 uint64_t size = bootinfo->memmap[i].size;
    63                                 uint64_t abase = ALIGN_UP(base, FRAME_SIZE);
     98        if (config.cpu_active > 1)
     99                return;
     100       
     101        frame_common_arch_init(true);
     102       
     103        /*
     104         * Blacklist ROM regions.
     105         */
     106        frame_mark_unavailable(ADDR2PFN(ROM_BASE),
     107            SIZE2FRAMES(ROM_SIZE));
    64108
    65                                 if (size > FRAME_SIZE)
    66                                         size -= abase - base;
    67 
    68                                 if (size > MIN_ZONE_SIZE) {
    69                                         zone_create(abase >> FRAME_WIDTH,
    70                                             size >> FRAME_WIDTH,
    71                                             max(MINCONF, abase >> FRAME_WIDTH),
    72                                             0);
    73                                 }
    74                                 if (abase + size > last_frame)
    75                                         last_frame = abase + size;
    76                         }
    77                 }
    78                
    79                 /*
    80                  * Blacklist ROM regions.
    81                  */
    82                 frame_mark_unavailable(ADDR2PFN(ROM_BASE),
    83                     SIZE2FRAMES(ROM_SIZE));
    84 
    85                 frame_mark_unavailable(ADDR2PFN(KERNEL_RESERVED_AREA_BASE),
    86                     SIZE2FRAMES(KERNEL_RESERVED_AREA_SIZE));
    87         }       
     109        frame_mark_unavailable(ADDR2PFN(KERNEL_RESERVED_AREA_BASE),
     110            SIZE2FRAMES(KERNEL_RESERVED_AREA_SIZE));
    88111}
    89112
    90113void frame_high_arch_init(void)
    91114{
     115        if (config.cpu_active > 1)
     116                return;
     117       
     118        frame_common_arch_init(false);
    92119}
    93120
Note: See TracChangeset for help on using the changeset viewer.