From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.si-head.nl (mail.si-head.nl [37.252.121.114]) by mx.groups.io with SMTP id smtpd.web10.5417.1600771148203217315 for ; Tue, 22 Sep 2020 03:39:08 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: mail.si-head.nl, ip: 37.252.121.114, mailfrom: sh1r4s3@mail.si-head.nl) Received: from localhost.localdomain (109-252-138-44.dynamic.spd-mgts.ru [109.252.138.44]) by mail.si-head.nl (Postfix) with ESMTPSA id D735AC16A4; Tue, 22 Sep 2020 13:39:05 +0300 (MSK) From: "Nikita" To: devel@edk2.groups.io Cc: Nikita Ermakov Subject: [PATCH] BaseTools: Add RISCV64 binding Date: Tue, 22 Sep 2020 13:38:24 +0300 Message-Id: <20200922103824.27161-1-sh1r4s3@mail.si-head.nl> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable - Add RISCV64 ProcessorBind.h - Add RISCV64 to Makefiles Signed-off-by: Nikita Ermakov --- BaseTools/Source/C/GNUmakefile | 3 + .../Source/C/Include/RiscV64/ProcessorBind.h | 85 +++++++++++++++++++ BaseTools/Source/C/Makefiles/header.makefile | 6 ++ 3 files changed, 94 insertions(+) create mode 100644 BaseTools/Source/C/Include/RiscV64/ProcessorBind.h diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile index df4eb64ea9..464f432774 100644 --- a/BaseTools/Source/C/GNUmakefile +++ b/BaseTools/Source/C/GNUmakefile @@ -26,6 +26,9 @@ ifndef HOST_ARCH else ifneq (,$(findstring arm,$(uname_m)))=0D HOST_ARCH=3DARM=0D endif=0D + ifneq (,$(findstring riscv64,$(uname_m)))=0D + HOST_ARCH=3DRISCV64=0D + endif=0D ifndef HOST_ARCH=0D $(info Could not detected HOST_ARCH from uname results)=0D $(error HOST_ARCH is not defined!)=0D diff --git a/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h b/BaseTools= /Source/C/Include/RiscV64/ProcessorBind.h new file mode 100644 index 0000000000..1612d6ea7f --- /dev/null +++ b/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h @@ -0,0 +1,85 @@ +/** @file=0D + Processor or Compiler specific defines and types for RISC-V.=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef __PROCESSOR_BIND_H__=0D +#define __PROCESSOR_BIND_H__=0D +=0D +//=0D +// Define the processor type so other code can make processor based choice= s=0D +//=0D +#define MDE_CPU_RISCV64=0D +=0D +//=0D +// Make sure we are using the correct packing rules per EFI specification= =0D +//=0D +#ifndef __GNUC__=0D +#pragma pack()=0D +#endif=0D +=0D +//=0D +// Use ANSI C 2000 stdint.h integer width declarations=0D +//=0D +#include =0D +typedef uint8_t BOOLEAN;=0D +typedef int8_t INT8;=0D +typedef uint8_t UINT8;=0D +typedef int16_t INT16;=0D +typedef uint16_t UINT16;=0D +typedef int32_t INT32;=0D +typedef uint32_t UINT32;=0D +typedef int64_t INT64;=0D +typedef uint64_t UINT64;=0D +typedef char CHAR8;=0D +typedef uint16_t CHAR16;=0D +=0D +//=0D +// Unsigned value of native width. (4 bytes on supported 32-bit processor= instructions,=0D +// 8 bytes on supported 64-bit processor instructions)=0D +//=0D +typedef UINT64 UINTN;=0D +=0D +//=0D +// Signed value of native width. (4 bytes on supported 32-bit processor i= nstructions,=0D +// 8 bytes on supported 64-bit processor instructions)=0D +//=0D +typedef INT64 INTN;=0D +=0D +//=0D +// Processor specific defines=0D +//=0D +=0D +//=0D +// A value of native width with the highest bit set.=0D +//=0D +#define MAX_BIT 0x8000000000000000=0D +=0D +//=0D +// A value of native width with the two highest bits set.=0D +//=0D +#define MAX_2_BITS 0xC000000000000000=0D +=0D +//=0D +// The stack alignment required for RISC-V=0D +//=0D +#define CPU_STACK_ALIGNMENT 16=0D +=0D +//=0D +// Modifier to ensure that all protocol member functions and EFI intrinsic= s=0D +// use the correct C calling convention. All protocol member functions and= =0D +// EFI intrinsics are required to modify their member functions with EFIAP= I.=0D +//=0D +#define EFIAPI=0D +=0D +#if defined(__GNUC__)=0D + //=0D + // For GNU assembly code, .global or .globl can declare global symbols.= =0D + // Define this macro to unify the usage.=0D + //=0D + #define ASM_GLOBAL .globl=0D +#endif=0D +=0D +#endif=0D diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Sourc= e/C/Makefiles/header.makefile index 1c105ee7d4..0df728f327 100644 --- a/BaseTools/Source/C/Makefiles/header.makefile +++ b/BaseTools/Source/C/Makefiles/header.makefile @@ -28,6 +28,9 @@ ifndef HOST_ARCH else ifneq (,$(findstring arm,$(uname_m)))=0D HOST_ARCH=3DARM=0D endif=0D + ifneq (,$(findstring riscv64,$(uname_m)))=0D + HOST_ARCH=3DRISCV64=0D + endif=0D ifndef HOST_ARCH=0D $(info Could not detected HOST_ARCH from uname results)=0D $(error HOST_ARCH is not defined!)=0D @@ -64,6 +67,9 @@ ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/Arm/ else ifeq ($(HOST_ARCH), AARCH64)=0D ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/AArch64/=0D =0D +else ifeq ($(HOST_ARCH), RISCV64)=0D +ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/RiscV64/=0D +=0D else=0D $(error Bad HOST_ARCH)=0D endif=0D --=20 2.28.0