public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sunny Wang" <Sunny.Wang@arm.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"daniel.schaefer@hpe.com" <daniel.schaefer@hpe.com>
Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>,
	Barton Gao <gaojie@byosoft.com.cn>,
	Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
	Eric Jin <eric.jin@intel.com>, Arvin Chen <arvinx.chen@intel.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Abner Chang <abner.chang@hpe.com>,
	Sunny Wang <Sunny.Wang@arm.com>
Subject: Re: [edk2-devel] [edk2-test PATCHv3 3/5] SctPkg: Add RISCV64 build support
Date: Tue, 30 Mar 2021 12:26:19 +0000	[thread overview]
Message-ID: <DB8PR08MB399384C8ADAE1DE4339D89BB857D9@DB8PR08MB3993.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20210304032116.24357-4-daniel.schaefer@hpe.com>

Looks good to me. Same comment as the patches 1/5 and 2/5.
Reviewed-by: Sunny Wang <sunny.wang@arm.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Daniel Schaefer
Sent: Thursday, March 4, 2021 11:21 AM
To: devel@edk2.groups.io
Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>; Barton Gao <gaojie@byosoft.com.cn>; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; Eric Jin <eric.jin@intel.com>; Arvin Chen <arvinx.chen@intel.com>; Leif Lindholm <leif@nuviainc.com>; Heinrich Schuchardt <xypron.glpk@gmx.de>; Abner Chang <abner.chang@hpe.com>
Subject: [edk2-devel] [edk2-test PATCHv3 3/5] SctPkg: Add RISCV64 build support

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3042

Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>
Cc: Barton Gao <gaojie@byosoft.com.cn>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Cc: Eric Jin <eric.jin@intel.com>
Cc: Arvin Chen <arvinx.chen@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Abner Chang <abner.chang@hpe.com>
Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
---
 uefi-sct/SctPkg/Application/InstallSct/InstallSctDef.h                                      |  4 ++
 uefi-sct/SctPkg/Library/SctLib/SctLib.inf                                                   |  6 ++
 uefi-sct/SctPkg/SCRT/SCRTApp/SCRTApp.inf                                                    |  5 ++
 uefi-sct/SctPkg/SCRT/SCRTDriver/SCRTDriver.inf                                              |  6 ++
 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/DebugSupportBBTest.inf |  6 ++
 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/Usb2Hc/BlackBoxTest/Usb2HcTest.inf               |  4 ++
 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/UsbHcTest.inf                 |  4 ++
 uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/EntsLib.inf                    |  5 ++
 uefi-sct/SctPkg/Tools/Source/GenBin/GNUmakefile                                             |  4 ++
 uefi-sct/SctPkg/UEFI/IHV_SCT.dsc                                                            | 17 +++++-
 uefi-sct/SctPkg/UEFI/Protocol/DebugSupport.h                                                | 61 +++++++++++++++++++-
 uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc                                                           | 18 +++++-
 uefi-sct/SctPkg/build.sh                                                                    | 11 +++-
 13 files changed, 144 insertions(+), 7 deletions(-)

diff --git a/uefi-sct/SctPkg/Application/InstallSct/InstallSctDef.h b/uefi-sct/SctPkg/Application/InstallSct/InstallSctDef.h
index a7815580..02f0283e 100644
--- a/uefi-sct/SctPkg/Application/InstallSct/InstallSctDef.h
+++ b/uefi-sct/SctPkg/Application/InstallSct/InstallSctDef.h
@@ -3,6 +3,7 @@
   Copyright 2006 - 2017 Unified EFI, Inc.<BR>
   Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
+  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>

   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License @@ -32,6 +33,9 @@  #elif defined(EFIAARCH64)
   #define INSTALL_SCT_PLATFORM_SHORT_NAME   L"aarch64"
   #define INSTALL_SCT_PLATFORM_NAME         L"AARCH64"
+#elif defined(EFIRISCV64)
+  #define INSTALL_SCT_PLATFORM_SHORT_NAME   L"riscv64"
+  #define INSTALL_SCT_PLATFORM_NAME         L"RISCV64"
 #else
   #error "Architecture not supported"
 #endif
