[edk2-devel] [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Initialize the fixed previous shadow stack token.

2021-06-12 Thread Sheng Wei
The fixed previous shadow stack token should be initialized as UINT64.

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

Signed-off-by: Sheng Wei 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Rahul Kumar 
Cc: Jiewen Yao 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
index 661c1ba294..ca3f5ff91a 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
@@ -202,7 +202,7 @@ InitShadowStack (
   // Please refer to UefiCpuPkg/Library/CpuExceptionHandlerLib/X64 for the 
full stack frame at runtime.
   //
   InterruptSsp = (UINT32)((UINTN)ShadowStack + EFI_PAGES_TO_SIZE(1) - 
sizeof(UINT64));
-  *(UINT32 *)(UINTN)InterruptSsp = (InterruptSsp - sizeof(UINT64) * 4) | 
0x2;
+  *(UINT64 *)(UINTN)InterruptSsp = (InterruptSsp - sizeof(UINT64) * 4) | 
0x2;
   mCetInterruptSsp = InterruptSsp - sizeof(UINT64);
 
   mCetInterruptSspTable = (UINT32)(UINTN)(mSmmInterruptSspTables + 
sizeof(UINT64) * 8 * CpuIndex);
-- 
2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76444): https://edk2.groups.io/g/devel/message/76444
Mute This Topic: https://groups.io/mt/83503553/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Fix spelling of "overwrite" and "overwriting" in toolset.bat

2021-06-12 Thread Rebecca Cran
The words "overwrite" and "overwriting" are one word and shouldn't have
hyphens.

Signed-off-by: Rebecca Cran 
---
 BaseTools/toolsetup.bat | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 4b5256ab6e..1fb44aaeff 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -227,7 +227,7 @@ if NOT exist %CONF_PATH% (
 ) else (
   if defined RECONFIG (
 echo.
-echo  Over-writing the files in the CONF_PATH directory
+echo  Overwriting the files in the CONF_PATH directory
 echo  using the default template files
 echo.
   )
@@ -240,7 +240,7 @@ if NOT exist %CONF_PATH%\target.txt (
   )
   copy %EDK_TOOLS_PATH%\Conf\target.template %CONF_PATH%\target.txt > nul
 ) else (
-  if defined RECONFIG echo over-write ... target.template to 
%CONF_PATH%\target.txt
+  if defined RECONFIG echo overwrite ... target.template to 
%CONF_PATH%\target.txt
   if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\target.template 
%CONF_PATH%\target.txt > nul
 )
 
@@ -251,7 +251,7 @@ if NOT exist %CONF_PATH%\tools_def.txt (
   )
   copy %EDK_TOOLS_PATH%\Conf\tools_def.template %CONF_PATH%\tools_def.txt > nul
 ) else (
-  if defined RECONFIG echo over-write ... tools_def.template to 
%CONF_PATH%\tools_def.txt
+  if defined RECONFIG echo overwrite ... tools_def.template to 
%CONF_PATH%\tools_def.txt
   if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\tools_def.template 
%CONF_PATH%\tools_def.txt > nul
 )
 
-- 
2.32.0




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76443): https://edk2.groups.io/g/devel/message/76443
Mute This Topic: https://groups.io/mt/83503170/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Reset ERRORLEVEL in toolsetup.bat after edk2basetools check

2021-06-12 Thread Rebecca Cran
When using the in-source BaseTools, edksetup.bat will exit with an
ERRORLEVEL of 1 because the line in toolsetup.bat
"%PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL"
fails.

Ensure ERRORLEVEL is set to 0 when edksetup.bat or toolsetup.bat is
successfully run.

Signed-off-by: Rebecca Cran 
---
 BaseTools/toolsetup.bat | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index a766a69f08..ca8bfdd677 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -401,6 +401,8 @@ goto end
   if %ERRORLEVEL% EQU 0 (
 goto use_pip_basetools
   ) else (
+REM reset ERRORLEVEL
+type nul>nul
 goto use_builtin_basetools
   )
 
-- 
2.32.0




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76442): https://edk2.groups.io/g/devel/message/76442
Mute This Topic: https://groups.io/mt/83503069/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Remove check for Split.exe in toolset.bat

2021-06-12 Thread Rebecca Cran
Split is now a Python tool, so BaseTools\Bin\Win32\Split.exe no longer
exists. Remove the check for it from toolsetup.bat to prevent the
erroneous claim that the binary C tools are missing.

Signed-off-by: Rebecca Cran 
---
 BaseTools/toolsetup.bat | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 4b5256ab6e..a766a69f08 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -299,7 +299,6 @@ IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_c_tools
 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_c_tools
 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_c_tools
 IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_c_tools
-IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_c_tools
 IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_c_tools
 IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_c_tools
 IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_c_tools
-- 
2.32.0




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76441): https://edk2.groups.io/g/devel/message/76441
Mute This Topic: https://groups.io/mt/83503018/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] OvmfPkg/Bhyve: clean up TPM_ENABLE remnants

2021-06-12 Thread Peter Grehan

On 6/13/21 6:43 AM, Rebecca Cran wrote:

TPM support hasn't been tested and any lines in the .dsc and .fdf files
that appear to show support are bogus. Remove them.

This fixes https://bugzilla.tianocore.org/show_bug.cgi?id=3354 .

Signed-off-by: Rebecca Cran 
---
  OvmfPkg/Bhyve/BhyveX64.dsc | 64 
  OvmfPkg/Bhyve/BhyveX64.fdf | 15 -
  2 files changed, 79 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index d8792812ab..cbf896e89b 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -31,8 +31,6 @@
DEFINE SECURE_BOOT_ENABLE  = FALSE
DEFINE SMM_REQUIRE = FALSE
DEFINE SOURCE_DEBUG_ENABLE = FALSE
-  DEFINE TPM_ENABLE  = FALSE
-  DEFINE TPM_CONFIG_ENABLE   = FALSE
  
#

# Network definition
@@ -221,16 +219,8 @@

OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
  
-

-!if $(TPM_ENABLE) == TRUE
-  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
-  
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
-  
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
-  
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
-!else

Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf

TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
-!endif
  
  [LibraryClasses.common]

BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -292,11 +282,6 @@

CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
  
-!if $(TPM_ENABLE) == TRUE

-  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
-  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf
-!endif
-

MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLib.inf
  
  [LibraryClasses.common.DXE_CORE]

