[edk2-devel] [edk2-test PATCHv3 2/5] SctPkg: Adapt Aarch64 sources for Riscv64

Sunny Wang Sunny.Wang at arm.com
Tue Mar 30 12:25:58 UTC 2021


Looks good to me.
Same comment as patch 1/5. This only affects RISCV. Therefore, as long as you build and run SCT on the RISCV platform, this change should be fine.
Reviewed-by: Sunny Wang <sunny.wang at arm.com>

-----Original Message-----
From: Schaefer, Daniel <daniel.schaefer at hpe.com>
Sent: Thursday, March 4, 2021 11:21 AM
To: devel at edk2.groups.io
Cc: G Edhaya Chandran <Edhaya.Chandran at arm.com>; Barton Gao <gaojie at byosoft.com.cn>; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud at arm.com>; Eric Jin <eric.jin at intel.com>; Arvin Chen <arvinx.chen at intel.com>; Leif Lindholm <leif at nuviainc.com>; Heinrich Schuchardt <xypron.glpk at gmx.de>; Chang, Abner (HPS SW/FW Technologist) <abner.chang at hpe.com>
Subject: [edk2-test PATCHv3 2/5] SctPkg: Adapt Aarch64 sources for Riscv64

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

Cc: G Edhaya Chandran <Edhaya.Chandran at arm.com>
Cc: Barton Gao <gaojie at byosoft.com.cn>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud at arm.com>
Cc: Eric Jin <eric.jin at intel.com>
Cc: Arvin Chen <arvinx.chen at intel.com>
Cc: Leif Lindholm <leif at nuviainc.com>
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Abner Chang <abner.chang at hpe.com>
Signed-off-by: Daniel Schaefer <daniel.schaefer at hpe.com>
---
 uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h                                                                        |  3 +-
 uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S                                                                           |  9 ++--
 uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c                                                                       | 16 +++----
 uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c                                                                            | 22 +++------
 uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c                                                                               |  7 +--
 uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h                                                                               | 48 --------------------
 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c | 12 ++---
 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/PlatformIsa.c                                 |  4 +-
 uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLibPlat.h                                         |  3 +-
 9 files changed, 32 insertions(+), 92 deletions(-)

diff --git a/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h b/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h
index ee7c656b..69e7f904 100644
--- a/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h
+++ b/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h
@@ -2,6 +2,7 @@


   Copyright 2006 - 2012 Unified EFI, Inc.<BR>

   Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.<BR>

+  Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>



   This program and the accompanying materials

   are licensed and made available under the terms and conditions of the BSD License

@@ -20,7 +21,7 @@ Module Name:


 Abstract:



-  AArch64 specific defines

+  RISCV64 specific defines



 --*/



diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
index d223b36b..ae33da18 100644
--- a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
+++ b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S
@@ -2,6 +2,7 @@
 #

 #  Copyright 2010 - 2012 Unified EFI, Inc.<BR>

 #  Copyright (c) 2012, ARM Ltd. All rights reserved.<BR>

+#  Copyright (c) 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

@@ -23,8 +24,6 @@
 #--*/

 #start of the code section

 .text

-/* FIXME: Should alignment be different on Aarch64? */

-.align 3



 .global JumpToTestFunc

 .type JumpToTestFunc, %function

@@ -37,8 +36,8 @@
 #   )

 #

 JumpToTestFunc:

-       mov x2, x0

-       mov x0, x1

+       mv x2, x0

+       mv x0, x1



        // Jump to Virtual function

-       blr x2

+       jalr x2

diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c
index 397b3514..00b59594 100644
--- a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c
+++ b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c
@@ -2,6 +2,7 @@


   Copyright 2006 - 2012 Unified EFI, Inc.<BR>

   Copyright (c) 2012, ARM Ltd. All rights reserved.<BR>

+  Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>



   This program and the accompanying materials

   are licensed and made available under the terms and conditions of the BSD License

@@ -22,9 +23,6 @@ Module Name:


 #include "SCRTApp.h"



-#define VIRT_TO_PHYS_OFFSET       (0x80000000)     //2G

-

-BOOLEAN     HighAddress = FALSE;

 UINTN       PageTable   = 0;





@@ -49,11 +47,10 @@ Returns:


 --*/

 {

-       /*Note: It is presumed that on ARM v5, V6 and V7 architectures

-        * the MMU is configured and enabled in PEI phase. As VirtualFunc

-        * is already mapped to virtual memory, don't have to do anything here.

+  /* Note: It is presumed that on RISCV architectures the MMU is configured and

+   * enabled in PEI phase. As VirtualFunc is already mapped to virtual memory,

+   * don't have to do anything here.

         */

-  /* FIXME: Is it the same on ARM v8? */

 }





