2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Marcin Nowakowski <marcin.nowakowski@mips.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
11 #include <linux/kexec.h>
12 #include <linux/libfdt.h>
13 #include <linux/uaccess.h>
15 static int generic_kexec_prepare(struct kimage
*image
)
19 for (i
= 0; i
< image
->nr_segments
; i
++) {
20 struct fdt_header fdt
;
22 if (image
->segment
[i
].memsz
<= sizeof(fdt
))
25 if (copy_from_user(&fdt
, image
->segment
[i
].buf
, sizeof(fdt
)))
28 if (fdt_check_header(&fdt
))
32 kexec_args
[1] = (unsigned long)
33 phys_to_virt((unsigned long)image
->segment
[i
].mem
);
39 static int __init
register_generic_kexec(void)
41 _machine_kexec_prepare
= generic_kexec_prepare
;
44 arch_initcall(register_generic_kexec
);