Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284679
b: refs/heads/master
c: 43064c0
h: refs/heads/master
i:
  284677: 30fb507
  284675: 30fe066
  284671: f5eec5e
v: v3
  • Loading branch information
David Daney authored and Ralf Baechle committed Dec 7, 2011
1 parent 4d0aa85 commit 5b25328
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b1c10bea620f79109b5cc9935267bea4f6f29ac6
refs/heads/master: 43064c0c8ee2ada8edd421520c633584d648e100
8 changes: 0 additions & 8 deletions trunk/arch/mips/cavium-octeon/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,14 +642,6 @@ void __init plat_mem_setup(void)

total = 0;

/* First add the init memory we will be returning. */
memory = __pa_symbol(&__init_begin) & PAGE_MASK;
mem_alloc_size = (__pa_symbol(&__init_end) & PAGE_MASK) - memory;
if (mem_alloc_size > 0) {
add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
total += mem_alloc_size;
}

/*
* The Mips memory init uses the first memory location for
* some memory vectors. When SPARSEMEM is in use, it doesn't
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/mips/include/asm/bootinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ extern unsigned long mips_machtype;
#define BOOT_MEM_RAM 1
#define BOOT_MEM_ROM_DATA 2
#define BOOT_MEM_RESERVED 3
#define BOOT_MEM_INIT_RAM 4

/*
* A memory map that's built upon what was determined
Expand Down
43 changes: 39 additions & 4 deletions trunk/arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ static void __init print_memory_map(void)
case BOOT_MEM_RAM:
printk(KERN_CONT "(usable)\n");
break;
case BOOT_MEM_INIT_RAM:
printk(KERN_CONT "(usable after init)\n");
break;
case BOOT_MEM_ROM_DATA:
printk(KERN_CONT "(ROM data)\n");
break;
Expand Down Expand Up @@ -361,15 +364,24 @@ static void __init bootmem_init(void)
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long start, end, size;

start = PFN_UP(boot_mem_map.map[i].addr);
end = PFN_DOWN(boot_mem_map.map[i].addr
+ boot_mem_map.map[i].size);

/*
* Reserve usable memory.
*/
if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
switch (boot_mem_map.map[i].type) {
case BOOT_MEM_RAM:
break;
case BOOT_MEM_INIT_RAM:
memory_present(0, start, end);
continue;
default:
/* Not usable memory */
continue;
}

start = PFN_UP(boot_mem_map.map[i].addr);
end = PFN_DOWN(boot_mem_map.map[i].addr
+ boot_mem_map.map[i].size);
/*
* We are rounding up the start address of usable memory
* and at the end of the usable range downwards.
Expand Down Expand Up @@ -455,11 +467,33 @@ early_param("mem", early_parse_mem);

static void __init arch_mem_init(char **cmdline_p)
{
phys_t init_mem, init_end, init_size;

extern void plat_mem_setup(void);

/* call board setup routine */
plat_mem_setup();

init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT;
init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT;
init_size = init_end - init_mem;
if (init_size) {
/* Make sure it is in the boot_mem_map */
int i, found;
found = 0;
for (i = 0; i < boot_mem_map.nr_map; i++) {
if (init_mem >= boot_mem_map.map[i].addr &&
init_mem < (boot_mem_map.map[i].addr +
boot_mem_map.map[i].size)) {
found = 1;
break;
}
}
if (!found)
add_memory_region(init_mem, init_size,
BOOT_MEM_INIT_RAM);
}

pr_info("Determined physical RAM map:\n");
print_memory_map();

Expand Down Expand Up @@ -523,6 +557,7 @@ static void __init resource_init(void)
res = alloc_bootmem(sizeof(struct resource));
switch (boot_mem_map.map[i].type) {
case BOOT_MEM_RAM:
case BOOT_MEM_INIT_RAM:
case BOOT_MEM_ROM_DATA:
res->name = "System RAM";
break;
Expand Down
9 changes: 7 additions & 2 deletions trunk/arch/mips/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,14 @@ int page_is_ram(unsigned long pagenr)
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long addr, end;

if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
switch (boot_mem_map.map[i].type) {
case BOOT_MEM_RAM:
case BOOT_MEM_INIT_RAM:
break;
default:
/* not usable memory */
continue;
}

addr = PFN_UP(boot_mem_map.map[i].addr);
end = PFN_DOWN(boot_mem_map.map[i].addr +
Expand Down Expand Up @@ -379,7 +384,7 @@ void __init mem_init(void)

reservedpages = ram = 0;
for (tmp = 0; tmp < max_low_pfn; tmp++)
if (page_is_ram(tmp)) {
if (page_is_ram(tmp) && pfn_valid(tmp)) {
ram++;
if (PageReserved(pfn_to_page(tmp)))
reservedpages++;
Expand Down

0 comments on commit 5b25328

Please sign in to comment.