diff --git a/uefi-sct/SctPkg/Library/SctLib/SctLib.inf b/uefi-sct/SctPkg/Library/SctLib/SctLib.inf
index 23cb77fb..7527b203 100644
--- a/uefi-sct/SctPkg/Library/SctLib/SctLib.inf
+++ b/uefi-sct/SctPkg/Library/SctLib/SctLib.inf
@@ -3,6 +3,7 @@
 #  Copyright 2006 - 2016 Unified EFI, Inc.<BR>  #  Copyright (c) 2013 - 2014, ARM Ltd. All rights reserved.<BR>  #  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -62,6 +63,11 @@
   Aarch64/initplat.c
   Math.c

+[sources.RISCV64]
+  Riscv64/SctLibPlat.h
+  Riscv64/initplat.c
+  Math.c
+
 [sources.ia32]
   ia32/SctLibPlat.h
   ia32/initplat.c
diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/SCRTApp.inf b/uefi-sct/SctPkg/SCRT/SCRTApp/SCRTApp.inf
index 7aca6e30..8104a4ef 100644
--- a/uefi-sct/SctPkg/SCRT/SCRTApp/SCRTApp.inf
+++ b/uefi-sct/SctPkg/SCRT/SCRTApp/SCRTApp.inf
@@ -2,6 +2,7 @@
 #
 #  Copyright 2006 - 2016 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -39,6 +40,10 @@
   Aarch64/GoVirtual.asm | RVCT
   Aarch64/GoVirtual.S | GCC

+[sources.RISCV64]
+  Riscv64/VirtualMemory.c
+  Riscv64/GoVirtual.S | GCC
+
 [sources.ia32]
   ia32/VirtualMemory.c
   ia32/GoVirtual.asm | MSFT
diff --git a/uefi-sct/SctPkg/SCRT/SCRTDriver/SCRTDriver.inf b/uefi-sct/SctPkg/SCRT/SCRTDriver/SCRTDriver.inf
index ad0eb0f8..a3ef454e 100644
--- a/uefi-sct/SctPkg/SCRT/SCRTDriver/SCRTDriver.inf
+++ b/uefi-sct/SctPkg/SCRT/SCRTDriver/SCRTDriver.inf
@@ -2,6 +2,7 @@
 #
 #  Copyright 2006 - 2016 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -69,6 +70,11 @@
   Aarch64/Dump.c
   Aarch64/Debug.c

+[sources.RISCV64]
+  Riscv64/Io.c
+  Riscv64/Dump.c
+  Riscv64/Debug.c
+
 [sources.common]
   Guid.h
   Guid.c
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/DebugSupportBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/DebugSupportBBTest.inf
index 799f86fd..03bf7ccf 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/DebugSupportBBTest.inf
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTe
+++ st/DebugSupportBBTest.inf
@@ -3,6 +3,7 @@
 #  Copyright 2006 - 2012 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>  #  Copyright (c) 2019, ARM Ltd. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -67,6 +68,11 @@
   Aarch64/DebugSupportBBTestExceptionCallbackFunction.c
   Aarch64/DebugSupportBBTestCacheFunction.c

+[sources.RISCV64]
+  Riscv64/PlatformIsa.c
+  Riscv64/DebugSupportBBTestExceptionCallbackFunction.c
+  Riscv64/DebugSupportBBTestCacheFunction.c
+
 [Packages]
   SctPkg/SctPkg.dec
   SctPkg/UEFI/UEFI.dec
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/Usb2Hc/BlackBoxTest/Usb2HcTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/Usb2Hc/BlackBoxTest/Usb2HcTest.inf
index e8118739..95ae593e 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/Usb2Hc/BlackBoxTest/Usb2HcTest.inf
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/Usb2Hc/BlackBoxTest/Usb
+++ 2HcTest.inf
@@ -2,6 +2,7 @@
 #
 #  Copyright 2006 - 2016 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -55,6 +56,9 @@  #[sources.Aarch64]  #  IPF/TimerInterrupt.c

