blob: b24c3d395210a0dce139165fd368fe3af3b26d90 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <smccc.h>
8#include <stdint.h>
9#include <tftf.h>
10#include <trusted_os.h>
11#include <uuid_utils.h>
12
13unsigned int is_trusted_os_present(uuid_t *tos_uuid)
14{
15 smc_args tos_uid_args = { SMC_TOS_UID };
16 smc_ret_values ret;
17 uint32_t *tos_uuid32;
18
19 ret = tftf_smc(&tos_uid_args);
20
21 if ((ret.ret0 == SMC_UNKNOWN) ||
22 ((ret.ret0 == 0) && (ret.ret1 == 0) && (ret.ret2 == 0) &&
23 (ret.ret3 == 0)))
24 return 0;
25
26 tos_uuid32 = (uint32_t *) tos_uuid;
27 tos_uuid32[0] = ret.ret0;
28 tos_uuid32[1] = ret.ret1;
29 tos_uuid32[2] = ret.ret2;
30 tos_uuid32[3] = ret.ret3;
31
32 return 1;
33}