diff options
author | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2019-01-07 09:53:50 +0100 |
---|---|---|
committer | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2019-01-07 12:53:44 +0100 |
commit | cab5e3693738743255bd9a8a8f36dccdd74ca495 (patch) | |
tree | f101603c56eeb05773923aa8d84a4a0603c3b5c7 | |
parent | bbdb2762062547ef279256d0163e4d743f21474a (diff) | |
download | tf-a-tests-cab5e3693738743255bd9a8a8f36dccdd74ca495.tar.gz |
Make UUID buffer optional for is_trusted_os_present()
The caller might simply want to know whether there is a Trusted OS,
without the need to identify it.
Change-Id: I97eef8b6e6c4cb948d48735cd7170fced98aee9a
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
-rw-r--r-- | include/runtime_services/trusted_os.h | 6 | ||||
-rw-r--r-- | lib/trusted_os/trusted_os.c | 13 |
2 files changed, 9 insertions, 10 deletions
diff --git a/include/runtime_services/trusted_os.h b/include/runtime_services/trusted_os.h index f480c6bcb..294788278 100644 --- a/include/runtime_services/trusted_os.h +++ b/include/runtime_services/trusted_os.h @@ -24,10 +24,8 @@ * Detect whether a Trusted OS is present in the software stack. * This is implemented using the Trusted OS UID SMC call. * - * If a Trusted OS is detected then this function returns 1 - * and populates 'tos_uuid' with the UUID of the detected Trusted OS. - * Otherwise, this function returns 0 and the value pointed by 'tos_uuid' - * should be ignored. + * Return 1 if a Trusted OS is detected, else 0. Additionally, the caller may + * get the UUID of the Trusted OS if he passes a non-null 'tos_uuid' pointer. */ unsigned int is_trusted_os_present(uuid_t *tos_uuid); diff --git a/lib/trusted_os/trusted_os.c b/lib/trusted_os/trusted_os.c index b24c3d395..ac6a6810b 100644 --- a/lib/trusted_os/trusted_os.c +++ b/lib/trusted_os/trusted_os.c @@ -14,7 +14,6 @@ unsigned int is_trusted_os_present(uuid_t *tos_uuid) { smc_args tos_uid_args = { SMC_TOS_UID }; smc_ret_values ret; - uint32_t *tos_uuid32; ret = tftf_smc(&tos_uid_args); @@ -23,11 +22,13 @@ unsigned int is_trusted_os_present(uuid_t *tos_uuid) (ret.ret3 == 0))) return 0; - tos_uuid32 = (uint32_t *) tos_uuid; - tos_uuid32[0] = ret.ret0; - tos_uuid32[1] = ret.ret1; - tos_uuid32[2] = ret.ret2; - tos_uuid32[3] = ret.ret3; + if (tos_uuid != NULL) { + uint32_t *tos_uuid32 = (uint32_t *) tos_uuid; + tos_uuid32[0] = ret.ret0; + tos_uuid32[1] = ret.ret1; + tos_uuid32[2] = ret.ret2; + tos_uuid32[3] = ret.ret3; + } return 1; } |