+#[sources.Riscv64]
+#  IPF/TimerInterrupt.c
+
 [Packages]
   MdePkg/MdePkg.dec
   SctPkg/SctPkg.dec
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/UsbHcTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/UsbHcTest.inf
index efc438c1..d3bcd5ce 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/UsbHcTest.inf
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/UsbH
+++ cTest.inf
@@ -2,6 +2,7 @@
 #
 #  Copyright 2006 - 2012 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -55,6 +56,9 @@  [sources.Aarch64]
   Aarch64/TimerInterrupt.c

+[sources.RISCV64]
+  Riscv64/TimerInterrupt.c
+
 [Packages]
   MdePkg/MdePkg.dec
   SctPkg/SctPkg.dec
diff --git a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/EntsLib.inf b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/EntsLib.inf
index 23f12d1a..b60e90b2 100644
--- a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/EntsLib.inf
+++ b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/EntsL
+++ ib.inf
@@ -3,6 +3,7 @@
 #  Copyright 2006 - 2012 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>  #  Copyright (c) 2019, ARM Ltd. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -66,6 +67,10 @@
   Aarch64/EntsLibPlat.h
   Aarch64/InitPlat.c

+[sources.RISCV64]
+  Riscv64/EntsLibPlat.h
+  Riscv64/InitPlat.c
+
 [Packages]
   MdePkg/MdePkg.dec
   SctPkg/SctPkg.dec
diff --git a/uefi-sct/SctPkg/Tools/Source/GenBin/GNUmakefile b/uefi-sct/SctPkg/Tools/Source/GenBin/GNUmakefile
index c235f313..c492d441 100644
--- a/uefi-sct/SctPkg/Tools/Source/GenBin/GNUmakefile
+++ b/uefi-sct/SctPkg/Tools/Source/GenBin/GNUmakefile
@@ -1,6 +1,7 @@
 #
 #  Copyright 2006 - 2010 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 Intel Corporation. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -31,6 +32,9 @@ ifndef ARCH
   ifneq (,$(findstring arm,$(uname_m)))
     ARCH=ARM
   endif
+  ifneq (,$(findstring riscv64,$(uname_m)))
+    ARCH=RISCV64
+  endif
   ifndef ARCH
     $(info Could not detected ARCH from uname results)
     $(error ARCH is not defined!)
diff --git a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
index f9e86264..94bb5c36 100644
--- a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
+++ b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
@@ -3,6 +3,7 @@
 #  Copyright 2006 - 2016 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>  #  Copyright (c) 2019,Microchip Technology Inc.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -42,7 +43,7 @@
   PLATFORM_VERSION               = 0.1
   DSC_SPECIFICATION              = 0x00010005
   OUTPUT_DIRECTORY               = Build/IhvSct
-  SUPPORTED_ARCHITECTURES        = IA32|X64|ARM|AARCH64
+  SUPPORTED_ARCHITECTURES        = IA32|X64|ARM|AARCH64|RISCV64
   BUILD_TARGETS                  = DEBUG|RELEASE
   SKUID_IDENTIFIER               = DEFAULT

@@ -109,6 +110,12 @@
   *_*_AARCH64_PP_FLAGS         = -D EFIAARCH64 $(GCC_VER_MACRO)
   RVCT:*_*_AARCH64_DLINK_FLAGS = --muldefweak

+  *_*_RISCV64_CC_FLAGS         = -D EFIRISCV64 $(GCC_VER_MACRO)
+  GCC:*_*_RISCV64_CC_FLAGS  = -D EFIRISCV64 $(GCC_VER_MACRO) -ffreestanding -nostdinc -nostdlib -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error
+  *_*_RISCV64_VFRPP_FLAGS      = -D EFIRISCV64 $(GCC_VER_MACRO)
+  *_*_RISCV64_APP_FLAGS        = -D EFIRISCV64 $(GCC_VER_MACRO)
+  *_*_RISCV64_PP_FLAGS         = -D EFIRISCV64 $(GCC_VER_MACRO)
+
   DEBUG_*_*_CC_FLAGS  = -DEFI_DEBUG
   RELEASE_*_*_CC_FLAGS  = -DMDEPKG_NDEBUG

