aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/fadump.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index da68bdad194a..a83bc9015c64 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -814,6 +814,19 @@ static void fadump_setup_crash_memory_ranges(void)
814 } 814 }
815} 815}
816 816
817/*
818 * If the given physical address falls within the boot memory region then
819 * return the relocated address that points to the dump region reserved
820 * for saving initial boot memory contents.
821 */
822static inline unsigned long fadump_relocate(unsigned long paddr)
823{
824 if (paddr > RMA_START && paddr < fw_dump.boot_memory_size)
825 return fdm.rmr_region.destination_address + paddr;
826 else
827 return paddr;
828}
829
817static int fadump_create_elfcore_headers(char *bufp) 830static int fadump_create_elfcore_headers(char *bufp)
818{ 831{
819 struct elfhdr *elf; 832 struct elfhdr *elf;
@@ -845,6 +858,22 @@ static int fadump_create_elfcore_headers(char *bufp)
845 858
846 (elf->e_phnum)++; 859 (elf->e_phnum)++;
847 860
861 /* setup ELF PT_NOTE for vmcoreinfo */
862 phdr = (struct elf_phdr *)bufp;
863 bufp += sizeof(struct elf_phdr);
864 phdr->p_type = PT_NOTE;
865 phdr->p_flags = 0;
866 phdr->p_vaddr = 0;
867 phdr->p_align = 0;
868
869 phdr->p_paddr = fadump_relocate(paddr_vmcoreinfo_note());
870 phdr->p_offset = phdr->p_paddr;
871 phdr->p_memsz = vmcoreinfo_max_size;
872 phdr->p_filesz = vmcoreinfo_max_size;
873
874 /* Increment number of program headers. */
875 (elf->e_phnum)++;
876
848 /* setup PT_LOAD sections. */ 877 /* setup PT_LOAD sections. */
849 878
850 for (i = 0; i < crash_mem_ranges; i++) { 879 for (i = 0; i < crash_mem_ranges; i++) {