diff options
author | Chen Liqin <liqin.chen@sunplusct.com> | 2009-08-30 00:31:58 -0400 |
---|---|---|
committer | Chen Liqin <liqin.chen@sunplusct.com> | 2009-08-30 00:31:58 -0400 |
commit | 324f40fbb02ed9339ddbdc450ff8ba614a92a630 (patch) | |
tree | ee25761ee677ad2558ef9a9fdb721eb6bdb8febd /arch/score/kernel | |
parent | ffa818b4b099f65b6cb74750bdb979061716e020 (diff) |
score: add MEMORY_START and MEMORY_SIZE define, to make the code clear
Diffstat (limited to 'arch/score/kernel')
-rw-r--r-- | arch/score/kernel/setup.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/arch/score/kernel/setup.c b/arch/score/kernel/setup.c index a172ce170f62..6a2503c75c4e 100644 --- a/arch/score/kernel/setup.c +++ b/arch/score/kernel/setup.c | |||
@@ -26,10 +26,12 @@ | |||
26 | #include <linux/bootmem.h> | 26 | #include <linux/bootmem.h> |
27 | #include <linux/initrd.h> | 27 | #include <linux/initrd.h> |
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/mm.h> | ||
29 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
30 | #include <linux/screen_info.h> | 31 | #include <linux/screen_info.h> |
31 | 32 | ||
32 | #include <asm-generic/sections.h> | 33 | #include <asm-generic/sections.h> |
34 | #include <asm/setup.h> | ||
33 | 35 | ||
34 | struct screen_info screen_info; | 36 | struct screen_info screen_info; |
35 | unsigned long kernelsp; | 37 | unsigned long kernelsp; |
@@ -40,25 +42,25 @@ static struct resource data_resource = { .name = "Kernel data",}; | |||
40 | 42 | ||
41 | static void __init bootmem_init(void) | 43 | static void __init bootmem_init(void) |
42 | { | 44 | { |
43 | unsigned long reserved_end, bootmap_size; | 45 | unsigned long start_pfn, bootmap_size; |
44 | unsigned long size = initrd_end - initrd_start; | 46 | unsigned long size = initrd_end - initrd_start; |
45 | 47 | ||
46 | reserved_end = (unsigned long)_end; | 48 | start_pfn = PFN_UP(__pa(&_end)); |
47 | 49 | ||
48 | min_low_pfn = 0; | 50 | min_low_pfn = PFN_UP(MEMORY_START); |
49 | max_low_pfn = MEM_SIZE / PAGE_SIZE; | 51 | max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE); |
50 | 52 | ||
51 | /* Initialize the boot-time allocator with low memory only. */ | 53 | /* Initialize the boot-time allocator with low memory only. */ |
52 | bootmap_size = init_bootmem_node(NODE_DATA(0), reserved_end, | 54 | bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, |
53 | min_low_pfn, max_low_pfn); | 55 | min_low_pfn, max_low_pfn); |
54 | add_active_range(0, min_low_pfn, max_low_pfn); | 56 | add_active_range(0, min_low_pfn, max_low_pfn); |
55 | 57 | ||
56 | free_bootmem(PFN_PHYS(reserved_end), | 58 | free_bootmem(PFN_PHYS(start_pfn), |
57 | (max_low_pfn - reserved_end) << PAGE_SHIFT); | 59 | (max_low_pfn - start_pfn) << PAGE_SHIFT); |
58 | memory_present(0, reserved_end, max_low_pfn); | 60 | memory_present(0, start_pfn, max_low_pfn); |
59 | 61 | ||
60 | /* Reserve space for the bootmem bitmap. */ | 62 | /* Reserve space for the bootmem bitmap. */ |
61 | reserve_bootmem(PFN_PHYS(reserved_end), bootmap_size, BOOTMEM_DEFAULT); | 63 | reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT); |
62 | 64 | ||
63 | if (size == 0) { | 65 | if (size == 0) { |
64 | printk(KERN_INFO "Initrd not found or empty"); | 66 | printk(KERN_INFO "Initrd not found or empty"); |
@@ -87,15 +89,15 @@ static void __init resource_init(void) | |||
87 | { | 89 | { |
88 | struct resource *res; | 90 | struct resource *res; |
89 | 91 | ||
90 | code_resource.start = (unsigned long)_text; | 92 | code_resource.start = __pa(&_text); |
91 | code_resource.end = (unsigned long)_etext - 1; | 93 | code_resource.end = __pa(&_etext) - 1; |
92 | data_resource.start = (unsigned long)_etext; | 94 | data_resource.start = __pa(&_etext); |
93 | data_resource.end = (unsigned long)_edata - 1; | 95 | data_resource.end = __pa(&_edata) - 1; |
94 | 96 | ||
95 | res = alloc_bootmem(sizeof(struct resource)); | 97 | res = alloc_bootmem(sizeof(struct resource)); |
96 | res->name = "System RAM"; | 98 | res->name = "System RAM"; |
97 | res->start = 0; | 99 | res->start = MEMORY_START; |
98 | res->end = MEM_SIZE - 1; | 100 | res->end = MEMORY_START + MEMORY_SIZE - 1; |
99 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | 101 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
100 | request_resource(&iomem_resource, res); | 102 | request_resource(&iomem_resource, res); |
101 | 103 | ||