Linux ACPI
 help / color / mirror / Atom feed
* [linux-next] [PATCH V2 3/4] ACPI: mark ACPI NVS memory region
@ 2008-07-11  5:29 Zhang Rui
  0 siblings, 0 replies; only message in thread
From: Zhang Rui @ 2008-07-11  5:29 UTC (permalink / raw)
  To: Linux Kernel Mailing List, linux-acpi, linux-pm
  Cc: Rafael J. Wysocki, Pavel Machek, Henrique de Moraes Holschuh,
	Andi Kleen, Ingo Molnar


Mark ACPI NVS memory region during startup.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 arch/x86/kernel/e820.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Index: linux-next/arch/x86/kernel/e820.c
===================================================================
--- linux-next.orig/arch/x86/kernel/e820.c	2008-07-11 11:44:54.000000000 +0800
+++ linux-next/arch/x86/kernel/e820.c	2008-07-11 11:52:22.000000000 +0800
@@ -19,6 +19,8 @@
 #include <linux/mm.h>
 #include <linux/pfn.h>
 #include <linux/suspend.h>
+#include <linux/efi.h>
+#include <linux/acpi.h>
 
 #include <asm/pgtable.h>
 #include <asm/page.h>
@@ -623,6 +625,33 @@
 }
 #endif
 
+#ifdef CONFIG_HIBERNATION
+/* Mark ACPI NVS region, so that OS can save/restore it during hibernation */
+static int __init e820_mark_nvs_memory(void)
+{
+	int i;
+
+	if (efi_enabled)
+		return 0;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+		unsigned long start, end;
+
+		if (ei->type != E820_NVS)
+			continue;
+		start = PFN_UP(ei->addr);
+		end = PFN_DOWN(ei->addr + ei->size);
+		if (start >= end)
+			continue;
+
+		acpi_mark_nvs_region(start, end - 1);
+	}
+	return 0;
+}
+core_initcall(e820_mark_nvs_memory);
+#endif
+
 /*
  * Early reserved memory areas.
  */



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-11  5:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-11  5:29 [linux-next] [PATCH V2 3/4] ACPI: mark ACPI NVS memory region Zhang Rui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox