blob: 9921da34dd7e00ed503b0fb512bfe1f81f8f265e [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (c) 2018 MediaTek Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#pragma once
25
26#include "imageinfo.h"
27
28/* smc function id from ATF MTK SiP service */
29#define MTK_SIP_KERNEL_BOOT_AARCH32 0x82000200
30#define MTK_SIP_KERNEL_BOOT_AARCH64 0xc2000200
31
32#define BOOT_AARCH32 0
33#define BOOT_AARCH64 1
34
35extern __WEAK paddr_t kvaddr_to_paddr(void *ptr);
36
37typedef void (*jump_func_type)(ulong arg0, ulong arg1, ulong arg2,
38 ulong arg3) __NO_RETURN;
39
40struct boot_param {
41 ulong arg0;
42 ulong arg1;
43 ulong arg2;
44 ulong arg3;
45};
46
47struct blxboot;
48
49struct blxOps {
50 int (*init)(void);
51 void (*notify)(struct blxboot *obj, struct imageinfo_t *img);
52 void (*fixup_image)(struct blxboot *obj, void *fdt_dtb);
53 void (*setup_boot_param)(struct blxboot *obj, struct boot_param *prm);
54 void (*exit)(ulong arg0, ulong arg1, ulong arg2, ulong arg3);
55 void (*get_overlay_image)(struct blxboot *obj, void **fdt_dtb,
56 void **dtbo, void **vpd);
57};
58
59struct blxCfg {
60 uint32_t boot_mode;
61 const char *ab_suffix;
62};
63
64struct blxboot {
65 struct blxOps ops;
66 struct blxCfg bootcfg;
67};
68
69struct blxboot *blxboot_create(void);
70