summaryrefslogtreecommitdiff
path: root/kexec/phys_to_virt.c
diff options
context:
space:
mode:
authorMika Westerberg <ext-mika.1.westerberg@nokia.com>2010-05-05 09:58:32 +0300
committerSimon Horman <horms@verge.net.au>2010-05-19 09:45:04 +0900
commit7429f91acaba453c819cc22b364a5f1339a275fd (patch)
treed27c78291c18a3e57e7ee09dab6aa991656d62ae /kexec/phys_to_virt.c
parent992971824134441065c29f475153a4c142696102 (diff)
kexec: introduce phys_to_virt() function
This function is used by ELF crashdump code which prepares crash memory headers for the dump capture kernel. Most architecture can use default version which just adds PAGE_OFFSET to the virtual address but some architectures might need some special handling. Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/phys_to_virt.c')
-rw-r--r--kexec/phys_to_virt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kexec/phys_to_virt.c b/kexec/phys_to_virt.c
new file mode 100644
index 0000000..91b6d01
--- /dev/null
+++ b/kexec/phys_to_virt.c
@@ -0,0 +1,16 @@
+#include "kexec.h"
+#include "crashdump.h"
+
+/**
+ * phys_to_virt() - translate physical address to virtual address
+ * @paddr: physical address to translate
+ *
+ * For most architectures physical address is simply virtual address minus
+ * PAGE_OFFSET. Architectures that don't follow this convention should provide
+ * their own implementation.
+ */
+unsigned long
+phys_to_virt(struct crash_elf_info *elf_info, unsigned long paddr)
+{
+ return paddr + elf_info->page_offset;
+}