aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChen Liqin <liqin.chen@sunplusct.com>2009-08-30 00:31:58 -0400
committerChen Liqin <liqin.chen@sunplusct.com>2009-08-30 00:31:58 -0400
commit324f40fbb02ed9339ddbdc450ff8ba614a92a630 (patch)
treeee25761ee677ad2558ef9a9fdb721eb6bdb8febd /arch
parentffa818b4b099f65b6cb74750bdb979061716e020 (diff)
score: add MEMORY_START and MEMORY_SIZE define, to make the code clear
Diffstat (limited to 'arch')
-rw-r--r--arch/score/include/asm/setup.h3
-rw-r--r--arch/score/kernel/setup.c32
2 files changed, 19 insertions, 16 deletions
diff --git a/arch/score/include/asm/setup.h b/arch/score/include/asm/setup.h
index de89eff98dae..3cb944dc68dc 100644
--- a/arch/score/include/asm/setup.h
+++ b/arch/score/include/asm/setup.h
@@ -2,7 +2,8 @@
2#define _ASM_SCORE_SETUP_H 2#define _ASM_SCORE_SETUP_H
3 3
4#define COMMAND_LINE_SIZE 256 4#define COMMAND_LINE_SIZE 256
5#define MEM_SIZE 0x2000000 5#define MEMORY_START 0
6#define MEMORY_SIZE 0x2000000
6 7
7#ifdef __KERNEL__ 8#ifdef __KERNEL__
8 9
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
34struct screen_info screen_info; 36struct screen_info screen_info;
35unsigned long kernelsp; 37unsigned long kernelsp;
@@ -40,25 +42,25 @@ static struct resource data_resource = { .name = "Kernel data",};
40 42
41static void __init bootmem_init(void) 43static 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