xref: /openbmc/linux/arch/sh/kernel/crash_dump.c (revision 195c5ad9)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  *	crash_dump.c - Memory preserving reboot related code.
4  *
5  *	Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
6  *	Copyright (C) IBM Corporation, 2004. All rights reserved
7  */
8 #include <linux/errno.h>
9 #include <linux/crash_dump.h>
10 #include <linux/io.h>
11 #include <linux/uio.h>
12 #include <linux/uaccess.h>
13 
14 ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn,
15 			 size_t csize, unsigned long offset)
16 {
17 	void  __iomem *vaddr;
18 
19 	if (!csize)
20 		return 0;
21 
22 	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
23 	csize = copy_to_iter(vaddr + offset, csize, iter);
24 	iounmap(vaddr);
25 
26 	return csize;
27 }
28