blob: 9921da34dd7e00ed503b0fb512bfe1f81f8f265e [file] [log] [blame]
/*
* Copyright (c) 2018 MediaTek Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include "imageinfo.h"
/* smc function id from ATF MTK SiP service */
#define MTK_SIP_KERNEL_BOOT_AARCH32 0x82000200
#define MTK_SIP_KERNEL_BOOT_AARCH64 0xc2000200
#define BOOT_AARCH32 0
#define BOOT_AARCH64 1
extern __WEAK paddr_t kvaddr_to_paddr(void *ptr);
typedef void (*jump_func_type)(ulong arg0, ulong arg1, ulong arg2,
ulong arg3) __NO_RETURN;
struct boot_param {
ulong arg0;
ulong arg1;
ulong arg2;
ulong arg3;
};
struct blxboot;
struct blxOps {
int (*init)(void);
void (*notify)(struct blxboot *obj, struct imageinfo_t *img);
void (*fixup_image)(struct blxboot *obj, void *fdt_dtb);
void (*setup_boot_param)(struct blxboot *obj, struct boot_param *prm);
void (*exit)(ulong arg0, ulong arg1, ulong arg2, ulong arg3);
void (*get_overlay_image)(struct blxboot *obj, void **fdt_dtb,
void **dtbo, void **vpd);
};
struct blxCfg {
uint32_t boot_mode;
const char *ab_suffix;
};
struct blxboot {
struct blxOps ops;
struct blxCfg bootcfg;
};
struct blxboot *blxboot_create(void);