Commit 61ef2489dbf587258526cfd4ebf4bba3b079f401
Committed by
H. Peter Anvin
1 parent
ccef086454
Exists in
master
and in
4 other branches
resources: introduce generic page_is_ram()
It's based on walk_system_ram_range(), for archs that don't have their own page_is_ram(). The static verions in MIPS and SCORE are also made global. v4: prefer plain 1 instead of PAGE_IS_RAM (H. Peter Anvin) v3: add comment (KAMEZAWA Hiroyuki) "AFAIK, this "System RAM" information has been used for kdump to grab valid memory area and seems good for the kernel itself." v2: add PAGE_IS_RAM macro (Américo Wang) Cc: Chen Liqin <liqin.chen@sunplusct.com> Cc: Lennox Wu <lennox.wu@gmail.com> Cc: Américo Wang <xiyou.wangcong@gmail.com> Cc: linux-mips@linux-mips.org Cc: Yinghai Lu <yinghai@kernel.org> Acked-by: Ralf Baechle <ralf@linux-mips.org> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> LKML-Reference: <20100122081619.GA6431@localhost> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Showing 4 changed files with 17 additions and 2 deletions Side-by-side Diff
arch/mips/mm/init.c
arch/score/mm/init.c
include/linux/ioport.h
... | ... | @@ -188,6 +188,8 @@ |
188 | 188 | walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, |
189 | 189 | void *arg, int (*func)(unsigned long, unsigned long, void *)); |
190 | 190 | |
191 | +extern int page_is_ram(unsigned long pfn); | |
192 | + | |
191 | 193 | #endif /* __ASSEMBLY__ */ |
192 | 194 | #endif /* _LINUX_IOPORT_H */ |
kernel/resource.c
... | ... | @@ -297,6 +297,19 @@ |
297 | 297 | |
298 | 298 | #endif |
299 | 299 | |
300 | +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg) | |
301 | +{ | |
302 | + return 1; | |
303 | +} | |
304 | +/* | |
305 | + * This generic page_is_ram() returns true if specified address is | |
306 | + * registered as "System RAM" in iomem_resource list. | |
307 | + */ | |
308 | +int __attribute__((weak)) page_is_ram(unsigned long pfn) | |
309 | +{ | |
310 | + return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1; | |
311 | +} | |
312 | + | |
300 | 313 | /* |
301 | 314 | * Find empty slot in the resource tree given range and alignment. |
302 | 315 | */ |