@@ -366,9 +351,6 @@
  !endif
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
-!if $(TPM_ENABLE) == TRUE
-  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf
-!endif
  
  [LibraryClasses.common.UEFI_APPLICATION]

PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -563,22 +545,12 @@
  
gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00
  
-!if $(TPM_ENABLE) == TRUE

-  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
-!endif
-
# MdeModulePkg resolution sets up the system display resolution
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0
  
-[PcdsDynamicHii]

-!if $(TPM_ENABLE) == TRUE && $(TPM_CONFIG_ENABLE) == TRUE
-  
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
-  
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x8|3|NV,BS
-!endif
-
  

  #
  # Components Section - list of all EDK II Modules needed by this Platform.
@@ -618,19 +590,6 @@
  
}
  
-!if $(TPM_ENABLE) == TRUE

-  OvmfPkg/Bhyve/Tcg/Tcg2Config/Tcg2ConfigPei.inf
-  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
-
-  
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
-  }
-!endif
-
#
# DXE Phase modules
#
@@ -653,9 +612,6 @@
  
  !if $(SECURE_BOOT_ENABLE) == TRUE

NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
-!endif
-!if $(TPM_ENABLE) == TRUE
-  NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
  !endif
}
  
@@ -841,23 +797,3 @@

NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
}
  
-

-  #
-  # TPM support
-  #
-!if $(TPM_ENABLE) == TRUE
-  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
-
-  
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
-  NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
-  

Re: [edk2-devel] [PATCH] OvmfPkg/Bhyve: Remove Xen remnants

2021-06-12 Thread Peter Grehan

On 6/13/21 7:07 AM, Rebecca Cran wrote:

Several Xen remnants were left over from adapting the Ovmf code for
Bhyve. Remove them.

Signed-off-by: Rebecca Cran 
---
  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h |  7 ---
  OvmfPkg/Bhyve/BhyveX64.dsc   |  1 -
  OvmfPkg/Bhyve/PlatformPei/Platform.h | 17 -
  3 files changed, 25 deletions(-)

diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
index 994ee2c7cd..87c9bdafba 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
@@ -18,7 +18,6 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  
  typedef struct {

@@ -46,12 +45,6 @@ BhyveInstallAcpiTable(
OUT  UINTN *TableKey
);
  
-EFI_STATUS

-EFIAPI
-InstallXenTables (
-  IN   EFI_ACPI_TABLE_PROTOCOL   *AcpiProtocol
-  );
-
  EFI_STATUS
  EFIAPI
  InstallAcpiTables (
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index d8792812ab..25420d8261 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -219,7 +219,6 @@

S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf

OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
  
  
  !if $(TPM_ENABLE) == TRUE

diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.h 
b/OvmfPkg/Bhyve/PlatformPei/Platform.h
index 8239ca05ac..e0327202a5 100644
--- a/OvmfPkg/Bhyve/PlatformPei/Platform.h
+++ b/OvmfPkg/Bhyve/PlatformPei/Platform.h
@@ -98,28 +98,11 @@ InstallClearCacheCallback (
VOID
);
  
-EFI_STATUS

-InitializeXen (
-  VOID
-  );
-
-BOOLEAN
-XenDetect (
-  VOID
-  );
-
  VOID
  AmdSevInitialize (
VOID
);
  
-extern BOOLEAN mXen;

-
-VOID
-XenPublishRamRegions (
-  VOID
-  );
-
  extern EFI_BOOT_MODE mBootMode;
  
  extern BOOLEAN mS3Supported;




Reviewed-by: Peter Grehan 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76439): https://edk2.groups.io/g/devel/message/76439
Mute This Topic: https://groups.io/mt/83497982/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: 回复: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with current lldb which uses python3

2021-06-12 Thread Rebecca Cran

Could someone commit this please?


--
Rebecca Cran

On 5/17/21 6:45 PM, gaoliming wrote:

Rebecca:
   This change supports python2 & python3 both. So, I think this is a good fix. 
Reviewed-by: Liming Gao 

Thanks
Liming

-邮件原件-
发件人: devel@edk2.groups.io  代表 Rebecca Cran
发送时间: 2021年5月17日 21:29
收件人: devel@edk2.groups.io; Andrew Fish ; Ray Ni

主题: Re: [edk2-devel] [PATCH] EmulatorPkg: Update lldbefi.py to work with
current lldb which uses python3

Could someone review this please?

Thanks.
Rebecca Cran

On 5/9/21 1:26 PM, Rebecca Cran wrote:

The version of lldb shipping with macOS Big Sur is lldb-1205.0.27.3, and
it uses python3. Update lldbefi.py to work with it, including removing
the unused 'commands' import and fixing the print statements.

Signed-off-by: Rebecca Cran 
---
   EmulatorPkg/Unix/lldbefi.py | 17 -
   1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/EmulatorPkg/Unix/lldbefi.py b/EmulatorPkg/Unix/lldbefi.py
index c3fb2675cb..952f8bf982 100755
--- a/EmulatorPkg/Unix/lldbefi.py
+++ b/EmulatorPkg/Unix/lldbefi.py
@@ -10,7 +10,6 @@ import lldb
   import os
   import uuid
   import string
-import commands
   import optparse
   import shlex

@@ -389,7 +388,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc ,

internal_dict):

   FileName = frame.thread.process.ReadCStringFromMemory

(FileNamePtr, FileNameLen, Error)

   if not Error.Success():
-print "!ReadCStringFromMemory() did not find a %d byte C string

at %x" % (FileNameLen, FileNamePtr)

+print("!ReadCStringFromMemory() did not find a %d byte C string

at %x" % (FileNameLen, FileNamePtr))

   # make breakpoint command continue
   return False

@@ -398,7 +397,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc ,

internal_dict):

   LoadAddress = frame.FindVariable

("LoadAddress").GetValueAsUnsigned() - 0x240

   debugger.HandleCommand ("target modules add  %s" %

FileName)

-print "target modules load --slid 0x%x %s" % (LoadAddress,

FileName)

+print("target modules load --slid 0x%x %s" % (LoadAddress,

FileName))

   debugger.HandleCommand ("target modules load --slide 0x%x

--file %s" % (LoadAddress, FileName))

   else:
   target = debugger.GetSelectedTarget()
@@ -408,7 +407,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc ,

internal_dict):

   if FileName == ModuleName or FileName ==

SBModule.GetFileSpec().GetFilename():

   target.ClearModuleLoadAddress (SBModule)
   if not target.RemoveModule (SBModule):
-print "!lldb.target.RemoveModule (%s) FAILED" %

