Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 13 | unsigned 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 Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 17 | |
| 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 Bailleux | cab5e36 | 2019-01-07 09:53:50 +0100 | [diff] [blame^] | 25 | 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 Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 32 | |
| 33 | return 1; |
| 34 | } |