blob: a6b576d3918a42506b19fb460d0c5380d161fe17 [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>
9#include <mm_svc.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020010#include <sp_helpers.h>
Antonio Nino Diazf6164aa2018-12-05 14:21:28 +000011#include <sprt_svc.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020012#include <spm_svc.h>
13#include <string.h>
14
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020015__dead2 void secure_services_loop(void)
16{
17 int32_t event_status_code;
18 svc_args svc_values = { 0 };
19
20 /*
21 * The first time this loop is executed corresponds to when Cactus has
22 * finished initialising its run time environment and is ready to handle
23 * secure service requests.
24 */
25 NOTICE("Cactus: Signal end of init to SPM\n");
26 event_status_code = SPM_SUCCESS;
27
28 while (1) {
29 svc_values.arg0 = SP_EVENT_COMPLETE_AARCH64;
30 svc_values.arg1 = event_status_code;
31 int32_t event_id = sp_svc(&svc_values);
32
33 switch (event_id) {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020034
35 default:
36 NOTICE("Unhandled Service ID 0x%x\n", event_id);
37 event_status_code = SPM_NOT_SUPPORTED;
38 break;
39 }
40 }
41}