SBModule

+print("!lldb.target.RemoveModule (%s) FAILED" %

SBModule)

   # make breakpoint command continue
   return False
@@ -490,15 +489,15 @@ def efi_guid_command(debugger, command,

result, dict):

   if len(args) >= 1:
   if GuidStr in guid_dict:
-print "%s = %s" % (guid_dict[GuidStr], GuidStr)
-print "%s = %s" % (guid_dict[GuidStr], GuidToCStructStr

(GuidStr))

+print("%s = %s" % (guid_dict[GuidStr], GuidStr))
+print("%s = %s" % (guid_dict[GuidStr], GuidToCStructStr

(GuidStr)))

   else:
-print GuidStr
+print(GuidStr)
   else:
   # dump entire dictionary
   width = max(len(v) for k,v in guid_dict.iteritems())
   for value in sorted(guid_dict, key=guid_dict.get):
-print '%-*s %s %s' % (width, guid_dict[value], value,

GuidToCStructStr(value))

+print('%-*s %s %s' % (width, guid_dict[value], value,

GuidToCStructStr(value)))

   return

@@ -538,4 +537,4 @@ def __lldb_init_module (debugger, internal_dict):
   if Breakpoint.GetNumLocations() == 1:
   # Set the emulator breakpoints, if we are in the emulator
   debugger.HandleCommand("breakpoint command add -s

python -F lldbefi.LoadEmulatorEfiSymbols {id}".format(id=Breakpoint.GetID()))

-print 'Type r to run emulator. SecLldbScriptBreak armed. EFI

modules should now get source level debugging in the emulator.'

+print('Type r to run emulator. SecLldbScriptBreak armed. EFI

modules should now get source level debugging in the emulator.')












-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76438): https://edk2.groups.io/g/devel/message/76438
Mute This Topic: https://groups.io/mt/82901806/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] OvmfPkg/Bhyve: Remove Xen remnants

2021-06-12 Thread Rebecca Cran
Several Xen remnants were left over from adapting the Ovmf code for
Bhyve. Remove them.

Signed-off-by: Rebecca Cran 
---
 OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h |  7 ---
 OvmfPkg/Bhyve/BhyveX64.dsc   |  1 -
 OvmfPkg/Bhyve/PlatformPei/Platform.h | 17 -
 3 files changed, 25 deletions(-)

diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
index 994ee2c7cd..87c9bdafba 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 typedef struct {
@@ -46,12 +45,6 @@ BhyveInstallAcpiTable(
   OUT  UINTN *TableKey
   );
 
-EFI_STATUS
-EFIAPI
-InstallXenTables (
-  IN   EFI_ACPI_TABLE_PROTOCOL   *AcpiProtocol
-  );
-
 EFI_STATUS
 EFIAPI
 InstallAcpiTables (
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index d8792812ab..25420d8261 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -219,7 +219,6 @@
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 
 !if $(TPM_ENABLE) == TRUE
diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.h 
b/OvmfPkg/Bhyve/PlatformPei/Platform.h
index 8239ca05ac..e0327202a5 100644
--- a/OvmfPkg/Bhyve/PlatformPei/Platform.h
+++ b/OvmfPkg/Bhyve/PlatformPei/Platform.h
@@ -98,28 +98,11 @@ InstallClearCacheCallback (
   VOID
   );
 
-EFI_STATUS
-InitializeXen (
-  VOID
-  );
-
-BOOLEAN
-XenDetect (
-  VOID
-  );
-
 VOID
 AmdSevInitialize (
   VOID
   );
 
-extern BOOLEAN mXen;
-
-VOID
-XenPublishRamRegions (
-  VOID
-  );
-
 extern EFI_BOOT_MODE mBootMode;
 
 extern BOOLEAN mS3Supported;
-- 
2.32.0




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76437): https://edk2.groups.io/g/devel/message/76437
Mute This Topic: https://groups.io/mt/83497982/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] OvmfPkg/Bhyve: clean up TPM_ENABLE remnants

2021-06-12 Thread Rebecca Cran
TPM support hasn't been tested and any lines in the .dsc and .fdf files
that appear to show support are bogus. Remove them.

This fixes https://bugzilla.tianocore.org/show_bug.cgi?id=3354 .

Signed-off-by: Rebecca Cran 
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 64 
 OvmfPkg/Bhyve/BhyveX64.fdf | 15 -
 2 files changed, 79 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index d8792812ab..cbf896e89b 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -31,8 +31,6 @@
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE SMM_REQUIRE = FALSE
   DEFINE SOURCE_DEBUG_ENABLE = FALSE
-  DEFINE TPM_ENABLE  = FALSE
-  DEFINE TPM_CONFIG_ENABLE   = FALSE
 
   #
   # Network definition
@@ -221,16 +219,8 @@
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
-
-!if $(TPM_ENABLE) == TRUE
-  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
-  
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
-  
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
-  
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
-!else
   
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLib.inf
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
-!endif
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -292,11 +282,6 @@
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
   PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
 
-!if $(TPM_ENABLE) == TRUE
-  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
-  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf
-!endif
-
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLib.inf
 
 [LibraryClasses.common.DXE_CORE]
@@ -366,9 +351,6 @@
 !endif
   PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
-!if $(TPM_ENABLE) == TRUE
-  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf
-!endif
 
 [LibraryClasses.common.UEFI_APPLICATION]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -563,22 +545,12 @@
 
   gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00
 
-!if $(TPM_ENABLE) == TRUE
-  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
-!endif
-
   # MdeModulePkg resolution sets up the system display resolution
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0
 
-[PcdsDynamicHii]
-!if $(TPM_ENABLE) == TRUE && $(TPM_CONFIG_ENABLE) == TRUE
-  
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
-  
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x8|3|NV,BS
-!endif
-
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform.
@@ -618,19 +590,6 @@
 
   }
 
-!if $(TPM_ENABLE) == TRUE
-  OvmfPkg/Bhyve/Tcg/Tcg2Config/Tcg2ConfigPei.inf
-  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
-
-  
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
-  NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
-  }
-!endif
-
   #
   # DXE Phase modules
   #
@@ -653,9 +612,6 @@
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   
NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
-!endif
-!if $(TPM_ENABLE) == TRUE
-  NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
 !endif
   }
 
@@ -841,23 +797,3 @@
   NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
   }
 
-
-  #
-  # TPM support
-  #
-!if $(TPM_ENABLE) == TRUE
-  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
-
-  
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
-  NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
-  
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
-  

