summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-zynq/bootm-zynqimg.c
blob: e903ab667905f1c1eed184ac1c4139cc82fe695d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-License-Identifier: GPL-2.0

#include <bootm.h>
#include <common.h>
#include <init.h>
#include <memory.h>

static int do_bootm_zynqimage(struct image_data *data)
{
	resource_size_t start, end;
	void (*barebox)(void);
	u32 *header;
	int ret;

	ret = memory_bank_first_find_space(&start, &end);
	if (ret)
		return ret;

	ret = bootm_load_os(data, start);
	if (ret)
		return ret;

	header = (u32*)start;
	barebox = (void*)start + header[12];

	if (data->verbose)
		printf("Loaded barebox image to 0x%08lx\n",
		       (unsigned long)barebox);

	shutdown_barebox();

	barebox();

	return -EIO;
}

static struct image_handler zynq_image_handler = {
	.name = "Zynq image",
	.bootm = do_bootm_zynqimage,
	.filetype = filetype_zynq_image,
};

static int zynq_register_image_handler(void)
{
	register_image_handler(&zynq_image_handler);

	return 0;
}
late_initcall(zynq_register_image_handler);