2 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
8 #include <runtime_svc.h>
11 #include "generic-arm64-smcall.h"
13 int trusty_disable_serial_debug
;
20 static struct dputc_state dputc_state
[2];
22 static void trusty_dputc(char ch
, int secure
)
25 struct dputc_state
*s
= &dputc_state
[!secure
];
27 if (trusty_disable_serial_debug
)
30 s
->linebuf
[s
->l
++] = ch
;
31 if (s
->l
== sizeof(s
->linebuf
) || ch
== '\n') {
33 printf("secure os: ");
35 printf("non-secure os: ");
36 for (i
= 0; i
< s
->l
; i
++) {
37 putchar(s
->linebuf
[i
]);
46 static uint64_t trusty_get_reg_base(uint32_t reg
)
50 return PLAT_ARM_GICD_BASE
;
53 return PLAT_ARM_GICC_BASE
;
56 NOTICE("%s(0x%x) unknown reg\n", __func__
, reg
);
61 static uintptr_t trusty_generic_platform_smc(uint32_t smc_fid
,
71 case SMC_FC_DEBUG_PUTC
:
72 trusty_dputc(x1
, is_caller_secure(flags
));
75 case SMC_FC_GET_REG_BASE
:
76 case SMC_FC64_GET_REG_BASE
:
77 SMC_RET1(handle
, trusty_get_reg_base(x1
));
80 NOTICE("%s(0x%x, 0x%lx) unknown smc\n", __func__
, smc_fid
, x1
);
81 SMC_RET1(handle
, SMC_UNK
);
85 /* Define a SPD runtime service descriptor for fast SMC calls */
89 SMC_ENTITY_PLATFORM_MONITOR
,
90 SMC_ENTITY_PLATFORM_MONITOR
,
93 trusty_generic_platform_smc