Changeset 00aece0 in mainline for kernel/arch/sparc64/src/mm/sun4u/frame.c
- Timestamp:
- 2012-02-18T16:47:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4449c6c
- Parents:
- bd5f3b7 (diff), f943dd3 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/mm/sun4u/frame.c
rbd5f3b7 r00aece0 41 41 #include <macros.h> 42 42 43 uintptr_t last_frame = (uintptr_t) NULL;44 45 43 /** Create memory zones according to information stored in memmap. 46 44 * 47 45 * Walk the memory map and create frame zones according to it. 48 46 */ 49 void frame_arch_init(void)47 static void frame_common_arch_init(bool low) 50 48 { 51 if (config.cpu_active == 1) { 52 unsigned int i; 49 unsigned int i; 50 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); 53 64 54 for (i = 0; i < memmap.cnt; i++) { 55 /* To be safe, make the available zone possibly smaller */ 56 uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start, 57 FRAME_SIZE); 58 size_t new_size = ALIGN_DOWN(memmap.zones[i].size - 59 (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE); 60 61 /* 62 * The memmap is created by HelenOS boot loader. 63 * It already contains no holes. 64 */ 65 66 pfn_t confdata = ADDR2PFN(new_start); 67 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; 68 74 if (confdata == ADDR2PFN(KA2PA(PFN2ADDR(0)))) 69 75 confdata = ADDR2PFN(KA2PA(PFN2ADDR(2))); 70 76 71 zone_create(ADDR2PFN(new_start), SIZE2FRAMES(new_size), 72 confdata, 0); 73 74 last_frame = max(last_frame, new_start + new_size); 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); 75 84 } 76 77 /*78 * On sparc64, physical memory can start on a non-zero address.79 * The generic frame_init() only marks PFN 0 as not free, so we80 * must mark the physically first frame not free explicitly81 * here, no matter what is its address.82 */83 frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);84 85 } 86 } 87 88 void frame_low_arch_init(void) 89 { 90 if (config.cpu_active > 1) 91 return; 85 92 86 end_of_identity = PA2KA(last_frame); 93 frame_common_arch_init(true); 94 95 /* 96 * On sparc64, physical memory can start on a non-zero address. 97 * The generic frame_init() only marks PFN 0 as not free, so we 98 * must mark the physically first frame not free explicitly 99 * here, no matter what is its address. 100 */ 101 frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1); 102 103 /* PA2KA will work only on low-memory. */ 104 end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE; 105 } 106 107 void frame_high_arch_init(void) 108 { 109 if (config.cpu_active > 1) 110 return; 111 112 frame_common_arch_init(false); 87 113 } 88 114
Note:
See TracChangeset
for help on using the changeset viewer.