From 0088b5dca9ae551e3fa257e56a045f2cbd2575c8 Mon Sep 17 00:00:00 2001 From: Larry Bassel Date: Fri, 22 Jan 2010 10:47:13 -0800 Subject: [PATCH] arm: add ARM-specific memory low-power support Add ARM-specific memory low-power support and allow the memory add code to call into platform-specific code as the memory remove and low-power code does. Change-Id: Ifb00366d8513092c8f14720980b4232fc8d758c0 Signed-off-by: Larry Bassel (cherry picked from commit ae314e9efd9f24f6347342a765f923d560080059) --- arch/arm/mm/init.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index f955cbc2c35..595f306debc 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -833,6 +833,46 @@ void free_initmem(void) } } +#ifdef CONFIG_MEMORY_HOTPLUG +int arch_add_memory(int nid, u64 start, u64 size) +{ + struct pglist_data *pgdata = NODE_DATA(nid); + struct zone *zone = pgdata->node_zones + ZONE_MOVABLE; + unsigned long start_pfn = start >> PAGE_SHIFT; + unsigned long nr_pages = size >> PAGE_SHIFT; + int ret; + + ret = __add_pages(nid, zone, start_pfn, nr_pages); + if (ret) + return ret; + return platform_physical_active_pages(start_pfn, nr_pages); +} + +int arch_physical_active_memory(u64 start, u64 size) +{ + unsigned long start_pfn = start >> PAGE_SHIFT; + unsigned long nr_pages = size >> PAGE_SHIFT; + + return platform_physical_active_pages(start_pfn, nr_pages); +} + +int arch_physical_remove_memory(u64 start, u64 size) +{ + unsigned long start_pfn = start >> PAGE_SHIFT; + unsigned long nr_pages = size >> PAGE_SHIFT; + + return platform_physical_remove_pages(start_pfn, nr_pages); +} + +int arch_physical_low_power_memory(u64 start, u64 size) +{ + unsigned long start_pfn = start >> PAGE_SHIFT; + unsigned long nr_pages = size >> PAGE_SHIFT; + + return platform_physical_low_power_pages(start_pfn, nr_pages); +} +#endif + #ifdef CONFIG_BLK_DEV_INITRD static int keep_initrd;