minimal changes to get it to build.
Signed-off-by: Fuad Tabba <tabba@google.com>
diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64
index dfd0c56..27a9bf0 100644
--- a/arm/Makefile.arm64
+++ b/arm/Makefile.arm64
@@ -20,6 +20,9 @@
cflatobjs += lib/arm64/processor.o
cflatobjs += lib/arm64/spinlock.o
cflatobjs += lib/arm64/gic-v3-its.o lib/arm64/gic-v3-its-cmd.o
+cflatobjs += lib/arm64/ffa.o
+cflatobjs += lib/arm64/call.o
+
OBJDIRS += lib/arm64
diff --git a/lib/arm64/call.c b/lib/arm64/call.c
index f92c644..7a5ae25 100644
--- a/lib/arm64/call.c
+++ b/lib/arm64/call.c
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-#include "hf/call.h"
-
-#include "hf/ffa.h"
-#include "hf/types.h"
+#include "call.h"
int64_t hf_call(uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3)
{
diff --git a/lib/arm64/call.h b/lib/arm64/call.h
index 204a248..e4c9950 100644
--- a/lib/arm64/call.h
+++ b/lib/arm64/call.h
@@ -16,9 +16,7 @@
#pragma once
-#include "hf/abi.h"
-#include "hf/ffa.h"
-#include "hf/types.h"
+#include "ffa.h"
/**
* This function must be implemented to trigger the architecture-specific
@@ -36,30 +34,6 @@
}
/**
- * Returns the VM's own ID.
- */
-static inline ffa_vm_id_t hf_vm_get_id(void)
-{
- return ffa_id_get().arg2;
-}
-
-/**
- * Returns the number of secondary VMs.
- */
-static inline ffa_vm_count_t hf_vm_get_count(void)
-{
- return hf_call(HF_VM_GET_COUNT, 0, 0, 0);
-}
-
-/**
- * Returns the number of vCPUs configured in the given secondary VM.
- */
-static inline ffa_vcpu_count_t hf_vcpu_get_count(ffa_vm_id_t vm_id)
-{
- return hf_call(HF_VCPU_GET_COUNT, vm_id, 0, 0);
-}
-
-/**
* Runs the given vCPU of the given VM.
*/
static inline struct ffa_value ffa_run(ffa_vm_id_t vm_id,
@@ -93,13 +67,13 @@
* - FFA_RX_RELEASE if it was called by the primary VM and the primary VM now
* needs to wake up or kick waiters.
*/
-static inline struct ffa_value ffa_rxtx_map(hf_ipaddr_t send, hf_ipaddr_t recv)
+static inline struct ffa_value ffa_rxtx_map(phys_addr_t send, phys_addr_t recv)
{
return ffa_call(
(struct ffa_value){.func = FFA_RXTX_MAP_64,
.arg1 = send,
.arg2 = recv,
- .arg3 = HF_MAILBOX_SIZE / FFA_PAGE_SIZE});
+ .arg3 = FFA_MAILBOX_SIZE / FFA_PAGE_SIZE});
}
/**
@@ -251,85 +225,6 @@
return ffa_call((struct ffa_value){.func = FFA_RX_RELEASE_32});
}
-/**
- * Retrieves the next VM whose mailbox became writable. For a VM to be notified
- * by this function, the caller must have called api_mailbox_send before with
- * the notify argument set to true, and this call must have failed because the
- * mailbox was not available.
- *
- * It should be called repeatedly to retrieve a list of VMs.
- *
- * Returns -1 if no VM became writable, or the id of the VM whose mailbox
- * became writable.
- */
-static inline int64_t hf_mailbox_writable_get(void)
-{
- return hf_call(HF_MAILBOX_WRITABLE_GET, 0, 0, 0);
-}
-
-/**
- * Retrieves the next VM waiting to be notified that the mailbox of the
- * specified VM became writable. Only primary VMs are allowed to call this.
- *
- * Returns -1 on failure or if there are no waiters; the VM id of the next
- * waiter otherwise.
- */
-static inline int64_t hf_mailbox_waiter_get(ffa_vm_id_t vm_id)
-{
- return hf_call(HF_MAILBOX_WAITER_GET, vm_id, 0, 0);
-}
-
-/**
- * Enables or disables a given interrupt ID.
- *
- * Returns 0 on success, or -1 if the intid is invalid.
- */
-static inline int64_t hf_interrupt_enable(uint32_t intid, bool enable)
-{
- return hf_call(HF_INTERRUPT_ENABLE, intid, enable, 0);
-}
-
-/**
- * Gets the ID of the pending interrupt (if any) and acknowledge it.
- *
- * Returns HF_INVALID_INTID if there are no pending interrupts.
- */
-static inline uint32_t hf_interrupt_get(void)
-{
- return hf_call(HF_INTERRUPT_GET, 0, 0, 0);
-}
-
-/**
- * Injects a virtual interrupt of the given ID into the given target vCPU.
- * This doesn't cause the vCPU to actually be run immediately; it will be taken
- * when the vCPU is next run, which is up to the scheduler.
- *
- * Returns:
- * - -1 on failure because the target VM or vCPU doesn't exist, the interrupt
- * ID is invalid, or the current VM is not allowed to inject interrupts to
- * the target VM.
- * - 0 on success if no further action is needed.
- * - 1 if it was called by the primary VM and the primary VM now needs to wake
- * up or kick the target vCPU.
- */
-static inline int64_t hf_interrupt_inject(ffa_vm_id_t target_vm_id,
- ffa_vcpu_index_t target_vcpu_idx,
- uint32_t intid)
-{
- return hf_call(HF_INTERRUPT_INJECT, target_vm_id, target_vcpu_idx,
- intid);
-}
-
-/**
- * Sends a character to the debug log for the VM.
- *
- * Returns 0 on success, or -1 if it failed for some reason.
- */
-static inline int64_t hf_debug_log(char c)
-{
- return hf_call(HF_DEBUG_LOG, c, 0, 0);
-}
-
/** Obtains the Hafnium's version of the implemented FF-A specification. */
static inline int32_t ffa_version(uint32_t requested_version)
{
diff --git a/lib/arm64/ffa.c b/lib/arm64/ffa.c
index 2040171..3746ca0 100644
--- a/lib/arm64/ffa.c
+++ b/lib/arm64/ffa.c
@@ -14,19 +14,7 @@
* limitations under the License.
*/
-#include "hf/ffa.h"
-
-#include <stddef.h>
-
-#include "hf/types.h"
-
-#if defined(__linux__) && defined(__KERNEL__)
-#include <linux/kernel.h>
-#include <linux/string.h>
-
-#else
-#include "hf/std.h"
-#endif
+#include "ffa.h"
/**
* Initialises the header of the given `ffa_memory_region`, not including the
diff --git a/lib/arm64/ffa.h b/lib/arm64/ffa.h
index e6a3015..ec17356 100644
--- a/lib/arm64/ffa.h
+++ b/lib/arm64/ffa.h
@@ -16,7 +16,7 @@
#pragma once
-#include "hf/types.h"
+#include "libcflat.h"
#define FFA_VERSION_MAJOR 0x1
#define FFA_VERSION_MINOR 0x0
@@ -89,8 +89,11 @@
*/
#define FFA_PAGE_SIZE 4096
+/* Size of an FFA mailbox. */
+#define FFA_MAILBOX_SIZE FFA_PAGE_SIZE
+
/* The maximum length possible for a single message. */
-#define FFA_MSG_PAYLOAD_MAX HF_MAILBOX_SIZE
+#define FFA_MSG_PAYLOAD_MAX FFA_MAILBOX_SIZE
enum ffa_data_access {
FFA_DATA_ACCESS_NOT_SPECIFIED,