Subversion Repositories HelenOS

Rev

Rev 1787 | Rev 1793 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1787 Rev 1790
Line 31... Line 31...
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
35
#include <arch/mm/frame.h>
35
#include <arch/mm/frame.h>
36
#include <genarch/ofw/memory_init.h>
-
 
37
#include <mm/frame.h>
36
#include <mm/frame.h>
-
 
37
#include <arch/boot/boot.h>
38
#include <config.h>
38
#include <config.h>
39
#include <align.h>
39
#include <align.h>
40
 
40
 
-
 
41
/** Create memory zones according to information stored in bootinfo.
-
 
42
 *
-
 
43
 * Walk the bootinfo memory map and create frame zones according to it.
-
 
44
 * The first frame is not blacklisted here as it is done in generic
-
 
45
 * frame_init().
-
 
46
 */
41
void frame_arch_init(void)
47
void frame_arch_init(void)
42
{
48
{
-
 
49
    int i;
43
    ofw_init_zones();
50
    pfn_t confdata;
-
 
51
 
-
 
52
    for (i = 0; i < bootinfo.memmap.count; i++) {
-
 
53
 
-
 
54
        /*
-
 
55
         * The memmap is created by HelenOS boot loader.
-
 
56
         * It already contains no holes.
-
 
57
         */
-
 
58
   
-
 
59
        confdata = ADDR2PFN(bootinfo.memmap.zones[i].start);
-
 
60
        if (confdata == 0)
-
 
61
            confdata = 2;
-
 
62
        zone_create(ADDR2PFN(bootinfo.memmap.zones[i].start),
-
 
63
            SIZE2FRAMES(ALIGN_DOWN(bootinfo.memmap.zones[i].size, PAGE_SIZE)),
-
 
64
            confdata, 0);
-
 
65
    }
44
 
66
 
45
    /*
-
 
46
     * Workaround to prevent slab allocator from allocating frame 0.
-
 
47
     * Frame 0 is
-
 
48
     * a) not mapped by OFW
-
 
49
     * b) would be confused with NULL error return code
-
 
50
     */
-
 
51
    frame_mark_unavailable(0, 1);
-
 
52
}
67
}
53
 
68
 
54
/** @}
69
/** @}
55
 */
70
 */