@@ -124,6 +131,9 @@
 [Libraries.AARCH64]
   ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+[Libraries.RISCV64]
+  ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+
 [Libraries.IA32,Libraries.X64]

 [LibraryClasses.common]
@@ -146,6 +156,9 @@
 [LibraryClasses.AARCH64]
   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+[LibraryClasses.RISCV64]
+  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+
 [LibraryClasses.IA32]

 ###############################################################################
@@ -228,4 +241,4 @@ SctPkg/TestInfrastructure/SCT/Framework/Sct.inf

 [Components.IA32, Components.X64]
 SctPkg/TestCase/UEFI/IHV/Protocol/PlatformDriverOverride/BlackBoxTest/IhvPlatformDriverOverrideBBTest.inf
-SctPkg/TestCase/UEFI/IHV/Protocol/PlatformToDriverConfiguration/BlackBoxTest/IhvPlatformToDriverConfigurationBBTest.inf
\ No newline at end of file
+SctPkg/TestCase/UEFI/IHV/Protocol/PlatformToDriverConfiguration/BlackBo
+xTest/IhvPlatformToDriverConfigurationBBTest.inf
diff --git a/uefi-sct/SctPkg/UEFI/Protocol/DebugSupport.h b/uefi-sct/SctPkg/UEFI/Protocol/DebugSupport.h
index 7fba87ae..1963d619 100644
--- a/uefi-sct/SctPkg/UEFI/Protocol/DebugSupport.h
+++ b/uefi-sct/SctPkg/UEFI/Protocol/DebugSupport.h
@@ -2,6 +2,7 @@

   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
   Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>

   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License @@ -607,6 +608,60 @@ typedef struct {
   UINT64  FAR;  // Fault Address Register  } EFI_SYSTEM_CONTEXT_AARCH64;

+///
+/// RISC-V processor exception types.
+///
+#define EXCEPT_RISCV_INST_MISALIGNED              0
+#define EXCEPT_RISCV_INST_ACCESS_FAULT            1
+#define EXCEPT_RISCV_ILLEGAL_INST                 2
+#define EXCEPT_RISCV_BREAKPOINT                   3
+#define EXCEPT_RISCV_LOAD_ADDRESS_MISALIGNED      4
+#define EXCEPT_RISCV_LOAD_ACCESS_FAULT            5
+#define EXCEPT_RISCV_STORE_AMO_ADDRESS_MISALIGNED 6
+#define EXCEPT_RISCV_STORE_AMO_ACCESS_FAULT       7
+#define EXCEPT_RISCV_ENV_CALL_FROM_UMODE          8
+#define EXCEPT_RISCV_ENV_CALL_FROM_SMODE          9
+#define EXCEPT_RISCV_ENV_CALL_FROM_HMODE          10
+#define EXCEPT_RISCV_ENV_CALL_FROM_MMODE          11
+
+#define EXCEPT_RISCV_SOFTWARE_INT       0x0
+#define EXCEPT_RISCV_TIMER_INT          0x1
+
+typedef struct {
+  UINT64  X0;
+  UINT64  X1;
+  UINT64  X2;
+  UINT64  X3;
+  UINT64  X4;
+  UINT64  X5;
+  UINT64  X6;
+  UINT64  X7;
+  UINT64  X8;
+  UINT64  X9;
+  UINT64  X10;
+  UINT64  X11;
+  UINT64  X12;
+  UINT64  X13;
+  UINT64  X14;
+  UINT64  X15;
+  UINT64  X16;
+  UINT64  X17;
+  UINT64  X18;
+  UINT64  X19;
+  UINT64  X20;
+  UINT64  X21;
+  UINT64  X22;
+  UINT64  X23;
+  UINT64  X24;
+  UINT64  X25;
+  UINT64  X26;
+  UINT64  X27;
+  UINT64  X28;
+  UINT64  X29;
+  UINT64  X30;
+  UINT64  X31;
+} EFI_SYSTEM_CONTEXT_RISCV64;
+
 //
 // Universal EFI_SYSTEM_CONTEXT definition  // @@ -618,6 +673,7 @@ union {
   EFI_SYSTEM_CONTEXT_IPF                  *SystemContextIpf;
   EFI_SYSTEM_CONTEXT_ARM                  *SystemContextArm;
   EFI_SYSTEM_CONTEXT_AARCH64              *SystemContextAArch64;
+  EFI_SYSTEM_CONTEXT_RISCV64              *SystemContextRiscV64;
 } EFI_SYSTEM_CONTEXT;

 //
