]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Add RISCV64 binding
authorNikita <sh1r4s3@mail.si-head.nl>
Tue, 22 Sep 2020 10:38:24 +0000 (18:38 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 29 Sep 2020 03:31:56 +0000 (03:31 +0000)
- Add RISCV64 ProcessorBind.h

- Add RISCV64 to Makefiles

Signed-off-by: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
Ack-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Abner Chang <abner.chang@hpe.com>
BaseTools/Source/C/GNUmakefile
BaseTools/Source/C/Include/RiscV64/ProcessorBind.h [new file with mode: 0644]
BaseTools/Source/C/Makefiles/header.makefile

index df4eb64ea95ec0ac51839b936c59a5c6a5156107..464f43277455128a1207554dc28f286578447f5d 100644 (file)
@@ -26,6 +26,9 @@ ifndef HOST_ARCH
   else ifneq (,$(findstring arm,$(uname_m)))\r
     HOST_ARCH=ARM\r
   endif\r
+  ifneq (,$(findstring riscv64,$(uname_m)))\r
+    HOST_ARCH=RISCV64\r
+  endif\r
   ifndef HOST_ARCH\r
     $(info Could not detected HOST_ARCH from uname results)\r
     $(error HOST_ARCH is not defined!)\r
diff --git a/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h b/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
new file mode 100644 (file)
index 0000000..1612d6e
--- /dev/null
@@ -0,0 +1,85 @@
+/** @file\r
+  Processor or Compiler specific defines and types for RISC-V.\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef __PROCESSOR_BIND_H__\r
+#define __PROCESSOR_BIND_H__\r
+\r
+//\r
+// Define the processor type so other code can make processor based choices\r
+//\r
+#define MDE_CPU_RISCV64\r
+\r
+//\r
+// Make sure we are using the correct packing rules per EFI specification\r
+//\r
+#ifndef __GNUC__\r
+#pragma pack()\r
+#endif\r
+\r
+//\r
+// Use ANSI C 2000 stdint.h integer width declarations\r
+//\r
+#include <stdint.h>\r
+typedef uint8_t   BOOLEAN;\r
+typedef int8_t    INT8;\r
+typedef uint8_t   UINT8;\r
+typedef int16_t   INT16;\r
+typedef uint16_t  UINT16;\r
+typedef int32_t   INT32;\r
+typedef uint32_t  UINT32;\r
+typedef int64_t   INT64;\r
+typedef uint64_t  UINT64;\r
+typedef char      CHAR8;\r
+typedef uint16_t  CHAR16;\r
+\r
+//\r
+// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,\r
+// 8 bytes on supported 64-bit processor instructions)\r
+//\r
+typedef UINT64  UINTN;\r
+\r
+//\r
+// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,\r
+// 8 bytes on supported 64-bit processor instructions)\r
+//\r
+typedef INT64   INTN;\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+\r
+//\r
+// A value of native width with the highest bit set.\r
+//\r
+#define MAX_BIT      0x8000000000000000\r
+\r
+//\r
+// A value of native width with the two highest bits set.\r
+//\r
+#define MAX_2_BITS   0xC000000000000000\r
+\r
+//\r
+// The stack alignment required for RISC-V\r
+//\r
+#define CPU_STACK_ALIGNMENT  16\r
+\r
+//\r
+// Modifier to ensure that all protocol member functions and EFI intrinsics\r
+// use the correct C calling convention. All protocol member functions and\r
+// EFI intrinsics are required to modify their member functions with EFIAPI.\r
+//\r
+#define EFIAPI\r
+\r
+#if defined(__GNUC__)\r
+  //\r
+  // For GNU assembly code, .global or .globl can declare global symbols.\r
+  // Define this macro to unify the usage.\r
+  //\r
+  #define ASM_GLOBAL .globl\r
+#endif\r
+\r
+#endif\r
index 1c105ee7d434f20e713476f606d92ebc6365e30e..0df728f3277228e7eb2625e3480f99395e15c473 100644 (file)
@@ -28,6 +28,9 @@ ifndef HOST_ARCH
   else ifneq (,$(findstring arm,$(uname_m)))\r
     HOST_ARCH=ARM\r
   endif\r
+  ifneq (,$(findstring riscv64,$(uname_m)))\r
+    HOST_ARCH=RISCV64\r
+  endif\r
   ifndef HOST_ARCH\r
     $(info Could not detected HOST_ARCH from uname results)\r
     $(error HOST_ARCH is not defined!)\r
@@ -64,6 +67,9 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
 else ifeq ($(HOST_ARCH), AARCH64)\r
 ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/\r
 \r
+else ifeq ($(HOST_ARCH), RISCV64)\r
+ARCH_INCLUDE = -I $(MAKEROOT)/Include/RiscV64/\r
+\r
 else\r
 $(error Bad HOST_ARCH)\r
 endif\r