blob: 63c7dba15b090e80cf2ae9a8964406208776f412 [file] [log] [blame]
Antonio Nino Diaz272e8712018-09-18 01:36:00 +01001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz272e8712018-09-18 01:36:00 +01007#include <stdint.h>
8
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <platform_def.h>
10
11#include <common/debug.h>
12#include <common/runtime_svc.h>
13#include <lib/mmio.h>
14
Antonio Nino Diaz272e8712018-09-18 01:36:00 +010015#include "gxbb_private.h"
16
17/*******************************************************************************
18 * This function is responsible for handling all SiP calls
19 ******************************************************************************/
20static uintptr_t gxbb_sip_handler(uint32_t smc_fid,
21 u_register_t x1, u_register_t x2,
22 u_register_t x3, u_register_t x4,
23 void *cookie, void *handle,
24 u_register_t flags)
25{
26 switch (smc_fid) {
27
28 case GXBB_SM_GET_SHARE_MEM_INPUT_BASE:
29 SMC_RET1(handle, GXBB_SHARE_MEM_INPUT_BASE);
30
31 case GXBB_SM_GET_SHARE_MEM_OUTPUT_BASE:
32 SMC_RET1(handle, GXBB_SHARE_MEM_OUTPUT_BASE);
33
34 case GXBB_SM_EFUSE_READ:
35 {
36 void *dst = (void *)GXBB_SHARE_MEM_OUTPUT_BASE;
37 uint64_t ret = gxbb_efuse_read(dst, (uint32_t)x1, x2);
38
39 SMC_RET1(handle, ret);
40 }
41 case GXBB_SM_EFUSE_USER_MAX:
42 SMC_RET1(handle, gxbb_efuse_user_max());
43
44 case GXBB_SM_JTAG_ON:
45 scpi_jtag_set_state(GXBB_JTAG_STATE_ON, x1);
46 SMC_RET1(handle, 0);
47
48 case GXBB_SM_JTAG_OFF:
49 scpi_jtag_set_state(GXBB_JTAG_STATE_OFF, x1);
50 SMC_RET1(handle, 0);
51
52 default:
53 ERROR("BL31: Unhandled SIP SMC: 0x%08x\n", smc_fid);
54 break;
55 }
56
57 SMC_RET1(handle, SMC_UNK);
58}
59
60DECLARE_RT_SVC(
61 gxbb_sip_handler,
62
63 OEN_SIP_START,
64 OEN_SIP_END,
65 SMC_TYPE_FAST,
66 NULL,
67 gxbb_sip_handler
68);