@@ -645,6 +701,8 @@ VOID
 #define IMAGE_FILE_MACHINE_EBC             0x0EBC
 #define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED  0x01c2
 #define IMAGE_FILE_MACHINE_ARM64           0xAA64
+#define IMAGE_FILE_MACHINE_RISCV64         0x5064
+

 typedef
 enum {
@@ -653,7 +711,8 @@ enum {
   IsaIpf  = IMAGE_FILE_MACHINE_IA64,
   IsaEbc  = IMAGE_FILE_MACHINE_EBC,
   IsaArm  = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED, ///< 0x01c2
-  IsaAArch64  = IMAGE_FILE_MACHINE_ARM64       ///< 0xAA64
+  IsaAArch64  = IMAGE_FILE_MACHINE_ARM64,      ///< 0xAA64
+  IsaRiscv64  = IMAGE_FILE_MACHINE_RISCV64     ///< 0x5064
 } EFI_INSTRUCTION_SET_ARCHITECTURE;

 typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL;; diff --git a/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc b/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
index 2e97687b..e13e40e4 100644
--- a/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
+++ b/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
@@ -2,7 +2,7 @@
 #
 #  Copyright 2006 - 2017 Unified EFI, Inc.<BR>  #  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> -#  (C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
+#  (C) Copyright 2017 - 2021 Hewlett Packard Enterprise Development
+LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -42,7 +42,7 @@
   PLATFORM_VERSION               = 0.1
   DSC_SPECIFICATION              = 0x00010005
   OUTPUT_DIRECTORY               = Build/UefiSct
-  SUPPORTED_ARCHITECTURES        = IA32|X64|ARM|AARCH64
+  SUPPORTED_ARCHITECTURES        = IA32|X64|ARM|AARCH64|RISCV64
   BUILD_TARGETS                  = DEBUG|RELEASE
   SKUID_IDENTIFIER               = DEFAULT

@@ -112,6 +112,12 @@
   *_*_AARCH64_PP_FLAGS         = -D EFIAARCH64 $(GCC_VER_MACRO)
   RVCT:*_*_AARCH64_DLINK_FLAGS = --muldefweak

+  *_*_RISCV64_CC_FLAGS         = -D EFIRISCV64 $(GCC_VER_MACRO)
+  GCC:*_*_RISCV64_CC_FLAGS     = -D EFIRISCV64 $(GCC_VER_MACRO) -ffreestanding -nostdinc -nostdlib -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error
+  *_*_RISCV64_VFRPP_FLAGS      = -D EFIRISCV64 $(GCC_VER_MACRO)
+  *_*_RISCV64_APP_FLAGS        = -D EFIRISCV64 $(GCC_VER_MACRO)
+  *_*_RISCV64_PP_FLAGS         = -D EFIRISCV64 $(GCC_VER_MACRO)
+
   DEBUG_*_*_CC_FLAGS  = -DEFI_DEBUG
   RELEASE_*_*_CC_FLAGS  = -DMDEPKG_NDEBUG

@@ -129,6 +135,9 @@
 [Libraries.AARCH64]
   ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+[Libraries.RISCV64]
+  ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+
 [LibraryClasses.common]
   UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
@@ -157,6 +166,9 @@
 [LibraryClasses.AARCH64]
   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+[LibraryClasses.RISCV64]
+  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+
 ###############################################################################
 #
 # These are the components that will be built by the master makefile @@ -483,4 +495,4 @@ SctPkg/TestCase/RIVL/Protocol/Http/Http/HttpENTSTest.inf
 SctPkg/TestCase/RIVL/Protocol/Http/HttpServiceBinding/HttpServiceBindingENTSTest.inf

 [Components.IA32, Components.X64]
-SctPkg/TestCase/UEFI/EFI/Generic/ExeMode/BlackBoxTest/ExeModeBBTest.inf
\ No newline at end of file
+SctPkg/TestCase/UEFI/EFI/Generic/ExeMode/BlackBoxTest/ExeModeBBTest.inf
diff --git a/uefi-sct/SctPkg/build.sh b/uefi-sct/SctPkg/build.sh index 37667711..f7c5e4bd 100755
--- a/uefi-sct/SctPkg/build.sh
+++ b/uefi-sct/SctPkg/build.sh
@@ -2,6 +2,7 @@
 #
 #  Copyright 2006 - 2015 Unified EFI, Inc.<BR>  #  Copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.<BR>
+#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
 #
 #  This program and the accompanying materials  #  are licensed and made available under the terms and conditions of the BSD License @@ -22,6 +23,8 @@ function get_build_arch
         BUILD_ARCH=ARM;;
     aarch64*)
         BUILD_ARCH=AARCH64;;
