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/sparc64/src/mm/sun4v/frame.c

    r7cede12c rb7068da  
    4545 * Walk the memory map and create frame zones according to it.
    4646 */
    47 void frame_arch_init(void)
     47static void frame_common_arch_init(bool low)
    4848{
    49         if (config.cpu_active == 1) {
    50                 unsigned int i;
     49        unsigned int i;
    5150               
    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                        
    59                         /*
    60                          * The memmap is created by HelenOS boot loader.
    61                          * It already contains no holes.
    62                          */
    63                        
    64                         pfn_t confdata = ADDR2PFN(new_start);
    65                        
     51        for (i = 0; i < memmap.cnt; i++) {
     52                uintptr_t base;
     53                size_t size;
     54
     55                /*
     56                 * The memmap is created by HelenOS boot loader.
     57                 * It already contains no holes.
     58                 */
     59
     60                /* To be safe, make the available zone possibly smaller */
     61                base = ALIGN_UP((uintptr_t) memmap.zones[i].start, FRAME_SIZE);
     62                size = ALIGN_DOWN(memmap.zones[i].size -
     63                    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
     64               
     65                if (!frame_adjust_zone_bounds(low, &base, &size))
     66                        continue;
     67
     68                pfn_t confdata;
     69                pfn_t pfn = ADDR2PFN(base);
     70                size_t count = SIZE2FRAMES(size);
     71
     72                if (low) {
     73                        confdata = pfn;
    6674                        if (confdata == ADDR2PFN(KA2PA(PFN2ADDR(0))))
    6775                                confdata = ADDR2PFN(KA2PA(PFN2ADDR(2)));
    6876                       
    69                         zone_create(ADDR2PFN(new_start), SIZE2FRAMES(new_size),
    70                             confdata, 0);
     77                        zone_create(pfn, count, confdata,
     78                            ZONE_AVAILABLE | ZONE_LOWMEM);
     79                } else {
     80                        confdata = zone_external_conf_alloc(count);
     81                        if (confdata != 0)
     82                                zone_create(pfn, count, confdata,
     83                                    ZONE_AVAILABLE | ZONE_HIGHMEM);
    7184                }
    72                
    73                 /*
    74                  * On sparc64, physical memory can start on a non-zero address.
    75                  * The generic frame_init() only marks PFN 0 as not free, so we
    76                  * must mark the physically first frame not free explicitly
    77                  * here, no matter what is its address.
    78                  */
    79                 frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
    8085        }
     86}
     87
     88
     89void frame_low_arch_init(void)
     90{
     91        if (config.cpu_active > 1)
     92                return;
     93
     94        frame_common_arch_init(true);
     95
     96        /*
     97         * On sparc64, physical memory can start on a non-zero address.
     98         * The generic frame_init() only marks PFN 0 as not free, so we
     99         * must mark the physically first frame not free explicitly
     100         * here, no matter what is its address.
     101         */
     102        frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
     103}
     104
     105void frame_high_arch_init(void)
     106{
     107        if (config.cpu_active > 1)
     108                return;
     109
     110        frame_common_arch_init(false);
    81111}
    82112
Note: See TracChangeset for help on using the changeset viewer.