blob: 4b202ada20213be00c6c073c6d72c70201210875 [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 <assert.h>
8#include <debug.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02009#include <sp_helpers.h>
Antonio Nino Diazf6164aa2018-12-05 14:21:28 +000010#include <sprt_svc.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020011#include <spm_svc.h>
12#include <string.h>
13
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020014__dead2 void secure_services_loop(void)
15{
16 int32_t event_status_code;
17 svc_args svc_values = { 0 };
18
19 /*
20 * The first time this loop is executed corresponds to when Cactus has
21 * finished initialising its run time environment and is ready to handle
22 * secure service requests.
23 */
24 NOTICE("Cactus: Signal end of init to SPM\n");
Antonio Nino Diaz652d20a2018-12-10 17:17:33 +000025 event_status_code = SPRT_SUCCESS;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020026
27 while (1) {
Antonio Nino Diaz652d20a2018-12-10 17:17:33 +000028 svc_values.arg0 = SPRT_REQUEST_COMPLETE_BLOCKING_AARCH64;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020029 svc_values.arg1 = event_status_code;
30 int32_t event_id = sp_svc(&svc_values);
31
32 switch (event_id) {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020033
34 default:
35 NOTICE("Unhandled Service ID 0x%x\n", event_id);
Antonio Nino Diaz652d20a2018-12-10 17:17:33 +000036 event_status_code = SPRT_NOT_SUPPORTED;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020037 break;
38 }
39 }
40}