+    riscv64*)
+        BUILD_ARCH=RISCV64;;
     *)
         BUILD_ARCH=other;;
 esac
@@ -47,6 +50,12 @@ function set_cross_compile
     else
         TEMP_CROSS_COMPILE=arm-linux-gnueabihf-
     fi
+elif [ "$SCT_TARGET_ARCH" == "RISCV64" ]; then
+    if [ X"$CROSS_COMPILE_64" != X"" ]; then
+        TEMP_CROSS_COMPILE="$CROSS_COMPILE_64"
+    else
+        TEMP_CROSS_COMPILE=riscv64-unknown-elf-
+    fi
 else
     echo "Unsupported target architecture '$SCT_TARGET_ARCH'!" >&2
 fi
@@ -110,7 +119,7 @@ PrintUsage() {
 #Print Help
 #
 echo "Usage:"
-echo "    $0 <architecture (ARM, AARCH64, X64, etc)> \
+echo "    $0 <architecture (ARM, AARCH64, X64, RISCV64, etc)> \
 <toolchain name (RVCT or ARMGCC or GCC*)> \  [build type (RELEASE OR DEBUG, DEFAULT: DEBUG)]"
 }
--
2.30.0






IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

  reply	other threads:[~2021-03-30 12:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04  3:21 [edk2-test PATCHv3 0/5] Port SCT to RISCV64 Daniel Schaefer
2021-03-04  3:21 ` [edk2-test PATCHv3 1/5] SctPkg: Add RISCV64 support by using Aarch64 sources Daniel Schaefer
2021-03-30 12:25   ` Sunny Wang
2021-03-04  3:21 ` [edk2-test PATCHv3 2/5] SctPkg: Adapt Aarch64 sources for Riscv64 Daniel Schaefer
2021-03-04  7:50   ` Abner Chang
2021-03-30 12:25   ` Sunny Wang
2021-03-04  3:21 ` [edk2-test PATCHv3 3/5] SctPkg: Add RISCV64 build support Daniel Schaefer
2021-03-30 12:26   ` Sunny Wang [this message]
2021-03-04  3:21 ` [edk2-test PATCHv3 4/5] SctPkg: Unify CC_FLAGS for all GCC platforms Daniel Schaefer
2021-03-04  7:50   ` Abner Chang
2021-03-30 12:26   ` [edk2-devel] " Sunny Wang
2021-03-04  3:21 ` [edk2-test PATCHv3 5/5] SctPkg: Remove trailing whitespace Daniel Schaefer
2021-03-04  7:51   ` Abner Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB8PR08MB399384C8ADAE1DE4339D89BB857D9@DB8PR08MB3993.eurprd08.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox