summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-03-19 17:38:42 +0100
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-04-01 17:17:33 +0200
commitb95f138fa1550040e68ac3dd34cfce7d148d7984 (patch)
tree6916752a1977a57434d4ae28d60d16f29b9c53bc /inc
parentdfdcd7eff371071d4f5089fa8bf1c50bef6828f5 (diff)
downloadgnu-efi-b95f138fa1550040e68ac3dd34cfce7d148d7984.tar.gz
Initial support for RISCV64
Add the RISCV64 architecture Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'inc')
-rw-r--r--inc/efi.h2
-rw-r--r--inc/efilib.h2
-rw-r--r--inc/efirtlib.h2
-rw-r--r--inc/riscv64/efibind.h31
-rw-r--r--inc/riscv64/efilibplat.h7
5 files changed, 44 insertions, 0 deletions
diff --git a/inc/efi.h b/inc/efi.h
index bd99451..f87477b 100644
--- a/inc/efi.h
+++ b/inc/efi.h
@@ -50,6 +50,8 @@ Revision History
#include "arm/efibind.h"
#elif defined (_M_MIPS64) || defined(__mips64__)
#include "mips64el/efibind.h"
+#elif defined (__riscv) && __riscv_xlen == 64
+#include "riscv64/efibind.h"
#else
#error Usupported architecture
#endif
diff --git a/inc/efilib.h b/inc/efilib.h
index f7db4b6..73f8cc8 100644
--- a/inc/efilib.h
+++ b/inc/efilib.h
@@ -33,6 +33,8 @@ Revision History
#include "arm/efilibplat.h"
#elif defined (_M_MIPS64) || defined(__mips64__)
#include "mips64el/efilibplat.h"
+#elif defined (__riscv) && __riscv_xlen == 64
+#include "riscv64/efilibplat.h"
#endif
#include "efilink.h"
#include "efirtlib.h"
diff --git a/inc/efirtlib.h b/inc/efirtlib.h
index 5071493..8643061 100644
--- a/inc/efirtlib.h
+++ b/inc/efirtlib.h
@@ -32,6 +32,8 @@ Revision History
#include "arm/efilibplat.h"
#elif defined (_M_MIPS64) || defined(__mips64__)
#include "mips64el/efilibplat.h"
+#elif defined (__riscv) && __riscv_xlen == 64
+#include "riscv64/efilibplat.h"
#endif
diff --git a/inc/riscv64/efibind.h b/inc/riscv64/efibind.h
new file mode 100644
index 0000000..40b9c20
--- /dev/null
+++ b/inc/riscv64/efibind.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#include <stdint.h>
+
+#define EFIAPI
+#define EFI_ERROR_MASK 0x8000000000000000
+#define EFIERR(a) (EFI_ERROR_MASK | a)
+#define INTERFACE_DECL(x) struct x
+#define MIN_ALIGNMENT_SIZE 8
+#define RUNTIMEFUNCTION
+#define VOID void
+
+typedef uint8_t BOOLEAN;
+typedef int64_t INTN;
+typedef uint64_t UINTN;
+typedef int8_t INT8;
+typedef uint8_t UINT8;
+typedef int16_t INT16;
+typedef uint16_t UINT16;
+typedef int32_t INT32;
+typedef uint32_t UINT32;
+typedef int64_t INT64;
+typedef uint64_t UINT64;
+typedef uint16_t WCHAR;
+
+#define BREAKPOINT() while(1);
+#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
+
+#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
+#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
+#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
diff --git a/inc/riscv64/efilibplat.h b/inc/riscv64/efilibplat.h
new file mode 100644
index 0000000..0a61b24
--- /dev/null
+++ b/inc/riscv64/efilibplat.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+VOID
+InitializeLibPlatform (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );