Skip to contentSkip to conversation

ia64,kexec: Move copy_oldmem_page into crash_dump.c

PATCH New Horms 1 participant 1 message Jun 19, 2006

lore
Share & tools
lore

Horms

author
#0 lore raw

PATCH 1/1 ia64,kexec: Move copy_oldmem_page into crash_dump.c

Move copy_oldmem_page() from crash.c to crash_dump.c in keeping with other architectures. As part of this change, copy_oldmem_page() is no longer complied if CONFIG_CRASH_DUMP is not configured

This patch is relative to Zou Nan hai's kdump patch which I rediffed and sent to linux-ia64 and fastboot on the 8th of June
http://permalink.gmane.org/gmane.linux.ports.ia64/14320

 arch/ia64/kernel/Makefile     |    1 +
 arch/ia64/kernel/crash.c      |   19 -------------------
 arch/ia64/kernel/crash_dump.c |   28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 19 deletions(-)

b1d8efcb99218a8473dc310b5346de7cc7362685

arch/ia64/kernel/Makefile +1 -0
index b433b58..6b2ff12 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_IA64_MCA_RECOVERY)	+= mca_recovery.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o jprobes.o
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
+obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR)	+= uncached.o
 mca_recovery-y			+= mca_drv.o mca_drv_asm.o
 
arch/ia64/kernel/crash.c +0 -19
index 03c3118..6623bfc 100644
@@ -21,25 +21,6 @@ #include <linux/delay.h>
 #include <linux/elf.h>
 #include <linux/elfcore.h>
 #include <linux/device.h>
-#include <asm/uaccess.h>
-
-size_t copy_oldmem_page(unsigned long pfn, char *buf,
-                               size_t csize, unsigned long offset, int userbuf)
-{
-        void  *vaddr;
-
-        if (!csize)
-                return 0;
-        vaddr = page_address(pfn_to_page(pfn));
-
-        if (userbuf) {
-                if (copy_to_user(buf, (vaddr + offset), csize)) {
-                        return -EFAULT;
-                }
-        } else
-                memcpy(buf, (vaddr + offset), csize);
-        return csize;
-}
 
 static void device_shootdown(void)
 {
arch/ia64/kernel/crash_dump.c new file +28 -0
new file mode 100644
index 0000000..f22ad7b
@@ -0,0 +1,28 @@
+/*
+ * arch/ia64/kernel/crash_dump.c
+ *
+ * Memory preserving reboot related code.
+ *
+ */
+
+#include <linux/mm.h>
+#include <linux/string.h>
+#include <asm/uaccess.h>
+
+size_t copy_oldmem_page(unsigned long pfn, char *buf,
+                               size_t csize, unsigned long offset, int userbuf)
+{
+        void  *vaddr;
+
+        if (!csize)
+                return 0;
+        vaddr = page_address(pfn_to_page(pfn));
+
+        if (userbuf) {
+                if (copy_to_user(buf, (vaddr + offset), csize)) {
+                        return -EFAULT;
+                }
+        } else
+                memcpy(buf, (vaddr + offset), csize);
+        return csize;
+}