blob: e300ade152fd297fb738c0dd57e7d707effd85a5 [file] [log] [blame]
Daniel Boulbyb2fb80e2021-02-03 15:09:23 +00001/*
2 * Copyright 2021 The Hafnium Authors.
3 *
4 * Use of this source code is governed by a BSD-style
5 * license that can be found in the LICENSE file or at
6 * https://opensource.org/licenses/BSD-3-Clause.
7 */
8
9#pragma once
10
11#include "hf/ffa.h"
Olivier Deprez55a189e2021-06-09 15:45:27 +020012#include "hf/vcpu.h"
Daniel Boulbyb2fb80e2021-02-03 15:09:23 +000013
14/** Returns the SPMC ID. */
15struct ffa_value plat_ffa_spmc_id_get(void);
Olivier Deprez55a189e2021-06-09 15:45:27 +020016
17void plat_ffa_log_init(void);
18void plat_ffa_init(bool tee_enabled);
19bool plat_ffa_is_direct_request_valid(struct vcpu *current,
20 ffa_vm_id_t sender_vm_id,
21 ffa_vm_id_t receiver_vm_id);
22bool plat_ffa_is_direct_response_valid(struct vcpu *current,
23 ffa_vm_id_t sender_vm_id,
24 ffa_vm_id_t receiver_vm_id);
25bool plat_ffa_direct_request_forward(ffa_vm_id_t receiver_vm_id,
26 struct ffa_value args,
27 struct ffa_value *ret);
28
29/**
30 * Encodes memory handle according to section 5.10.2 of the FF-A v1.0 spec.
31 */
32ffa_memory_handle_t plat_ffa_memory_handle_make(uint64_t index);
33
34/**
35 * Checks whether given handle was allocated by current world, according to
36 * handle encoding rules.
37 */
38bool plat_ffa_memory_handle_allocated_by_current_world(
39 ffa_memory_handle_t handle);