[AMD Official Use Only - General]

Acked-by: Abner Chang <abner.ch...@amd.com>

> -----Original Message-----
> From: Abdul Lateef Attar <abdat...@amd.com>
> Sent: Wednesday, July 12, 2023 2:24 PM
> To: devel@edk2.groups.io
> Cc: Attar, AbdulLateef (Abdul Lateef) <abdullateef.at...@amd.com>; Eric
> Dong <eric.d...@intel.com>; Ray Ni <ray...@intel.com>; Rahul Kumar
> <rahul1.ku...@intel.com>; Gerd Hoffmann <kra...@redhat.com>; Chang,
> Abner <abner.ch...@amd.com>
> Subject: [PATCH v1 1/1] UefiCpuPkg: Uses gMmst in MmSaveStateLib
>
> From: Abdul Lateef Attar <abdullateef.at...@amd.com>
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4182
>
> Use gMmst instead of gSmst.
> Replace SmmServicesTableLib with MmServicesTableLib.
>
> Cc: Eric Dong <eric.d...@intel.com>
> Cc: Ray Ni <ray...@intel.com>
> Cc: Rahul Kumar <rahul1.ku...@intel.com>
> Cc: Gerd Hoffmann <kra...@redhat.com>
> Cc: Abner Chang <abner.ch...@amd.com>
> Signed-off-by: Abdul Lateef Attar <abdullateef.at...@amd.com>
> ---
>  UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveStateLib.inf   | 2 +-
>  UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.inf | 2 +-
>  UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h           | 2 +-
>  UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveState.c        | 4 ++--
>  UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveState.c      | 2 +-
>  UefiCpuPkg/Library/MmSaveStateLib/MmSaveStateCommon.c     | 8 ++++---
> -
>  6 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveStateLib.inf
> b/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveStateLib.inf
> index 5c0685f283d3..dcee6c401d30 100644
> --- a/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveStateLib.inf
> +++ b/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveStateLib.inf
> @@ -31,4 +31,4 @@ [LibraryClasses]
>    BaseLib
>    BaseMemoryLib
>    DebugLib
> -  SmmServicesTableLib
> +  MmServicesTableLib
> diff --git a/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.inf
> b/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.inf
> index b92dfa643203..b7fd4078f58a 100644
> --- a/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.inf
> +++ b/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.inf
> @@ -31,4 +31,4 @@ [LibraryClasses]
>    BaseLib
>    BaseMemoryLib
>    DebugLib
> -  SmmServicesTableLib
> +  MmServicesTableLib
> diff --git a/UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h
> b/UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h
> index c3499cbb3b17..6c7e8abd5f62 100644
> --- a/UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h
> +++ b/UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h
> @@ -14,7 +14,7 @@
>  #include <Protocol/MmCpu.h>
>  #include <Library/DebugLib.h>
>  #include <Library/MmSaveStateLib.h>
> -#include <Library/SmmServicesTableLib.h>
> +#include <Library/MmServicesTableLib.h>
>  #include <Library/BaseMemoryLib.h>
>
>  // Macro used to simplify the lookup table entries of type
> CPU_MM_SAVE_STATE_REGISTER_RANGE
> diff --git a/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveState.c
> b/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveState.c
> index 9fed52896f5c..3315a6cc44ff 100644
> --- a/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveState.c
> +++ b/UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveState.c
> @@ -108,7 +108,7 @@ MmSaveStateReadRegister (
>    UINT8                      DataWidth;
>
>    // Read CPU State
> -  CpuSaveState = (AMD_SMRAM_SAVE_STATE_MAP *)gSmst-
> >CpuSaveState[CpuIndex];
> +  CpuSaveState = (AMD_SMRAM_SAVE_STATE_MAP *)gMmst-
> >CpuSaveState[CpuIndex];
>
>    // Check for special EFI_MM_SAVE_STATE_REGISTER_LMA
>    if (Register == EFI_MM_SAVE_STATE_REGISTER_LMA) {
> @@ -226,7 +226,7 @@ MmSaveStateWriteRegister (
>      return EFI_NOT_FOUND;
>    }
>
> -  CpuSaveState = gSmst->CpuSaveState[CpuIndex];
> +  CpuSaveState = gMmst->CpuSaveState[CpuIndex];
>
>    //
>    // Do not write non-writable SaveState, because it will cause exception.
> diff --git a/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveState.c
> b/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveState.c
> index fd321bb571d5..c2ccd65b1dc4 100644
> --- a/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveState.c
> +++ b/UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveState.c
> @@ -296,7 +296,7 @@ MmSaveStateWriteRegister (
>      return EFI_NOT_FOUND;
>    }
>
> -  CpuSaveState = gSmst->CpuSaveState[CpuIndex];
> +  CpuSaveState = gMmst->CpuSaveState[CpuIndex];
>
>    //
>    // Do not write non-writable SaveState, because it will cause exception.
> diff --git a/UefiCpuPkg/Library/MmSaveStateLib/MmSaveStateCommon.c
> b/UefiCpuPkg/Library/MmSaveStateLib/MmSaveStateCommon.c
> index 09c6c3f96fed..f66245b82c40 100644
> --- a/UefiCpuPkg/Library/MmSaveStateLib/MmSaveStateCommon.c
> +++ b/UefiCpuPkg/Library/MmSaveStateLib/MmSaveStateCommon.c
> @@ -99,8 +99,8 @@ MmSaveStateReadRegisterByIndex (
>      //
>      // Write return buffer
>      //
> -    ASSERT (gSmst->CpuSaveState[CpuIndex] != NULL);
> -    CopyMem (Buffer, (UINT8 *)gSmst->CpuSaveState[CpuIndex] +
> mCpuWidthOffset[RegisterIndex].Offset32, Width);
> +    ASSERT (gMmst->CpuSaveState[CpuIndex] != NULL);
> +    CopyMem (Buffer, (UINT8 *)gMmst->CpuSaveState[CpuIndex] +
> mCpuWidthOffset[RegisterIndex].Offset32, Width);
>    } else {
>      //
>      // If 64-bit mode width is zero, then the specified register can not be
> accessed
> @@ -119,12 +119,12 @@ MmSaveStateReadRegisterByIndex (
>      //
>      // Write lower 32-bits of return buffer
>      //
> -    CopyMem (Buffer, (UINT8 *)gSmst->CpuSaveState[CpuIndex] +
> mCpuWidthOffset[RegisterIndex].Offset64Lo, MIN (4, Width));
> +    CopyMem (Buffer, (UINT8 *)gMmst->CpuSaveState[CpuIndex] +
> mCpuWidthOffset[RegisterIndex].Offset64Lo, MIN (4, Width));
>      if (Width > 4) {
>        //
>        // Write upper 32-bits of return buffer
>        //
> -      CopyMem ((UINT8 *)Buffer + 4, (UINT8 *)gSmst-
> >CpuSaveState[CpuIndex] + mCpuWidthOffset[RegisterIndex].Offset64Hi,
> Width - 4);
> +      CopyMem ((UINT8 *)Buffer + 4, (UINT8 *)gMmst-
> >CpuSaveState[CpuIndex] + mCpuWidthOffset[RegisterIndex].Offset64Hi,
> Width - 4);
>      }
>    }
>
> --
> 2.25.1



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


Reply via email to