blob: 777ef82402bfd3e5d2e010f54d196e9c778b2b6d [file] [log] [blame]
Ruari Phipps1925b2a2020-09-10 14:05:55 +01001/*
2 * Copyright (c) 2018-2021, 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 <errno.h>
10#include <ffa_helpers.h>
Olivier Deprez2765ebf2020-12-16 15:46:14 +010011#include <sp_debug.h>
Ruari Phipps1925b2a2020-09-10 14:05:55 +010012#include <sp_helpers.h>
13
14#include "ivy.h"
15
16/* Host machine information injected by the build system in the ELF file. */
17extern const char build_message[];
18extern const char version_string[];
19
20void __dead2 ivy_main(void)
21{
22 u_register_t ret;
23 svc_args args;
24
Olivier Deprez2765ebf2020-12-16 15:46:14 +010025 set_putc_impl(SVC_CALL_AS_STDOUT);
26
Olivier Deprez24bd1702021-10-05 14:35:17 +020027 args = (svc_args) {.fid = FFA_ID_GET};
28 ret = sp_svc(&args);
29
30 NOTICE("Booting Secure Partition (ID: %x)\n",
31 (unsigned int)args.arg2);
Ruari Phipps1925b2a2020-09-10 14:05:55 +010032 NOTICE("%s\n", build_message);
33 NOTICE("%s\n", version_string);
34
35init:
Olivier Deprez24bd1702021-10-05 14:35:17 +020036 args = (svc_args) {.fid = FFA_MSG_WAIT};
Ruari Phipps1925b2a2020-09-10 14:05:55 +010037 ret = sp_svc(&args);
Olivier Deprez2765ebf2020-12-16 15:46:14 +010038
Ruari Phipps1925b2a2020-09-10 14:05:55 +010039 while (1) {
40 if (ret != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
41 ERROR("unknown FF-A request %lx\n", ret);
42 goto init;
43 }
Olivier Deprez2765ebf2020-12-16 15:46:14 +010044
Ruari Phipps1925b2a2020-09-10 14:05:55 +010045 VERBOSE("Received request: %lx\n", args.arg3);
Olivier Deprez2765ebf2020-12-16 15:46:14 +010046
Ruari Phipps1925b2a2020-09-10 14:05:55 +010047 args.fid = FFA_MSG_SEND_DIRECT_RESP_SMC32;
48 args.arg1 = 0x80020000;
49 args.arg2 = 0;
50 args.arg3 = 0;
Olivier Deprez2765ebf2020-12-16 15:46:14 +010051
Ruari Phipps1925b2a2020-09-10 14:05:55 +010052 ret = sp_svc(&args);
53 }
54}