@@ -174,9 +171,8 @@ Returns:
 --*/

 {

   //

-  // Note: It is assumed that the MMU and page tables are configured on ARM platforms

-  // based on ARM v5 v6 and v7 architecture.

+  // Note: It is assumed that the MMU and page tables are configured on RISC-V

+  // platforms.

   //

-  /* FIXME: Is it the same on ARM v8? */

        JumpToTestFunc(VirtualFunc, HandOffAddr);

 }

diff --git a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c
index 6161d596..2991935a 100644
--- a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c
+++ b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c
@@ -1,7 +1,8 @@
 /** @file



   Copyright 2006 - 2012 Unified EFI, Inc.<BR>

-  Copyright (c) 2011 - 2012 ARM Ltd. All rights reserved.<BR>

+  Copyright (c) 2011 - 2012 ARM Ltd. All rights reserved.<BR>

+  Copyright (c) 2021 Hewlett Packard Enterprise Development LP. All rights reserved.<BR>



   This program and the accompanying materials

   are licensed and made available under the terms and conditions of the BSD License

@@ -24,7 +25,6 @@ Module Name:
 #include "SCRTDriver.h"



 UINTN                 mHandOffPtr        =  0;

-EFI_PHYSICAL_ADDRESS  mIoPortSpaceAddress = 0;





 EFI_STATUS

@@ -42,18 +42,10 @@ ConsumeHandOff (
    HandOffPtr  = (RUNTIME_HANDOFF*)mHandOffPtr;

    *ConfigData =  HandOffPtr->ConfigureInfo;



-   if (!HandOffPtr->DebuggerInfo.MmioFlag){

-     //

-     // If debug port is I/O mapped, fix IoBase Address.

-     //

-     FixAddress(&HandOffPtr->DebuggerInfo.IoBase);

-     mIoPortSpaceAddress = HandOffPtr->DebuggerInfo.IoBase;

-   } else {

-     //

-     // If debug port is MMIO, fix MmioBase Address.

-     //

-     FixAddress(&HandOffPtr->DebuggerInfo.MmioBase);

-   }

+   //

+   // Fix MmioBase Address.

+   //

+   FixAddress(&HandOffPtr->DebuggerInfo.MmioBase);



    return EFI_SUCCESS;

 }

@@ -65,7 +57,7 @@ Send2UART (
   )

 {

   //

-  // TODO: On ARM platforms use platform specific functions to

+  // TODO: On RISC-V platforms use platform specific functions to

   // write the data to UART.

   //

   return EFI_SUCCESS;

diff --git a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c
index b925e151..255cb9a6 100644
--- a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c
+++ b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c
@@ -2,6 +2,7 @@


   Copyright 2006 - 2012 Unified EFI, Inc.<BR>

   Copyright (c) 2011 - 2012 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

@@ -21,7 +22,7 @@ Module Name:


 --*/



-#include "Io.h"

+#include "SCRTDriver.h"



 EFI_STATUS

 EFIAPI

@@ -119,11 +120,11 @@ FixAddress (
   )

 {

                //

-               //Note: On ARM platforms don't have to do this as all the functions are virtually mapped.

+               //Note: On RISC-V platforms don't have to do this as all the functions are virtually mapped.

                //

 }



-// Quick port to ARM

