Date   

[PATCH v1 2/5] MdePkg: Adds AMD SMRAM save state map

Abdul Lateef Attar
 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4182

Adds an SMM SMRAM save-state map for AMD processors.
SMRAM save state maps for the AMD processor family are now supported.

Save state map structure is added based on
AMD64 Architecture Programmer's Manual, Volume 2, Section 10.2.

The AMD legacy save state map for 32-bit architecture is defined.
The AMD64 save state map for 64-bit architecture is defined. 

Also added Amd/SmramSaveStateMap.h to IgnoreFiles of EccCheck,
because structures defined in this file are derived from
Intel/SmramSaveStateMap.h.

Cc: Paul Grimes <paul.grimes@...>
Cc: Garrett Kirkendall <garrett.kirkendall@...>
Cc: Abner Chang <abner.chang@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>

Signed-off-by: Abdul Lateef Attar <abdattar@...>
---
.../Include/Register/Amd/SmramSaveStateMap.h | 194 ++++++++++++++++++
MdePkg/MdePkg.ci.yaml | 3 +-
2 files changed, 196 insertions(+), 1 deletion(-)
create mode 100644 MdePkg/Include/Register/Amd/SmramSaveStateMap.h

diff --git a/MdePkg/Include/Register/Amd/SmramSaveStateMap.h b/MdePkg/Include/Register/Amd/SmramSaveStateMap.h
new file mode 100644
index 000000000000..6da1538608cf
--- /dev/null
+++ b/MdePkg/Include/Register/Amd/SmramSaveStateMap.h
@@ -0,0 +1,194 @@
+/** @file
+ AMD SMRAM Save State Map Definitions.
+
+ SMRAM Save State Map definitions based on contents of the
+ AMD64 Architecture Programmer Manual:
+ Volume 2, System Programming, Section 10.2 SMM Resources
+
+ Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved .<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef AMD_SMRAM_SAVE_STATE_MAP_H_
+#define AMD_SMRAM_SAVE_STATE_MAP_H_
+
+///
+/// Default SMBASE address
+///
+#define SMM_DEFAULT_SMBASE 0x30000
+
+///
+/// Offset of SMM handler from SMBASE
+///
+#define SMM_HANDLER_OFFSET 0x8000
+
+// SMM-Revision Identifier for AMD64 Architecture.
+#define AMD_SMM_MIN_REV_ID_X64 0x30064
+
+#pragma pack (1)
+
+///
+/// 32-bit SMRAM Save State Map
+///
+typedef struct {
+ // Padded an extra 0x200 bytes to match Intel/EDK2
+ UINT8 Reserved[0x200]; // fc00h
+ // AMD Save State area starts @ 0xfe00
+ UINT8 Reserved1[0xf8]; // fe00h
+ UINT32 SMBASE; // fef8h
+ UINT32 SMMRevId; // fefch
+ UINT16 IORestart; // ff00h
+ UINT16 AutoHALTRestart; // ff02h
+ UINT8 Reserved2[0x84]; // ff04h
+ UINT32 GDTBase; // ff88h
+ UINT64 Reserved3; // ff8ch
+ UINT32 IDTBase; // ff94h
+ UINT8 Reserved4[0x10]; // ff98h
+ UINT32 _ES; // ffa8h
+ UINT32 _CS; // ffach
+ UINT32 _SS; // ffb0h
+ UINT32 _DS; // ffb4h
+ UINT32 _FS; // ffb8h
+ UINT32 _GS; // ffbch
+ UINT32 LDTBase; // ffc0h
+ UINT32 _TR; // ffc4h
+ UINT32 _DR7; // ffc8h
+ UINT32 _DR6; // ffcch
+ UINT32 _EAX; // ffd0h
+ UINT32 _ECX; // ffd4h
+ UINT32 _EDX; // ffd8h
+ UINT32 _EBX; // ffdch
+ UINT32 _ESP; // ffe0h
+ UINT32 _EBP; // ffe4h
+ UINT32 _ESI; // ffe8h
+ UINT32 _EDI; // ffech
+ UINT32 _EIP; // fff0h
+ UINT32 _EFLAGS; // fff4h
+ UINT32 _CR3; // fff8h
+ UINT32 _CR0; // fffch
+} AMD_SMRAM_SAVE_STATE_MAP32;
+
+///
+/// 64-bit SMRAM Save State Map
+///
+typedef struct {
+ // Padded an extra 0x200 bytes to match Intel/EDK2
+ UINT8 Reserved[0x200]; // fc00h
+ // AMD Save State area starts @ 0xfe00
+ UINT16 _ES; // fe00h
+ UINT16 _ESAttributes; // fe02h
+ UINT32 _ESLimit; // fe04h
+ UINT64 _ESBase; // fe08h
+
+ UINT16 _CS; // fe10h
+ UINT16 _CSAttributes; // fe12h
+ UINT32 _CSLimit; // fe14h
+ UINT64 _CSBase; // fe18h
+
+ UINT16 _SS; // fe20h
+ UINT16 _SSAttributes; // fe22h
+ UINT32 _SSLimit; // fe24h
+ UINT64 _SSBase; // fe28h
+
+ UINT16 _DS; // fe30h
+ UINT16 _DSAttributes; // fe32h
+ UINT32 _DSLimit; // fe34h
+ UINT64 _DSBase; // fe38h
+
+ UINT16 _FS; // fe40h
+ UINT16 _FSAttributes; // fe42h
+ UINT32 _FSLimit; // fe44h
+ UINT64 _FSBase; // fe48h
+
+ UINT16 _GS; // fe50h
+ UINT16 _GSAttributes; // fe52h
+ UINT32 _GSLimit; // fe54h
+ UINT64 _GSBase; // fe58h
+
+ UINT32 _GDTRReserved1; // fe60h
+ UINT16 _GDTRLimit; // fe64h
+ UINT16 _GDTRReserved2; // fe66h
+ // UINT64 _GDTRBase; // fe68h
+ UINT32 _GDTRBaseLoDword;
+ UINT32 _GDTRBaseHiDword;
+
+ UINT16 _LDTR; // fe70h
+ UINT16 _LDTRAttributes; // fe72h
+ UINT32 _LDTRLimit; // fe74h
+ // UINT64 _LDTRBase; // fe78h
+ UINT32 _LDTRBaseLoDword;
+ UINT32 _LDTRBaseHiDword;
+
+ UINT32 _IDTRReserved1; // fe80h
+ UINT16 _IDTRLimit; // fe84h
+ UINT16 _IDTRReserved2; // fe86h
+ // UINT64 _IDTRBase; // fe88h
+ UINT32 _IDTRBaseLoDword;
+ UINT32 _IDTRBaseHiDword;
+
+ UINT16 _TR; // fe90h
+ UINT16 _TRAttributes; // fe92h
+ UINT32 _TRLimit; // fe94h
+ UINT64 _TRBase; // fe98h
+
+ UINT64 IO_RIP; // fea0h
+ UINT64 IO_RCX; // fea8h
+ UINT64 IO_RSI; // feb0h
+ UINT64 IO_RDI; // feb8h
+ UINT32 IO_DWord; // fec0h
+ UINT8 Reserved1[0x04]; // fec4h
+ UINT8 IORestart; // fec8h
+ UINT8 AutoHALTRestart; // fec9h
+ UINT8 Reserved2[0x06]; // fecah
+ UINT64 EFER; // fed0h
+ UINT64 SVM_Guest; // fed8h
+ UINT64 SVM_GuestVMCB; // fee0h
+ UINT64 SVM_GuestVIntr; // fee8h
+ UINT8 Reserved3[0x0c]; // fef0h
+ UINT32 SMMRevId; // fefch
+ UINT32 SMBASE; // ff00h
+ UINT8 Reserved4[0x14]; // ff04h
+ UINT64 SSP; // ff18h
+ UINT64 SVM_GuestPAT; // ff20h
+ UINT64 SVM_HostEFER; // ff28h
+ UINT64 SVM_HostCR4; // ff30h
+ UINT64 SVM_HostCR3; // ff38h
+ UINT64 SVM_HostCR0; // ff40h
+ UINT64 _CR4; // ff48h
+ UINT64 _CR3; // ff50h
+ UINT64 _CR0; // ff58h
+ UINT64 _DR7; // ff60h
+ UINT64 _DR6; // ff68h
+ UINT64 _RFLAGS; // ff70h
+ UINT64 _RIP; // ff78h
+ UINT64 _R15; // ff80h
+ UINT64 _R14; // ff88h
+ UINT64 _R13; // ff90h
+ UINT64 _R12; // ff98h
+ UINT64 _R11; // ffa0h
+ UINT64 _R10; // ffa8h
+ UINT64 _R9; // ffb0h
+ UINT64 _R8; // ffb8h
+ UINT64 _RDI; // ffc0h
+ UINT64 _RSI; // ffc8h
+ UINT64 _RBP; // ffd0h
+ UINT64 _RSP; // ffd8h
+ UINT64 _RBX; // ffe0h
+ UINT64 _RDX; // ffe8h
+ UINT64 _RCX; // fff0h
+ UINT64 _RAX; // fff8h
+} AMD_SMRAM_SAVE_STATE_MAP64;
+
+///
+/// Union of 32-bit and 64-bit SMRAM Save State Maps
+///
+typedef union {
+ AMD_SMRAM_SAVE_STATE_MAP32 x86;
+ AMD_SMRAM_SAVE_STATE_MAP64 x64;
+} AMD_SMRAM_SAVE_STATE_MAP;
+
+#pragma pack ()
+
+#endif
diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml
index 19bc0138cb76..86c9c502d799 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -65,7 +65,8 @@
"Include/Library/PcdLib.h",
"Include/Library/SafeIntLib.h",
"Include/Protocol/DebugSupport.h",
- "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c"
+ "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c",
+ "Include/Register/Amd/SmramSaveStateMap.h"
]
},
## options defined ci/Plugin/CompilerPlugin
--
2.25.1


[PATCH v1 1/5] UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code

Abdul Lateef Attar
 

From: Abdul Lateef Attar <AbdulLateef.Attar@...>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4182

moves Intel-specific code to the arch-dependent file.
Other processor families might have different
implementation of these functions.
Hence, moving out of the common file.

Cc: Abner Chang <abner.chang@...>
Cc: Garrett Kirkendall <garrett.kirkendall@...>
Cc: Paul Grimes <paul.grimes@...>
Cc: Eric Dong <eric.dong@...>
Cc: Ray Ni <ray.ni@...>
Cc: Rahul Kumar <rahul1.kumar@...>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@...>
---
.../IntelSmmCpuFeaturesLib.c | 140 ++++++++++++++++++
.../SmmCpuFeaturesLibCommon.c | 140 ------------------
2 files changed, 140 insertions(+), 140 deletions(-)

diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c
index d5eaaa7a991e..994267f393b3 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c
@@ -400,3 +400,143 @@ SmmCpuFeaturesSetSmmRegister (
AsmWriteMsr64 (SMM_FEATURES_LIB_SMM_FEATURE_CONTROL, Value);
}
}
+
+/**
+ This function updates the SMRAM save state on the currently executing CPU
+ to resume execution at a specific address after an RSM instruction. This
+ function must evaluate the SMRAM save state to determine the execution mode
+ the RSM instruction resumes and update the resume execution address with
+ either NewInstructionPointer32 or NewInstructionPoint. The auto HALT restart
+ flag in the SMRAM save state must always be cleared. This function returns
+ the value of the instruction pointer from the SMRAM save state that was
+ replaced. If this function returns 0, then the SMRAM save state was not
+ modified.
+
+ This function is called during the very first SMI on each CPU after
+ SmmCpuFeaturesInitializeProcessor() to set a flag in normal execution mode
+ to signal that the SMBASE of each CPU has been updated before the default
+ SMBASE address is used for the first SMI to the next CPU.
+
+ @param[in] CpuIndex The index of the CPU to hook. The value
+ must be between 0 and the NumberOfCpus
+ field in the System Management System Table
+ (SMST).
+ @param[in] CpuState Pointer to SMRAM Save State Map for the
+ currently executing CPU.
+ @param[in] NewInstructionPointer32 Instruction pointer to use if resuming to
+ 32-bit execution mode from 64-bit SMM.
+ @param[in] NewInstructionPointer Instruction pointer to use if resuming to
+ same execution mode as SMM.
+
+ @retval 0 This function did modify the SMRAM save state.
+ @retval > 0 The original instruction pointer value from the SMRAM save state
+ before it was replaced.
+**/
+UINT64
+EFIAPI
+SmmCpuFeaturesHookReturnFromSmm (
+ IN UINTN CpuIndex,
+ IN SMRAM_SAVE_STATE_MAP *CpuState,
+ IN UINT64 NewInstructionPointer32,
+ IN UINT64 NewInstructionPointer
+ )
+{
+ return 0;
+}
+
+/**
+ Read an SMM Save State register on the target processor. If this function
+ returns EFI_UNSUPPORTED, then the caller is responsible for reading the
+ SMM Save Sate register.
+
+ @param[in] CpuIndex The index of the CPU to read the SMM Save State. The
+ value must be between 0 and the NumberOfCpus field in
+ the System Management System Table (SMST).
+ @param[in] Register The SMM Save State register to read.
+ @param[in] Width The number of bytes to read from the CPU save state.
+ @param[out] Buffer Upon return, this holds the CPU register value read
+ from the save state.
+
+ @retval EFI_SUCCESS The register was read from Save State.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL.
+ @retval EFI_UNSUPPORTED This function does not support reading Register.
+
+**/
+EFI_STATUS
+EFIAPI
+SmmCpuFeaturesReadSaveStateRegister (
+ IN UINTN CpuIndex,
+ IN EFI_SMM_SAVE_STATE_REGISTER Register,
+ IN UINTN Width,
+ OUT VOID *Buffer
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Writes an SMM Save State register on the target processor. If this function
+ returns EFI_UNSUPPORTED, then the caller is responsible for writing the
+ SMM Save Sate register.
+
+ @param[in] CpuIndex The index of the CPU to write the SMM Save State. The
+ value must be between 0 and the NumberOfCpus field in
+ the System Management System Table (SMST).
+ @param[in] Register The SMM Save State register to write.
+ @param[in] Width The number of bytes to write to the CPU save state.
+ @param[in] Buffer Upon entry, this holds the new CPU register value.
+
+ @retval EFI_SUCCESS The register was written to Save State.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL.
+ @retval EFI_UNSUPPORTED This function does not support writing Register.
+**/
+EFI_STATUS
+EFIAPI
+SmmCpuFeaturesWriteSaveStateRegister (
+ IN UINTN CpuIndex,
+ IN EFI_SMM_SAVE_STATE_REGISTER Register,
+ IN UINTN Width,
+ IN CONST VOID *Buffer
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Check to see if an SMM register is supported by a specified CPU.
+
+ @param[in] CpuIndex The index of the CPU to check for SMM register support.
+ The value must be between 0 and the NumberOfCpus field
+ in the System Management System Table (SMST).
+ @param[in] RegName Identifies the SMM register to check for support.
+
+ @retval TRUE The SMM register specified by RegName is supported by the CPU
+ specified by CpuIndex.
+ @retval FALSE The SMM register specified by RegName is not supported by the
+ CPU specified by CpuIndex.
+**/
+BOOLEAN
+EFIAPI
+SmmCpuFeaturesIsSmmRegisterSupported (
+ IN UINTN CpuIndex,
+ IN SMM_REG_NAME RegName
+ )
+{
+ if (FeaturePcdGet (PcdSmmFeatureControlEnable) && (RegName == SmmRegFeatureControl)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ This function is hook point called after the gEfiSmmReadyToLockProtocolGuid
+ notification is completely processed.
+**/
+VOID
+EFIAPI
+SmmCpuFeaturesCompleteSmmReadyToLock (
+ VOID
+ )
+{
+}
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c
index 7777e52740eb..2f8841bbbf77 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c
@@ -17,49 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

#include "CpuFeaturesLib.h"

-/**
- This function updates the SMRAM save state on the currently executing CPU
- to resume execution at a specific address after an RSM instruction. This
- function must evaluate the SMRAM save state to determine the execution mode
- the RSM instruction resumes and update the resume execution address with
- either NewInstructionPointer32 or NewInstructionPoint. The auto HALT restart
- flag in the SMRAM save state must always be cleared. This function returns
- the value of the instruction pointer from the SMRAM save state that was
- replaced. If this function returns 0, then the SMRAM save state was not
- modified.
-
- This function is called during the very first SMI on each CPU after
- SmmCpuFeaturesInitializeProcessor() to set a flag in normal execution mode
- to signal that the SMBASE of each CPU has been updated before the default
- SMBASE address is used for the first SMI to the next CPU.
-
- @param[in] CpuIndex The index of the CPU to hook. The value
- must be between 0 and the NumberOfCpus
- field in the System Management System Table
- (SMST).
- @param[in] CpuState Pointer to SMRAM Save State Map for the
- currently executing CPU.
- @param[in] NewInstructionPointer32 Instruction pointer to use if resuming to
- 32-bit execution mode from 64-bit SMM.
- @param[in] NewInstructionPointer Instruction pointer to use if resuming to
- same execution mode as SMM.
-
- @retval 0 This function did modify the SMRAM save state.
- @retval > 0 The original instruction pointer value from the SMRAM save state
- before it was replaced.
-**/
-UINT64
-EFIAPI
-SmmCpuFeaturesHookReturnFromSmm (
- IN UINTN CpuIndex,
- IN SMRAM_SAVE_STATE_MAP *CpuState,
- IN UINT64 NewInstructionPointer32,
- IN UINT64 NewInstructionPointer
- )
-{
- return 0;
-}
-
/**
Hook point in normal execution mode that allows the one CPU that was elected
as monarch during System Management Mode initialization to perform additional
@@ -90,103 +47,6 @@ SmmCpuFeaturesRendezvousExit (
{
}

-/**
- Check to see if an SMM register is supported by a specified CPU.
-
- @param[in] CpuIndex The index of the CPU to check for SMM register support.
- The value must be between 0 and the NumberOfCpus field
- in the System Management System Table (SMST).
- @param[in] RegName Identifies the SMM register to check for support.
-
- @retval TRUE The SMM register specified by RegName is supported by the CPU
- specified by CpuIndex.
- @retval FALSE The SMM register specified by RegName is not supported by the
- CPU specified by CpuIndex.
-**/
-BOOLEAN
-EFIAPI
-SmmCpuFeaturesIsSmmRegisterSupported (
- IN UINTN CpuIndex,
- IN SMM_REG_NAME RegName
- )
-{
- if (FeaturePcdGet (PcdSmmFeatureControlEnable) && (RegName == SmmRegFeatureControl)) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- Read an SMM Save State register on the target processor. If this function
- returns EFI_UNSUPPORTED, then the caller is responsible for reading the
- SMM Save Sate register.
-
- @param[in] CpuIndex The index of the CPU to read the SMM Save State. The
- value must be between 0 and the NumberOfCpus field in
- the System Management System Table (SMST).
- @param[in] Register The SMM Save State register to read.
- @param[in] Width The number of bytes to read from the CPU save state.
- @param[out] Buffer Upon return, this holds the CPU register value read
- from the save state.
-
- @retval EFI_SUCCESS The register was read from Save State.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_UNSUPPORTED This function does not support reading Register.
-
-**/
-EFI_STATUS
-EFIAPI
-SmmCpuFeaturesReadSaveStateRegister (
- IN UINTN CpuIndex,
- IN EFI_SMM_SAVE_STATE_REGISTER Register,
- IN UINTN Width,
- OUT VOID *Buffer
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- Writes an SMM Save State register on the target processor. If this function
- returns EFI_UNSUPPORTED, then the caller is responsible for writing the
- SMM Save Sate register.
-
- @param[in] CpuIndex The index of the CPU to write the SMM Save State. The
- value must be between 0 and the NumberOfCpus field in
- the System Management System Table (SMST).
- @param[in] Register The SMM Save State register to write.
- @param[in] Width The number of bytes to write to the CPU save state.
- @param[in] Buffer Upon entry, this holds the new CPU register value.
-
- @retval EFI_SUCCESS The register was written to Save State.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_UNSUPPORTED This function does not support writing Register.
-**/
-EFI_STATUS
-EFIAPI
-SmmCpuFeaturesWriteSaveStateRegister (
- IN UINTN CpuIndex,
- IN EFI_SMM_SAVE_STATE_REGISTER Register,
- IN UINTN Width,
- IN CONST VOID *Buffer
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- This function is hook point called after the gEfiSmmReadyToLockProtocolGuid
- notification is completely processed.
-**/
-VOID
-EFIAPI
-SmmCpuFeaturesCompleteSmmReadyToLock (
- VOID
- )
-{
-}
-
/**
This API provides a method for a CPU to allocate a specific region for storing page tables.

--
2.25.1


[PATCH v1 0/5] Adds AmdSmmCpuFeaturesLib

Abdul Lateef Attar
 

Implements SmmCpuFeaturesLib library class for AMD processor family.
Adds AMD processor families processor save state registers.
Implements required functions.
Handles S3 save state from SMM.

PR: https://github.com/tianocore/edk2/pull/3726

Cc: Paul Grimes <paul.grimes@...>
Cc: Garrett Kirkendall <garrett.kirkendall@...>
Cc: Abner Chang <abner.chang@...>
Cc: Eric Dong <eric.dong@...>
Cc: Ray Ni <ray.ni@...>
Cc: Rahul Kumar <rahul1.kumar@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>

Abdul Lateef Attar (5):
UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code
MdePkg: Adds AMD SMRAM save state map
UefiCpuPkg: Initial implementation of AMD's SmmCpuFeaturesLib
UefiCpuPkg: Implements SmmCpuFeaturesLib for AMD Family
UefiCpuPkg/AmdSmmCpuFeaturesLib: Handles S3 save state

UefiCpuPkg/UefiCpuPkg.dsc | 9 +
.../AmdSmmCpuFeaturesLib.inf | 40 ++
.../Include/Register/Amd/SmramSaveStateMap.h | 194 +++++++
.../SmmCpuFeaturesLib/Amd/SmramSaveState.h | 128 +++++
.../SmmCpuFeaturesLib/Amd/SmmCpuFeaturesLib.c | 476 ++++++++++++++++++
.../SmmCpuFeaturesLib/Amd/SmramSaveState.c | 409 +++++++++++++++
.../IntelSmmCpuFeaturesLib.c | 140 ++++++
.../SmmCpuFeaturesLibCommon.c | 140 ------
MdePkg/MdePkg.ci.yaml | 3 +-
9 files changed, 1398 insertions(+), 141 deletions(-)
create mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.inf
create mode 100644 MdePkg/Include/Register/Amd/SmramSaveStateMap.h
create mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Amd/SmramSaveState.h
create mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Amd/SmmCpuFeaturesLib.c
create mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Amd/SmramSaveState.c

--
2.25.1


Re: [PATCH v4 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID

Pedro Falcato
 

Hi,

Ping. Is there a blocker here?
 
Pedro


回复: [edk2-platform][PATCH 1/1] MdeModulePkg: SdMmcPciHcDxe: Fix issue that SD1.0 cards can't be recognized

Chevron Li (WH) <chevron.li@...>
 

Thanks for your response.

I will update patch later according to your suggestions.

Answer your questions below.

BR,
Chevron

-----邮件原件-----
发件人: Wu, Hao A <hao.a.wu@...>
发送时间: Tuesday, December 6, 2022 16:28
收件人: Chevron Li (WH) <chevron.li@...>;
devel@edk2.groups.io
抄送: Ni, Ray <ray.ni@...>; Wang, Jian J <jian.j.wang@...>; Gao,
Liming <gaoliming@...>; Shirley Her(SC)
<shirley.her@...>; Shaper Liu (WH)
<shaper.liu@...>; XiaoGuang Yu (WH)
<xiaoguang.yu@...>
主题: RE: [edk2-platform][PATCH 1/1] MdeModulePkg: SdMmcPciHcDxe: Fix
issue that SD1.0 cards can't be recognized

Hello,

The proposed patch will cause CI test failure:
https://github.com/tianocore/edk2/pull/3724. Could you help to resolve
them?
Yes, I will update according to your suggestions.

May I know what kind of tests have been performed for this patch? Have
you tried with non SD1.0 cards and make sure that they still work fine after
the patch?
We have tested this patch with SD1.0 cards and SD2.0, SD3.0 cards, all of them can work right.
Test items are application level:
Such as card identify, create file, delete file.

Also, serveral more inline comments below:


-----Original Message-----
From: Chevron Li <chevron.li@...>
Sent: Tuesday, December 6, 2022 2:48 PM
To: devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Ni, Ray <ray.ni@...>; Wang,
Jian J <jian.j.wang@...>; Gao, Liming
<gaoliming@...>; shirley.her@...;
shaper.liu@...; xiaoguang.yu@...; Chevron Li
(WH) <chevron.li@...>
Subject: [edk2-platform][PATCH 1/1] MdeModulePkg: SdMmcPciHcDxe:
Fix
issue that SD1.0 cards can't be recognized

From: "Chevron Li (WH)" <chevron.li@...>


SD1.0 cards don't support CMD8 and CMD6

CMD8 result can be used to distinguish the card is SD1.0 or not.

CMD8 result can be used to decide following CMD6 is sent or skip.



Cc: Hao A Wu <hao.a.wu@...>

Cc: Ray Ni <ray.ni@...>

Cc: Jian J Wang <jian.j.wang@...>

Cc: Liming Gao <gaoliming@...>

Signed-off-by: Chevron Li <chevron.li@...>

---

MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 30
++++++++++++---
----

1 file changed, 20 insertions(+), 10 deletions(-)



diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c

index f5a3607e47..281aa38170 100644

--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c

+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c

@@ -1085,7 +1085,8 @@ SdCardSetBusMode (

IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru,

IN UINT8 Slot,

IN UINT16 Rca,

- IN BOOLEAN S18A

+ IN BOOLEAN S18A,

+ IN BOOLEAN SdVersion1

For the newly added input parameter 'SdVersion1', please help to update
the function description comments to reflect it.



)

{

EFI_STATUS Status;

@@ -1117,10 +1118,13 @@ SdCardSetBusMode (



//

// Get the supported bus speed from SWITCH cmd return data group #1.

+ // SdVersion1 don't support the SWITCH cmd

//

- Status = SdCardSwitch (PassThru, Slot, 0xFF, 0xF,
SdDriverStrengthIgnore, 0xF, FALSE, SwitchResp);

- if (EFI_ERROR (Status)) {

- return Status;

+ if(SdVersion1 == FALSE) {

+ Status = SdCardSwitch (PassThru, Slot, 0xFF, 0xF,
+ SdDriverStrengthIgnore,
0xF, FALSE, SwitchResp);

The local variable 'SwitchResp' is an output parameter for SdCardSwitch().
When SdVersion1 is TRUE, SdCardSwitch() call will be skipped and
'SwitchResp' will have uninitialized value.
This will probably cause issues when 'SwitchResp' later being used as an input
parameter for SdGetTargetBusMode() function call.
Could you help to check on this?



+ if (EFI_ERROR (Status)) {

+ return Status;

+ }

}



SdGetTargetBusMode (Private, Slot, SwitchResp, S18A, &BusMode);

@@ -1141,9 +1145,14 @@ SdCardSetBusMode (

}

}



- Status = SdCardSwitch (PassThru, Slot, BusMode.BusTiming, 0xF,
BusMode.DriverStrength.Sd, 0xF, TRUE, SwitchResp);

- if (EFI_ERROR (Status)) {

- return Status;

+ //

+ // SdVersion1 don't support the SWITCH cmd

+ //

+ if(SdVersion1 == FALSE){

+ Status = SdCardSwitch (PassThru, Slot, BusMode.BusTiming, 0xF,
BusMode.DriverStrength.Sd, 0xF, TRUE, SwitchResp);

+ if (EFI_ERROR (Status)) {

+ return Status;

+ }

}



Status = SdMmcSetDriverStrength (Private->PciIo, Slot,
BusMode.DriverStrength.Sd);

@@ -1214,6 +1223,7 @@ SdCardIdentification (

UINT8 HostCtrl2;

UINTN Retry;

BOOLEAN ForceVoltage33;

+ BOOLEAN SdVersion1;



ForceVoltage33 = FALSE;

Please help to assign a initial value for the newly added local variable
'SdVersion1'.
If the card supports cmd8, this local variable will have uninitialized value
when calling SdCardSetBusMode().





@@ -1231,12 +1241,12 @@ Voltage33Retry:

}



//

- // 2. Send Cmd8 to the device

+ // 2. Send Cmd8 to the device, the command will fail for
+ SdVersion1;

//

Status = SdCardVoltageCheck (PassThru, Slot, 0x1, 0xFF);

if (EFI_ERROR (Status)) {

+ SdVersion1 = 1;

Please use "SdVersion1 = TRUE;".

Best Regards,
Hao Wu



DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing Cmd8 fails
with %r\n", Status));

- return Status;

}



//

@@ -1426,7 +1436,7 @@ Voltage33Retry:

DEBUG ((DEBUG_INFO, "SdCardIdentification: Found a SD device at
slot [%d]\n", Slot));

Private->Slot[Slot].CardType = SdCardType;



- Status = SdCardSetBusMode (PciIo, PassThru, Slot, Rca, ((Ocr &
BIT24) != 0));

+ Status = SdCardSetBusMode (PciIo, PassThru, Slot, Rca, ((Ocr &
+ BIT24) != 0),
SdVersion1);



return Status;





base-commit: 7bee2498910a9034faaf90802c49188afb7582dc

--

2.18.0.windows.1


[PATCH v2] Maintainer.txt: add myself as reviewer for bhyve's OvmfPkg

Corvin Köhne <corvink@...>
 

Signed-off-by: Corvin Köhne <corvink@...>
Reviewed-by: Rebecca Cran <rebecca@...>
Reviewed-by: Peter Grehan <grehan@...>
Cc: Andrew Fish <afish@...>
Cc: Leif Lindholm <quic_llindhol@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: devel@edk2.groups.io
---
Maintainers.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 7e98083685..3ea9a4cca6 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -457,6 +457,7 @@ F: OvmfPkg/Library/ResetSystemLib/BaseResetShutdownBhyve.c
F: OvmfPkg/Library/ResetSystemLib/BaseResetSystemLibBhyve.inf
R: Rebecca Cran <rebecca@...> [bcran]
R: Peter Grehan <grehan@...> [grehan-freebsd]
+R: Corvin Köhne <corvink@...> [corvink]

OvmfPkg: cloudhv-related modules
F: OvmfPkg/CloudHv/
--
2.37.3.windows.1


[edk2-platform][PATCH 1/1] MdeModulePkg: SdMmcPciHcDxe: Fix issue that SD1.0 cards can't be recognized

Chevron Li <chevron.li@...>
 

From: "Chevron Li (WH)" <chevron.li@...>

SD1.0 cards don't support CMD8 and CMD6
CMD8 result can be used to distinguish the card is SD1.0 or not.
CMD8 result can be used to decide following CMD6 is sent or skip.

Cc: Hao A Wu <hao.a.wu@...>
Cc: Ray Ni <ray.ni@...>
Cc: Jian J Wang <jian.j.wang@...>
Cc: Liming Gao <gaoliming@...>
Signed-off-by: Chevron Li <chevron.li@...>
---
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 30 ++++++++++++-------
1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index f5a3607e47..281aa38170 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -1085,7 +1085,8 @@ SdCardSetBusMode (
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru,
IN UINT8 Slot,
IN UINT16 Rca,
- IN BOOLEAN S18A
+ IN BOOLEAN S18A,
+ IN BOOLEAN SdVersion1
)
{
EFI_STATUS Status;
@@ -1117,10 +1118,13 @@ SdCardSetBusMode (

//
// Get the supported bus speed from SWITCH cmd return data group #1.
+ // SdVersion1 don't support the SWITCH cmd
//
- Status = SdCardSwitch (PassThru, Slot, 0xFF, 0xF, SdDriverStrengthIgnore, 0xF, FALSE, SwitchResp);
- if (EFI_ERROR (Status)) {
- return Status;
+ if(SdVersion1 == FALSE) {
+ Status = SdCardSwitch (PassThru, Slot, 0xFF, 0xF, SdDriverStrengthIgnore, 0xF, FALSE, SwitchResp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}

SdGetTargetBusMode (Private, Slot, SwitchResp, S18A, &BusMode);
@@ -1141,9 +1145,14 @@ SdCardSetBusMode (
}
}

- Status = SdCardSwitch (PassThru, Slot, BusMode.BusTiming, 0xF, BusMode.DriverStrength.Sd, 0xF, TRUE, SwitchResp);
- if (EFI_ERROR (Status)) {
- return Status;
+ //
+ // SdVersion1 don't support the SWITCH cmd
+ //
+ if(SdVersion1 == FALSE){
+ Status = SdCardSwitch (PassThru, Slot, BusMode.BusTiming, 0xF, BusMode.DriverStrength.Sd, 0xF, TRUE, SwitchResp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}

Status = SdMmcSetDriverStrength (Private->PciIo, Slot, BusMode.DriverStrength.Sd);
@@ -1214,6 +1223,7 @@ SdCardIdentification (
UINT8 HostCtrl2;
UINTN Retry;
BOOLEAN ForceVoltage33;
+ BOOLEAN SdVersion1;

ForceVoltage33 = FALSE;

@@ -1231,12 +1241,12 @@ Voltage33Retry:
}

//
- // 2. Send Cmd8 to the device
+ // 2. Send Cmd8 to the device, the command will fail for SdVersion1;
//
Status = SdCardVoltageCheck (PassThru, Slot, 0x1, 0xFF);
if (EFI_ERROR (Status)) {
+ SdVersion1 = 1;
DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing Cmd8 fails with %r\n", Status));
- return Status;
}

//
@@ -1426,7 +1436,7 @@ Voltage33Retry:
DEBUG ((DEBUG_INFO, "SdCardIdentification: Found a SD device at slot [%d]\n", Slot));
Private->Slot[Slot].CardType = SdCardType;

- Status = SdCardSetBusMode (PciIo, PassThru, Slot, Rca, ((Ocr & BIT24) != 0));
+ Status = SdCardSetBusMode (PciIo, PassThru, Slot, Rca, ((Ocr & BIT24) != 0), SdVersion1);

return Status;


base-commit: 7bee2498910a9034faaf90802c49188afb7582dc
--
2.18.0.windows.1


Access non-SMRAM memory regions from SMM

asallan3@...
 

Hi, I'm aware theres been implemented a PCD `gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmRestrictedMemoryAccess` that blocks access to "any" type of non-SMRAM memory after SmmReadyToLock.

But I ran some tests and found out I can access some memory regions outside SMRAM, like address 0xFFFD0 for instance, and dereference a pointer to that address inside my Mm Handler without any problems, even though this is a non-SMRAM address and I have that PCD set to TRUE (Access to non-SMRAM memory is restricted).

However when I try to dereference a pointer to a memory region used by the OS I get an error saying `Access SMM communication forbidden address (0xC600000)!`

So I'm wondering:

1) Is it blocked or not?
2) In what context I can access non-SMRAM memory regions from inside my mm Handler?
3) Is there any way to read these memory regions used by the OS from inside the mm Handler other than setting PcdCpuSmmRestrictedMemoryAccess to FALSE?

Any kind of help would be appreciated. Thanks!


[PATCH] Maintainer.txt: add myself as reviewer for bhyve's OvmfPkg

Corvin Köhne <corvink@...>
 

Signed-off-by: Corvin Köhne <corvink@...>
Cc: Andrew Fish <afish@...>
Cc: Leif Lindholm <quic_llindhol@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: devel@edk2.groups.io
---
Maintainers.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 7e98083685..3ea9a4cca6 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -457,6 +457,7 @@ F: OvmfPkg/Library/ResetSystemLib/BaseResetShutdownBhyve.c
F: OvmfPkg/Library/ResetSystemLib/BaseResetSystemLibBhyve.inf
R: Rebecca Cran <rebecca@...> [bcran]
R: Peter Grehan <grehan@...> [grehan-freebsd]
+R: Corvin Köhne <corvink@...> [corvink]

OvmfPkg: cloudhv-related modules
F: OvmfPkg/CloudHv/
--
2.34.1


[PATCH 1/3] ArmPkg: Fix typos

Dongdong Zhang
 

Fix some typos in ArmPkg directory.

Signed-off-by: Dongdong Zhang <zhangdongdong@...>
---
ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 2 +-
ArmPkg/Include/Library/OemMiscLib.h | 2 +-
ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c | 6 +++---
ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S | 2 +-
ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S | 2 +-
ArmPkg/Library/SemihostLib/Arm/GccSemihost.S | 2 +-
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c | 6 +++---
ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c | 2 +-
.../Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c | 2 +-
9 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c
index 1fc448b9bf..a9cff0c395 100644
--- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c
+++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c
@@ -40,7 +40,7 @@ STATIC CONST SCMI_PROTOCOL_ENTRY Protocols[] = {
install Base, Clock and Performance protocols.
@param[in] SystemTable A pointer to boot time system table.

- @retval EFI_SUCCESS Driver initalized successfully.
+ @retval EFI_SUCCESS Driver initialized successfully.
@retval EFI_UNSUPPORTED If SCMI base protocol version is not supported.
@retval !(EFI_SUCCESS) Other errors.
**/
diff --git a/ArmPkg/Include/Library/OemMiscLib.h b/ArmPkg/Include/Library/OemMiscLib.h
index 541274999e..02af6afdc2 100644
--- a/ArmPkg/Include/Library/OemMiscLib.h
+++ b/ArmPkg/Include/Library/OemMiscLib.h
@@ -86,7 +86,7 @@ OemGetCpuFreq (

@param ProcessorIndex Index of the processor to get the information for.
@param ProcessorStatus Processor status.
- @param ProcessorCharacteristics Processor characteritics.
+ @param ProcessorCharacteristics Processor characteristics.
@param MiscProcessorData Miscellaneous processor information.

@return TRUE on success, FALSE on failure.
diff --git a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c
index 6dae7a9121..7083f6f514 100644
--- a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c
+++ b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c
@@ -663,9 +663,9 @@ DisassembleThumbInstruction (
// ITSTATE = cond:mask OpCode[7:4]:OpCode[3:0]
// ITSTATE[7:5] == cond[3:1]
// ITSTATE[4] == 1st Instruction cond[0]
- // ITSTATE[3] == 2st Instruction cond[0]
- // ITSTATE[2] == 3st Instruction cond[0]
- // ITSTATE[1] == 4st Instruction cond[0]
+ // ITSTATE[3] == 2nd Instruction cond[0]
+ // ITSTATE[2] == 3rd Instruction cond[0]
+ // ITSTATE[1] == 4th Instruction cond[0]
// ITSTATE[0] == 1 4 instruction IT block. 0 means 0,1,2 or 3 instructions
// 1st one in ITSTATE low bits defines the number of instructions
Mask = (OpCode & 0xf);
diff --git a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S
index ba0ec5682b..c402154e4c 100644
--- a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S
+++ b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S
@@ -20,7 +20,7 @@ ASM_FUNC(ArmReadMidr)
ret

ASM_FUNC(ArmCacheInfo)
- mrs x0, ctr_el0 // Read from Cache Type Regiter (CTR)
+ mrs x0, ctr_el0 // Read from Cache Type Register (CTR)
ret

ASM_FUNC(ArmGetInterruptState)
diff --git a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S
index 0ae75e4cb9..6a64219f67 100644
--- a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S
+++ b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S
@@ -23,7 +23,7 @@


ASM_FUNC(ArmIsMpCore)
- mrs x0, mpidr_el1 // Read EL1 Multiprocessor Affinty Reg (MPIDR)
+ mrs x0, mpidr_el1 // Read EL1 Multiprocessor Affinity Reg (MPIDR)
and x0, x0, #MPIDR_U_MASK // U Bit clear, the processor is part of a multiprocessor system
lsr x0, x0, #MPIDR_U_BIT
eor x0, x0, #1
diff --git a/ArmPkg/Library/SemihostLib/Arm/GccSemihost.S b/ArmPkg/Library/SemihostLib/Arm/GccSemihost.S
index d6f81ec2c9..b1992b605f 100644
--- a/ArmPkg/Library/SemihostLib/Arm/GccSemihost.S
+++ b/ArmPkg/Library/SemihostLib/Arm/GccSemihost.S
@@ -16,7 +16,7 @@
BKPT 0xAB for ARMv7-M (Thumb-2 only)

R0 - operation type
- R1 - block containing all other parametes
+ R1 - block containing all other parameters

lr - must be saved as svc instruction will cause an svc exception and write
the svc lr register. That happens to be the one we are using, so we must
diff --git a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c
index d55aff7620..c61d6f7b77 100644
--- a/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c
+++ b/ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c
@@ -31,7 +31,7 @@
return it contains the response parameters.
@param [out] RetVal Pointer to return the response value.

- @retval EFI_SUCCESS Request successfull.
+ @retval EFI_SUCCESS Request successful.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_READY Callee is busy or not in a state to handle
this request.
@@ -134,7 +134,7 @@ SendMemoryPermissionRequest (
@param [in] BaseAddress Base address for the memory region.
@param [out] MemoryAttributes Pointer to return the memory attributes.

- @retval EFI_SUCCESS Request successfull.
+ @retval EFI_SUCCESS Request successful.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_READY Callee is busy or not in a state to handle
this request.
@@ -193,7 +193,7 @@ GetMemoryPermissions (
@param [in] Length Length of the memory region.
@param [in] Permissions Memory access controls attributes.

- @retval EFI_SUCCESS Request successfull.
+ @retval EFI_SUCCESS Request successful.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_READY Callee is busy or not in a state to handle
this request.
diff --git a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c b/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c
index a5d635da9e..dd207a62f7 100644
--- a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c
+++ b/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c
@@ -39,7 +39,7 @@ OemGetCpuFreq (

@param ProcessorIndex Index of the processor to get the information for.
@param ProcessorStatus Processor status.
- @param ProcessorCharacteristics Processor characteritics.
+ @param ProcessorCharacteristics Processor characteristics.
@param MiscProcessorData Miscellaneous processor information.

@return TRUE on success, FALSE on failure.
diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
index b961be2133..8d83f0723d 100644
--- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
+++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
@@ -79,7 +79,7 @@ SmbiosProcessorHasSeparateCaches (
return SeparateCaches;
}

-/** Checks if ther ARM64 SoC ID SMC call is supported
+/** Checks if the ARM64 SoC ID SMC call is supported

@return Whether the ARM64 SoC ID call is supported.
**/
--
2.17.1


[PATCH 3/3] ArmVirtPkg: Fix typos

Dongdong Zhang
 

Fix some typos in ArmVirtPkg directory.

Signed-off-by: Dongdong Zhang <zhangdongdong@...>
---
ArmVirtPkg/ArmVirt.dsc.inc | 2 +-
.../Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c | 2 +-
ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 462073517a..f1aa51c896 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -93,7 +93,7 @@

#
# It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions.
- # This library provides the instrinsic functions such a compiler may generate calls to.
+ # This library provides the intrinsic functions such a compiler may generate calls to.
#
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
index 28a0c0b078..107ebbf3cd 100644
--- a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
@@ -103,7 +103,7 @@ CloudHvVirtMemInfoPeiLibConstructor (
CurBase + CurSize - 1
));

- // We should build Hob seperately for the memory node except the first one
+ // We should build Hob separately for the memory node except the first one
if (CurBase != MemBase) {
BuildResourceDescriptorHob (
EFI_RESOURCE_SYSTEM_MEMORY,
diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c
index 9cf43f06c0..464e7a6d04 100644
--- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c
+++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c
@@ -27,7 +27,7 @@
#define MACH_VIRT_PERIPH_SIZE SIZE_128MB

/**
- Default library constructur that obtains the memory size from a PCD.
+ Default library constructor that obtains the memory size from a PCD.

@return Always returns RETURN_SUCCESS

--
2.17.1


[PATCH 0/3] Fix some typos

Dongdong Zhang
 

Hi all,

My focus was fixing typos in comments. Most of them
were found by spellchecker.

There are many similar spelling mistakes, so to avoid involving
too many modules at once, only the files in the 'ArmPkg',
'ArmPlatformPkg' and 'ArmVirtPkg' directories were modified this time.

Dongdong Zhang (3):
ArmPkg: Fix typos
ArmPlatformPkg: Fix typos
ArmVirtPkg: Fix typos

ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 2 +-
ArmPkg/Include/Library/OemMiscLib.h | 2 +-
ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c | 6 +++---
ArmPkg/Library/ArmLib/AArch64/ArmLibSupport.S | 2 +-
ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S | 2 +-
ArmPkg/Library/SemihostLib/Arm/GccSemihost.S | 2 +-
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.c | 6 +++---
ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c | 2 +-
.../Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c | 2 +-
ArmPlatformPkg/ArmPlatformPkg.dec | 2 +-
ArmPlatformPkg/Include/Library/LcdPlatformLib.h | 2 +-
ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c | 2 +-
ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 4 ++--
ArmVirtPkg/ArmVirt.dsc.inc | 2 +-
.../Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c | 2 +-
ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c | 2 +-
16 files changed, 21 insertions(+), 21 deletions(-)

--
2.17.1


[PATCH 2/3] ArmPlatformPkg: Fix typos

Dongdong Zhang
 

Fix some typos in ArmPlatformPkg directory.

Signed-off-by: Dongdong Zhang <zhangdongdong@...>
---
ArmPlatformPkg/ArmPlatformPkg.dec | 2 +-
ArmPlatformPkg/Include/Library/LcdPlatformLib.h | 2 +-
ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c | 2 +-
ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index 7b5d7e6cb5..c905f97d2c 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -97,7 +97,7 @@
gArmPlatformTokenSpaceGuid.PcdPL111LcdBase|0x0|UINT32|0x00000026
gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x0|UINT32|0x00000027

- ## Default size for display modes upto 1920x1080 (1920 * 1080 * 4 Bytes Per Pixel)
+ ## Default size for display modes up to 1920x1080 (1920 * 1080 * 4 Bytes Per Pixel)
gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferSize|0x7E9000|UINT32|0x00000043
## If set, framebuffer memory will be reserved and mapped in the system RAM
gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase|0x0|UINT64|0x00000044
diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
index b5628ece56..2049e5ef60 100644
--- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
+++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
@@ -220,7 +220,7 @@ typedef struct {

@param[in] Handle Handle to the LCD device instance.

- @retval EFI_SUCCESS Plaform library initialized successfully.
+ @retval EFI_SUCCESS Platform library initialized successfully.
@retval !(EFI_SUCCESS) Other errors.
**/
EFI_STATUS
diff --git a/ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c b/ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c
index d01c910f6e..cea7ce2cc7 100644
--- a/ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c
+++ b/ArmPlatformPkg/Library/ArmMaliDp/ArmMaliDp.c
@@ -287,7 +287,7 @@ LcdInitialize (
return EFI_SUCCESS;
}

-/** Set ARM Mali DP in cofiguration mode.
+/** Set ARM Mali DP in configuration mode.

The ARM Mali DP must be in the configuration mode for
configuration of the H_INTERVALS, V_INTERVALS, SYNC_CONTROL
diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
index 07f9b0f6be..f0658b40dc 100644
--- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
+++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
@@ -19,7 +19,7 @@
@retval EFI_SUCCESS Returns success if platform implements a
PL111 controller.

- @retval EFI_NOT_FOUND PL111 display controller not found the plaform.
+ @retval EFI_NOT_FOUND PL111 display controller not found the platform.
**/
EFI_STATUS
LcdIdentify (
@@ -73,7 +73,7 @@ LcdInitialize (

@param[in] ModeNumbe Display mode number.

- @retval EFI_SUCCESS Display mode set successfuly.
+ @retval EFI_SUCCESS Display mode set successfully.
@retval !(EFI_SUCCESS) Other errors.
**/
EFI_STATUS
--
2.17.1


回复: [edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - Tuesday, December 6, 2022 #cal-reminder

gaoliming
 

Few issues are submitted. This week meeting is cancelled.

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Group Notification
发送时间: 2022126 10:30
收件人: devel@edk2.groups.io
主题: [edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - Tuesday, December 6, 2022 #cal-reminder

 

Reminder: TianoCore Bug Triage - APAC / NAMO

When:
Tuesday, December 6, 2022
6:30pm to 7:30pm
(UTC-08:00) America/Los Angeles

Where:
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d

Organizer: Liming Gao gaoliming@...

View Event

Description:

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao

 

________________________________________________________________________________

Microsoft Teams meeting

Join on your computer or mobile app

Click here to join the meeting

Join with a video conferencing device

teams@...

Video Conference ID: 116 062 094 0

Alternate VTC dialing instructions

Or call in (audio only)

+1 916-245-6934,,77463821#   United States, Sacramento

Phone Conference ID: 774 638 21#

Find a local number | Reset PIN

Learn More | Meeting options


Re: [PATCH 1/2] EmulatorPkg: Add persistent memory in EmuThunkPpi

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@...>
Sent: Tuesday, December 6, 2022 1:41 PM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang <zhiguang.liu@...>; Andrew Fish <afish@...>;
Ni, Ray <ray.ni@...>
Subject: [PATCH 1/2] EmulatorPkg: Add persistent memory in EmuThunkPpi

The persistent memory is for PEIM to use, and won't lose during cold
or warm reset. PcdPersistentMemorySize is only used by WinHost.c,
other modules can check the persistent memory size using the field
PersistentMemorySize.

Cc: Andrew Fish <afish@...>
Cc: Ray Ni <ray.ni@...>
Signed-off-by: Zhiguang Liu <zhiguang.liu@...>
---
EmulatorPkg/EmulatorPkg.dec | 3 ++-
EmulatorPkg/Include/Ppi/EmuThunk.h | 4 +++-
EmulatorPkg/Unix/Host/Host.c | 13 +++++++++++--
EmulatorPkg/Unix/Host/Host.inf | 3 ++-
EmulatorPkg/Win/Host/WinHost.c | 11 ++++++++++-
EmulatorPkg/Win/Host/WinHost.inf | 2 +-
6 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec
index b9c70b63b3..fe81652b04 100644
--- a/EmulatorPkg/EmulatorPkg.dec
+++ b/EmulatorPkg/EmulatorPkg.dec
@@ -2,7 +2,7 @@
#
# This is the Emu Emulation Environment Platform
#
-# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2011, Apple Inc. All rights reserved.
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
#
@@ -86,6 +86,7 @@
# The user ID and password are fixed as below.

gEmulatorPkgTokenSpaceGuid.PcdRedfishServieUserId|"admin"|VOID*|0x0
0001022

gEmulatorPkgTokenSpaceGuid.PcdRedfishServiePassword|"pwd123456"|VO
ID*|0x00001023
+
gEmulatorPkgTokenSpaceGuid.PcdPersistentMemorySize|0x4000000|UINT3
2|0x00001024

[PcdsFixedAtBuild, PcdsPatchableInModule]
gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode|1|UINT32|0x00001006
diff --git a/EmulatorPkg/Include/Ppi/EmuThunk.h
b/EmulatorPkg/Include/Ppi/EmuThunk.h
index c0e2bc6b98..cf29cf824c 100644
--- a/EmulatorPkg/Include/Ppi/EmuThunk.h
+++ b/EmulatorPkg/Include/Ppi/EmuThunk.h
@@ -2,7 +2,7 @@
Emulator Thunk to abstract OS services from pure EFI code

Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
-
+ Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -107,6 +107,8 @@ typedef struct {
EMU_PEI_AUTOSCAN MemoryAutoScan;
EMU_PEI_FD_INFORMATION FirmwareDevices;
EMU_PEI_THUNK_INTERFACE Thunk;
+ UINTN PersistentMemorySize;
+ UINT8 PersistentMemory[0];
} EMU_THUNK_PPI;

extern EFI_GUID gEmuThunkPpiGuid;
diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index 38c01c84af..8d0be5b54b 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -1,6 +1,6 @@
/*++ @file

-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -102,6 +102,7 @@ main (
CHAR16 *FirmwareVolumesStr;
UINTN *StackPointer;
FILE *GdbTempFile;
+ EMU_THUNK_PPI *SecEmuThunkPpi;

//
// Xcode does not support sourcing gdb scripts directly, so the Xcode XML
@@ -137,7 +138,15 @@ main (
//
// PPIs pased into PEI_CORE
//
- AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
&mSecEmuThunkPpi);
+ SecEmuThunkPpi = AllocateZeroPool (sizeof (EMU_THUNK_PPI) +
FixedPcdGet32 (PcdPersistentMemorySize));
+ if (SecEmuThunkPpi == NULL) {
+ printf ("ERROR : Can not allocate memory for SecEmuThunkPpi.
Exiting.\n");
+ exit (1);
+ }
+
+ CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof
(EMU_THUNK_PPI));
+ SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32
(PcdPersistentMemorySize);
+ AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
SecEmuThunkPpi);

SecInitThunkProtocol ();

diff --git a/EmulatorPkg/Unix/Host/Host.inf
b/EmulatorPkg/Unix/Host/Host.inf
index c479d2b7d0..f5ebbed683 100644
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ b/EmulatorPkg/Unix/Host/Host.inf
@@ -2,7 +2,7 @@
# Entry Point of Emu Emulator
#
# Main executable file of Unix Emulator that loads PEI core after initialization
finished.
-# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -106,6 +106,7 @@
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
+ gEmulatorPkgTokenSpaceGuid.PcdPersistentMemorySize

[FeaturePcd]
gEmulatorPkgTokenSpaceGuid.PcdEmulatorLazyLoadSymbols
diff --git a/EmulatorPkg/Win/Host/WinHost.c
b/EmulatorPkg/Win/Host/WinHost.c
index 096292f95a..3b2fde297d 100644
--- a/EmulatorPkg/Win/Host/WinHost.c
+++ b/EmulatorPkg/Win/Host/WinHost.c
@@ -436,6 +436,7 @@ Returns:
UINTN SystemAffinityMask;
INT32 LowBit;
UINTN ResetJumpCode;
+ EMU_THUNK_PPI *SecEmuThunkPpi;

//
// Enable the privilege so that RTC driver can successfully run SetTime()
@@ -477,7 +478,15 @@ Returns:
//
// PPIs pased into PEI_CORE
//
- AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
&mSecEmuThunkPpi);
+ SecEmuThunkPpi = AllocateZeroPool (sizeof (EMU_THUNK_PPI) +
FixedPcdGet32 (PcdPersistentMemorySize));
+ if (SecEmuThunkPpi == NULL) {
+ SecPrint ("ERROR : Can not allocate memory for SecEmuThunkPpi.
Exiting.\n");
+ exit (1);
+ }
+
+ CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof
(EMU_THUNK_PPI));
+ SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32
(PcdPersistentMemorySize);
+ AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
SecEmuThunkPpi);
AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiPeiReset2PpiGuid,
&mEmuReset2Ppi);

//
diff --git a/EmulatorPkg/Win/Host/WinHost.inf
b/EmulatorPkg/Win/Host/WinHost.inf
index b61901fae2..4dac6e033e 100644
--- a/EmulatorPkg/Win/Host/WinHost.inf
+++ b/EmulatorPkg/Win/Host/WinHost.inf
@@ -74,7 +74,7 @@

[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
-
+ gEmulatorPkgTokenSpaceGuid.PcdPersistentMemorySize
gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume
gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize
--
2.31.1.windows.1


Re: [PATCH] EmulatorPkg: Remove unnecessary dependency on EmbeddedPkg

Ni, Ray
 

Thanks for the cleaning up.
Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@...>
Sent: Tuesday, December 6, 2022 1:30 PM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang <zhiguang.liu@...>; Andrew Fish <afish@...>;
Ni, Ray <ray.ni@...>
Subject: [PATCH] EmulatorPkg: Remove unnecessary dependency on
EmbeddedPkg

EmulatorPkg doesn't need depend on EmbeddedPkg, so remove the
dependency.

Cc: Andrew Fish <afish@...>
Cc: Ray Ni <ray.ni@...>
Signed-off-by: Zhiguang Liu <zhiguang.liu@...>
---
EmulatorPkg/EmulatorPkg.ci.yaml | 3 +--
.../Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf | 3 +--
.../Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml
b/EmulatorPkg/EmulatorPkg.ci.yaml
index 338d5fc2d3..6e9b2857cb 100644
--- a/EmulatorPkg/EmulatorPkg.ci.yaml
+++ b/EmulatorPkg/EmulatorPkg.ci.yaml
@@ -5,7 +5,7 @@
# used for code analysis.
#
# Copyright (c) Microsoft Corporation
-# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
{
@@ -55,7 +55,6 @@
"EmulatorPkg/EmulatorPkg.dec",
"NetworkPkg/NetworkPkg.dec",
"RedfishPkg/RedfishPkg.dec",
- "EmbeddedPkg/EmbeddedPkg.dec", ## is this one OK??
],
# For host based unit tests
"AcceptableDependencies-HOST_APPLICATION":[
diff --git
a/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
b/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
index d91f7de181..dfdabde22a 100644
--- a/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
+++ b/EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
@@ -1,7 +1,7 @@
## @file
# Write only instance of Serial Port Library with empty functions.
#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2011, Apple Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -25,7 +25,6 @@
[Packages]
MdePkg/MdePkg.dec
EmulatorPkg/EmulatorPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec

[LibraryClasses]
EmuThunkLib
diff --git a/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
b/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
index 2f5e656fd7..7ef3e3baaf 100644
--- a/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
+++ b/EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
@@ -1,7 +1,7 @@
## @file
# Write only instance of Serial Port Library with empty functions.
#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2011, Apple Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -28,7 +28,6 @@
[Packages]
MdePkg/MdePkg.dec
EmulatorPkg/EmulatorPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec

[LibraryClasses]
PeiServicesLib
--
2.31.1.windows.1


Re: [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@...>
Sent: Tuesday, December 6, 2022 1:42 PM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang <zhiguang.liu@...>; Andrew Fish <afish@...>;
Ni, Ray <ray.ni@...>
Subject: [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk
Ppi

Record Argc, Argv and Envp in EmuThunk Ppi so that other modules
can use these fields to change behavior depends on boot parameters
or environment.

Cc: Andrew Fish <afish@...>
Cc: Ray Ni <ray.ni@...>
Signed-off-by: Zhiguang Liu <zhiguang.liu@...>
---
EmulatorPkg/Include/Ppi/EmuThunk.h | 3 +++
EmulatorPkg/Unix/Host/Host.c | 3 +++
EmulatorPkg/Win/Host/WinHost.c | 3 +++
3 files changed, 9 insertions(+)

diff --git a/EmulatorPkg/Include/Ppi/EmuThunk.h
b/EmulatorPkg/Include/Ppi/EmuThunk.h
index cf29cf824c..c78ad692ed 100644
--- a/EmulatorPkg/Include/Ppi/EmuThunk.h
+++ b/EmulatorPkg/Include/Ppi/EmuThunk.h
@@ -107,6 +107,9 @@ typedef struct {
EMU_PEI_AUTOSCAN MemoryAutoScan;
EMU_PEI_FD_INFORMATION FirmwareDevices;
EMU_PEI_THUNK_INTERFACE Thunk;
+ INTN Argc;
+ CHAR8 **Argv;
+ CHAR8 **Envp;
UINTN PersistentMemorySize;
UINT8 PersistentMemory[0];
} EMU_THUNK_PPI;
diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index 8d0be5b54b..1f29dd00a3 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -145,6 +145,9 @@ main (
}

CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof
(EMU_THUNK_PPI));
+ SecEmuThunkPpi->Argc = Argc;
+ SecEmuThunkPpi->Argv = Argv;
+ SecEmuThunkPpi->Envp = Envp;
SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32
(PcdPersistentMemorySize);
AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
SecEmuThunkPpi);

diff --git a/EmulatorPkg/Win/Host/WinHost.c
b/EmulatorPkg/Win/Host/WinHost.c
index 3b2fde297d..f639ba3b1b 100644
--- a/EmulatorPkg/Win/Host/WinHost.c
+++ b/EmulatorPkg/Win/Host/WinHost.c
@@ -485,6 +485,9 @@ Returns:
}

CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof
(EMU_THUNK_PPI));
+ SecEmuThunkPpi->Argc = Argc;
+ SecEmuThunkPpi->Argv = Argv;
+ SecEmuThunkPpi->Envp = Envp;
SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32
(PcdPersistentMemorySize);
AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
SecEmuThunkPpi);
AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiPeiReset2PpiGuid,
&mEmuReset2Ppi);
--
2.31.1.windows.1


Re: [PATCH] UsbNetworkPkg: add USB network devices support

RichardHo [何明忠]
 

Hi Rebecca,

Thanks for your response. I will fixed it next.

Thanks,
Richard

-----Original Message-----
From: Rebecca Cran <rebecca@...>
Sent: 2022年12月5日 11:15 AM
To: devel@edk2.groups.io; Richard Ho (何明忠) <RichardHo@...>
Cc: Andrew Fish <afish@...>; Leif Lindholm <quic_llindhol@...>; Michael D Kinney <michael.d.kinney@...>; Michael Kubacki <michael.kubacki@...>; Zhiguang Liu <zhiguang.liu@...>; Liming Gao <gaoliming@...>; Tony Lo (羅金松) <TonyLo@...>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] UsbNetworkPkg: add USB network devices support


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**

On 9/1/22 23:24, RichardHo [何明忠] via groups.io wrote:
+ DataLength = (UINTN)(Cpb->DataLen + (UINT32)Cpb->MediaheaderLen);
+
+ while (1) {
+ if (Counter >= 3) {
+ StatCode = PXE_STATCODE_BUSY;
+ break;
+ }
+
+ Status = Nic->UsbEth->UsbEthTransmit (Cdb, Nic->UsbEth, (VOID *)(UINTN)BulkOutData, &DataLength);
+ if (EFI_ERROR (Status)) {
+ StatCode = PXE_STATFLAGS_COMMAND_FAILED;
+ }
+
+ if (Status == EFI_INVALID_PARAMETER) {
+ StatCode = PXE_STATCODE_INVALID_PARAMETER;
+ break;
+ }
+
+ if (Status == EFI_DEVICE_ERROR) {
+ StatCode = PXE_STATCODE_DEVICE_FAILURE;
+ break;
+ }
+
+ if (!EFI_ERROR (Status)) {
+ Nic->TxFrame++;
+ StatCode = PXE_STATCODE_SUCCESS;
+ break;
+ }
+
+ Counter++;
+ }
You need to set DataLength inside the while loop, otherwise on subsequent iterations DataLength will be whatever value UsbEthTransmit just set it to, which will likely be 0 since an error occurred.

--
Rebecca Cran
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


Re: [edk2-platform][PATCH 1/1] MdeModulePkg: SdMmcPciHcDxe: Fix issue that SD1.0 cards can't be recognized

Wu, Hao A
 

Hello,

The proposed patch will cause CI test failure: https://github.com/tianocore/edk2/pull/3724. Could you help to resolve them?
May I know what kind of tests have been performed for this patch? Have you tried with non SD1.0 cards and make sure that they still work fine after the patch?

Also, serveral more inline comments below:

-----Original Message-----
From: Chevron Li <chevron.li@...>
Sent: Tuesday, December 6, 2022 2:48 PM
To: devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Ni, Ray <ray.ni@...>; Wang,
Jian J <jian.j.wang@...>; Gao, Liming <gaoliming@...>;
shirley.her@...; shaper.liu@...;
xiaoguang.yu@...; Chevron Li (WH)
<chevron.li@...>
Subject: [edk2-platform][PATCH 1/1] MdeModulePkg: SdMmcPciHcDxe: Fix
issue that SD1.0 cards can't be recognized

From: "Chevron Li (WH)" <chevron.li@...>


SD1.0 cards don't support CMD8 and CMD6

CMD8 result can be used to distinguish the card is SD1.0 or not.

CMD8 result can be used to decide following CMD6 is sent or skip.



Cc: Hao A Wu <hao.a.wu@...>

Cc: Ray Ni <ray.ni@...>

Cc: Jian J Wang <jian.j.wang@...>

Cc: Liming Gao <gaoliming@...>

Signed-off-by: Chevron Li <chevron.li@...>

---

MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 30 ++++++++++++---
----

1 file changed, 20 insertions(+), 10 deletions(-)



diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c

index f5a3607e47..281aa38170 100644

--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c

+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c

@@ -1085,7 +1085,8 @@ SdCardSetBusMode (

IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru,

IN UINT8 Slot,

IN UINT16 Rca,

- IN BOOLEAN S18A

+ IN BOOLEAN S18A,

+ IN BOOLEAN SdVersion1

For the newly added input parameter 'SdVersion1', please help to update the function description comments to reflect it.



)

{

EFI_STATUS Status;

@@ -1117,10 +1118,13 @@ SdCardSetBusMode (



//

// Get the supported bus speed from SWITCH cmd return data group #1.

+ // SdVersion1 don't support the SWITCH cmd

//

- Status = SdCardSwitch (PassThru, Slot, 0xFF, 0xF, SdDriverStrengthIgnore,
0xF, FALSE, SwitchResp);

- if (EFI_ERROR (Status)) {

- return Status;

+ if(SdVersion1 == FALSE) {

+ Status = SdCardSwitch (PassThru, Slot, 0xFF, 0xF, SdDriverStrengthIgnore,
0xF, FALSE, SwitchResp);

The local variable 'SwitchResp' is an output parameter for SdCardSwitch().
When SdVersion1 is TRUE, SdCardSwitch() call will be skipped and 'SwitchResp' will have uninitialized value.
This will probably cause issues when 'SwitchResp' later being used as an input parameter for SdGetTargetBusMode() function call.
Could you help to check on this?



+ if (EFI_ERROR (Status)) {

+ return Status;

+ }

}



SdGetTargetBusMode (Private, Slot, SwitchResp, S18A, &BusMode);

@@ -1141,9 +1145,14 @@ SdCardSetBusMode (

}

}



- Status = SdCardSwitch (PassThru, Slot, BusMode.BusTiming, 0xF,
BusMode.DriverStrength.Sd, 0xF, TRUE, SwitchResp);

- if (EFI_ERROR (Status)) {

- return Status;

+ //

+ // SdVersion1 don't support the SWITCH cmd

+ //

+ if(SdVersion1 == FALSE){

+ Status = SdCardSwitch (PassThru, Slot, BusMode.BusTiming, 0xF,
BusMode.DriverStrength.Sd, 0xF, TRUE, SwitchResp);

+ if (EFI_ERROR (Status)) {

+ return Status;

+ }

}



Status = SdMmcSetDriverStrength (Private->PciIo, Slot,
BusMode.DriverStrength.Sd);

@@ -1214,6 +1223,7 @@ SdCardIdentification (

UINT8 HostCtrl2;

UINTN Retry;

BOOLEAN ForceVoltage33;

+ BOOLEAN SdVersion1;



ForceVoltage33 = FALSE;

Please help to assign a initial value for the newly added local variable 'SdVersion1'.
If the card supports cmd8, this local variable will have uninitialized value when calling SdCardSetBusMode().





@@ -1231,12 +1241,12 @@ Voltage33Retry:

}



//

- // 2. Send Cmd8 to the device

+ // 2. Send Cmd8 to the device, the command will fail for SdVersion1;

//

Status = SdCardVoltageCheck (PassThru, Slot, 0x1, 0xFF);

if (EFI_ERROR (Status)) {

+ SdVersion1 = 1;

Please use "SdVersion1 = TRUE;".

Best Regards,
Hao Wu



DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing Cmd8 fails
with %r\n", Status));

- return Status;

}



//

@@ -1426,7 +1436,7 @@ Voltage33Retry:

DEBUG ((DEBUG_INFO, "SdCardIdentification: Found a SD device at slot
[%d]\n", Slot));

Private->Slot[Slot].CardType = SdCardType;



- Status = SdCardSetBusMode (PciIo, PassThru, Slot, Rca, ((Ocr & BIT24) !=
0));

+ Status = SdCardSetBusMode (PciIo, PassThru, Slot, Rca, ((Ocr & BIT24) != 0),
SdVersion1);



return Status;





base-commit: 7bee2498910a9034faaf90802c49188afb7582dc

--

2.18.0.windows.1


Re: [Patch 1/1] RedfishPkg: Remove overlapping private include path in DEC file

Chang, Abner
 

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@...>

-----Original Message-----
From: Michael D Kinney <michael.d.kinney@...>
Sent: Tuesday, December 6, 2022 8:45 AM
To: devel@edk2.groups.io
Cc: Chang, Abner <Abner.Chang@...>; Nickle Wang
<nicklew@...>; Igor Kulchytskyy <igork@...>
Subject: [Patch 1/1] RedfishPkg: Remove overlapping private include path in
DEC file

Caution: This message originated from an External Source. Use proper
caution when opening attachments, clicking links, or responding.


Update ReadfishPkg.dec to remove PrivateInclude from the
[Includes.Common.Private] section. The PrivateInclude directory does not
contain any include files, and the PrivateInclude/Crt include path remaining in
the [Includes.Common.Private] section providing the include path required
to access the CRT related include files by components within the RedfishPkg.

Without this update, there are two forms of #include statements that can be
used to include the CRT related include files.
Include files should only be available using one form of #include statements.

Cc: Abner Chang <abner.chang@...>
Cc: Nickle Wang <nicklew@...>
Cc: Igor Kulchytskyy <igork@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
RedfishPkg/RedfishPkg.dec | 1 -
1 file changed, 1 deletion(-)

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec index
0aa26883e220..d2b189b13d8c 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -17,7 +17,6 @@ [Includes]
Include

[Includes.Common.Private]
- PrivateInclude # Private header files for C RTL.
PrivateInclude/Crt # Private header files for C RTL.
Library/JsonLib # Private header files for jansson
# configuration files.
--
2.37.1.windows.1