blob: ac6a6810bd305346763b142a8e83097e29e2d580 [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;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020017
18 ret = tftf_smc(&tos_uid_args);
19
20 if ((ret.ret0 == SMC_UNKNOWN) ||
21 ((ret.ret0 == 0) && (ret.ret1 == 0) && (ret.ret2 == 0) &&
22 (ret.ret3 == 0)))
23 return 0;
24
Sandrine Bailleuxcab5e362019-01-07 09:53:50 +010025 if (tos_uuid != NULL) {
26 uint32_t *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 }
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020032
33 return 1;
34}