Re: [PATCH] MIPS: fix pfn_valid() for FLAGMEM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Wu Zhangjin wrote:

When CONFIG_FLAGMEM enabled, STD/Hiberation will fail on YeeLoong

  You surely meant FLATMEM here and the subject.

laptop, This patch fix it:

  Fixes.

Signed-off-by: Wu Zhangjin <wuzhangjin@xxxxxxxxx>
[...]
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index f266295..16903a6 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -168,13 +168,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
#ifdef CONFIG_FLATMEM -#define pfn_valid(pfn) \
-({									\
-	unsigned long __pfn = (pfn);					\
-	/* avoid <linux/bootmem.h> include hell */			\
-	extern unsigned long min_low_pfn;				\
-									\
-	__pfn >= min_low_pfn && __pfn < max_mapnr;			\
+#define pfn_valid(pfn)				\
+({						\
+	extern int is_pfn_valid(unsigned long); \
+	is_pfn_valid(pfn);			\

  Why not just define pfn_valid() as *extern* function in this case?

diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index f5c7375..48a4d2a 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -689,3 +689,20 @@ void copy_page(void *to, void *from)
 }
#endif /* CONFIG_SIBYTE_DMA_PAGEOPS */
+
+#ifdef CONFIG_FLATMEM
+int is_pfn_valid(unsigned long pfn)
+{
+	int i;
+
+	for (i = 0; i < boot_mem_map.nr_map; i++) {
+		if (boot_mem_map.map[i].type == BOOT_MEM_RAM) {
+			if ((pfn >= PFN_DOWN(boot_mem_map.map[i].addr)) &&
+				((pfn) <= (PFN_UP(boot_mem_map.map[i].addr +

  Not <?

+					boot_mem_map.map[i].size))))
+				return 1;
+		}
+	}
+	return 0;
+}
+#endif

WBR, Sergei




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux