blob: f9f8ccae976407d7ca4daec69b67cf873289941b [file] [log] [blame]
Andrew Scull18834872018-10-12 11:48:09 +01001/*
Andrew Walbran692b3252019-03-07 15:51:31 +00002 * Copyright 2018 The Hafnium Authors.
Andrew Scull18834872018-10-12 11:48:09 +01003 *
Andrew Walbrane959ec12020-06-17 15:01:09 +01004 * 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.
Andrew Scull18834872018-10-12 11:48:09 +01007 */
8
Andrew Scullfbc938a2018-08-20 14:09:28 +01009#pragma once
Wedson Almeida Filho3fcbcff2018-07-10 23:53:39 +010010
Andrew Scull18c78fc2018-08-20 12:57:41 +010011#include "hf/cpu.h"
Wedson Almeida Filho22d5eaa2018-12-16 00:38:49 +000012#include "hf/mpool.h"
Andrew Scull18c78fc2018-08-20 12:57:41 +010013#include "hf/vm.h"
Wedson Almeida Filho3fcbcff2018-07-10 23:53:39 +010014
Andrew Scull6d2db332018-10-10 15:28:17 +010015#include "vmapi/hf/call.h"
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010016#include "vmapi/hf/ffa.h"
Andrew Scull6d2db332018-10-10 15:28:17 +010017
Wedson Almeida Filho22d5eaa2018-12-16 00:38:49 +000018void api_init(struct mpool *ppool);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010019ffa_vm_count_t api_vm_get_count(void);
20ffa_vcpu_count_t api_vcpu_get_count(ffa_vm_id_t vm_id,
21 const struct vcpu *current);
Andrew Walbran1f8d4872018-12-20 11:21:32 +000022void api_regs_state_saved(struct vcpu *vcpu);
Wedson Almeida Filhoea62e2e2019-01-09 19:14:59 +000023int64_t api_mailbox_writable_get(const struct vcpu *current);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010024int64_t api_mailbox_waiter_get(ffa_vm_id_t vm_id, const struct vcpu *current);
Andrew Walbranc1ad4ce2019-05-09 11:41:39 +010025int64_t api_debug_log(char c, struct vcpu *current);
Andrew Scull6bca35e2018-10-02 12:05:32 +010026
Andrew Scull33fecd32019-01-08 14:48:27 +000027struct vcpu *api_preempt(struct vcpu *current);
Andrew Scull33fecd32019-01-08 14:48:27 +000028struct vcpu *api_wait_for_interrupt(struct vcpu *current);
Andrew Walbran33645652019-04-15 12:29:31 +010029struct vcpu *api_vcpu_off(struct vcpu *current);
Andrew Scull9726c252019-01-23 13:44:19 +000030struct vcpu *api_abort(struct vcpu *current);
Andrew Walbran33645652019-04-15 12:29:31 +010031struct vcpu *api_wake_up(struct vcpu *current, struct vcpu *target_vcpu);
Andrew Walbran318f5732018-11-20 16:23:42 +000032
Wedson Almeida Filhoc559d132019-01-09 19:33:40 +000033int64_t api_interrupt_enable(uint32_t intid, bool enable, struct vcpu *current);
34uint32_t api_interrupt_get(struct vcpu *current);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010035int64_t api_interrupt_inject(ffa_vm_id_t target_vm_id,
36 ffa_vcpu_index_t target_vcpu_idx, uint32_t intid,
Andrew Walbran42347a92019-05-09 13:59:03 +010037 struct vcpu *current, struct vcpu **next);
Jose Marinhoa1dfeda2019-02-27 16:46:03 +000038
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010039struct ffa_value api_ffa_msg_send(ffa_vm_id_t sender_vm_id,
40 ffa_vm_id_t receiver_vm_id, uint32_t size,
41 uint32_t attributes, struct vcpu *current,
42 struct vcpu **next);
43struct ffa_value api_ffa_msg_recv(bool block, struct vcpu *current,
44 struct vcpu **next);
45struct ffa_value api_ffa_rx_release(struct vcpu *current, struct vcpu **next);
46struct ffa_value api_ffa_rxtx_map(ipaddr_t send, ipaddr_t recv,
47 uint32_t page_count, struct vcpu *current,
48 struct vcpu **next);
Andrew Walbran16075b62019-09-03 17:11:07 +010049void api_yield(struct vcpu *current, struct vcpu **next);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010050struct ffa_value api_ffa_version(uint32_t requested_version);
Fuad Tabbae4efcc32020-07-16 15:37:27 +010051struct ffa_value api_ffa_partition_info_get(struct vcpu *current,
52 const struct ffa_uuid *uuid);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010053struct ffa_value api_ffa_id_get(const struct vcpu *current);
54struct ffa_value api_ffa_features(uint32_t function_id);
55struct ffa_value api_ffa_run(ffa_vm_id_t vm_id, ffa_vcpu_index_t vcpu_idx,
56 const struct vcpu *current, struct vcpu **next);
57struct ffa_value api_ffa_mem_send(uint32_t share_func, uint32_t length,
58 uint32_t fragment_length, ipaddr_t address,
Andrew Walbran1a86aa92020-05-15 17:22:28 +010059 uint32_t page_count, struct vcpu *current);
Andrew Walbranb5ab43c2020-04-30 11:32:54 +010060struct ffa_value api_ffa_mem_retrieve_req(uint32_t length,
61 uint32_t fragment_length,
62 ipaddr_t address, uint32_t page_count,
63 struct vcpu *current);
64struct ffa_value api_ffa_mem_relinquish(struct vcpu *current);
65struct ffa_value api_ffa_mem_reclaim(ffa_memory_handle_t handle,
66 ffa_memory_region_flags_t flags,
67 struct vcpu *current);
Andrew Walbranca808b12020-05-15 17:22:28 +010068struct ffa_value api_ffa_mem_frag_rx(ffa_memory_handle_t handle,
69 uint32_t fragment_offset,
70 ffa_vm_id_t sender_vm_id,
71 struct vcpu *current);
72struct ffa_value api_ffa_mem_frag_tx(ffa_memory_handle_t handle,
73 uint32_t fragment_length,
74 ffa_vm_id_t sender_vm_id,
75 struct vcpu *current);