aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/memory.c')
-rw-r--r--drivers/base/memory.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 2f8691511190..4f4aa5897b4c 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -22,6 +22,7 @@
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/stat.h> 24#include <linux/stat.h>
25#include <linux/slab.h>
25 26
26#include <asm/atomic.h> 27#include <asm/atomic.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
@@ -429,12 +430,16 @@ static inline int memory_fail_init(void)
429 * differentiation between which *physical* devices each 430 * differentiation between which *physical* devices each
430 * section belongs to... 431 * section belongs to...
431 */ 432 */
433int __weak arch_get_memory_phys_device(unsigned long start_pfn)
434{
435 return 0;
436}
432 437
433static int add_memory_block(int nid, struct mem_section *section, 438static int add_memory_block(int nid, struct mem_section *section,
434 unsigned long state, int phys_device, 439 unsigned long state, enum mem_add_context context)
435 enum mem_add_context context)
436{ 440{
437 struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL); 441 struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL);
442 unsigned long start_pfn;
438 int ret = 0; 443 int ret = 0;
439 444
440 if (!mem) 445 if (!mem)
@@ -443,7 +448,8 @@ static int add_memory_block(int nid, struct mem_section *section,
443 mem->phys_index = __section_nr(section); 448 mem->phys_index = __section_nr(section);
444 mem->state = state; 449 mem->state = state;
445 mutex_init(&mem->state_mutex); 450 mutex_init(&mem->state_mutex);
446 mem->phys_device = phys_device; 451 start_pfn = section_nr_to_pfn(mem->phys_index);
452 mem->phys_device = arch_get_memory_phys_device(start_pfn);
447 453
448 ret = register_memory(mem, section); 454 ret = register_memory(mem, section);
449 if (!ret) 455 if (!ret)
@@ -515,7 +521,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,
515 */ 521 */
516int register_new_memory(int nid, struct mem_section *section) 522int register_new_memory(int nid, struct mem_section *section)
517{ 523{
518 return add_memory_block(nid, section, MEM_OFFLINE, 0, HOTPLUG); 524 return add_memory_block(nid, section, MEM_OFFLINE, HOTPLUG);
519} 525}
520 526
521int unregister_memory_section(struct mem_section *section) 527int unregister_memory_section(struct mem_section *section)
@@ -548,7 +554,7 @@ int __init memory_dev_init(void)
548 if (!present_section_nr(i)) 554 if (!present_section_nr(i))
549 continue; 555 continue;
550 err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE, 556 err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE,
551 0, BOOT); 557 BOOT);
552 if (!ret) 558 if (!ret)
553 ret = err; 559 ret = err;
554 } 560 }