Re: [edk2-devel] [PATCH v4 1/3] Platform/RaspberryPi: Dynamically build UARTs info in ACPI

2021-06-12 Thread Ard Biesheuvel
On Sat, 12 Jun 2021 at 15:40, Pete Batard  wrote:
>
> No more comments on this series for me.
>
> I have also tested this patch using Putty (serial) on Windows ARM64, to
> validate that COM1: was set to the serial output defined in config.txt,
> be it miniUART or PL011.
>
> The only thing I saw was that the baudrate for PL011 was double the one
> set in Putty, but this is an issue with the Windows drivers using
> hardcoded clocks
> (https://github.com/raspberrypi/windows-drivers/issues/33) and unrelated
> to these changes.
>
> With this:
>
> On 2021.06.07 08:53, Sunny Wang wrote:
> > Changes:
> >1. Add code to ConfigDxe driver and AcpiTables module to dynamically
> >   build either Mini UART or PL011 UART info in ACPI. This also fixes
> >   the issue discussed in https://github.com/pftf/RPi4/issues/118.
> >2. Cleanup by moving duplicate Debug Port 2 table related defines and
> >   structures to a newly created header file (RpiDebugPort2Table.h).
> >
> > Testing Done:
> >- Booted to UEFI shell and use acpiview command to check the result of
> >  the different UART settings in config.txt (enabling either Mini UART
> >  or PL011) and SPCR, DBG2 tables and device BTH0 are dynamically
> >  changed as expected.
> >
> > Cc: Samer El-Haj-Mahmoud 
> > Cc: Sami Mujawar 
> > Cc: Jeremy Linton 
> > Cc: Pete Batard 
> > Cc: Ard Biesheuvel 
> > Cc: Mario Bălănică 
> > Signed-off-by: Sunny Wang 
> > ---
> >   .../RaspberryPi/AcpiTables/AcpiTables.inf |   8 +-
> >   .../RaspberryPi/AcpiTables/Dbg2MiniUart.aslc  |  81 +
> >   .../AcpiTables/{Dbg2.aslc => Dbg2Pl011.aslc}  |  30 +---
> >   .../RaspberryPi/AcpiTables/SpcrMiniUart.aslc  |  91 ++
> >   .../AcpiTables/{Spcr.aslc => SpcrPl011.aslc}  |  10 +-
> >   Platform/RaspberryPi/AcpiTables/Uart.asl  | 155 +-
> >   .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  48 +-
> >   .../Drivers/ConfigDxe/ConfigDxe.inf   |   1 +
> >   .../IndustryStandard/RpiDebugPort2Table.h |  33 
> >   Platform/RaspberryPi/Include/UartSelection.h  |  20 +++
> >   Platform/RaspberryPi/RPi3/RPi3.dsc|   8 +
> >   Platform/RaspberryPi/RPi4/RPi4.dsc|   8 +
> >   Platform/RaspberryPi/RaspberryPi.dec  |   1 +
> >   13 files changed, 410 insertions(+), 84 deletions(-)
> >   create mode 100644 Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc
> >   rename Platform/RaspberryPi/AcpiTables/{Dbg2.aslc => Dbg2Pl011.aslc} (72%)
> >   create mode 100644 Platform/RaspberryPi/AcpiTables/SpcrMiniUart.aslc
> >   rename Platform/RaspberryPi/AcpiTables/{Spcr.aslc => SpcrPl011.aslc} (87%)
> >   create mode 100644 
> > Platform/RaspberryPi/Include/IndustryStandard/RpiDebugPort2Table.h
> >   create mode 100644 Platform/RaspberryPi/Include/UartSelection.h
> >
> > diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf 
> > b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
> > index d3363a76a1..1ddc9ca5fe 100644
> > --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
> > +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
> > @@ -2,7 +2,7 @@
> >   #
> >   #  ACPI table data and ASL sources required to boot the platform.
> >   #
> > -#  Copyright (c) 2019, ARM Limited. All rights reserved.
> > +#  Copyright (c) 2019-2021, ARM Limited. All rights reserved.
> >   #  Copyright (c) 2017, Andrey Warkentin 
> >   #  Copyright (c) Microsoft Corporation. All rights reserved.
> >   #
> > @@ -28,12 +28,14 @@
> > Emmc.asl
> > Madt.aslc
> > Fadt.aslc
> > -  Dbg2.aslc
> > +  Dbg2MiniUart.aslc
> > +  Dbg2Pl011.aslc
> > Gtdt.aslc
> > Iort.aslc
> > Dsdt.asl
> > Csrt.aslc
> > -  Spcr.aslc
> > +  SpcrMiniUart.aslc
> > +  SpcrPl011.aslc
> > Pptt.aslc
> > SsdtThermal.asl
> >
> > diff --git a/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc 
> > b/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc
> > new file mode 100644
> > index 00..be7d96c179
> > --- /dev/null
> > +++ b/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc
> > @@ -0,0 +1,81 @@
> > +/** @file
> > + *
> > + *  Debug Port Table (DBG2)
> > + *
> > + *  Copyright (c) 2019, Pete Batard 
> > + *  Copyright (c) 2012-2021, ARM Limited. All rights reserved.
> > + *
> > + *  SPDX-License-Identifier: BSD-2-Clause-Patent
> > + *
> > + **/
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "AcpiTables.h"
> > +
> > +#pragma pack(1)
> > +
> > +#define RPI_UART_INTERFACE_TYPE 
> > EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_BCM2835_UART
> > +#define RPI_UART_BASE_ADDRESS   
> > BCM2836_MINI_UART_BASE_ADDRESS
> > +#define RPI_UART_LENGTH 
> > BCM2836_MINI_UART_LENGTH
> > +//
> > +// RPI_UART_STR should match the value used Uart.asl
> > +//
> > +#define RPI_UART_STR{ '\\', '_', 'S', 
> > 'B', '.', 'G', 'D', 'V', '0', '.', 'U', 'R', 'T', 'M', 0x00 }
> > +
> > +#define 

Re: [edk2-devel] Help with debugging

2021-06-12 Thread Andrew Fish via groups.io
Ethin,

USB was designed in the 90’s and people actually worried about the number of Si 
gates in a mouse, so a vast majority of the complexity of USB is in the USB 
Host Controller (XHCI is the common  host controller, aka HC). The devices are 
just end points on the bus. The end points are abstracted via the USB IO 
protocol. So you just need to match up the USB IO protocol to the USB sub spec 
for audio devices. The XHCI complexity is abstracted via a USB HC (Host 
Controller) driver that is consumed by the generic USB Bus driver that 
enumerates all the devices and produces USB IO. So you can just treat the USB 
IO protocol as a black box. 

