blob: aeb3983f0130ba98a5d25ddc1cc009ebd91f8426 [file] [log] [blame]
weichangzheng74b45192022-03-02 15:09:05 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2021
4 * lixinde <lixinde@phytium.com.cn>
5 * weichangzheng <weichangzheng@phytium.com.cn>
6 */
7
8#include <stdio.h>
9#include <string.h>
10#include <linux/arm-smccc.h>
11#include <init.h>
12#include "cpu.h"
13
14struct common_config {
15 u32 magic;
16 u32 version;
17 u32 size;
18 u8 rev1[4];
19 u64 core_bit_map;
20} __attribute((aligned(4)));
21
22struct common_config const common_base_info = {
23 .magic = PARAMETER_COMMON_MAGIC,
24 .version = 0x1,
25 .core_bit_map = 0x3333,
26};
27
28void sec_init(void)
29{
30 u8 buffer[0x100];
31 struct arm_smccc_res res;
32
33 memcpy(buffer, &common_base_info, sizeof(common_base_info));
34 arm_smccc_smc(CPU_INIT_SEC_SVC, 0, (u64)buffer, 0, 0, 0, 0, 0, &res);
35 if (res.a0 != 0)
36 panic("SEC init failed :0x%lx\n", res.a0);
37}