Changeset 96cd5b4 in mainline for kernel/arch/ia64/src/mm/frame.c


Ignore:
Timestamp:
2012-01-04T13:37:10Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9957a97
Parents:
ecf823a (diff), c520034 (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 with mainline

File:
1 edited

Legend:

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

    recf823a r96cd5b4  
    5151#define MINCONF 1
    5252
    53 uintptr_t last_frame = 0;
     53uintptr_t end_of_identity = -1ULL;
    5454
    55 void frame_arch_init(void)
     55static void frame_common_arch_init(bool low)
    5656{
    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);
     57        unsigned int i;
    6458
    65                                 if (size > FRAME_SIZE)
    66                                         size -= abase - base;
     59        for (i = 0; i < bootinfo->memmap_items; i++) {
     60                if (bootinfo->memmap[i].type != MEMMAP_FREE_MEM)
     61                        continue;
    6762
    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;
     63                uintptr_t base = bootinfo->memmap[i].base;
     64                size_t size = bootinfo->memmap[i].size;
     65                uintptr_t abase = ALIGN_UP(base, FRAME_SIZE);
     66
     67                if (size > FRAME_SIZE)
     68                        size -= abase - base;
     69
     70                if (!frame_adjust_zone_bounds(low, &abase, &size))
     71                        continue;
     72
     73                if (size > MIN_ZONE_SIZE) {
     74                        pfn_t pfn = ADDR2PFN(abase);
     75                        size_t count = SIZE2FRAMES(size);
     76
     77                        if (low) {
     78                                zone_create(pfn, count, max(MINCONF, pfn),
     79                                    ZONE_AVAILABLE | ZONE_LOWMEM);
     80                        } else {
     81                                pfn_t conf;
     82
     83                                conf = zone_external_conf_alloc(count);
     84                                zone_create(pfn, count, conf,
     85                                    ZONE_AVAILABLE | ZONE_HIGHMEM);
    7686                        }
    7787                }
    78                
    79                 /*
    80                  * Blacklist ROM regions.
    81                  */
    82                 frame_mark_unavailable(ADDR2PFN(ROM_BASE),
    83                     SIZE2FRAMES(ROM_SIZE));
     88        }
     89}
    8490
    85                 frame_mark_unavailable(ADDR2PFN(KERNEL_RESERVED_AREA_BASE),
    86                     SIZE2FRAMES(KERNEL_RESERVED_AREA_SIZE));
    87         }       
     91void frame_low_arch_init(void)
     92{
     93        if (config.cpu_active > 1)
     94                return;
     95       
     96        frame_common_arch_init(true);
     97       
     98        /*
     99         * Blacklist ROM regions.
     100         */
     101        frame_mark_unavailable(ADDR2PFN(ROM_BASE),
     102            SIZE2FRAMES(ROM_SIZE));
     103
     104        frame_mark_unavailable(ADDR2PFN(KERNEL_RESERVED_AREA_BASE),
     105            SIZE2FRAMES(KERNEL_RESERVED_AREA_SIZE));
     106
     107        /* PA2KA will work only on low-memory. */
     108        end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE;
     109}
     110
     111void frame_high_arch_init(void)
     112{
     113        if (config.cpu_active > 1)
     114                return;
     115       
     116        frame_common_arch_init(false);
    88117}
    89118
Note: See TracChangeset for help on using the changeset viewer.