So I think your 1st task is getting your Driver Bindging Supported() function 
matching on an audio endpoint you want to support. The Supported() will need to 
return success before your Start() function is called. So maybe take a look at 
some example USB drivers that sit in the same layer in the stack for different 
devices? [1]

[1] 
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c#L68
 

https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c#L72
 

https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c#L706

Thanks,

Andrew Fish

> On Jun 11, 2021, at 9:47 PM, Ethin Probst  wrote:
> 
> Yeah, maybe. Now I just have to figure out where to even begin with
> USB audio. The specs aren't useful in determining where to begin -- or
> at least they aren't from my POV (though that might just be my
> inexperience with USB/XHCI showing).
> 
> On 6/11/21, Andrew Fish mailto:af...@apple.com>> wrote:
>> 
>> 
>>> On Jun 11, 2021, at 4:29 PM, Ethin Probst 
>>> wrote:
>>> 
>>> Your suggestion of adding 0x240 worked. I'm able to successfully step
>>> through the code now. Thank you!
>>> 
>> 
>> OK that makes sense. The address in the add-symbol-file command is not the
>> load address of the image, but the start address of the text section. So
>> that is why you had to add 0x240.
>> 
>> Sorry I had to work backwards from how it works, but maybe that info will be
>> helpful for others?
>> 
>> Thanks,
>> 
>> Andrew Fish
>> 
>>> On 6/11/21, Andrew Fish mailto:af...@apple.com> 
>>> >> wrote:
 
 
> On Jun 11, 2021, at 2:29 PM, Ethin Probst  >
> wrote:
> 
> Initial connection and loading symbols:
> Remote debugging using :1234
> 0x7e4b9517 in ?? ()
> add symbol table from file
> "Build/MdeModule/DEBUG_GCC5/X64/UsbAudio.debug"
> at
>   .text_addr = 0x7e4b8000
> Reading symbols from Build/MdeModule/DEBUG_GCC5/X64/UsbAudio.debug...
> Expanding full symbols from
> Build/MdeModule/DEBUG_GCC5/X64/UsbAudio.debug...
> Backtrace:
> #0  0x7e4b9517 in UefiMain (st=0x7f9ee018,
> imageHandle=0x7e4f7518) at
> /home/ethin/source/edk/edk2/MdeModulePkg/Application/UsbAudio/UsbAudio.c:72
> #1  ProcessModuleEntryPointList (SystemTable=0x7f9ee018,
> ImageHandle=0x7e4f7518) at
> /home/ethin/source/edk/edk2/Build/MdeModule/DEBUG_GCC5/X64/MdeModulePkg/Application/UsbAudio/UsbAudio/DEBUG/AutoGen.c:300
> #2  _ModuleEntryPoint (ImageHandle=0x7e4f7518, SystemTable=0x7f9ee018)
> at
> /home/ethin/source/edk/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c:59
> #3  0x7fead316 in ?? ()
> #4  0x7e4f7518 in ?? ()
> #5  0x7feab5c7 in ?? ()
> #6  0x7fea3520 in ?? ()
> #7  0x00010100 in ?? ()
> #8  0x0030 in ?? ()
> #9  0x7e4f6018 in ?? ()
> #10 0x7e60a918 in ?? ()
> #11 0x011d in ?? ()
> #12 0x7fea3528 in ?? ()
> #13 0x7e4f7818 in ?? ()
> #14 0x7e4f7c98 in ?? ()
> #15 0x7fea3538 in ?? ()
> #16 0x7e3abfca in ?? ()
> #17 0x7e4f7418 in ?? ()
> #18 0x7fea3528 in ?? ()
> #19 0x in ?? ()
> Source-code listing:
> 1 /** @file
> 2   GCC inline implementation of BaseLib processor specific functions.
> 3 
> 4   Copyright (c) 2006 - 2020, Intel Corporation. All rights
> reserved.
> 5   Portions copyright (c) 2008 - 2009, Apple Inc. All rights
> reserved.
> 6   SPDX-License-Identifier: BSD-2-Clause-Patent
> 7 
> 8 **/
> 9 
> 10
> Attempt to use "next":
> 72} else if (interfaceDescriptor.InterfaceClass == 0x01 &&
> interfaceDescriptor.InterfaceSubClass == 0x03) {
> (This is my code but it continuously prints this same line over and
> over every time "next" is used.)
> Attempt to use "print Index":
> No symbol 

Re: [edk2-devel] [PATCH v4 3/3] Platform/RaspberryPi: Enable Bluetooth and UART in Windows OS

2021-06-12 Thread Pete Batard

On 2021.06.07 08:53, Sunny Wang wrote:

This change is based on edk2-platforms-raspberrypi-pl011-bth-noflow.diff
in https://github.com/worproject/RPi-Bluetooth-Testing/ with the
modifications and additional changes below for enabling Bluetooth
and serial port (Mini UART) in Windows IOT.
   - Remove RPIQ connection for BT_ON/OFF in Uart.asl because it is
 useless. The firmware already turns on the Bluetooth by default.
   - Move the GPIO pin muxing stuff from Uart.asl to ConfigDxe driver.

Testing Done:
   - Successfully booted Windows Windows 10 IOT (20279.1) on SD (made by
 WOR) with the RPi-Windows-Drivers release ver 0.5 downloaded from
 https://github.com/worproject/RPi-Windows-Drivers/releases
 and checked that both Bluetooth and serial port (Mini UART) can
 work fine.
   - Successfully booted VMware ESXi-Arm Fling v1.3 with only serial
 console connection (PL011 UART).

Cc: Samer El-Haj-Mahmoud 
Cc: Sami Mujawar 
Cc: Jeremy Linton 
Cc: Pete Batard 
Cc: Ard Biesheuvel 
Cc: Mario Bălănică 
Signed-off-by: Sunny Wang 
---
  Platform/RaspberryPi/AcpiTables/Uart.asl  | 16 --
  .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 22 +++
  2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl 
b/Platform/RaspberryPi/AcpiTables/Uart.asl
index bac9d791eb..167f94e889 100644
--- a/Platform/RaspberryPi/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
@@ -71,14 +71,6 @@ Device (URTM)
  MEMORY32FIXED (ReadWrite, 0, BCM2836_MINI_UART_LENGTH, RMEM)
  Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { 
BCM2836_MINI_UART_INTERRUPT }
  
-// NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing

-// until a proper solution can be created for the dmap conflict.
-// When muxing is enabled, must consider DBG2 table conflict.
-// The alternate function resource needs to be reserved when
-// the kernel debugger is enabled to prevent another client
-// from muxing the pins away.
-
-// PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, 
ResourceConsumer, , ) { 14, 15 }
})
Method (_CRS, 0x0, Serialized)
{
@@ -143,10 +135,6 @@ Device(BTH0)
UAR0,  // DescriptorName: creates name
  //   for offset of resource descriptor
  )// Vendor data
