Andrew Scull | 1883487 | 2018-10-12 11:48:09 +0100 | [diff] [blame] | 1 | /* |
Andrew Walbran | 692b325 | 2019-03-07 15:51:31 +0000 | [diff] [blame] | 2 | * Copyright 2018 The Hafnium Authors. |
Andrew Scull | 1883487 | 2018-10-12 11:48:09 +0100 | [diff] [blame] | 3 | * |
Andrew Walbran | e959ec1 | 2020-06-17 15:01:09 +0100 | [diff] [blame] | 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. |
Andrew Scull | 1883487 | 2018-10-12 11:48:09 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
Andrew Scull | fbc938a | 2018-08-20 14:09:28 +0100 | [diff] [blame] | 9 | #pragma once |
Wedson Almeida Filho | 3fcbcff | 2018-07-10 23:53:39 +0100 | [diff] [blame] | 10 | |
Andrew Scull | 18c78fc | 2018-08-20 12:57:41 +0100 | [diff] [blame] | 11 | #include "hf/cpu.h" |
Wedson Almeida Filho | 22d5eaa | 2018-12-16 00:38:49 +0000 | [diff] [blame] | 12 | #include "hf/mpool.h" |
Andrew Scull | 18c78fc | 2018-08-20 12:57:41 +0100 | [diff] [blame] | 13 | #include "hf/vm.h" |
Wedson Almeida Filho | 3fcbcff | 2018-07-10 23:53:39 +0100 | [diff] [blame] | 14 | |
Andrew Scull | 6d2db33 | 2018-10-10 15:28:17 +0100 | [diff] [blame] | 15 | #include "vmapi/hf/call.h" |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 16 | #include "vmapi/hf/ffa.h" |
Andrew Scull | 6d2db33 | 2018-10-10 15:28:17 +0100 | [diff] [blame] | 17 | |
Wedson Almeida Filho | 22d5eaa | 2018-12-16 00:38:49 +0000 | [diff] [blame] | 18 | void api_init(struct mpool *ppool); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 19 | ffa_vm_count_t api_vm_get_count(void); |
| 20 | ffa_vcpu_count_t api_vcpu_get_count(ffa_vm_id_t vm_id, |
| 21 | const struct vcpu *current); |
Andrew Walbran | 1f8d487 | 2018-12-20 11:21:32 +0000 | [diff] [blame] | 22 | void api_regs_state_saved(struct vcpu *vcpu); |
Wedson Almeida Filho | ea62e2e | 2019-01-09 19:14:59 +0000 | [diff] [blame] | 23 | int64_t api_mailbox_writable_get(const struct vcpu *current); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 24 | int64_t api_mailbox_waiter_get(ffa_vm_id_t vm_id, const struct vcpu *current); |
Andrew Walbran | c1ad4ce | 2019-05-09 11:41:39 +0100 | [diff] [blame] | 25 | int64_t api_debug_log(char c, struct vcpu *current); |
Andrew Scull | 6bca35e | 2018-10-02 12:05:32 +0100 | [diff] [blame] | 26 | |
Andrew Scull | 33fecd3 | 2019-01-08 14:48:27 +0000 | [diff] [blame] | 27 | struct vcpu *api_preempt(struct vcpu *current); |
Andrew Scull | 33fecd3 | 2019-01-08 14:48:27 +0000 | [diff] [blame] | 28 | struct vcpu *api_wait_for_interrupt(struct vcpu *current); |
Andrew Walbran | 3364565 | 2019-04-15 12:29:31 +0100 | [diff] [blame] | 29 | struct vcpu *api_vcpu_off(struct vcpu *current); |
Andrew Scull | 9726c25 | 2019-01-23 13:44:19 +0000 | [diff] [blame] | 30 | struct vcpu *api_abort(struct vcpu *current); |
Andrew Walbran | 3364565 | 2019-04-15 12:29:31 +0100 | [diff] [blame] | 31 | struct vcpu *api_wake_up(struct vcpu *current, struct vcpu *target_vcpu); |
Andrew Walbran | 318f573 | 2018-11-20 16:23:42 +0000 | [diff] [blame] | 32 | |
Wedson Almeida Filho | c559d13 | 2019-01-09 19:33:40 +0000 | [diff] [blame] | 33 | int64_t api_interrupt_enable(uint32_t intid, bool enable, struct vcpu *current); |
| 34 | uint32_t api_interrupt_get(struct vcpu *current); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 35 | int64_t api_interrupt_inject(ffa_vm_id_t target_vm_id, |
| 36 | ffa_vcpu_index_t target_vcpu_idx, uint32_t intid, |
Andrew Walbran | 42347a9 | 2019-05-09 13:59:03 +0100 | [diff] [blame] | 37 | struct vcpu *current, struct vcpu **next); |
Jose Marinho | a1dfeda | 2019-02-27 16:46:03 +0000 | [diff] [blame] | 38 | |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 39 | struct 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); |
| 43 | struct ffa_value api_ffa_msg_recv(bool block, struct vcpu *current, |
| 44 | struct vcpu **next); |
| 45 | struct ffa_value api_ffa_rx_release(struct vcpu *current, struct vcpu **next); |
| 46 | struct 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 Walbran | 16075b6 | 2019-09-03 17:11:07 +0100 | [diff] [blame] | 49 | void api_yield(struct vcpu *current, struct vcpu **next); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 50 | struct ffa_value api_ffa_version(uint32_t requested_version); |
Fuad Tabba | e4efcc3 | 2020-07-16 15:37:27 +0100 | [diff] [blame^] | 51 | struct ffa_value api_ffa_partition_info_get(struct vcpu *current, |
| 52 | const struct ffa_uuid *uuid); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 53 | struct ffa_value api_ffa_id_get(const struct vcpu *current); |
| 54 | struct ffa_value api_ffa_features(uint32_t function_id); |
| 55 | struct 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); |
| 57 | struct ffa_value api_ffa_mem_send(uint32_t share_func, uint32_t length, |
| 58 | uint32_t fragment_length, ipaddr_t address, |
Andrew Walbran | 1a86aa9 | 2020-05-15 17:22:28 +0100 | [diff] [blame] | 59 | uint32_t page_count, struct vcpu *current); |
Andrew Walbran | b5ab43c | 2020-04-30 11:32:54 +0100 | [diff] [blame] | 60 | struct 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); |
| 64 | struct ffa_value api_ffa_mem_relinquish(struct vcpu *current); |
| 65 | struct ffa_value api_ffa_mem_reclaim(ffa_memory_handle_t handle, |
| 66 | ffa_memory_region_flags_t flags, |
| 67 | struct vcpu *current); |
Andrew Walbran | ca808b1 | 2020-05-15 17:22:28 +0100 | [diff] [blame] | 68 | struct 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); |
| 72 | struct 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); |