+// Quick port to RISC-V. It doesn't have traditional I/O-Port 80h POST Codes



 VOID

 Port80 (

diff --git a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h
deleted file mode 100644
index 1e78b3e4..00000000
--- a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file

-

-  Copyright 2006 - 2012 Unified EFI, Inc.<BR>

-  Copyright (c) 2011 - 2012 ARM Ltd. All rights reserved.<BR>

-

-  This program and the accompanying materials

-  are licensed and made available under the terms and conditions of the BSD License

-  which accompanies this distribution.  The full text of the license may be found at

-  http://opensource.org/licenses/bsd-license.php

-

-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-**/

-

-/*++

-

-Module Name:

-

-  Debug.h

-

---*/

-

-#ifndef _IA32_IO_ACCESS_H

-#define _IA32_IO_ACCESS_H

-

-#include "SCRTDriver.h"

-

-#define IA32_MAX_IO_ADDRESS   0xFFFF

-

-#define IA32API

-

-

-typedef union {

-  UINT8  VOLATILE  *buf;

-  UINT8  VOLATILE  *ui8;

-  UINT16 VOLATILE  *ui16;

-  UINT32 VOLATILE  *ui32;

-  UINT64 VOLATILE  *ui64;

-  UINTN  VOLATILE  ui;

-} PTR;

-

-// This address is assuming a pure PC architecture. Not required?

-#define   VIRT_TO_PHYS_OFFSET            (0x80000000)     //2G

-

-

-

-#endif

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c
index c27c0c0c..c6e72806 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c
@@ -2,6 +2,7 @@


   Copyright 2006 - 2016 Unified EFI, Inc.<BR>

   Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>

+  Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>



   This program and the accompanying materials

   are licensed and made available under the terms and conditions of the BSD License

@@ -37,7 +38,7 @@ SoftwareBreak (
   void

   )

 {

-  // Not ported to ARM yet

+  // Not ported to RISC-V yet

   ASSERT (FALSE);

 }



@@ -99,9 +100,7 @@ BBTestRegisterExceptionCallbackFunctionManualTest (
   // Invoke RegisterExceptionCallback() to install an interrupt handler function.

   //

   InvokedExceptionCallback = FALSE;

-  // FIXME: Is it normal that we use EXCEPT_IA32_BREAKPOINT here?

-  // Shouldn't we define proper constants for ARM exceptions in DebugSupportProtocol.h file?

-  Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, ExceptionCallback, EXCEPT_IA32_BREAKPOINT);

+  Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, ExceptionCallback, EXCEPT_RISCV_BREAKPOINT);



   if ((Status == EFI_SUCCESS) || (Status == EFI_ALREADY_STARTED)) {

     AssertionType = EFI_TEST_ASSERTION_PASSED;

@@ -205,7 +204,7 @@ BBTestRegisterExceptionCallbackFunctionManualTest (
   // Assertion Point 3.4.2.3

   // Invoke RegisterExceptionCallback() to install another interrupt handler function.

   //

-  Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, ExceptionCallback1, EXCEPT_IA32_BREAKPOINT);

+  Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, ExceptionCallback1, EXCEPT_RISCV_BREAKPOINT);



   if (Status != EFI_ALREADY_STARTED) {

     AssertionType = EFI_TEST_ASSERTION_FAILED;

@@ -228,7 +227,7 @@ BBTestRegisterExceptionCallbackFunctionManualTest (
   // Assertion Point 3.4.2.4

   // Invoke RegisterExceptionCallback() to unstall the interrupt handler function.

   //

-  Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, NULL, EXCEPT_IA32_BREAKPOINT);

+  Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, NULL, EXCEPT_RISCV_BREAKPOINT);



   if (EFI_ERROR(Status)) {

     AssertionType = EFI_TEST_ASSERTION_FAILED;

@@ -273,4 +272,3 @@ BBTestRegisterExceptionCallbackFunctionManualTest (


   return EFI_SUCCESS;

 }

-

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/PlatformIsa.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/PlatformIsa.c
index 8334f601..8b23d91b 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/PlatformIsa.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/PlatformIsa.c
@@ -2,6 +2,7 @@


   Copyright 2006 - 2012 Unified EFI, Inc.<BR>

   Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.<BR>

+  Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>



   This program and the accompanying materials

   are licensed and made available under the terms and conditions of the BSD License

@@ -26,5 +27,4 @@ Abstract:


 #include "DebugSupportBBTestMain.h"



-EFI_INSTRUCTION_SET_ARCHITECTURE PlatformIsa = IsaAArch64;

-

+EFI_INSTRUCTION_SET_ARCHITECTURE PlatformIsa = IsaRiscv64;

diff --git a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLibPlat.h b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLibPlat.h
index ff781aee..144f812a 100644
--- a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLibPlat.h
+++ b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLibPlat.h
@@ -2,6 +2,7 @@


   Copyright 2006 - 2012 Unified EFI, Inc.<BR>

   Copyright (c) 2010 - 2012, ARM Ltd. All rights reserved.<BR>

+  Copyright (c) 2021 Hewlett Packard Enterprise Development LP. All rights reserved.<BR>



   This program and the accompanying materials

   are licensed and made available under the terms and conditions of the BSD License

@@ -20,7 +21,7 @@ Module Name:


 Abstract:



-  AArch64 specific defines

+  RISCV64 specific defines



 --*/



--
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.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73526): https://edk2.groups.io/g/devel/message/73526
Mute This Topic: https://groups.io/mt/81069867/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list