-//
-// RPIQ connection for BT_ON/OFF
-//
-GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ", 0, 
ResourceConsumer, , ) { 128 }
})
  
//

@@ -190,10 +178,6 @@ Device(BTH0)
UARM,  // DescriptorName: creates name
  //   for offset of resource descriptor
  )// Vendor data
-//
-// RPIQ connection for BT_ON/OFF
-//
-GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ", 0, 
ResourceConsumer, , ) { 128 }
})
  
Method (_CRS, 0x0, Serialized)

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c 
b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index d6efb59793..cf9880bd20 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -618,6 +618,28 @@ ApplyVariables (
  DEBUG ((DEBUG_INFO, "Fan enabled on GPIO %d\n", FanOnGpio));
  GpioPinFuncSet (FanOnGpio, GPIO_FSEL_OUTPUT);
}
+
+  //
+  // Fake the CTS signal as we don't support HW flow control yet.
+  // Pin 31 must be held LOW so that we can talk to the BT chip
+  // without flow control
+  //
+  GpioPinFuncSet (31, GPIO_FSEL_OUTPUT);
+  GpioPinConfigure (31, CLEAR_GPIO);
+
+  //
+  // Bluetooth pin muxing
+  //
+  if ((PcdGet32 (PcdUartInUse) == PL011_UART_IN_USE)) {
+DEBUG ((DEBUG_INFO, "Enable Bluetooth over MiniUART\n"));
+GpioPinFuncSet (32, GPIO_FSEL_ALT5);
+GpioPinFuncSet (33, GPIO_FSEL_ALT5);
+  } else {
+DEBUG ((DEBUG_INFO, "Enable Bluetooth over PL011 UART\n"));
+GpioPinFuncSet (32, GPIO_FSEL_ALT3);
+GpioPinFuncSet (33, GPIO_FSEL_ALT3);
+  }
+
  }
  
  



Reviewed-by: Pete Batard 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76433): https://edk2.groups.io/g/devel/message/76433
Mute This Topic: https://groups.io/mt/83365133/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 2/3] Silicon/Broadcom/Bcm283x: Clean up GpioPinSet function

2021-06-12 Thread Pete Batard

On 2021.06.07 08:53, Sunny Wang wrote:

Make the changes below for making it clearer.
 - Rename GpioPinSet() to GpioPinConfigure()
 - Rename parameter Val to Config and change its type to BOOLEAN

Cc: Samer El-Haj-Mahmoud 
Cc: Sami Mujawar 
Cc: Jeremy Linton 
Cc: Pete Batard 
Cc: Ard Biesheuvel 
Cc: Mario Bălănică 
Signed-off-by: Sunny Wang 
---
  Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h | 10 +++---
  Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c |  9 +
  2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h 
b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
index 75c2c8be51..1f7d2204e0 100644
--- a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
+++ b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
@@ -3,6 +3,7 @@
   *  GPIO manipulation.
   *
   *  Copyright (c) 2018, Andrei Warkentin 
+ *  Copyright (c) 2021, ARM Limited. All rights reserved.
   *
   *  SPDX-License-Identifier: BSD-2-Clause-Patent
   *
@@ -13,6 +14,9 @@
  
  #include 
  
+#define CLEAR_GPIO0

