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 <assert.h> |
| 8 | #include <debug.h> |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 9 | #include <sp_helpers.h> |
Antonio Nino Diaz | f6164aa | 2018-12-05 14:21:28 +0000 | [diff] [blame] | 10 | #include <sprt_svc.h> |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 11 | #include <spm_svc.h> |
| 12 | #include <string.h> |
| 13 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 14 | __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 Diaz | 652d20a | 2018-12-10 17:17:33 +0000 | [diff] [blame^] | 25 | event_status_code = SPRT_SUCCESS; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 26 | |
| 27 | while (1) { |
Antonio Nino Diaz | 652d20a | 2018-12-10 17:17:33 +0000 | [diff] [blame^] | 28 | svc_values.arg0 = SPRT_REQUEST_COMPLETE_BLOCKING_AARCH64; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 29 | svc_values.arg1 = event_status_code; |
| 30 | int32_t event_id = sp_svc(&svc_values); |
| 31 | |
| 32 | switch (event_id) { |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 33 | |
| 34 | default: |
| 35 | NOTICE("Unhandled Service ID 0x%x\n", event_id); |
Antonio Nino Diaz | 652d20a | 2018-12-10 17:17:33 +0000 | [diff] [blame^] | 36 | event_status_code = SPRT_NOT_SUPPORTED; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 37 | break; |
| 38 | } |
| 39 | } |
| 40 | } |