Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

score: add MEMORY_START and MEMORY_SIZE define, to make the code clear

+19 -16
+2 -1
arch/score/include/asm/setup.h
··· 2 2 #define _ASM_SCORE_SETUP_H 3 3 4 4 #define COMMAND_LINE_SIZE 256 5 - #define MEM_SIZE 0x2000000 5 + #define MEMORY_START 0 6 + #define MEMORY_SIZE 0x2000000 6 7 7 8 #ifdef __KERNEL__ 8 9
+17 -15
arch/score/kernel/setup.c
··· 26 26 #include <linux/bootmem.h> 27 27 #include <linux/initrd.h> 28 28 #include <linux/ioport.h> 29 + #include <linux/mm.h> 29 30 #include <linux/seq_file.h> 30 31 #include <linux/screen_info.h> 31 32 32 33 #include <asm-generic/sections.h> 34 + #include <asm/setup.h> 33 35 34 36 struct screen_info screen_info; 35 37 unsigned long kernelsp; ··· 42 40 43 41 static void __init bootmem_init(void) 44 42 { 45 - unsigned long reserved_end, bootmap_size; 43 + unsigned long start_pfn, bootmap_size; 46 44 unsigned long size = initrd_end - initrd_start; 47 45 48 - reserved_end = (unsigned long)_end; 46 + start_pfn = PFN_UP(__pa(&_end)); 49 47 50 - min_low_pfn = 0; 51 - max_low_pfn = MEM_SIZE / PAGE_SIZE; 48 + min_low_pfn = PFN_UP(MEMORY_START); 49 + max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE); 52 50 53 51 /* Initialize the boot-time allocator with low memory only. */ 54 - bootmap_size = init_bootmem_node(NODE_DATA(0), reserved_end, 52 + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, 55 53 min_low_pfn, max_low_pfn); 56 54 add_active_range(0, min_low_pfn, max_low_pfn); 57 55 58 - free_bootmem(PFN_PHYS(reserved_end), 59 - (max_low_pfn - reserved_end) << PAGE_SHIFT); 60 - memory_present(0, reserved_end, max_low_pfn); 56 + free_bootmem(PFN_PHYS(start_pfn), 57 + (max_low_pfn - start_pfn) << PAGE_SHIFT); 58 + memory_present(0, start_pfn, max_low_pfn); 61 59 62 60 /* Reserve space for the bootmem bitmap. */ 63 - reserve_bootmem(PFN_PHYS(reserved_end), bootmap_size, BOOTMEM_DEFAULT); 61 + reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT); 64 62 65 63 if (size == 0) { 66 64 printk(KERN_INFO "Initrd not found or empty"); ··· 89 87 { 90 88 struct resource *res; 91 89 92 - code_resource.start = (unsigned long)_text; 93 - code_resource.end = (unsigned long)_etext - 1; 94 - data_resource.start = (unsigned long)_etext; 95 - data_resource.end = (unsigned long)_edata - 1; 90 + code_resource.start = __pa(&_text); 91 + code_resource.end = __pa(&_etext) - 1; 92 + data_resource.start = __pa(&_etext); 93 + data_resource.end = __pa(&_edata) - 1; 96 94 97 95 res = alloc_bootmem(sizeof(struct resource)); 98 96 res->name = "System RAM"; 99 - res->start = 0; 100 - res->end = MEM_SIZE - 1; 97 + res->start = MEMORY_START; 98 + res->end = MEMORY_START + MEMORY_SIZE - 1; 101 99 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 102 100 request_resource(&iomem_resource, res); 103 101