+#define SET_GPIO  1
+
  VOID
  GpioPinFuncSet (
IN  UINTN Pin,
@@ -25,9 +29,9 @@ GpioPinFuncGet (
);
  
  VOID

-GpioPinSet (
-  IN  UINTN Pin,
-  IN  UINTN Val
+GpioPinConfigure (
+  IN  UINTN   Pin,
+  IN  BOOLEAN Config
);
  
  UINTN

diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c 
b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
index a4b4af59eb..eaf53e5369 100644
--- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
+++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
@@ -4,6 +4,7 @@
   *
   *  Copyright (c) 2020, Pete Batard 
   *  Copyright (c) 2018, Andrei Warkentin 
+ *  Copyright (c) 2021, ARM Limited. All rights reserved.
   *
   *  SPDX-License-Identifier: BSD-2-Clause-Patent
   *
@@ -85,9 +86,9 @@ GpioPinFuncGet (
  }
  
  VOID

-GpioPinSet (
-  IN  UINTN Pin,
-  IN  UINTN Val
+GpioPinConfigure (
+  IN  UINTN   Pin,
+  IN  BOOLEAN Config
)
  {
EFI_PHYSICAL_ADDRESS Reg;
@@ -102,7 +103,7 @@ GpioPinSet (
//
// Different base addresses are used for clear and set
//
-  Reg = (Val == 0) ? GPIO_GPCLR0 : GPIO_GPSET0;
+  Reg = (Config == CLEAR_GPIO) ? GPIO_GPCLR0 : GPIO_GPSET0;
Reg += RegIndex * sizeof (UINT32);
MmioWrite32 (Reg, 1 << SelIndex);
  }



Reviewed-by: Pete Batard 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76432): https://edk2.groups.io/g/devel/message/76432
Mute This Topic: https://groups.io/mt/83365132/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 1/3] Platform/RaspberryPi: Dynamically build UARTs info in ACPI

2021-06-12 Thread Pete Batard

No more comments on this series for me.

I have also tested this patch using Putty (serial) on Windows ARM64, to 
validate that COM1: was set to the serial output defined in config.txt, 
be it miniUART or PL011.


The only thing I saw was that the baudrate for PL011 was double the one 
set in Putty, but this is an issue with the Windows drivers using 
hardcoded clocks 
(https://github.com/raspberrypi/windows-drivers/issues/33) and unrelated 
to these changes.


With this:

On 2021.06.07 08:53, Sunny Wang wrote:

Changes:
   1. Add code to ConfigDxe driver and AcpiTables module to dynamically
  build either Mini UART or PL011 UART info in ACPI. This also fixes
  the issue discussed in https://github.com/pftf/RPi4/issues/118.
   2. Cleanup by moving duplicate Debug Port 2 table related defines and
  structures to a newly created header file (RpiDebugPort2Table.h).

Testing Done:
   - Booted to UEFI shell and use acpiview command to check the result of
 the different UART settings in config.txt (enabling either Mini UART
 or PL011) and SPCR, DBG2 tables and device BTH0 are dynamically
 changed as expected.

Cc: Samer El-Haj-Mahmoud 
Cc: Sami Mujawar 
Cc: Jeremy Linton 
Cc: Pete Batard 
Cc: Ard Biesheuvel 
Cc: Mario Bălănică 
Signed-off-by: Sunny Wang 
---
  .../RaspberryPi/AcpiTables/AcpiTables.inf |   8 +-
  .../RaspberryPi/AcpiTables/Dbg2MiniUart.aslc  |  81 +
  .../AcpiTables/{Dbg2.aslc => Dbg2Pl011.aslc}  |  30 +---
  .../RaspberryPi/AcpiTables/SpcrMiniUart.aslc  |  91 ++
  .../AcpiTables/{Spcr.aslc => SpcrPl011.aslc}  |  10 +-
  Platform/RaspberryPi/AcpiTables/Uart.asl  | 155 +-
  .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  48 +-
  .../Drivers/ConfigDxe/ConfigDxe.inf   |   1 +
  .../IndustryStandard/RpiDebugPort2Table.h |  33 
  Platform/RaspberryPi/Include/UartSelection.h  |  20 +++
  Platform/RaspberryPi/RPi3/RPi3.dsc|   8 +
  Platform/RaspberryPi/RPi4/RPi4.dsc|   8 +
  Platform/RaspberryPi/RaspberryPi.dec  |   1 +
  13 files changed, 410 insertions(+), 84 deletions(-)
  create mode 100644 Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc
  rename Platform/RaspberryPi/AcpiTables/{Dbg2.aslc => Dbg2Pl011.aslc} (72%)
  create mode 100644 Platform/RaspberryPi/AcpiTables/SpcrMiniUart.aslc
  rename Platform/RaspberryPi/AcpiTables/{Spcr.aslc => SpcrPl011.aslc} (87%)
  create mode 100644 
Platform/RaspberryPi/Include/IndustryStandard/RpiDebugPort2Table.h
  create mode 100644 Platform/RaspberryPi/Include/UartSelection.h

diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf 
b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
index d3363a76a1..1ddc9ca5fe 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
@@ -2,7 +2,7 @@
  #
  #  ACPI table data and ASL sources required to boot the platform.
  #
-#  Copyright (c) 2019, ARM Limited. All rights reserved.
+#  Copyright (c) 2019-2021, ARM Limited. All rights reserved.
  #  Copyright (c) 2017, Andrey Warkentin 
  #  Copyright (c) Microsoft Corporation. All rights reserved.
  #
@@ -28,12 +28,14 @@
Emmc.asl
Madt.aslc
Fadt.aslc
-  Dbg2.aslc
+  Dbg2MiniUart.aslc
+  Dbg2Pl011.aslc
Gtdt.aslc
Iort.aslc
Dsdt.asl
Csrt.aslc
-  Spcr.aslc
+  SpcrMiniUart.aslc
+  SpcrPl011.aslc
Pptt.aslc
SsdtThermal.asl
  
diff --git a/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc b/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc

new file mode 100644
index 00..be7d96c179
--- /dev/null
+++ b/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc
@@ -0,0 +1,81 @@
+/** @file
+ *
+ *  Debug Port Table (DBG2)
+ *
+ *  Copyright (c) 2019, Pete Batard 
+ *  Copyright (c) 2012-2021, ARM Limited. All rights reserved.
+ *
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ **/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "AcpiTables.h"
+
+#pragma pack(1)
+
+#define RPI_UART_INTERFACE_TYPE 
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_BCM2835_UART
+#define RPI_UART_BASE_ADDRESS   
BCM2836_MINI_UART_BASE_ADDRESS
+#define RPI_UART_LENGTH 
BCM2836_MINI_UART_LENGTH
+//
+// RPI_UART_STR should match the value used Uart.asl
+//
+#define RPI_UART_STR{ '\\', '_', 'S', 'B', 
'.', 'G', 'D', 'V', '0', '.', 'U', 'R', 'T', 'M', 0x00 }
+
+#define DBG2_DEBUG_PORT_DDI(NumReg, SubType, UartBase, UartAddrLen, 
UartNameStr) {\
+{  
   \
+  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, /* UINT8 
Revision */\
+  sizeof (DBG2_DEBUG_DEVICE_INFORMATION), /* 
UINT16Length */  \
+  NumReg,

Re: [edk2-devel] [PATCH v1 1/4] StandaloneMmPkg: Core: Spelling error in comment

2021-06-12 Thread Ard Biesheuvel
On Sat, 12 Jun 2021 at 05:44, Kun Qin  wrote:
>
> From: Sean Brogan 
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3445
>
> This change fixed a misspelling that was not caught by spell check.
>
> Cc: Ard Biesheuvel 
> Cc: Sami Mujawar 
> Cc: Jiewen Yao 
> Cc: Supreeth Venkatesh 
> Cc: Sean Brogan 
>
> Signed-off-by: Sean Brogan 

Hello Kun Qin,

When you send patches to the list that were authored by someone else,
you should add your own signoff, and add it last. (The signoff means
that you attest that the patch is contributed under terms that are
compatible with the open source licenses we support. The signoff has
nothing to do with recognizing authorship, so even if someone else did
most of the work, if that person is not involved in contributing these
changes, their name does not need to appear in the Git log.)

Sean is the author, which will be reflected in the git log anyway, so
his signoff does not have any significance here, as he is not the one
sending the patch to the public mailing list.

Usually, I would fix up minor issues like these when merging the
changes, but adding a signoff on someone else's behalf is the one
thing I can never do.

So please fix this up, and then you can add

Reviewed-by: Ard Biesheuvel 

to the entire series.

Thanks,



> ---
>  StandaloneMmPkg/Core/Dispatcher.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/StandaloneMmPkg/Core/Dispatcher.c 
> b/StandaloneMmPkg/Core/Dispatcher.c
> index dbd5332fa9d3..7e4bf5e94025 100644
> --- a/StandaloneMmPkg/Core/Dispatcher.c
> +++ b/StandaloneMmPkg/Core/Dispatcher.c
> @@ -4,7 +4,7 @@
>Step #1 - When a FV protocol is added to the system every driver in the FV
>  is added to the mDiscoveredList. The Before, and After Depex are
>  pre-processed as drivers are added to the mDiscoveredList. If an 
> Apriori
> -file exists in the FV those drivers are addeded to the
> +file exists in the FV those drivers are added to the
>  mScheduledQueue. The mFwVolList is used to make sure a
>  FV is only processed once.
>
> --
> 2.31.1.windows.1
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76430): https://edk2.groups.io/g/devel/message/76430
Mute This Topic: https://groups.io/mt/83484181/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] UefiPayloadPkg/PayloadLoader: Add more checks to verify ELF images

2021-06-12 Thread Ni, Ray
More checks are added to verify ELF image.
ParseElfImage() is changed to InitializeElfContext()

Signed-off-by: Ray Ni 
Cc: Marvin Häuser 
Cc: Guo Dong 
Cc: Benjamin You 
---
 UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h |  11 +-
 .../PayloadLoaderPeim/ElfLib/Elf32Lib.c   |  38 ++--
 .../PayloadLoaderPeim/ElfLib/Elf64Lib.c   |  39 ++--
 .../PayloadLoaderPeim/ElfLib/ElfLib.c | 210 +-
 .../PayloadLoaderPeim/PayloadLoaderPeim.c |   6 +-
 5 files changed, 188 insertions(+), 116 deletions(-)

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h 
b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h
index 9cfc2912cf..0ed93140a9 100644
--- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h
+++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib.h
@@ -17,7 +17,6 @@
 #define  ELF_PT_LOAD   1

 

 typedef struct {

-  RETURN_STATUS ParseStatus; ///< Return the status after 
ParseElfImage().

   UINT8 *FileBase;   ///< The source location in memory.

   UINTN FileSize;///< The size including sections that 
don't require loading.

   UINT8 *PreferredImageAddress;  ///< The preferred image to be 
loaded. No relocation is needed if loaded to this address.

@@ -45,7 +44,10 @@ typedef struct {
 /**

   Parse the ELF image info.

 

-  @param[in]  ImageBase  Memory address of an image.

+  On return, all fields in ElfCt are updated except ImageAddress.

+

+  @param[in]  FileBase   Memory address of an image.

+  @param[in]  MaxFileSizeThe maximum file size.

   @param[out] ElfCt  The EFL image context pointer.

 

   @retval EFI_INVALID_PARAMETER   Input parameters are not valid.

@@ -55,8 +57,9 @@ typedef struct {
 **/

 EFI_STATUS

 EFIAPI

-ParseElfImage (

-  IN  VOID *ImageBase,

+InitializeElfContext (

+  IN  VOID *FileBase,

+  IN  UINTNMaxFileSize,

   OUT ELF_IMAGE_CONTEXT*ElfCt

   );

 

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c 
b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
index 3fa100ce4a..79f4ce623b 100644
--- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
+++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
@@ -115,7 +115,7 @@ ProcessRelocation32 (
   UINT32Type;

 

   for ( Index = 0

-  ; RelaEntrySize * Index < RelaSize

+  ; Index < RelaSize / RelaEntrySize

   ; Index++, Rela = ELF_NEXT_ENTRY (Elf32_Rela, Rela, RelaEntrySize)

   ) {

 //

@@ -137,7 +137,6 @@ ProcessRelocation32 (
   // Dynamic section doesn't contain entries of this type.

   //

   DEBUG ((DEBUG_INFO, "Unsupported relocation type %02X\n", Type));

-  ASSERT (FALSE);

 } else {

   *Ptr += (UINT32) Delta;

 }

@@ -164,7 +163,6 @@ ProcessRelocation32 (
   // Calculation: B + A

   //

   if (RelaType == SHT_RELA) {

-ASSERT (*Ptr == 0);

 *Ptr = (UINT32) Delta + Rela->r_addend;

   } else {

 //

@@ -177,7 +175,6 @@ ProcessRelocation32 (
   // non-Dynamic section doesn't contain entries of this type.

   //

   DEBUG ((DEBUG_INFO, "Unsupported relocation type %02X\n", Type));

-  ASSERT (FALSE);

 }

 break;

 

@@ -236,12 +233,12 @@ RelocateElf32Dynamic (
   //

   // It's abnormal a DYN ELF doesn't contain a dynamic section.

   //

-  ASSERT (DynShdr != NULL);

   if (DynShdr == NULL) {

 return EFI_UNSUPPORTED;

   }

-  ASSERT (DynShdr->sh_type == SHT_DYNAMIC);

-  ASSERT (DynShdr->sh_entsize >= sizeof (*Dyn));

+  if ((DynShdr->sh_type != SHT_DYNAMIC) || DynShdr->sh_entsize < sizeof 
(*Dyn)) {

+return EFI_UNSUPPORTED;

+  }

 

   //

   // 2. Locate the relocation section from the dynamic section.

@@ -286,9 +283,6 @@ RelocateElf32Dynamic (
   }

 

   if (RelaOffset == MAX_UINT64) {

-ASSERT (RelaCount == 0);

-ASSERT (RelaEntrySize == 0);

-ASSERT (RelaSize  == 0);

 //

 // It's fine that a DYN ELF doesn't contain relocation section.

 //

@@ -299,23 +293,22 @@ RelocateElf32Dynamic (
   // Verify the existence of the relocation section.

   //

   RelShdr = GetElf32SectionByRange (ElfCt->FileBase, RelaOffset, RelaSize);

-  ASSERT (RelShdr != NULL);

   if (RelShdr == NULL) {

 return EFI_UNSUPPORTED;

   }

-  ASSERT (RelShdr->sh_type == RelaType);

-  ASSERT (RelShdr->sh_entsize == RelaEntrySize);

+  if ((RelShdr->sh_type != RelaType) || (RelShdr->sh_entsize != 
RelaEntrySize)) {

+return EFI_UNSUPPORTED;

+  }

 

   //

   // 3. Process the relocation section.

   //

-  ProcessRelocation32 (

-(Elf32_Rela *) (ElfCt->FileBase + RelShdr->sh_offset),

-RelShdr->sh_size, RelShdr->sh_entsize, RelShdr->sh_type,

-(UINTN) ElfCt->ImageAddress - (UINTN) ElfCt->PreferredImageAddress,

-TRUE

-);

-  return EFI_SUCCESS;

+  return ProcessRelocation32 (

+