Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305329
b: refs/heads/master
c: 8ac5fd1
h: refs/heads/master
i:
  305327: f9ae758
v: v3
  • Loading branch information
Hector Martin authored and Geoff Levand committed Apr 24, 2012
1 parent 40452cc commit e7b96b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 57 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: 1e755c09926de2d9b0e239ba0ce10fdb6835551a
refs/heads/master: 8ac5fd118cd137db5ca8c786778ba600f87111a0
66 changes: 10 additions & 56 deletions trunk/arch/powerpc/platforms/ps3/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/memory_hotplug.h>
#include <linux/memblock.h>
#include <linux/slab.h>

Expand Down Expand Up @@ -98,7 +97,7 @@ struct mem_region {
* The HV virtual address space (vas) allows for hotplug memory regions.
* Memory regions can be created and destroyed in the vas at runtime.
* @rm: real mode (bootmem) region
* @r1: hotplug memory region(s)
* @r1: highmem region(s)
*
* ps3 addresses
* virt_addr: a cpu 'translated' effective address
Expand Down Expand Up @@ -224,10 +223,6 @@ void ps3_mm_vas_destroy(void)
}
}

/*============================================================================*/
/* memory hotplug routines */
/*============================================================================*/

/**
* ps3_mm_region_create - create a memory region in the vas
* @r: pointer to a struct mem_region to accept initialized values
Expand Down Expand Up @@ -328,56 +323,6 @@ static int ps3_mm_get_repository_highmem(struct mem_region *r)
return result;
}

/**
* ps3_mm_add_memory - hot add memory
*/

static int __init ps3_mm_add_memory(void)
{
int result;
unsigned long start_addr;
unsigned long start_pfn;
unsigned long nr_pages;

if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
return -ENODEV;

BUG_ON(!mem_init_done);

if (!map.r1.size) {
DBG("%s:%d: No region 1, not adding memory\n",
__func__, __LINE__);
return 0;
}

start_addr = map.rm.size;
start_pfn = start_addr >> PAGE_SHIFT;
nr_pages = (map.r1.size + PAGE_SIZE - 1) >> PAGE_SHIFT;

DBG("%s:%d: start_addr %lxh, start_pfn %lxh, nr_pages %lxh\n",
__func__, __LINE__, start_addr, start_pfn, nr_pages);

result = add_memory(0, start_addr, map.r1.size);

if (result) {
pr_err("%s:%d: add_memory failed: (%d)\n",
__func__, __LINE__, result);
return result;
}

memblock_add(start_addr, map.r1.size);

result = online_pages(start_pfn, nr_pages);

if (result)
pr_err("%s:%d: online_pages failed: (%d)\n",
__func__, __LINE__, result);

return result;
}

device_initcall(ps3_mm_add_memory);

/*============================================================================*/
/* dma routines */
/*============================================================================*/
Expand Down Expand Up @@ -1271,6 +1216,15 @@ void __init ps3_mm_init(void)
/* correct map.total for the real total amount of memory we use */
map.total = map.rm.size + map.r1.size;

if (!map.r1.size) {
DBG("%s:%d: No highmem region found\n", __func__, __LINE__);
} else {
DBG("%s:%d: Adding highmem region: %llxh %llxh\n",
__func__, __LINE__, map.rm.size,
map.total - map.rm.size);
memblock_add(map.rm.size, map.total - map.rm.size);
}

DBG(" <- %s:%d\n", __func__, __LINE__);
}

Expand Down

0 comments on commit e7b96b3

Please sign in to comment.