[PATCH v3 07/28] JadePkg: Implement RealTimeClockLib for PCF85063
Nhi Pham
From: Vu Nguyen <vunguyen@os.amperecomputing.com>
This library adds the support for retrieving and updating system datetime over real RTC PCF85063 device on Mt. Jade platform instead of using virtual RTC. Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Vu Nguyen <vunguyen@os.amperecomputing.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com> --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 2 + Platform/Ampere/JadePkg/Jade.dsc | 2 +- Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf | 44 +++ Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h | 91 ++++++ Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c | 317 ++++++++++++++++++++ Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.c | 257 ++++++++++++++++ 6 files changed, 712 insertions(+), 1 deletion(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 89c143cd28e6..5f7a56133777 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -84,6 +84,8 @@ [LibraryClasses.common] SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf + I2cLib|Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf + GpioLib|Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.inf # diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc index 0681835dd175..332cd8ac0c8e 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -75,7 +75,7 @@ [LibraryClasses] # # RTC Library: Common RTC # - RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf + RealTimeClockLib|Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf # # Library for FailSafe support diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf new file mode 100644 index 000000000000..1fe561cc0ec9 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf @@ -0,0 +1,44 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + MODULE_TYPE = BASE + BASE_NAME = PCF85063RealTimeClockLib + FILE_GUID = 271569F6-5522-4006-9FF5-F07A59473AAC + LIBRARY_CLASS = RealTimeClockLib + VERSION_STRING = 1.0 + +[Sources.common] + PCF85063.c + PCF85063.h + PCF85063RealTimeClockLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmGenericTimerCounterLib + ArmLib + BaseLib + DebugLib + GpioLib + DxeServicesTableLib + I2cLib + TimeBaseLib + TimerLib + UefiLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h new file mode 100644 index 000000000000..03ce4d29a03f --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h @@ -0,0 +1,91 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PCF85063_H_ +#define PCF85063_H_ + +#include <Uefi.h> + +#include <Library/BaseLib.h> +#include <Library/RealTimeClockLib.h> + +// +// I2C bus address that RTC connected to +// +#define I2C_RTC_BUS_ADDRESS 1 + +// +// I2C RTC bus speed +// +#define I2C_RTC_BUS_SPEED 100000 + +// +// I2C chip address that RTC connected to +// +#define I2C_RTC_CHIP_ADDRESS 0x51 + +// +// The GPI PIN that tell if RTC can be access +// +#define I2C_RTC_ACCESS_GPIO_PIN 28 + +/** + * Returns the current time and date information of the hardware platform. + * + * @param Time A pointer to storage to receive a snapshot of the current time. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. + */ +EFI_STATUS +EFIAPI +PlatformGetTime ( + OUT EFI_TIME *Time + ); + +/** + * Set the time and date information to the hardware platform. + * + * @param Time A pointer to storage to set the current time to hardware platform. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. + **/ +EFI_STATUS +EFIAPI +PlatformSetTime ( + IN EFI_TIME *Time + ); + +/** + * Callback function for hardware platform to convert data pointers to virtual address + */ +VOID +EFIAPI +PlatformVirtualAddressChangeEvent ( + VOID + ); + +/** + * Callback function for hardware platform to initialize private data + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval Others The error status indicates the error + */ +EFI_STATUS +EFIAPI +PlatformInitialize ( + VOID + ); + +#endif /* PCF85063_H_ */ diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c new file mode 100644 index 000000000000..bc886b530f3c --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c @@ -0,0 +1,317 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Library/BaseLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/GpioLib.h> +#include <Library/I2cLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/PcdLib.h> +#include <Library/TimerLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiLib.h> +#include <Library/UefiRuntimeLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> + +#include "PCF85063.h" + +#define RTC_TIMEOUT_WAIT_ACCESS 100000 /* 100 miliseconds */ +#define RTC_DEFAULT_MIN_YEAR 2000 +#define RTC_DEFAULT_MAX_YEAR 2099 + +#define RTC_ADDR 0x4 +#define RTC_DATA_BUF_LEN 8 + +/** + * PCF85063 register offsets + */ +#define PCF85063_OFFSET_SEC 0x0 +#define PCF85063_OFFSET_MIN 0x1 +#define PCF85063_OFFSET_HR 0x2 +#define PCF85063_OFFSET_DAY 0x3 +#define PCF85063_OFFSET_WKD 0x4 +#define PCF85063_OFFSET_MON 0x5 +#define PCF85063_OFFSET_YEA 0x6 + +/** + * PCF85063 encoding macros + */ +#define PCF85063_SEC_ENC(s) (((((s) / 10) & 0x7) << 4) | (((s) % 10) & 0xf)) +#define PCF85063_MIN_ENC(m) (((((m) / 10) & 0x7) << 4) | (((m) % 10) & 0xf)) +#define PCF85063_HR_ENC(h) (((((h) / 10) & 0x3) << 4) | (((h) % 10) & 0xf)) +#define PCF85063_DAY_ENC(d) (((((d) / 10) & 0x3) << 4) | (((d) % 10) & 0xf)) +#define PCF85063_WKD_ENC(w) ((w) & 0x7) +#define PCF85063_MON_ENC(m) (((((m) / 10) & 0x1) << 4) | (((m) % 10) & 0xf)) +#define PCF85063_YEA_ENC(y) (((((y) / 10) & 0xf) << 4) | (((y) % 10) & 0xf)) + +/** + * PCF85063 decoding macros + */ +#define PCF85063_SEC_DEC(s) (((((s) & 0x70) >> 4) * 10) + ((s) & 0xf)) +#define PCF85063_MIN_DEC(m) (((((m) & 0x70) >> 4) * 10) + ((m) & 0xf)) +#define PCF85063_HR_DEC(h) (((((h) & 0x30) >> 4) * 10) + ((h) & 0xf)) +#define PCF85063_DAY_DEC(d) (((((d) & 0x30) >> 4) * 10) + ((d) & 0xf)) +#define PCF85063_WKD_DEC(w) ((w) & 0x7) +#define PCF85063_MON_DEC(m) (((((m) & 0x10) >> 4) * 10) + ((m) & 0xf)) +#define PCF85063_YEA_DEC(y) (((((y) & 0xf0) >> 4) * 10) + ((y) & 0xf)) + +/* Buffer pointers to convert Vir2Phys and Phy2Vir */ +STATIC volatile UINT64 RtcBufVir; +STATIC volatile UINT64 RtcBufPhy; + +STATIC +EFI_STATUS +RtcI2cWaitAccess ( + VOID + ) +{ + INTN Timeout; + + Timeout = RTC_TIMEOUT_WAIT_ACCESS; + while ((GpioReadBit (I2C_RTC_ACCESS_GPIO_PIN) != 0) && (Timeout > 0)) { + MicroSecondDelay (100); + Timeout -= 100; + } + + if (Timeout <= 0) { + DEBUG ((DEBUG_ERROR, "%a: Timeout while waiting access RTC\n", __FUNCTION__)); + return EFI_TIMEOUT; + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +RtcI2cRead ( + IN UINT8 Addr, + IN OUT UINT64 Data, + IN UINT32 DataLen + ) +{ + EFI_STATUS Status; + UINT32 TmpLen; + + if (EFI_ERROR (RtcI2cWaitAccess ())) { + return EFI_DEVICE_ERROR; + } + + Status = I2cProbe (I2C_RTC_BUS_ADDRESS, I2C_RTC_BUS_SPEED); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + // + // Send the slave address for read + // + TmpLen = 1; + Status = I2cWrite (I2C_RTC_BUS_ADDRESS, I2C_RTC_CHIP_ADDRESS, (UINT8 *)&Addr, &TmpLen); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + // + // Read back the time + // + Status = I2cRead (I2C_RTC_BUS_ADDRESS, I2C_RTC_CHIP_ADDRESS, NULL, 0, (UINT8 *)Data, &DataLen); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +RtcI2cWrite ( + IN UINT8 Addr, + IN UINT64 Data, + IN UINT32 DataLen + ) +{ + EFI_STATUS Status; + UINT8 TmpBuf[RTC_DATA_BUF_LEN + 1]; + UINT32 TmpLen; + + if (EFI_ERROR (RtcI2cWaitAccess ())) { + return EFI_DEVICE_ERROR; + } + + if (DataLen > sizeof (TmpBuf) - 1) { + return EFI_INVALID_PARAMETER; + } + + Status = I2cProbe (I2C_RTC_BUS_ADDRESS, I2C_RTC_BUS_SPEED); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + // + // The first byte is the address + // + TmpBuf[0] = Addr; + TmpLen = DataLen + 1; + CopyMem ((VOID *)(TmpBuf + 1), (VOID *)Data, DataLen); + + Status = I2cWrite (I2C_RTC_BUS_ADDRESS, I2C_RTC_CHIP_ADDRESS, TmpBuf, &TmpLen); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +/** + * Returns the current time and date information of the hardware platform. + * + * @param Time A pointer to storage to receive a snapshot of the current time. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. + */ +EFI_STATUS +EFIAPI +PlatformGetTime ( + OUT EFI_TIME *Time + ) +{ + EFI_STATUS Status; + UINT8 *Data; + + if (Time == NULL) { + return EFI_INVALID_PARAMETER; + } + + Status = RtcI2cRead (RTC_ADDR, RtcBufVir, RTC_DATA_BUF_LEN); + + Data = (UINT8 *)RtcBufVir; + if (Status == EFI_SUCCESS) { + Time->Second = PCF85063_SEC_DEC (Data[PCF85063_OFFSET_SEC]); + Time->Minute = PCF85063_MIN_DEC (Data[PCF85063_OFFSET_MIN]); + Time->Hour = PCF85063_HR_DEC (Data[PCF85063_OFFSET_HR]); + Time->Day = PCF85063_DAY_DEC (Data[PCF85063_OFFSET_DAY]); + Time->Month = PCF85063_MON_DEC (Data[PCF85063_OFFSET_MON]); + Time->Year = PCF85063_YEA_DEC (Data[PCF85063_OFFSET_YEA]); + Time->Year += RTC_DEFAULT_MIN_YEAR; + if (Time->Year > RTC_DEFAULT_MAX_YEAR) { + Time->Year = RTC_DEFAULT_MAX_YEAR; + } + if (Time->Year < RTC_DEFAULT_MIN_YEAR) { + Time->Year = RTC_DEFAULT_MIN_YEAR; + } + } + + return Status; +} + +/** + * Set the time and date information to the hardware platform. + * + * @param Time A pointer to storage to set the current time to hardware platform. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. + **/ +EFI_STATUS +EFIAPI +PlatformSetTime ( + IN EFI_TIME *Time + ) +{ + UINT8 *Data; + + if (Time == NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Time->Year < RTC_DEFAULT_MIN_YEAR || + Time->Year > RTC_DEFAULT_MAX_YEAR) + { + return EFI_INVALID_PARAMETER; + } + + Data = (UINT8 *)RtcBufVir; + Data[PCF85063_OFFSET_SEC] = PCF85063_SEC_ENC (Time->Second); + Data[PCF85063_OFFSET_MIN] = PCF85063_MIN_ENC (Time->Minute); + Data[PCF85063_OFFSET_HR] = PCF85063_HR_ENC (Time->Hour); + Data[PCF85063_OFFSET_DAY] = PCF85063_DAY_ENC (Time->Day); + Data[PCF85063_OFFSET_MON] = PCF85063_MON_ENC (Time->Month); + Data[PCF85063_OFFSET_YEA] = PCF85063_YEA_ENC (Time->Year - RTC_DEFAULT_MIN_YEAR); + + return RtcI2cWrite (RTC_ADDR, RtcBufVir, RTC_DATA_BUF_LEN); +} + +/** + * Callback function for hardware platform to convert data pointers to virtual address + */ +VOID +EFIAPI +PlatformVirtualAddressChangeEvent ( + VOID + ) +{ + EfiConvertPointer (0x0, (VOID **)&RtcBufVir); +} + +/** + * Callback function for hardware platform to initialize private data + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval Others The error status indicates the error + */ +EFI_STATUS +EFIAPI +PlatformInitialize ( + VOID + ) +{ + EFI_STATUS Status; + + /* + * Allocate the buffer for RTC data + * The buffer can be accessible after ExitBootServices + */ + RtcBufVir = (UINT64)AllocateRuntimeZeroPool (RTC_DATA_BUF_LEN); + ASSERT_EFI_ERROR (RtcBufVir); + RtcBufPhy = (UINT64)RtcBufVir; + + Status = I2cSetupRuntime (I2C_RTC_BUS_ADDRESS); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a:%d I2cSetupRuntime() failed - %r \n", + __FUNCTION__, + __LINE__, + Status + )); + return Status; + } + + Status = GpioSetupRuntime (I2C_RTC_ACCESS_GPIO_PIN); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a:%d GpioSetupRuntime() failed - %r \n", + __FUNCTION__, + __LINE__, + Status + )); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.c b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.c new file mode 100644 index 000000000000..ef8c71e92c18 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.c @@ -0,0 +1,257 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiDxe.h> +#include <Uefi.h> + +#include <Guid/EventGroup.h> +#include <Library/ArmGenericTimerCounterLib.h> +#include <Library/ArmLib.h> +#include <Library/BaseLib.h> +#include <Library/DebugLib.h> +#include <Library/DxeServicesTableLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/RealTimeClockLib.h> +#include <Library/TimeBaseLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiLib.h> +#include <Library/UefiRuntimeLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> +#include <Protocol/RealTimeClock.h> + +#include "PCF85063.h" + +#define TICKS_PER_SEC (ArmGenericTimerGetTimerFreq ()) + +STATIC EFI_EVENT mVirtualAddressChangeEvent = NULL; + +STATIC UINT64 mLastSavedSystemCount = 0; +STATIC UINT64 mLastSavedTimeEpoch = 0; + +/** + * Returns the current time and date information, and the time-keeping capabilities + * of the hardware platform. + * + * @param Time A pointer to storage to receive a snapshot of the current time. + * @param Capabilities An optional pointer to a buffer to receive the real time clock + * device's capabilities. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. + */ +EFI_STATUS +EFIAPI +LibGetTime ( + OUT EFI_TIME *Time, + OUT EFI_TIME_CAPABILITIES *Capabilities + ) +{ + EFI_STATUS Status; + UINT64 CurrentSystemCount; + UINT64 TimeElapsed; + UINTN EpochSeconds; + + if ((mLastSavedTimeEpoch == 0) || EfiAtRuntime ()) { + Status = PlatformGetTime (Time); + if (EFI_ERROR (Status)) { + // Failed to read platform RTC so create fake time + Time->Second = 0; + Time->Minute = 0; + Time->Hour = 10; + Time->Day = 1; + Time->Month = 1; + Time->Year = 2017; + } + + EpochSeconds = EfiTimeToEpoch (Time); + if (!EfiAtRuntime ()) { + mLastSavedTimeEpoch = EpochSeconds; + mLastSavedSystemCount = ArmGenericTimerGetSystemCount (); + } + } else { + CurrentSystemCount = ArmGenericTimerGetSystemCount (); + if (CurrentSystemCount >= mLastSavedSystemCount) { + TimeElapsed = (CurrentSystemCount - mLastSavedSystemCount) / MultU64x32 (1, TICKS_PER_SEC); + EpochSeconds = mLastSavedTimeEpoch + TimeElapsed; + } else { + // System counter overflow 64 bits + // Call GetTime again to read the date from RTC HW, not using generic timer system counter + mLastSavedTimeEpoch = 0; + return LibGetTime (Time, Capabilities); + } + } + + // Adjust for the correct timezone + if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { + EpochSeconds += Time->TimeZone * SEC_PER_MIN; + } + + // Adjust for the correct period + if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { + // Convert to adjusted time, i.e. spring forwards one hour + EpochSeconds += SEC_PER_HOUR; + } + + EpochToEfiTime (EpochSeconds, Time); + + return EFI_SUCCESS; +} + +/** + * Sets the current local time and date information. + * + * @param Time A pointer to the current time. + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER A time field is out of range. + * @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. + */ +EFI_STATUS +EFIAPI +LibSetTime ( + IN EFI_TIME *Time + ) +{ + EFI_STATUS Status; + UINTN EpochSeconds; + + EpochSeconds = EfiTimeToEpoch (Time); + + // Adjust for the correct time zone, i.e. convert to UTC time zone + if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { + EpochSeconds -= Time->TimeZone * SEC_PER_MIN; + } + + // Adjust for the correct period, i.e. fall back one hour + if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { + EpochSeconds -= SEC_PER_HOUR; + } + + EpochToEfiTime (EpochSeconds, Time); + + Status = PlatformSetTime (Time); + if (EFI_ERROR (Status)) { + return Status; + } + + if (!EfiAtRuntime ()) { + mLastSavedTimeEpoch = EpochSeconds; + mLastSavedSystemCount = ArmGenericTimerGetSystemCount (); + } + + return EFI_SUCCESS; +} + +/** + * Returns the current wakeup alarm clock setting. + * + * @param Enabled Indicates if the alarm is currently enabled or disabled. + * @param Pending Indicates if the alarm signal is pending and requires acknowledgement. + * @param Time The current alarm setting. + * + * @retval EFI_SUCCESS The alarm settings were returned. + * @retval EFI_INVALID_PARAMETER Any parameter is NULL. + * @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. + */ +EFI_STATUS +EFIAPI +LibGetWakeupTime ( + OUT BOOLEAN *Enabled, + OUT BOOLEAN *Pending, + OUT EFI_TIME *Time + ) +{ + return EFI_UNSUPPORTED; +} + +/** + * Sets the system wakeup alarm clock time. + * + * @param Enabled Enable or disable the wakeup alarm. + * @param Time If Enable is TRUE, the time to set the wakeup alarm for. + * + * @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If + * Enable is FALSE, then the wakeup alarm was disabled. + * @retval EFI_INVALID_PARAMETER A time field is out of range. + * @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. + * @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. + */ +EFI_STATUS +EFIAPI +LibSetWakeupTime ( + IN BOOLEAN Enabled, + OUT EFI_TIME *Time + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers in + lib to virtual mode. + + @param[in] Event The Event that is being processed + @param[in] Context Event Context +**/ +VOID +EFIAPI +LibRtcVirtualNotifyEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Only needed if you are going to support the OS calling RTC functions in virtual mode. + // You will need to call EfiConvertPointer (). To convert any stored physical addresses + // to virtual address. After the OS transitions to calling in virtual mode, all future + // runtime calls will be made in virtual mode. + // + PlatformVirtualAddressChangeEvent (); +} + +/** + * This is the declaration of an EFI image entry point. This can be the entry point to an application + * written to this specification, an EFI boot service driver, or an EFI runtime driver. + * + * @param ImageHandle Handle that identifies the loaded image. + * @param SystemTable System Table for this image. + * + * @retval EFI_SUCCESS The operation completed successfully. + */ +EFI_STATUS +EFIAPI +LibRtcInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status = PlatformInitialize (); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Register for the virtual address change event + // + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + LibRtcVirtualNotifyEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mVirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} -- 2.17.1
|
|
[PATCH v3 06/28] AmpereAltraPkg: Add DwGpioLib library
Nhi Pham
From: Vu Nguyen <vunguyen@os.amperecomputing.com>
The DwGpioLib library provides basic functions to control the GPIO controller on Ampere Altra processor. Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Vu Nguyen <vunguyen@os.amperecomputing.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com> --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf | 33 ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h | 76 +++++ Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c | 314 ++++++++++++++++++++ 4 files changed, 426 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec index 8be6a329bb26..be827dd19a96 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -31,6 +31,9 @@ [LibraryClasses] ## @libraryclass Defines a set of methods to read/write to I2C devices. I2cLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h + ## @libraryclass Defines a set of methods to get/set GPIO. + GpioLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h + ## @libraryclass Defines a set of methods to communicate with secure parition over MM interface. MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf new file mode 100644 index 000000000000..36ce0c3be2c8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf @@ -0,0 +1,33 @@ +## @file +# Component description for DwGpioLib library for the Designware GPIO controller. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = DwGpioLib + FILE_GUID = E7D9CAE1-6930-46E3-BDF9-0027446E7DF2 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = GpioLib + +[Sources.common] + DwGpioLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + IoLib + +[Guids] + gEfiEventVirtualAddressChangeGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h new file mode 100644 index 000000000000..cb201bc98322 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h @@ -0,0 +1,76 @@ +/** @file + Library implementation for the Designware GPIO controller. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef GPIO_LIB_H_ +#define GPIO_LIB_H_ + +enum SocGpioConfigMode { + GPIO_CONFIG_OUT_LOW = 0, + GPIO_CONFIG_OUT_HI, + GPIO_CONFIG_OUT_LOW_TO_HIGH, + GPIO_CONFIG_OUT_HIGH_TO_LOW, + GPIO_CONFIG_IN, + MAX_GPIO_CONFIG_MODE +}; + +/* + * GpioWriteBit: Use to Set/Clear GPIOs + * Input: + * Pin : Pin Identification + * Val : 1 to Set, 0 to Clear + */ +VOID +EFIAPI +GpioWriteBit ( + IN UINT32 Pin, + IN UINT32 Val + ); + +/* + * GpioReadBit: + * Input: + * Pin : Pin Identification + * Return: + * 1 : On/High + * 0 : Off/Low + */ +UINTN +EFIAPI +GpioReadBit ( + IN UINT32 Pin + ); + +/* + * GpioModeConfig: Use to configure GPIOs as Input/Output + * Input: + * Pin : Pin Identification + * InOut : GPIO_OUT/1 as Output + * GPIO_IN/0 as Input + */ +EFI_STATUS +EFIAPI +GpioModeConfig ( + UINT8 Pin, + UINTN Mode + ); + +/* + * Setup a controller that to be used in runtime service. + * Input: + * Pin: Pin belongs to the controller. + * return: 0 for success. + * Otherwise, error code. + */ +EFI_STATUS +EFIAPI +GpioSetupRuntime ( + IN UINT32 Pin + ); + +#endif /* GPIO_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c new file mode 100644 index 000000000000..dbb53f7d57d2 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c @@ -0,0 +1,314 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiDxe.h> +#include <Uefi.h> + +#include <Library/DebugLib.h> +#include <Library/GpioLib.h> +#include <Library/DxeServicesTableLib.h> +#include <Library/IoLib.h> +#include <Library/TimerLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeLib.h> +#include <Platform/Ac01.h> + +/* Runtime needs to be 64K alignment */ +#define RUNTIME_ADDRESS_MASK (~(SIZE_64KB - 1)) +#define RUNTIME_ADDRESS_LENGTH SIZE_64KB + +#define GPIO_MUX_VAL(Gpio) (0x00000001 << (Gpio)) +#define GPIO_IN 0 +#define GPIO_OUT 1 + +/* Address GPIO_REG Registers */ +#define GPIO_SWPORTA_DR_ADDR 0x00000000 +#define GPIO_SWPORTA_DDR_ADDR 0x00000004 +#define GPIO_EXT_PORTA_ADDR 0x00000050 + +STATIC UINT64 GpioBaseAddr[] = { GPIO_DWAPB_BASE_ADDR }; +STATIC UINT64 GpiBaseAddr[] = { GPI_DWAPB_BASE_ADDR }; +STATIC BOOLEAN GpioRuntimeEnableArray[sizeof (GpioBaseAddr) / sizeof (GpioBaseAddr[0])] = { FALSE }; +STATIC EFI_EVENT mVirtualAddressChangeEvent = NULL; + +UINT64 +GetBaseAddr ( + IN UINT32 Pin + ) +{ + UINT32 NumberOfControllers = sizeof (GpioBaseAddr) / sizeof (GpioBaseAddr[0]); + UINT32 TotalPins = GPIO_DWAPB_PINS_PER_CONTROLLER * NumberOfControllers; + + if (NumberOfControllers == 0 || Pin >= TotalPins) { + return 0; + } + + return GpioBaseAddr[Pin / GPIO_DWAPB_PINS_PER_CONTROLLER]; +} + +VOID +GpioWrite ( + IN UINT64 Base, + IN UINT32 Val + ) +{ + MmioWrite32 ((UINTN)Base, Val); +} + +VOID +GpioRead ( + IN UINT64 Base, + OUT UINT32 *Val + ) +{ + ASSERT (Val != NULL); + *Val = MmioRead32 (Base); +} + +VOID +EFIAPI +GpioWriteBit ( + IN UINT32 Pin, + IN UINT32 Val + ) +{ + UINT64 Reg; + UINT32 GpioPin; + UINT32 ReadVal; + + Reg = GetBaseAddr (Pin); + if (Reg == 0) { + return; + } + + GpioPin = Pin % GPIO_DWAPB_PINS_PER_CONTROLLER; + + Reg += GPIO_SWPORTA_DR_ADDR; + GpioRead (Reg, &ReadVal); + + if (Val != 0) { + GpioWrite (Reg, ReadVal | GPIO_MUX_VAL (GpioPin)); + } else { + GpioWrite (Reg, ReadVal & ~GPIO_MUX_VAL (GpioPin)); + } +} + +UINTN +EFIAPI +GpioReadBit ( + IN UINT32 Pin + ) +{ + UINT64 Reg; + UINT32 Val; + UINT32 GpioPin; + UINT8 Index; + UINT32 MaxIndex; + + Reg = GetBaseAddr (Pin); + if (Reg == 0) { + return 0; + } + + GpioPin = Pin % GPIO_DWAPB_PINS_PER_CONTROLLER; + + /* Check if a base address is GPI */ + MaxIndex = sizeof (GpiBaseAddr) / sizeof (GpiBaseAddr[0]); + for (Index = 0; Index < MaxIndex; Index++) { + if (Reg == GpiBaseAddr[Index]) { + break; + } + } + if (Index == MaxIndex) { + /* Only GPIO has GPIO_EXT_PORTA register, not for GPI */ + Reg += GPIO_EXT_PORTA_ADDR; + } + + GpioRead (Reg, &Val); + + return Val & GPIO_MUX_VAL (GpioPin) ? 1 : 0; +} + +EFI_STATUS +GpioConfig ( + IN UINT32 Pin, + IN UINT32 InOut + ) +{ + INTN GpioPin; + UINT32 Val; + UINT64 Reg; + + /* + * Caculate GPIO Pin Number for Direction Register + * GPIO_SWPORTA_DDR for GPIO[31...0] + * GPIO_SWPORTB_DDR for GPIO[51...32] + */ + + Reg = GetBaseAddr (Pin); + if (Reg == 0) { + return EFI_UNSUPPORTED; + } + + Reg += GPIO_SWPORTA_DDR_ADDR; + GpioPin = Pin % GPIO_DWAPB_PINS_PER_CONTROLLER; + GpioRead (Reg, &Val); + + if (InOut == GPIO_OUT) { + Val |= GPIO_MUX_VAL (GpioPin); + } else { + Val &= ~GPIO_MUX_VAL (GpioPin); + } + GpioWrite (Reg, Val); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +GpioModeConfig ( + UINT8 Pin, + UINTN Mode + ) +{ + UINT32 NumberOfControllers = sizeof (GpioBaseAddr) / sizeof (UINT64); + UINT32 NumersOfPins = NumberOfControllers * GPIO_DWAPB_PINS_PER_CONTROLLER; + UINT32 Delay = 10; + + if (Mode < GPIO_CONFIG_OUT_LOW + || Mode >= MAX_GPIO_CONFIG_MODE + || Pin > NumersOfPins - 1 + || Pin < 0) + { + return EFI_INVALID_PARAMETER; + } + + switch (Mode) { + case GPIO_CONFIG_OUT_LOW: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 0); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output low\n", Pin)); + break; + + case GPIO_CONFIG_OUT_HI: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 1); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output high\n", Pin)); + break; + + case GPIO_CONFIG_OUT_LOW_TO_HIGH: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 0); + MicroSecondDelay (1000 * Delay); + GpioWriteBit (Pin, 1); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output low->high\n", Pin)); + break; + + case GPIO_CONFIG_OUT_HIGH_TO_LOW: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 1); + MicroSecondDelay (1000 * Delay); + GpioWriteBit (Pin, 0); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output high->low\n", Pin)); + break; + + case GPIO_CONFIG_IN: + GpioConfig (Pin, GPIO_IN); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as input\n", Pin)); + break; + + default: + break; + } + + return EFI_SUCCESS; +} + +/** + * Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. + * + * This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. + * It convers pointer to new virtual address. + * + * @param Event Event whose notification function is being invoked. + * @param Context Pointer to the notification function's context. + */ +VOID +EFIAPI +GpioVirtualAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + UINTN Count; + + EfiConvertPointer (0x0, (VOID **)&GpioBaseAddr); + for (Count = 0; Count < sizeof (GpioBaseAddr) / sizeof (GpioBaseAddr[0]); Count++) { + if (!GpioRuntimeEnableArray[Count]) { + continue; + } + EfiConvertPointer (0x0, (VOID **)&GpioBaseAddr[Count]); + } +} + +/** + Setup a controller that to be used in runtime service. + + @Bus: Bus ID. + @return: 0 for success. + Otherwise, error code. + **/ +EFI_STATUS +EFIAPI +GpioSetupRuntime ( + IN UINT32 Pin + ) +{ + EFI_STATUS Status; + EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor; + + if (GetBaseAddr (Pin) == 0) { + return EFI_INVALID_PARAMETER; + } + + if (mVirtualAddressChangeEvent == NULL) { + /* + * Register for the virtual address change event + */ + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + GpioVirtualAddressChangeEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mVirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + } + + Status = gDS->GetMemorySpaceDescriptor ( + GetBaseAddr (Pin) & RUNTIME_ADDRESS_MASK, + &Descriptor + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gDS->SetMemorySpaceAttributes ( + GetBaseAddr (Pin) & RUNTIME_ADDRESS_MASK, + RUNTIME_ADDRESS_LENGTH, + Descriptor.Attributes | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + return Status; + } + + GpioRuntimeEnableArray[Pin / GPIO_DWAPB_PINS_PER_CONTROLLER] = TRUE; + + return Status; +} -- 2.17.1
|
|
[PATCH v3 05/28] AmpereAltraPkg: Add DwI2cLib library
Nhi Pham
From: Vu Nguyen <vunguyen@os.amperecomputing.com>
The DwI2cLib library provides basic functions to control the I2C controller on Ampere Altra processor. Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Vu Nguyen <vunguyen@os.amperecomputing.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com> --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf | 38 + Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h | 100 +++ Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c | 883 ++++++++++++++++++++ 4 files changed, 1024 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec index 73097afaf841..8be6a329bb26 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -28,6 +28,9 @@ [LibraryClasses] ## @libraryclass Defines a set of methods to communicate with SCP. SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h + ## @libraryclass Defines a set of methods to read/write to I2C devices. + I2cLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h + ## @libraryclass Defines a set of methods to communicate with secure parition over MM interface. MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf new file mode 100644 index 000000000000..091f5f9b310c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf @@ -0,0 +1,38 @@ +## @file +# Component description for DwI2cLib library for the Designware I2C controller. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = DwI2cLib + FILE_GUID = 222609E2-C181-11E6-A4A6-CEC0C932CE01 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = I2cLib + CONSTRUCTOR = I2cLibConstructor + +[Sources] + DwI2cLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + HobLib + IoLib + TimerLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + gPlatformHobGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h new file mode 100644 index 000000000000..f13794171029 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h @@ -0,0 +1,100 @@ +/** @file + Library implementation for the Designware I2C controller. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef I2C_LIB_H_ +#define I2C_LIB_H_ + +#include <Uefi/UefiBaseType.h> + +/** + Write to I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in,out] Buf Buffer that holds data to write. + @param[in,out] WriteLength Pointer to length of buffer. + + @return EFI_SUCCESS Write successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + +**/ +EFI_STATUS +EFIAPI +I2cWrite ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN OUT UINT8 *Buf, + IN OUT UINT32 *WriteLength + ); + +/** + Read data from I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in] BufCmd Buffer where to send the command. + @param[in] CmdLength Pointer to length of BufCmd. + @param[in,out] Buf Buffer where to put the read data to. + @param[in,out] ReadLength Pointer to length of buffer. + + @return EFI_SUCCESS Read successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + @return EFI_CRC_ERROR There are errors on receiving data. + +**/ +EFI_STATUS +EFIAPI +I2cRead ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN UINT8 *BufCmd, + IN UINT32 CmdLength, + IN OUT UINT8 *Buf, + IN OUT UINT32 *ReadLength + ); + +/** + Setup new transaction with I2C slave device. + + @param[in] Bus I2C bus Id. + @param[in] BusSpeed I2C bus speed in Hz. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +I2cProbe ( + IN UINT32 Bus, + IN UINTN BusSpeed + ); + +/** + Setup a bus that to be used in runtime service. + + @param[in] Bus I2C bus Id. + + @retval EFI_SUCCESS Success. + @retval Otherwise Error code. + +**/ +EFI_STATUS +EFIAPI +I2cSetupRuntime ( + IN UINT32 Bus + ); + +#endif /* I2C_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c new file mode 100644 index 000000000000..ca89863aec69 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c @@ -0,0 +1,883 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiDxe.h> +#include <Uefi.h> + +#include <Guid/PlatformInfoHobGuid.h> +#include <Library/DebugLib.h> +#include <Library/DxeServicesTableLib.h> +#include <Library/HobLib.h> +#include <Library/I2cLib.h> +#include <Library/IoLib.h> +#include <Library/TimerLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeLib.h> +#include <PlatformInfoHob.h> + +#define I2cSync() { asm volatile ("dmb ish" : : : "memory"); } + +// +// Runtime needs to be 64K alignment +// +#define RUNTIME_ADDRESS_MASK (~(SIZE_64KB - 1)) +#define RUNTIME_ADDRESS_LENGTH SIZE_64KB + +// +// Private I2C bus data +// +typedef struct { + UINTN Base; + UINT32 BusSpeed; + UINT32 RxFifo; + UINT32 TxFifo; + UINT32 PollingTime; + UINT32 Enabled; +} DW_I2C_CONTEXT_T; + +// +// I2C SCL counter macros +// +typedef enum { + I2cSpeedModeStandard = 0, + I2cSpeedModeFast, +} I2C_SPEED_MODE; + +#define DW_I2C_MAXIMUM_SPEED_HZ 400000 + +typedef enum { + I2cSclSpkLen = 0, + I2cSclHcnt, + I2cSclLcnt, +} I2C_SCL_PARAM; + +STATIC UINT32 I2cSclParam[][3] = { + /* SPK_LEN, HCNT, LCNT */ + [I2cSpeedModeStandard] = { 10, 0x3E2, 0x47D }, // SS (Standard Speed) + [I2cSpeedModeFast] = { 10, 0xA4, 0x13F }, // FS (Fast Speed) +}; + +STATIC BOOLEAN mI2cRuntimeEnableArray[MAX_PLATFORM_I2C_BUS_NUM] = {FALSE}; +STATIC UINTN mI2cBaseArray[MAX_PLATFORM_I2C_BUS_NUM] = {PLATFORM_I2C_REGISTER_BASE}; +STATIC DW_I2C_CONTEXT_T mI2cBusList[MAX_PLATFORM_I2C_BUS_NUM]; +STATIC UINTN mI2cClock = 0; +STATIC EFI_EVENT mVirtualAddressChangeEvent = NULL; + +// +// Registers +// +#define DW_IC_CON 0x0 +#define DW_IC_CON_MASTER BIT0 +#define DW_IC_CON_SPEED_STD BIT1 +#define DW_IC_CON_SPEED_FAST BIT2 +#define DW_IC_CON_10BITADDR_MASTER BIT4 +#define DW_IC_CON_RESTART_EN BIT5 +#define DW_IC_CON_SLAVE_DISABLE BIT6 +#define DW_IC_TAR 0x4 +#define DW_IC_TAR_10BITS BIT12 +#define DW_IC_SAR 0x8 +#define DW_IC_DATA_CMD 0x10 +#define DW_IC_DATA_CMD_RESTART BIT10 +#define DW_IC_DATA_CMD_STOP BIT9 +#define DW_IC_DATA_CMD_CMD BIT8 +#define DW_IC_DATA_CMD_DAT_MASK 0xFF +#define DW_IC_SS_SCL_HCNT 0x14 +#define DW_IC_SS_SCL_LCNT 0x18 +#define DW_IC_FS_SCL_HCNT 0x1c +#define DW_IC_FS_SCL_LCNT 0x20 +#define DW_IC_HS_SCL_HCNT 0x24 +#define DW_IC_HS_SCL_LCNT 0x28 +#define DW_IC_INTR_STAT 0x2c +#define DW_IC_INTR_MASK 0x30 +#define DW_IC_INTR_RX_UNDER BIT0 +#define DW_IC_INTR_RX_OVER BIT1 +#define DW_IC_INTR_RX_FULL BIT2 +#define DW_IC_INTR_TX_EMPTY BIT4 +#define DW_IC_INTR_TX_ABRT BIT6 +#define DW_IC_INTR_ACTIVITY BIT8 +#define DW_IC_INTR_STOP_DET BIT9 +#define DW_IC_INTR_START_DET BIT10 +#define DW_IC_ERR_CONDITION \ + (DW_IC_INTR_RX_UNDER | DW_IC_INTR_RX_OVER | DW_IC_INTR_TX_ABRT) +#define DW_IC_RAW_INTR_STAT 0x34 +#define DW_IC_CLR_INTR 0x40 +#define DW_IC_CLR_RX_UNDER 0x44 +#define DW_IC_CLR_RX_OVER 0x48 +#define DW_IC_CLR_TX_ABRT 0x54 +#define DW_IC_CLR_ACTIVITY 0x5c +#define DW_IC_CLR_STOP_DET 0x60 +#define DW_IC_CLR_START_DET 0x64 +#define DW_IC_ENABLE 0x6c +#define DW_IC_STATUS 0x70 +#define DW_IC_STATUS_ACTIVITY BIT0 +#define DW_IC_STATUS_TFE BIT2 +#define DW_IC_STATUS_RFNE BIT3 +#define DW_IC_STATUS_MST_ACTIVITY BIT5 +#define DW_IC_TXFLR 0x74 +#define DW_IC_RXFLR 0x78 +#define DW_IC_SDA_HOLD 0x7c +#define DW_IC_TX_ABRT_SOURCE 0x80 +#define DW_IC_ENABLE_STATUS 0x9c +#define DW_IC_COMP_PARAM_1 0xf4 +#define DW_IC_COMP_PARAM_1_RX_BUFFER_DEPTH(x) \ + ((((x) >> 8) & 0xFF) + 1) +#define DW_IC_COMP_PARAM_1_TX_BUFFER_DEPTH(x) \ + ((((x) >> 16) & 0xFF) + 1) +#define DW_IC_COMP_TYPE 0xfc +#define SB_DW_IC_CON 0xa8 +#define SB_DW_IC_SCL_TMO_CNT 0xac +#define SB_DW_IC_RX_PEC 0xb0 +#define SB_DW_IC_ACK 0xb4 +#define SB_DW_IC_FLG 0xb8 +#define SB_DW_IC_FLG_CLR 0xbc +#define SB_DW_IC_INTR_STAT 0xc0 +#define SB_DW_IC_INTR_STAT_MASK 0xc4 +#define SB_DW_IC_DEBUG_SEL 0xec +#define SB_DW_IC_ACK_DEBUG 0xf0 +#define DW_IC_FS_SPKLEN 0xa0 +#define DW_IC_HS_SPKLEN 0xa4 + +// +// Timeout interval +// +// The interval is equal to the 10 times the signaling period +// for the highest I2C transfer speed used in the system. +// +#define DW_POLL_INTERVAL_US(x) (10 * (1000000 / (x))) + +// +// Maximum timeout count +// +#define DW_MAX_TRANSFER_POLL_COUNT 100000 // Maximum timeout: 10s +#define DW_MAX_STATUS_POLL_COUNT 100 + +#define DW_POLL_MST_ACTIVITY_INTERVAL_US 1000 // 1ms +#define DW_MAX_MST_ACTIVITY_POLL_COUNT 20 + +/** + Initialize I2C Bus + **/ +VOID +I2cHWInit ( + UINT32 Bus + ) +{ + UINT32 Param; + + mI2cBusList[Bus].Base = mI2cBaseArray[Bus]; + + Param = MmioRead32 (mI2cBusList[Bus].Base + DW_IC_COMP_PARAM_1); + + mI2cBusList[Bus].PollingTime = DW_POLL_INTERVAL_US (mI2cBusList[Bus].BusSpeed); + mI2cBusList[Bus].RxFifo = DW_IC_COMP_PARAM_1_RX_BUFFER_DEPTH (Param); + mI2cBusList[Bus].TxFifo = DW_IC_COMP_PARAM_1_TX_BUFFER_DEPTH (Param); + mI2cBusList[Bus].Enabled = 0; + + DEBUG ((DEBUG_VERBOSE, "%a: Bus %d, Rx_Buffer %d, Tx_Buffer %d\n", + __FUNCTION__, + Bus, + mI2cBusList[Bus].RxFifo, + mI2cBusList[Bus].TxFifo + )); +} + +/** + Enable or disable I2C Bus + */ +VOID +I2cEnable ( + UINT32 Bus, + UINT32 Enable + ) +{ + UINT32 I2cStatusCnt; + UINTN Base; + + Base = mI2cBusList[Bus].Base; + I2cStatusCnt = DW_MAX_STATUS_POLL_COUNT; + mI2cBusList[Bus].Enabled = Enable; + + MmioWrite32 (Base + DW_IC_ENABLE, Enable); + + do { + if ((MmioRead32 (Base + DW_IC_ENABLE_STATUS) & 0x01) == Enable) { + break; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } while (I2cStatusCnt-- != 0); + + if (I2cStatusCnt == 0) { + DEBUG ((DEBUG_ERROR, "%a: Enable/disable timeout\n", __FUNCTION__)); + } + + if ((Enable == 0) || (I2cStatusCnt == 0)) { + /* Unset the target adddress */ + MmioWrite32 (Base + DW_IC_TAR, 0); + mI2cBusList[Bus].Enabled = 0; + } +} + +/** + Setup Slave address + **/ +VOID +I2cSetSlaveAddr ( + UINT32 Bus, + UINT32 SlaveAddr + ) +{ + UINTN Base; + UINT32 OldEnableStatus; + + Base = mI2cBusList[Bus].Base; + OldEnableStatus = mI2cBusList[Bus].Enabled; + + I2cEnable (Bus, 0); + MmioWrite32 (Base + DW_IC_TAR, SlaveAddr); + if (OldEnableStatus != 0) { + I2cEnable (Bus, 1); + } +} + +/** + Check for errors on I2C Bus + **/ +UINT32 +I2cCheckErrors ( + UINT32 Bus + ) +{ + UINTN Base; + UINT32 ErrorStatus; + + Base = mI2cBusList[Bus].Base; + + ErrorStatus = MmioRead32 (Base + DW_IC_RAW_INTR_STAT) & DW_IC_ERR_CONDITION; + + if ((ErrorStatus & DW_IC_INTR_RX_UNDER) != 0) { + DEBUG ((DEBUG_ERROR, "%a: RX_UNDER error on i2c bus %d error status %08x\n", + __FUNCTION__, + Bus, + ErrorStatus + )); + MmioRead32 (Base + DW_IC_CLR_RX_UNDER); + } + + if ((ErrorStatus & DW_IC_INTR_RX_OVER) != 0) { + DEBUG ((DEBUG_ERROR, "%a: RX_OVER error on i2c bus %d error status %08x\n", + __FUNCTION__, + Bus, + ErrorStatus + )); + MmioRead32 (Base + DW_IC_CLR_RX_OVER); + } + + if ((ErrorStatus & DW_IC_INTR_TX_ABRT) != 0) { + DEBUG ((DEBUG_VERBOSE, "%a: TX_ABORT at source %08x\n", + __FUNCTION__, + MmioRead32 (Base + DW_IC_TX_ABRT_SOURCE) + )); + MmioRead32 (Base + DW_IC_CLR_TX_ABRT); + } + + return ErrorStatus; +} + +/** + Waiting for bus to not be busy + **/ +BOOLEAN +I2cWaitBusNotBusy ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base = mI2cBusList[Bus].Base; + PollCount = DW_MAX_MST_ACTIVITY_POLL_COUNT; + + while ((MmioRead32 (Base + DW_IC_STATUS) & DW_IC_STATUS_MST_ACTIVITY) != 0) { + if (PollCount == 0) { + DEBUG ((DEBUG_VERBOSE, "%a: Timeout while waiting for bus ready\n", __FUNCTION__)); + return FALSE; + } + PollCount--; + /* + * A delay isn't absolutely necessary. + * But to ensure that we don't hammer the bus constantly, + * delay for DW_POLL_MST_ACTIVITY_INTERVAL_US as with other implementation. + */ + MicroSecondDelay (DW_POLL_MST_ACTIVITY_INTERVAL_US); + } + + return TRUE; +} + +/** + Waiting for TX FIFO buffer available + **/ +EFI_STATUS +I2cWaitTxData ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base = mI2cBusList[Bus].Base; + PollCount = 0; + + while (MmioRead32 (Base + DW_IC_TXFLR) == mI2cBusList[Bus].TxFifo) { + if (PollCount++ >= DW_MAX_TRANSFER_POLL_COUNT) { + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for TX buffer available\n", __FUNCTION__)); + return EFI_TIMEOUT; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } + + return EFI_SUCCESS; +} + +/** + Waiting for RX FIFO buffer available + **/ +EFI_STATUS +I2cWaitRxData ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base = mI2cBusList[Bus].Base; + PollCount = 0; + + while ((MmioRead32 (Base + DW_IC_STATUS) & DW_IC_STATUS_RFNE) == 0) { + if (PollCount++ >= DW_MAX_TRANSFER_POLL_COUNT) { + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for RX buffer available\n", __FUNCTION__)); + return EFI_TIMEOUT; + } + + if ((I2cCheckErrors (Bus) & DW_IC_INTR_TX_ABRT) != 0) { + return EFI_ABORTED; + } + + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } + + return EFI_SUCCESS; +} + +/** + Initialize the Designware I2C SCL Counts + + This functions configures SCL clock Count for Standard Speed (SS) and Fast Speed (FS) mode. + **/ +VOID +I2cSclInit ( + UINT32 Bus, + UINT32 I2cClkFreq, + UINT32 I2cSpeed + ) +{ + UINT16 IcCon; + UINTN Base; + UINT32 I2cSpeedKhz; + + Base = mI2cBusList[Bus].Base; + I2cSpeedKhz = I2cSpeed / 1000; + + DEBUG ((DEBUG_VERBOSE, "%a: Bus %d I2cClkFreq %d I2cSpeed %d\n", + __FUNCTION__, + Bus, + I2cClkFreq, + I2cSpeed + )); + + IcCon = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE | DW_IC_CON_RESTART_EN; + + if (I2cSpeedKhz <= 100) { + IcCon |= DW_IC_CON_SPEED_STD; + // Standard speed mode + MmioWrite32 (Base + DW_IC_FS_SPKLEN, I2cSclParam[I2cSpeedModeStandard][I2cSclSpkLen]); + MmioWrite32 (Base + DW_IC_SS_SCL_HCNT, I2cSclParam[I2cSpeedModeStandard][I2cSclHcnt]); + MmioWrite32 (Base + DW_IC_SS_SCL_LCNT, I2cSclParam[I2cSpeedModeStandard][I2cSclLcnt]); + } else if (I2cSpeedKhz > 100 && I2cSpeedKhz <= 400) { + IcCon |= DW_IC_CON_SPEED_FAST; + // Fast speed mode + MmioWrite32 (Base + DW_IC_FS_SPKLEN, I2cSclParam[I2cSpeedModeFast][I2cSclSpkLen]); + MmioWrite32 (Base + DW_IC_FS_SCL_HCNT, I2cSclParam[I2cSpeedModeFast][I2cSclHcnt]); + MmioWrite32 (Base + DW_IC_FS_SCL_LCNT, I2cSclParam[I2cSpeedModeFast][I2cSclLcnt]); + } + MmioWrite32 (Base + DW_IC_CON, IcCon); +} + +/** + Initialize the designware i2c master hardware + **/ +EFI_STATUS +I2cInit ( + UINT32 Bus, + UINTN BusSpeed + ) +{ + UINTN Base; + + ASSERT (mI2cClock != 0); + + mI2cBusList[Bus].BusSpeed = BusSpeed; + I2cHWInit (Bus); + + Base = mI2cBusList[Bus].Base; + + /* Disable the adapter and interrupt */ + I2cEnable (Bus, 0); + MmioWrite32 (Base + DW_IC_INTR_MASK, 0); + + /* Set standard and fast speed divider for high/low periods */ + I2cSclInit (Bus, mI2cClock, BusSpeed); + MmioWrite32 (Base + DW_IC_SDA_HOLD, 0x4b); + + return EFI_SUCCESS; +} + +/** + Wait the transaction finished + **/ +EFI_STATUS +I2cFinish ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base = mI2cBusList[Bus].Base; + PollCount = 0; + + /* Wait for TX FIFO empty */ + do { + if ((MmioRead32 (Base + DW_IC_STATUS) & DW_IC_STATUS_TFE) != 0) { + break; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } while (PollCount++ < DW_MAX_TRANSFER_POLL_COUNT); + + if (PollCount >= DW_MAX_TRANSFER_POLL_COUNT) { + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for TX FIFO empty\n", __FUNCTION__)); + return EFI_TIMEOUT; + } + + /* Wait for STOP signal detected on the bus */ + PollCount = 0; + do { + if ((MmioRead32 (Base + DW_IC_RAW_INTR_STAT) & DW_IC_INTR_STOP_DET) != 0) { + MmioRead32 (Base + DW_IC_CLR_STOP_DET); + return EFI_SUCCESS; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } while (PollCount++ < DW_MAX_TRANSFER_POLL_COUNT); + + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for transaction finished\n", __FUNCTION__)); + return EFI_TIMEOUT; +} + +EFI_STATUS +InternalI2cWrite ( + UINT32 Bus, + UINT8 *Buf, + UINT32 *Length + ) +{ + EFI_STATUS Status; + UINTN WriteCount; + UINTN Base; + + Status = EFI_SUCCESS; + Base = mI2cBusList[Bus].Base; + + DEBUG ((DEBUG_VERBOSE, "%a: Write Bus %d Buf %p Length %d\n", + __FUNCTION__, + Bus, + Buf, + *Length + )); + I2cEnable (Bus, 1); + + WriteCount = 0; + while ((*Length - WriteCount) != 0) { + Status = I2cWaitTxData (Bus); + if (EFI_ERROR (Status)) { + MmioWrite32 (Base + DW_IC_DATA_CMD, DW_IC_DATA_CMD_STOP); + I2cSync (); + goto Exit; + } + + if (WriteCount == *Length - 1) { + MmioWrite32 ( + Base + DW_IC_DATA_CMD, + (Buf[WriteCount] & DW_IC_DATA_CMD_DAT_MASK) | DW_IC_DATA_CMD_STOP + ); + } else { + MmioWrite32 ( + Base + DW_IC_DATA_CMD, + Buf[WriteCount] & DW_IC_DATA_CMD_DAT_MASK + ); + } + I2cSync (); + WriteCount++; + } + +Exit: + *Length = WriteCount; + I2cFinish (Bus); + I2cWaitBusNotBusy (Bus); + I2cEnable (Bus, 0); + + return Status; +} + +EFI_STATUS +InternalI2cRead ( + UINT32 Bus, + UINT8 *BufCmd, + UINT32 CmdLength, + UINT8 *Buf, + UINT32 *Length + ) +{ + EFI_STATUS Status; + UINTN Base; + UINT32 CmdSend; + UINT32 TxLimit, RxLimit; + UINTN Idx; + UINTN Count; + UINTN ReadCount; + UINTN WriteCount; + + Status = EFI_SUCCESS; + Base = mI2cBusList[Bus].Base; + Count = 0; + ReadCount = 0; + + DEBUG ((DEBUG_VERBOSE, "%a: Read Bus %d Buf %p Length:%d\n", + __FUNCTION__, + Bus, + Buf, + *Length + )); + + I2cEnable (Bus, 1); + + /* Write command data */ + WriteCount = 0; + while (CmdLength != 0) { + TxLimit = mI2cBusList[Bus].TxFifo - MmioRead32 (Base + DW_IC_TXFLR); + Count = CmdLength > TxLimit ? TxLimit : CmdLength; + + for (Idx = 0; Idx < Count; Idx++ ) { + CmdSend = BufCmd[WriteCount++] & DW_IC_DATA_CMD_DAT_MASK; + MmioWrite32 (Base + DW_IC_DATA_CMD, CmdSend); + I2cSync (); + + if (I2cCheckErrors (Bus) != 0) { + Status = EFI_CRC_ERROR; + goto Exit; + } + CmdLength--; + } + + Status = I2cWaitTxData (Bus); + if (EFI_ERROR (Status)) { + MmioWrite32 (Base + DW_IC_DATA_CMD, DW_IC_DATA_CMD_STOP); + I2cSync (); + goto Exit; + } + } + + WriteCount = 0; + while ((*Length - ReadCount) != 0) { + TxLimit = mI2cBusList[Bus].TxFifo - MmioRead32 (Base + DW_IC_TXFLR); + RxLimit = mI2cBusList[Bus].RxFifo - MmioRead32 (Base + DW_IC_RXFLR); + Count = *Length - ReadCount; + Count = Count > RxLimit ? RxLimit : Count; + Count = Count > TxLimit ? TxLimit : Count; + + for (Idx = 0; Idx < Count; Idx++ ) { + CmdSend = DW_IC_DATA_CMD_CMD; + if (WriteCount == *Length - 1) { + CmdSend |= DW_IC_DATA_CMD_STOP; + } + MmioWrite32 (Base + DW_IC_DATA_CMD, CmdSend); + I2cSync (); + WriteCount++; + + if (I2cCheckErrors (Bus) != 0) { + DEBUG ((DEBUG_VERBOSE, + "%a: Sending reading command remaining length %d CRC error\n", + __FUNCTION__, + *Length + )); + Status = EFI_CRC_ERROR; + goto Exit; + } + } + + for (Idx = 0; Idx < Count; Idx++ ) { + Status = I2cWaitRxData (Bus); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_VERBOSE, + "%a: Reading remaining length %d failed to wait data\n", + __FUNCTION__, + *Length + )); + + if (Status != EFI_ABORTED) { + MmioWrite32 (Base + DW_IC_DATA_CMD, DW_IC_DATA_CMD_STOP); + I2cSync (); + } + + goto Exit; + } + + Buf[ReadCount++] = MmioRead32 (Base + DW_IC_DATA_CMD) & DW_IC_DATA_CMD_DAT_MASK; + I2cSync (); + + if (I2cCheckErrors (Bus) != 0) { + DEBUG ((DEBUG_VERBOSE, "%a: Reading remaining length %d CRC error\n", + __FUNCTION__, + *Length + )); + Status = EFI_CRC_ERROR; + goto Exit; + } + } + } + +Exit: + *Length = ReadCount; + I2cFinish (Bus); + I2cWaitBusNotBusy (Bus); + I2cEnable (Bus, 0); + + return Status; +} + +/** + Write to I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in,out] Buf Buffer that holds data to write. + @param[in,out] WriteLength Pointer to length of buffer. + + @return EFI_SUCCESS Write successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + +**/ +EFI_STATUS +EFIAPI +I2cWrite ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN OUT UINT8 *Buf, + IN OUT UINT32 *WriteLength + ) +{ + if (Bus >= MAX_PLATFORM_I2C_BUS_NUM + || Buf == NULL + || WriteLength == NULL) + { + return EFI_INVALID_PARAMETER; + } + + I2cSetSlaveAddr (Bus, SlaveAddr); + + return InternalI2cWrite (Bus, Buf, WriteLength); +} + +/** + Read data from I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in] BufCmd Buffer where to send the command. + @param[in] CmdLength Pointer to length of BufCmd. + @param[in,out] Buf Buffer where to put the read data to. + @param[in,out] ReadLength Pointer to length of buffer. + + @return EFI_SUCCESS Read successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + @return EFI_CRC_ERROR There are errors on receiving data. + +**/ +EFI_STATUS +EFIAPI +I2cRead ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN UINT8 *BufCmd, + IN UINT32 CmdLength, + IN OUT UINT8 *Buf, + IN OUT UINT32 *ReadLength + ) +{ + if (Bus >= MAX_PLATFORM_I2C_BUS_NUM + || Buf == NULL + || ReadLength == NULL) + { + return EFI_INVALID_PARAMETER; + } + + I2cSetSlaveAddr (Bus, SlaveAddr); + + return InternalI2cRead (Bus, BufCmd, CmdLength, Buf, ReadLength); +} + +/** + Setup new transaction with I2C slave device. + + @param[in] Bus I2C bus Id. + @param[in] BusSpeed I2C bus speed in Hz. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +I2cProbe ( + IN UINT32 Bus, + IN UINTN BusSpeed + ) +{ + if (Bus >= MAX_PLATFORM_I2C_BUS_NUM + || BusSpeed > DW_I2C_MAXIMUM_SPEED_HZ) + { + return EFI_INVALID_PARAMETER; + } + + return I2cInit (Bus, BusSpeed); +} + +/** + * Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. + * + * This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. + * It convers pointer to new virtual address. + * + * @param Event Event whose notification function is being invoked. + * @param Context Pointer to the notification function's context. + */ +VOID +EFIAPI +I2cVirtualAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + UINTN Count; + + EfiConvertPointer (0x0, (VOID **)&mI2cBusList); + EfiConvertPointer (0x0, (VOID **)&mI2cBaseArray); + EfiConvertPointer (0x0, (VOID **)&mI2cClock); + for (Count = 0; Count < MAX_PLATFORM_I2C_BUS_NUM; Count++) { + if (!mI2cRuntimeEnableArray[Count]) { + continue; + } + EfiConvertPointer (0x0, (VOID **)&mI2cBaseArray[Count]); + EfiConvertPointer (0x0, (VOID **)&mI2cBusList[Count].Base); + } +} + +/** + Setup a bus that to be used in runtime service. + + @param[in] Bus I2C bus Id. + + @retval EFI_SUCCESS Success. + @retval Otherwise Error code. + +**/ +EFI_STATUS +EFIAPI +I2cSetupRuntime ( + IN UINT32 Bus + ) +{ + EFI_STATUS Status; + EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor; + + if (Bus >= MAX_PLATFORM_I2C_BUS_NUM) { + return EFI_INVALID_PARAMETER; + } + + if (mVirtualAddressChangeEvent == NULL) { + /* + * Register for the virtual address change event + */ + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + I2cVirtualAddressChangeEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mVirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + } + + Status = gDS->GetMemorySpaceDescriptor ( + mI2cBaseArray[Bus] & RUNTIME_ADDRESS_MASK, + &Descriptor + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gDS->SetMemorySpaceAttributes ( + mI2cBaseArray[Bus] & RUNTIME_ADDRESS_MASK, + RUNTIME_ADDRESS_LENGTH, + Descriptor.Attributes | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + return Status; + } + + mI2cRuntimeEnableArray[Bus] = TRUE; + + return Status; +} + +EFI_STATUS +EFIAPI +I2cLibConstructor ( + VOID + ) +{ + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + /* Get I2C Clock from the Platform HOB */ + Hob = GetFirstGuidHob (&gPlatformHobGuid); + if (Hob == NULL) { + return EFI_NOT_FOUND; + } + PlatformHob = (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + mI2cClock = PlatformHob->AhbClk; + ASSERT (mI2cClock != 0); + + return EFI_SUCCESS; +} -- 2.17.1
|
|
[PATCH v3 04/28] AmperePlatformPkg: Add FailSafe and WDT support
Nhi Pham
The FailSafeDxe is a driver for the FailSafe feature which reverts the
system's configuration to known good values if the system fails to boot up multiple times. Also, this driver implements the Watchdog Timer Architectural Protocol to reset the system if it hangs, which is implemented by the MdeModulePkg/Universal/WatchdogTimerDxe module. So, the WDT is now used exclusively by the FailSafeDxe. By default, when system starts, it configures the secure watchdog timer with a default value of 5 minutes. If the system boots up cleanly to the considered good stage, the counter is cleared as it indicates FailSafe monitor (ATF) that has booted up successfully. If the timer expires, it is considered a failed boot and the system is rebooted. Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 1 - Platform/Ampere/JadePkg/Jade.dsc | 9 + Platform/Ampere/JadePkg/Jade.fdf | 6 +- Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf | 54 +++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h | 20 ++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h | 29 ++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.c | 184 ++++++++++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c | 357 ++++++++++++++++++++ 8 files changed, 658 insertions(+), 2 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 7dadf15b7825..89c143cd28e6 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -593,7 +593,6 @@ [Components.common] # Timer # ArmPkg/Drivers/TimerDxe/TimerDxe.inf - MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf # # ARM GIC Dxe diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc index 1e580b5c4904..0681835dd175 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -77,6 +77,11 @@ [LibraryClasses] # RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf + # + # Library for FailSafe support + # + FailSafeLib|Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.inf + ################################################################################ # # Specific Platform Pcds @@ -100,3 +105,7 @@ [PcdsFixedAtBuild.common] # ################################################################################ [Components.common] + # + # FailSafe and Watchdog Timer + # + Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jade.fdf index 905289844378..80a86d7c1156 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -185,7 +185,11 @@ [FV.FvMain] # Timer # INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf - INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + + # + # FailSafe and Watchdog Timer + # + INF Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf # # ARM GIC Dxe diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf new file mode 100644 index 000000000000..60de10c95c85 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf @@ -0,0 +1,54 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = FailSafeDxe + FILE_GUID = 7BC4F970-B1CF-11E6-80F5-76304DEC7EB7 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = FailSafeDxeEntryPoint + +[Sources] + FailSafe.h + FailSafeDxe.c + Watchdog.c + Watchdog.h + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmSmcLib + DebugLib + FailSafeLib + NVParamLib + PcdLib + TimerLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Pcd] + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogEl2IntrNum + +[Protocols] + gEfiWatchdogTimerArchProtocolGuid ## PRODUCES + gHardwareInterrupt2ProtocolGuid ## CONSUMES + +[Depex] + gHardwareInterrupt2ProtocolGuid diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h new file mode 100644 index 000000000000..8bf3a98f1d8e --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h @@ -0,0 +1,20 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef FAILSAFE_H_ +#define FAILSAFE_H_ + +#include <Uefi.h> + +BOOLEAN +EFIAPI +IsFailSafeOff ( + VOID + ); + +#endif /* FAILSAFE_H_ */ diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h new file mode 100644 index 000000000000..6c9106fdbea5 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h @@ -0,0 +1,29 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef GENERIC_WATCHDOG_H_ +#define GENERIC_WATCHDOG_H_ + +#include <Protocol/WatchdogTimer.h> + +/* The number of 100ns periods (the unit of time passed to these functions) + in a second */ +#define TIME_UNITS_PER_SECOND 10000000 + +/** + The function to install Watchdog timer protocol to the system + + @retval Return EFI_SUCCESS if install Watchdog timer protocol successfully. + **/ +EFI_STATUS +EFIAPI +WatchdogTimerInstallProtocol ( + EFI_WATCHDOG_TIMER_ARCH_PROTOCOL **WatchdogTimerProtocol + ); + +#endif /* GENERIC_WATCHDOG_H_ */ diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.c b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.c new file mode 100644 index 000000000000..4e4aab9e5353 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.c @@ -0,0 +1,184 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Guid/EventGroup.h> +#include <Library/ArmSmcLib.h> +#include <Library/BaseLib.h> +#include <Library/DebugLib.h> +#include <Library/FailSafeLib.h> +#include <Library/NVParamLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> + +#include "FailSafe.h" +#include "Watchdog.h" + +STATIC UINTN gWatchdogOSTimeout; +STATIC BOOLEAN gFailSafeOff; +STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer; + +EFI_STATUS +EFIAPI +FailSafeTestBootFailure ( + VOID + ); + +STATIC VOID +FailSafeTurnOff ( + VOID + ) +{ + EFI_STATUS Status; + + if (IsFailSafeOff ()) { + return; + } + + Status = FailSafeBootSuccessfully (); + ASSERT_EFI_ERROR (Status); + + gFailSafeOff = TRUE; + + /* Disable Watchdog timer */ + gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, 0); +} + +BOOLEAN +EFIAPI +IsFailSafeOff ( + VOID + ) +{ + return gFailSafeOff; +} + +/** + The function to disable Watchdog timer when enter Setup screen + **/ +VOID +WdtTimerEnterSetupScreenCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + /* Make sure FailSafe is turned off */ + FailSafeTurnOff (); +} + +/** + The function to refresh Watchdog timer in the event before booting + **/ +VOID +WdtTimerBeforeBootCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + /* + * At this point, the system is considered boot successfully to BIOS + */ + FailSafeTurnOff (); + + /* + * It is BIOS's responsibility to setup Watchdog when load an EFI application + * after this step + */ +} + +/** + The function to refresh Watchdog timer in the event before exiting boot services + **/ +VOID +WdtTimerExitBootServiceCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + + /* Enable Watchdog timer for OS booting */ + if (gWatchdogOSTimeout != 0) { + gWatchdogTimer->SetTimerPeriod ( + gWatchdogTimer, + gWatchdogOSTimeout * TIME_UNITS_PER_SECOND + ); + } else { + /* Disable Watchdog timer */ + gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, 0); + } +} + +/** + This function is a hook called when user loads the manufacturing + or optimal defaults. + + @param Defaults : (NVRAM_VARIABLE *)optimal or manufacturing + @Data : Messagebox + + @retval VOID +**/ +VOID +LoadNVRAMDefaultConfig ( + IN VOID *Defaults, + IN UINTN Data + ) +{ + NVParamClrAll (); +} + +/** + Main entry for this driver. + + @param ImageHandle Image handle this driver. + @param SystemTable Pointer to SystemTable. + + @retval EFI_SUCESS This function always complete successfully. + +**/ +EFI_STATUS +EFIAPI +FailSafeDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_EVENT ExitBootServicesEvent; + EFI_STATUS Status; + + gFailSafeOff = FALSE; + + FailSafeTestBootFailure (); + + /* We need to setup non secure Watchdog to ensure that the system will + * boot to OS successfully. + * + * The BIOS doesn't handle Watchdog interrupt so we expect WS1 asserted EL3 + * when Watchdog timeout triggered + */ + + Status = WatchdogTimerInstallProtocol (&gWatchdogTimer); + ASSERT_EFI_ERROR (Status); + + // We should register a callback function before entering to Setup screen + // rather than always call it at DXE phase. + FailSafeTurnOff (); + + /* Register event before exit boot services */ + Status = gBS->CreateEvent ( + EVT_SIGNAL_EXIT_BOOT_SERVICES, + TPL_NOTIFY, + WdtTimerExitBootServiceCallback, + NULL, + &ExitBootServicesEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c new file mode 100644 index 000000000000..34329d04206a --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c @@ -0,0 +1,357 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/ArmGenericTimerCounterLib.h> +#include <Library/ArmLib.h> +#include <Library/BaseLib.h> +#include <Library/DebugLib.h> +#include <Library/IoLib.h> +#include <Library/PcdLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> +#include <Protocol/HardwareInterrupt2.h> + +#include "FailSafe.h" +#include "Watchdog.h" + +/* Watchdog timer controller registers */ +#define WDT_CTRL_BASE_REG FixedPcdGet64 (PcdGenericWatchdogControlBase) +#define WDT_CTRL_WCS_OFF 0x0 +#define WDT_CTRL_WCS_ENABLE_MASK 0x1 +#define WDT_CTRL_WOR_OFF 0x8 +#define WDT_CTRL_WCV_OFF 0x10 +#define WS0_INTERRUPT_SOURCE FixedPcdGet32 (PcdGenericWatchdogEl2IntrNum) + +STATIC UINT64 mNumTimerTicks; +STATIC EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol; +BOOLEAN mInterruptWS0Enabled; + +STATIC +VOID +WatchdogTimerWriteOffsetRegister ( + UINT32 Value + ) +{ + MmioWrite32 (WDT_CTRL_BASE_REG + WDT_CTRL_WOR_OFF, Value); +} + +STATIC +VOID +WatchdogTimerWriteCompareRegister ( + UINT64 Value + ) +{ + MmioWrite64 (WDT_CTRL_BASE_REG + WDT_CTRL_WCV_OFF, Value); +} + +STATIC +EFI_STATUS +WatchdogTimerEnable ( + IN BOOLEAN Enable + ) +{ + UINT32 Val = MmioRead32 ((UINTN)(WDT_CTRL_BASE_REG + WDT_CTRL_WCS_OFF)); + + if (Enable) { + Val |= WDT_CTRL_WCS_ENABLE_MASK; + } else { + Val &= ~WDT_CTRL_WCS_ENABLE_MASK; + } + MmioWrite32 ((UINTN)(WDT_CTRL_BASE_REG + WDT_CTRL_WCS_OFF), Val); + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +WatchdogTimerSetup ( + VOID + ) +{ + EFI_STATUS Status; + + /* Disable Watchdog timer */ + WatchdogTimerEnable (FALSE); + + if (!mInterruptWS0Enabled) { + Status = mInterruptProtocol->EnableInterruptSource ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE + ); + ASSERT_EFI_ERROR (Status); + + mInterruptWS0Enabled = TRUE; + } + + if (mNumTimerTicks == 0) { + return EFI_SUCCESS; + } + + /* If the number of required ticks is greater than the max the Watchdog's + offset register (WOR) can hold, we need to manually compute and set + the compare register (WCV) */ + if (mNumTimerTicks > MAX_UINT32) { + /* We need to enable the Watchdog *before* writing to the compare register, + because enabling the Watchdog causes an "explicit refresh", which + clobbers the compare register (WCV). In order to make sure this doesn't + trigger an interrupt, set the offset to max. */ + WatchdogTimerWriteOffsetRegister (MAX_UINT32); + WatchdogTimerEnable (TRUE); + WatchdogTimerWriteCompareRegister (ArmGenericTimerGetSystemCount () + mNumTimerTicks); + } else { + WatchdogTimerWriteOffsetRegister ((UINT32)mNumTimerTicks); + WatchdogTimerEnable (TRUE); + } + + return EFI_SUCCESS; +} + + +/* This function is called when the Watchdog's first signal (WS0) goes high. + It uses the ResetSystem Runtime Service to reset the board. +*/ +VOID +EFIAPI +WatchdogTimerInterruptHandler ( + IN HARDWARE_INTERRUPT_SOURCE Source, + IN EFI_SYSTEM_CONTEXT SystemContext + ) +{ + STATIC CONST CHAR16 ResetString[]= L"The generic Watchdog timer ran out."; + + mInterruptProtocol->EndOfInterrupt (mInterruptProtocol, Source); + + if (!IsFailSafeOff ()) { + /* Not handling interrupt as ATF is monitoring it */ + return; + } + + WatchdogTimerEnable (FALSE); + + gRT->ResetSystem ( + EfiResetCold, + EFI_TIMEOUT, + StrSize (ResetString), + (VOID *)&ResetString + ); + + /* If we got here then the reset didn't work */ + ASSERT (FALSE); +} + +/** + This function registers the handler NotifyFunction so it is called every time + the Watchdog timer expires. It also passes the amount of time since the last + handler call to the NotifyFunction. + If NotifyFunction is not NULL and a handler is not already registered, + then the new handler is registered and EFI_SUCCESS is returned. + If NotifyFunction is NULL, and a handler is already registered, + then that handler is unregistered. + If an attempt is made to register a handler when a handler is already + registered, then EFI_ALREADY_STARTED is returned. + If an attempt is made to unregister a handler when a handler is not + registered, then EFI_INVALID_PARAMETER is returned. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param NotifyFunction The function to call when a timer interrupt fires. + This function executes at TPL_HIGH_LEVEL. The DXE + Core will register a handler for the timer interrupt, + so it can know how much time has passed. This + information is used to signal timer based events. + NULL will unregister the handler. + + @retval EFI_UNSUPPORTED The code does not support NotifyFunction. + +**/ +EFI_STATUS +EFIAPI +WatchdogTimerRegisterHandler ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction + ) +{ + /* Not support. Watchdog will reset the board */ + return EFI_UNSUPPORTED; +} + +/** + This function sets the amount of time to wait before firing the Watchdog + timer to TimerPeriod 100ns units. If TimerPeriod is 0, then the Watchdog + timer is disabled. + + @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod The amount of time in 100ns units to wait before + the Watchdog timer is fired. If TimerPeriod is zero, + then the Watchdog timer is disabled. + + @retval EFI_SUCCESS The Watchdog timer has been programmed to fire + in Time 100ns units. + @retval EFI_DEVICE_ERROR A Watchdog timer could not be programmed due + to a device error. + +**/ +EFI_STATUS +EFIAPI +WatchdogTimerSetPeriod ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod // In 100ns units + ) +{ + mNumTimerTicks = (ArmGenericTimerGetTimerFreq () * TimerPeriod) / TIME_UNITS_PER_SECOND; + + if (!IsFailSafeOff ()) { + /* Not support Watchdog timer service until FailSafe is off as ATF is monitoring it */ + return EFI_SUCCESS; + } + + return WatchdogTimerSetup (); +} + +/** + This function retrieves the period of timer interrupts in 100ns units, + returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod + is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is + returned, then the timer is currently disabled. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod A pointer to the timer period to retrieve in + 100ns units. If 0 is returned, then the timer is + currently disabled. + + + @retval EFI_SUCCESS The timer period was returned in TimerPeriod. + @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. + +**/ +EFI_STATUS +EFIAPI +WatchdogTimerGetPeriod ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ) +{ + if (TimerPeriod == NULL) { + return EFI_INVALID_PARAMETER; + } + + *TimerPeriod = ((TIME_UNITS_PER_SECOND / ArmGenericTimerGetTimerFreq ()) * mNumTimerTicks); + + return EFI_SUCCESS; +} + +/** + Interface structure for the Watchdog Architectural Protocol. + + @par Protocol Description: + This protocol provides a service to set the amount of time to wait + before firing the Watchdog timer, and it also provides a service to + register a handler that is invoked when the Watchdog timer fires. + + @par When the Watchdog timer fires, control will be passed to a handler + if one has been registered. If no handler has been registered, + or the registered handler returns, then the system will be + reset by calling the Runtime Service ResetSystem(). + + @param RegisterHandler + Registers a handler that will be called each time the + Watchdogtimer interrupt fires. TimerPeriod defines the minimum + time between timer interrupts, so TimerPeriod will also + be the minimum time between calls to the registered + handler. + NOTE: If the Watchdog resets the system in hardware, then + this function will not have any chance of executing. + + @param SetTimerPeriod + Sets the period of the timer interrupt in 100ns units. + This function is optional, and may return EFI_UNSUPPORTED. + If this function is supported, then the timer period will + be rounded up to the nearest supported timer period. + + @param GetTimerPeriod + Retrieves the period of the timer interrupt in 100ns units. + +**/ +STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL gWatchdogTimer = { + (EFI_WATCHDOG_TIMER_REGISTER_HANDLER)WatchdogTimerRegisterHandler, + (EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD)WatchdogTimerSetPeriod, + (EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD)WatchdogTimerGetPeriod +}; + +EFI_STATUS +EFIAPI +WatchdogTimerInstallProtocol ( + EFI_WATCHDOG_TIMER_ARCH_PROTOCOL **WatchdogTimerProtocol + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + EFI_TPL CurrentTpl; + + /* Make sure the Watchdog Timer Architectural Protocol has not been installed + in the system yet. + This will avoid conflicts with the universal Watchdog */ + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid); + + ASSERT (ArmGenericTimerGetTimerFreq () != 0); + + /* Install interrupt handler */ + Status = gBS->LocateProtocol ( + &gHardwareInterrupt2ProtocolGuid, + NULL, + (VOID **)&mInterruptProtocol + ); + ASSERT_EFI_ERROR (Status); + + /* + * We don't want to be interrupted while registering Watchdog interrupt source as the interrupt + * may be trigger in the middle because the interrupt line already enabled in the EL3. + */ + CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); + + Status = mInterruptProtocol->RegisterInterruptSource ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE, + WatchdogTimerInterruptHandler + ); + ASSERT_EFI_ERROR (Status); + + /* Don't enable interrupt until FailSafe off */ + mInterruptWS0Enabled = FALSE; + Status = mInterruptProtocol->DisableInterruptSource ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE + ); + ASSERT_EFI_ERROR (Status); + + gBS->RestoreTPL (CurrentTpl); + + Status = mInterruptProtocol->SetTriggerType ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE, + EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH + ); + ASSERT_EFI_ERROR (Status); + + /* Install the Timer Architectural Protocol onto a new handle */ + Handle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiWatchdogTimerArchProtocolGuid, + &gWatchdogTimer, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mNumTimerTicks = 0; + + if (WatchdogTimerProtocol != NULL) { + *WatchdogTimerProtocol = &gWatchdogTimer; + } + + return Status; +} -- 2.17.1
|
|
[PATCH v3 01/28] Ampere: Initial support for Ampere Altra processor and Mt. Jade platform
Nhi Pham
From: Vu Nguyen <vunguyen@os.amperecomputing.com>
This commit adds the support for Ampere’s Altra processor-based Mt. Jade platform that provides up to 160 processor cores in a dual socket configuration. The essential modules are wired up enough to boot system to EDK2 UiApp. Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Vu Nguyen <vunguyen@os.amperecomputing.com> --- Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec | 28 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 42 ++ Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec | 46 ++ Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 682 ++++++++++++++++++++ Platform/Ampere/JadePkg/Jade.dsc | 102 +++ Platform/Ampere/JadePkg/Jade.fdf | 225 +++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf | 41 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf | 64 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf | 45 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.inf | 50 ++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.inf | 57 ++ Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf | 37 ++ Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf | 63 ++ Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.inf | 35 + Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf | 32 + Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.inf | 42 ++ Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf | 29 + Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf | 30 + Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf | 29 + Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHobGuid.h | 17 + Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h | 276 ++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h | 172 +++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h | 19 + Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h | 133 ++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h | 282 ++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h | 31 + Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h | 79 +++ Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h | 525 +++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h | 317 +++++++++ Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h | 182 ++++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMap.h | 135 ++++ Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c | 52 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.c | 151 +++++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c | 43 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c | 637 ++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.c | 138 ++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c | 169 +++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMemory.c | 257 ++++++++ Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.c | 281 ++++++++ Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 93 +++ Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.c | 184 ++++++ Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c | 202 ++++++ Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.c | 40 ++ Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c | 141 ++++ Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.c | 328 ++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c | 63 ++ Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc | 176 +++++ Platform/Ampere/JadePkg/JadeBoardSetting.cfg | 224 +++++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelper.S | 45 ++ Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni | 13 + 50 files changed, 7084 insertions(+) diff --git a/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec b/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec new file mode 100644 index 000000000000..7c1d1f84f780 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec @@ -0,0 +1,28 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION = 0x0001001B + PACKAGE_NAME = AmperePlatformPkg + PACKAGE_GUID = 7A78F1B2-E9BE-4F94-891C-385ED524036C + PACKAGE_VERSION = 0.1 + +################################################################################ +# +# Include Section - list of Include Paths that are provided by this package. +# Comments are used for Keywords and Module Types. +# +# Supported Module Types: +# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION +# +################################################################################ +[Includes] + +[LibraryClasses] + +[Guids] diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec new file mode 100644 index 000000000000..f0a5bd04ec22 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -0,0 +1,42 @@ +## @file +# +# Copyright (c) 2020-2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION = 0x0001001B + PACKAGE_NAME = AmpereAltraPkg + PACKAGE_GUID = 481F7D0D-7525-4B76-AF12-58E7B82C46C2 + PACKAGE_VERSION = 0.1 + +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Defines a set of methods to retrieve CPU info. + AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h + + ## @libraryclass Defines a set of methods to get/set NVParam. + NVParamLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h + + ## @libraryclass Defines a set of methods to access Mailbox interface. + MailboxInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h + + ## @libraryclass Defines a set of methods to communicate with SCP. + SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h + + ## @libraryclass Defines a set of methods to communicate with secure parition over MM interface. + MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h + + ## @libraryclass Defines a set of methods to generate random numbers by using Hardware RNG. + TrngLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h + +[Guids] + ## NVParam MM GUID + gNVParamMmGuid = { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } + + ## Include/Guid/PlatformInfoHobGuid.h + gPlatformHobGuid = { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0x76, 0x78, 0x30, 0x32, 0x6d, 0x79, 0xb4 } } diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec new file mode 100644 index 000000000000..6ebdf7db0a57 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -0,0 +1,46 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION = 0x0001001B + PACKAGE_NAME = AmpereSiliconPkg + PACKAGE_GUID = F9EB69A8-7569-4C0E-87D1-3CC9EB7CBF09 + PACKAGE_VERSION = 0.1 + +################################################################################ +# +# Include Section - list of Include Paths that are provided by this package. +# Comments are used for Keywords and Module Types. +# +# Supported Module Types: +# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION +# +################################################################################ +[Includes.common] + +[LibraryClasses] + +[Guids] + gAmpereTokenSpaceGuid = { 0xdbd4436e, 0x89cb, 0x44dc, { 0xb5, 0xc0, 0x49, 0xc3, 0x91, 0x35, 0xbf, 0xdf } } + +[Ppis] + +[PcdsFixedAtBuild] + # + # SMpro PMpro Pcds + # + gAmpereTokenSpaceGuid.PcdSmproDbBaseReg|0x100000540000|UINT64|0x00000001 + gAmpereTokenSpaceGuid.PcdSmproEfuseShadow0|0x10000054a000|UINT64|0x00000002 + gAmpereTokenSpaceGuid.PcdSmproNsMailboxIndex|0x1|UINT32|0x00000003 + gAmpereTokenSpaceGuid.PcdPmproDbBaseReg|0x100001540000|UINT64|0x00000004 + +[PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx] + # + # Firmware Volume Pcds + # + gAmpereTokenSpaceGuid.PcdFvBlockSize|0|UINT32|0xB0000001 diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc new file mode 100644 index 000000000000..770b4a12bc0b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -0,0 +1,682 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION] + GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x1000 + +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000 + +[BuildOptions] + GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG + +[LibraryClasses.common] +!if $(TARGET) == RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!endif + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + + # + # Allow dynamic PCDs + # + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + + # + # Random Generator Library + # + TrngLib|Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf + RngLib|Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf + + # + # ARM Architectural Libraries + # + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf + CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf + ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf + ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf + + # + # Ampere Altra specific Libraries + # + ArmPlatformLib|Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.inf + PlatformPeiLib|Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.inf + NVParamLib|Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf + MailboxInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf + SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf + AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf + TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf + MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.inf + + # + # ARM PL011 UART Driver + # + PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf + SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf + PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf + + # + # Timer Library + # + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + + # + # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window + # in the debugger will show load and unload commands for symbols. You can cut and paste this + # into the command window to load symbols. We should be able to use a script to do this, but + # the version of RVD I have does not support scripts accessing system memory. + # + #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf + PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf + #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf + + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf + + SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf + + # + # BDS Libraries + # + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf + PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf + + # + # UEFI Shell libraries + # + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf + + # + # Secure Boot dependencies + # +!if $(SECURE_BOOT_ENABLE) == TRUE + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf + SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf + + # + # re-use the UserPhysicalPresent() dummy implementation from the ovmf tree + # + PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf +!else + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf +!endif + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf + + # + # Networking Requirements + # +!if $(NETWORK_TLS_ENABLE) == TRUE + TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf +!endif + + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf + + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + +[LibraryClasses.common.SEC] + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf + +!ifdef $(EDK2_SKIP_PEICORE) + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf + LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf + HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf +!endif + + ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf + +[LibraryClasses.common.PEI_CORE] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf + PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + + PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + +[LibraryClasses.common.PEIM] + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf + PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf + PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf + +[LibraryClasses.common.SEC, LibraryClasses.common.PEIM] + MemoryInitPeiLib|Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf + +[LibraryClasses.common.DXE_DRIVER] + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf + UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf +!if $(SECURE_BOOT_ENABLE) == TRUE + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +!endif +!if $(TARGET) != RELEASE + DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf +!endif + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf + + EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.inf + +[LibraryClasses.ARM,LibraryClasses.AARCH64] + # + # It is not possible to prevent the ARM compiler for generic intrinsic functions. + # This library provides the instrinsic functions generate by a given compiler. + # [LibraryClasses.ARM] and NULL mean link this library into all ARM images. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + + # + # Add support for GCC stack protector + # + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ + +[PcdsFeatureFlag.common] + gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|FALSE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE + + # + # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress + # + gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE + + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE + + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE + + # + # If TRUE, Graphics Output Protocol will be installed on virtual handle + # created by ConsplitterDxe. It could be set FALSE to save size. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + +[PcdsFixedAtBuild.common] +!ifdef $(FIRMWARE_VER) + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)" +!endif + + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 + + # DEBUG_ASSERT_ENABLED 0x01 + # DEBUG_PRINT_ENABLED 0x02 + # DEBUG_CODE_ENABLED 0x04 + # CLEAR_MEMORY_ENABLED 0x08 + # ASSERT_BREAKPOINT_ENABLED 0x10 + # ASSERT_DEADLOOP_ENABLED 0x20 +!if $(TARGET) == RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F +!endif + + # + # SBSA Watchdog Count + # +!ifndef DISABLE_SBSA_WATCHDOG + gArmPlatformTokenSpaceGuid.PcdWatchdogCount|1 +!endif + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free (pool) + # DEBUG_PAGE 0x00000020 // Alloc & Free (page) + # DEBUG_INFO 0x00000040 // Informational debug messages + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNP Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // LoadFile + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_GCD 0x00100000 // Global Coherency Database changes + # DEBUG_CACHE 0x00200000 // Memory range cachability changes + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may + # // significantly impact boot performance + # DEBUG_ERROR 0x80000000 // Error + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEVEL) + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + # + # Optional feature to help prevent EFI memory map fragments + # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob + # Values are in EFI Pages (4K). DXE Core will make sure that + # at least this much of each type of memory can be allocated + # from a single memory range. This way you only end up with + # maximum of two fragements for each type in the memory map + # (the memory used, and the free memory that was prereserved + # but not used). + # + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|65 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 + + gArmTokenSpaceGuid.PcdVFPEnabled|1 + + gArmTokenSpaceGuid.PcdArmPrimaryCore|0x0 + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + + # + # Stacks for MPCores in Normal World + # + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x91100000 + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x20000 + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize|0x1000 + + # + # System Memory Base + # + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x90000000 + + # + # UEFI region size + # + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x08000000 + + # + # Ampere Altra Core-Cluster profile + # + gArmPlatformTokenSpaceGuid.PcdCoreCount|80 + gArmPlatformTokenSpaceGuid.PcdClusterCount|40 + + # + # PL011 - Serial Terminal + # Ampere Altra UART0 + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x100002600000 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|32 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1 + + gArmPlatformTokenSpaceGuid.PL011UartClkInHz|1843200 + gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x62 + + # + # PL011 - Serial Debug UART + # Ampere Altra UART2 + # + gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase|0x100002620000 + gArmPlatformTokenSpaceGuid.PcdSerialDbgUartBaudRate|115200 + + # + # We want to use the Shell Libraries but don't want it to initialise + # automatically. We initialise the libraries when the command is called by the + # Shell. + # + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE + + # + # ARM SBSA Watchdog + # + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase|0x1000027c0000 + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase|0x1000027d0000 + gArmTokenSpaceGuid.PcdGenericWatchdogEl2IntrNum|92 + + # + # ARM Generic Interrupt Controller + # + gArmTokenSpaceGuid.PcdGicDistributorBase|0x100100000000 + gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x100100140000 + + # + # ARM Architectural Timer Frequency + # + # Set it to 0 so that the code will read frequence from register + gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0 + gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|1000 + + # + # use the TTY terminal type + # + gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4 + + # + # GUID of the UI app + # + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 } + + # + # Enable strict image permissions for all images. (This applies + # only to images that were built with >= 4 KB section alignment.) + # + gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x3 + + # + # Enable NX memory protection for all non-code regions, including OEM and OS + # reserved ones, with the exception of LoaderData regions, of which OS loaders + # (i.e., GRUB) may assume that its contents are executable. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC000000000007FD1 + + # + # Enable the non-executable DXE stack. (This gets set up by DxeIpl) + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE + + # + # MmCommunication + # + gArmTokenSpaceGuid.PcdMmBufferBase|0x88300000 + gArmTokenSpaceGuid.PcdMmBufferSize|0x100000 + + # + # Number of address lines in the I/O space for the CPU + # + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|32 + +[PcdsDynamicHii.common.DEFAULT] + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10 + +[PcdsDynamicDefault.common] + # + # Fist DRAM Memory region under 4GB address range + # + gArmTokenSpaceGuid.PcdSystemMemorySize|0x70000000 + + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0x0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0x0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0x0 + +################################################################################ +# +# Component Section - list of all EDK II Component Entries defined by this Platform +# +################################################################################ + +[Components.common] + # + # PEI Phase modules + # + ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf + MdeModulePkg/Core/Pei/PeiMain.inf + MdeModulePkg/Universal/PCD/Pei/Pcd.inf { + <LibraryClasses> + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + ArmPlatformPkg/PlatformPei/PlatformPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf + ArmPkg/Drivers/CpuPei/CpuPei.inf + UefiCpuPkg/CpuIoPei/CpuIoPei.inf + MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { + <LibraryClasses> + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + } + MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf + MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf + + # + # DXE Phase modules + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + <LibraryClasses> + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf + } + MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf + + # + # PCD + # + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + <LibraryClasses> + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + # + # Architectural Protocols + # + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { + <LibraryClasses> +!if $(SECURE_BOOT_ENABLE) == TRUE + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf +!endif + } + +!if $(SECURE_BOOT_ENABLE) == TRUE + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf +!endif + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + + # + # Environment Variables Protocol + # + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { + <PcdsFixedAtBuild> + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE + <LibraryClasses> + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + } + + # + # Timer + # + ArmPkg/Drivers/TimerDxe/TimerDxe.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + + # + # ARM GIC Dxe + # + ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + + # + # Uefi Cpu + # + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + + # + # Console + # + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + + # + # Simple TextIn/TextOut for UEFI Terminal + # + EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + # + # Hii Database + # + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + # + # Semi-hosting filesystem + # + ArmPkg/Filesystem/SemihostFs/SemihostFs.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + FatPkg/EnhancedFatDxe/Fat.inf + + # + # Bds + # + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + MdeModulePkg/Application/UiApp/UiApp.inf { + <LibraryClasses> + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf + } + + # + # Networking stack + # +!include NetworkPkg/Network.dsc.inc + + # + # UEFI application (Shell Embedded Boot Loader) + # + ShellPkg/Application/Shell/Shell.inf { + <LibraryClasses> + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf + NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf + BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf + <PcdsFixedAtBuild> + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000 + } +!ifdef $(INCLUDE_TFTP_COMMAND) + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +!endif #$(INCLUDE_TFTP_COMMAND) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc new file mode 100644 index 000000000000..1e580b5c4904 --- /dev/null +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -0,0 +1,102 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + PLATFORM_NAME = Jade + PLATFORM_GUID = 7BDD00C0-68F3-4CC1-8775-F0F00572019F + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x0001001B + OUTPUT_DIRECTORY = Build/Jade + SUPPORTED_ARCHITECTURES = AARCH64 + BUILD_TARGETS = DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER = DEFAULT + FLASH_DEFINITION = Platform/Ampere/JadePkg/Jade.fdf + + # + # Defines for default states. These can be changed on the command line. + # -D FLAG=VALUE + # + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free (pool) + # DEBUG_PAGE 0x00000020 // Alloc & Free (page) + # DEBUG_INFO 0x00000040 // Informational debug messages + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNP Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // LoadFile + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_GCD 0x00100000 // Global Coherency Database changes + # DEBUG_CACHE 0x00200000 // Memory range cachability changes + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may + # // significantly impact boot performance + # DEBUG_ERROR 0x80000000 // Error + DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000000F + DEFINE FIRMWARE_VER = 0.01.001 + DEFINE EDK2_SKIP_PEICORE = TRUE + DEFINE SECURE_BOOT_ENABLE = FALSE + DEFINE INCLUDE_TFTP_COMMAND = TRUE + + # + # Network definition + # + DEFINE NETWORK_IP6_ENABLE = FALSE + DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE + DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE + DEFINE NETWORK_TLS_ENABLE = FALSE + +!include MdePkg/MdeLibs.dsc.inc + +# Include default Ampere Platform DSC file +!include Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc + +################################################################################ +# +# Specific Platform Library +# +################################################################################ +[LibraryClasses] + # + # RTC Library: Common RTC + # + RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf + +################################################################################ +# +# Specific Platform Pcds +# +################################################################################ +[PcdsFeatureFlag.common] +[PcdsFixedAtBuild.common] + +!if $(SECURE_BOOT_ENABLE) == TRUE + # Override the default values from SecurityPkg to ensure images + # from all sources are verified in secure boot + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04 +!endif + + +################################################################################ +# +# Specific Platform Component +# +################################################################################ +[Components.common] diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jade.fdf new file mode 100644 index 000000000000..8ed6df381aed --- /dev/null +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -0,0 +1,225 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +################################################################################ + +[FD.BL33_JADE_UEFI] +BaseAddress = 0x92000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash. +Size = 0x007C0000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device +ErasePolarity = 1 + +# This one is tricky, it must be: BlockSize * NumBlocks = Size +BlockSize = 0x10000 +NumBlocks = 0x7C + +################################################################################ +# +# Following are lists of FD Region layout which correspond to the locations of different +# images within the flash device. +# +# Regions must be defined in ascending order and may not overlap. +# +# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by +# the pipe "|" character, followed by the size of the region, also in hex with the leading +# "0x" characters. Like: +# Offset|Size +# PcdOffsetCName|PcdSizeCName +# RegionType <FV, DATA, or FILE> +# +################################################################################ + +# +# FV MAIN +# Offset: 0x00000000 +# Size: 0x00740000 +# +0x00000000|0x00740000 +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize +FV = FVMAIN_COMPACT + +# +# NV Variables +# T.B.D +# + +################################################################################ +# +# FV Section +# +# [FV] section is used to define what components or modules are placed within a flash +# device file. This section also defines order the components and modules are positioned +# within the image. The [FV] section consists of define statements, set statements and +# module statements. +# +################################################################################ + +[FV.FVMAIN_COMPACT] +FvAlignment = 16 +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE +FvNameGuid = 61C0F511-A691-4F54-974F-B9A42172CE53 + +APRIORI PEI { + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf + INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf +} + + INF ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf + INF MdeModulePkg/Core/Pei/PeiMain.inf + INF UefiCpuPkg/CpuIoPei/CpuIoPei.inf + INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf + INF ArmPkg/Drivers/CpuPei/CpuPei.inf + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf + INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf + + # + # Print platform information before passing control into the Driver Execution Environment (DXE) phase + # + INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + + FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { + SECTION FV_IMAGE = FVMAIN + } + } + +[FV.FvMain] +FvAlignment = 16 +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE +FvNameGuid = 5C60F367-A505-419A-859E-2A4FF6CA6FE5 + +APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf + INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf +} + + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf + INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf + + # + # PI DXE Drivers producing Architectural Protocols (EFI Services) + # + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf +!if $(SECURE_BOOT_ENABLE) == TRUE + INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf +!endif + INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + # + # Environment Variables Protocol + # + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + + # + # Multiple Console IO support + # + INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + + # + # Timer + # + INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf + INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + + # + # ARM GIC Dxe + # + INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + + INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + INF FatPkg/EnhancedFatDxe/Fat.inf + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + + # + # UEFI application (Shell Embedded Boot Loader) + # + INF ShellPkg/Application/Shell/Shell.inf +!if $(INCLUDE_TFTP_COMMAND) == TRUE + INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +!endif + + # + # Bds + # + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf + INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + INF MdeModulePkg/Application/UiApp/UiApp.inf + + # + # Networking stack + # +!include NetworkPkg/Network.fdf.inc + +!include Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf new file mode 100644 index 000000000000..c1bcdbad9392 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf @@ -0,0 +1,41 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = ATFHobPeim + FILE_GUID = B1975734-77C2-4827-9617-914883F3B578 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + ENTRY_POINT = InitializeATFHobPeim + +[Sources] + ATFHobPeim.c + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + HobLib + PcdLib + PeiServicesLib + PeimEntryPoint + +[Guids] + gPlatformHobGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf new file mode 100644 index 000000000000..8d857b9612b4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf @@ -0,0 +1,64 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = MemoryInit + FILE_GUID = AC939A4D-D185-463F-A0CE-4120BF0ACF79 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + ENTRY_POINT = InitializeMemory + +[Sources] + MemoryInitPeim.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + ArmLib + ArmPlatformLib + DebugLib + HobLib + MemoryInitPeiLib + PeimEntryPoint + +[Guids] + gEfiMemoryTypeInformationGuid + gPlatformHobGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf new file mode 100644 index 000000000000..da36bac3b3cb --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf @@ -0,0 +1,45 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = AmpereCpuLib + FILE_GUID = 4ACE898C-4DDC-4EF7-BB6C-91549BDF5B9C + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = AmpereCpuLib + +[Sources] + AmpereCpuLibCommon.c + AmpereCpuLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + BaseLib + HobLib + IoLib + NVParamLib + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdClusterCount + + gAmpereTokenSpaceGuid.PcdSmproEfuseShadow0 + + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[Guids] + gPlatformHobGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.inf new file mode 100644 index 000000000000..eade773da3cc --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.inf @@ -0,0 +1,50 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = RuntimeAmpereCpuLib + FILE_GUID = 5BE8FCAD-5D7E-4696-948A-E90970CA442E + MODULE_TYPE = DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = AmpereCpuLib + CONSTRUCTOR = RuntimeAmpereCpuLibConstructor + DESTRUCTOR = RuntimeAmpereCpuLibDestructor + +[Sources] + AmpereCpuLibCommon.c + RuntimeAmpereCpuLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + BaseLib + HobLib + IoLib + MemoryAllocationLib + NVParamLib + UefiRuntimeLib + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdClusterCount + + gAmpereTokenSpaceGuid.PcdSmproEfuseShadow0 + + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[Guids] + gEfiEventVirtualAddressChangeGuid + gPlatformHobGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.inf new file mode 100644 index 000000000000..a4d29379198d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.inf @@ -0,0 +1,57 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = ArmPlatformLib + FILE_GUID = 7F829BB1-5092-4D8E-8FB7-2B2C2A80D783 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Sources] + ArmPlatformHelper.S + ArmPlatformLib.c + ArmPlatformLibMemory.c + +[LibraryClasses] + AmpereCpuLib + ArmLib + ArmSmcLib + HobLib + IoLib + MemoryAllocationLib + PL011UartLib + PcdLib + SerialPortLib + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[Pcd] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdClusterCount + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PL011UartClkInHz + + gArmTokenSpaceGuid.PcdArmPrimaryCore + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf new file mode 100644 index 000000000000..de07a573b62b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf @@ -0,0 +1,37 @@ +## @file +# The library implements the hardware Mailbox (Doorbell) interface for communication +# between the Application Processor (ARMv8) and the System Control Processors (SMpro/PMpro). +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = MailboxInterface + FILE_GUID = EE482BD0-A91A-45BE-83B1-2157A0FB94C3 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MailboxInterfaceLib + +[Sources] + MailboxInterfaceLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + BaseMemoryLib + DebugLib + IoLib + TimerLib + +[FixedPcd] + gAmpereTokenSpaceGuid.PcdSmproDbBaseReg + gAmpereTokenSpaceGuid.PcdPmproDbBaseReg diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf new file mode 100644 index 000000000000..b6dc7d2ec04a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf @@ -0,0 +1,63 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = ArmMemoryInitPeiLib + FILE_GUID = 55DDB6E0-70B5-11E0-B33E-0002A5D5C51B + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + LIBRARY_CLASS = MemoryInitPeiLib + +[Sources] + MemoryInitPeiLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + ArmMmuLib + ArmPlatformLib + DebugLib + HobLib + +[Guids] + gEfiMemoryTypeInformationGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.inf new file mode 100644 index 000000000000..1693fa7e8050 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.inf @@ -0,0 +1,35 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = MmCommunicationLib + FILE_GUID = 106099B8-0051-4B35-9578-EFB1045D2FA8 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MmCommunicationLib + CONSTRUCTOR = MmCommunicationLibConstructor + +[Sources] + MmCommunicationLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + ArmLib + ArmSmcLib + BaseMemoryLib + DebugLib + PcdLib + +[Pcd] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf new file mode 100644 index 000000000000..2d506913f733 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf @@ -0,0 +1,32 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = NVParamLib + FILE_GUID = 8512FF56-11DF-4A16-A0CF-81B27DBD23FB + MODULE_TYPE = BASE + VERSION_STRING = 0.1 + LIBRARY_CLASS = NVParamLib + +[Sources.common] + NVParamLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + MmCommunicationLib + +[Guids] + gNVParamMmGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.inf new file mode 100644 index 000000000000..524b3fe777b8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.inf @@ -0,0 +1,42 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = ArmPlatformPeiLib + FILE_GUID = 49D37060-70B5-11E0-AA2D-0002A5D5C51B + MODULE_TYPE = SEC + VERSION_STRING = 0.1 + LIBRARY_CLASS = PlatformPeiLib + +[Sources] + PlatformPeiLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + ArmPlatformLib + ArmSmcLib + DebugLib + HobLib + PcdLib + PeiServicesLib + +[FixedPcd] + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf new file mode 100644 index 000000000000..5b25a64d5451 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf @@ -0,0 +1,29 @@ +## @file +# Instance of RNG (Random Number Generator) Library. +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = RngLib + MODULE_UNI_FILE = RngLib.uni + FILE_GUID = 9CC35499-5CC8-49A2-8C27-AE7B3B83D149 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RngLib + +[Sources] + RngLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + TrngLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf new file mode 100644 index 000000000000..f11291003dde --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf @@ -0,0 +1,30 @@ +## @file +# Provides functions for communication with System Firmware (SMpro/PMpro) +# via interfaces like Mailbox. +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = SystemFirmwareInterface + FILE_GUID = 8574F1CC-BF8C-46FD-9276-5B202E2A425C + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = SystemFirmwareInterfaceLib + +[Sources] + SystemFirmwareInterfaceLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MailboxInterfaceLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf new file mode 100644 index 000000000000..aac835ed46ed --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf @@ -0,0 +1,29 @@ +## @file +# Instance of RNG (Random Number Generator) Library. +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = Trng + FILE_GUID = 30200949-29CF-4BDB-8300-EFFC44D03603 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = TrngLib + +[Sources] + TrngLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + SystemFirmwareInterfaceLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHobGuid.h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHobGuid.h new file mode 100644 index 000000000000..5b199bf2b4e8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHobGuid.h @@ -0,0 +1,17 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_INFO_HOB_GUID_H_ +#define PLATFORM_INFO_HOB_GUID_H_ + +#define PLATFORM_INFO_HOB_GUID \ + { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0x76, 0x78, 0x30, 0x32, 0x6d, 0x79, 0xb4 } } + +extern EFI_GUID gPlatformHobGuid; + +#endif /* PLATFORM_INFO_HOB_GUID_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h new file mode 100644 index 000000000000..78d14998978b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h @@ -0,0 +1,276 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AMPERE_CPU_LIB_H_ +#define AMPERE_CPU_LIB_H_ + +#define SUBNUMA_MODE_MONOLITHIC 0 +#define SUBNUMA_MODE_HEMISPHERE 1 +#define SUBNUMA_MODE_QUADRANT 2 + +#define MONOLITIC_NUM_OF_REGION 1 +#define HEMISPHERE_NUM_OF_REGION 2 +#define QUADRANT_NUM_OF_REGION 4 +#define SUBNUMA_CPM_REGION_SIZE 4 +#define NUM_OF_CPM_PER_MESH_ROW 8 + +#define CPM_PER_ROW_OFFSET(CpmId) ((CpmId) % NUM_OF_CPM_PER_MESH_ROW) +#define CPM_ROW_NUMBER(CpmId) ((CpmId) / NUM_OF_CPM_PER_MESH_ROW) + +#define SOCKET_ID(CpuId) ((CpuId) / (PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_NUM_CORES_PER_CPM)) +#define CLUSTER_ID(CpuId) (((CpuId) / PLATFORM_CPU_NUM_CORES_PER_CPM) % PLATFORM_CPU_MAX_CPM) + + +/** + Get current CPU frequency. + + @param Socket Socket index. + @return UINTN Current CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetCurrentFreq ( + UINT8 Socket + ); + +/** + Get maximum CPU frequency. + + @param Socket Socket index. + @return UINTN Maximum CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetMaxFreq ( + UINT8 Socket + ); + +/** + Get CPU voltage. + + @param Socket Socket index. + @return UINT8 CPU voltage. + +**/ +UINT8 +EFIAPI +CpuGetVoltage ( + UINT8 Socket + ); + +/** + Get the SubNUMA mode. + + @return UINT8 The SubNUMA mode. + +**/ +UINT8 +EFIAPI +CpuGetSubNumaMode ( + VOID + ); + +/** + Get the number of SubNUMA region. + + @return UINT8 The number of SubNUMA region. + +**/ +UINT8 +EFIAPI +CpuGetNumberOfSubNumaRegion ( + VOID + ); + +/** + Get the SubNUMA node of a CPM. + + @param SocketId Socket index. + @param Cpm CPM index. + @return UINT8 The SubNUMA node of a CPM. + +**/ +UINT8 +EFIAPI +CpuGetSubNumNode ( + UINT8 Socket, + UINT16 Cpm + ); + +/** + Get the number of supported socket. + + @return UINT8 Number of supported socket. + +**/ +UINT8 +EFIAPI +GetNumberOfSupportedSockets ( + VOID + ); + +/** + Get the number of active socket. + + @return UINT8 Number of active socket. + +**/ +UINT8 +EFIAPI +GetNumberOfActiveSockets ( + VOID + ); + +/** + Get the number of active CPM per socket. + + @param SocketId Socket index. + @return UINT16 Number of CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCPMsPerSocket ( + UINT8 SocketId + ); + +/** + Get the number of configured CPM per socket. + + @param SocketId Socket index. + @return UINT16 Number of configured CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfConfiguredCPMs ( + UINT8 SocketId + ); + +/** + Set the number of configured CPM per socket. + + @param SocketId Socket index. + @param NumberOfCPMs Number of CPM to be configured. + @return EFI_SUCCESS Operation succeeded. + @return Others An error has occurred. + +**/ +EFI_STATUS +EFIAPI +SetNumberOfConfiguredCPMs ( + UINT8 SocketId, + UINT16 NumberOfCPMs + ); + +/** + Get the maximum number of core per socket. This number + should be the same for all sockets. + + @return UINT16 Maximum number of core. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCores ( + VOID + ); + +/** + Get the maximum number of CPM per socket. This number + should be the same for all sockets. + + @return UINT32 Maximum number of CPM. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCPMs ( + VOID + ); + +/** + Get the number of active cores of a sockets. + + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCoresPerSocket ( + UINT8 SocketId + ); + +/** + Get the number of active cores of all socket. + + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCores ( + VOID + ); + +/** + Check if the logical CPU is enabled or not. + + @param CpuId The logical Cpu ID. Started from 0. + @return BOOLEAN TRUE if the Cpu enabled + FALSE if the Cpu disabled. + +**/ +BOOLEAN +EFIAPI +IsCpuEnabled ( + UINT16 CpuId + ); + + +/** + Check if the slave socket is present + + @return BOOLEAN TRUE if the Slave Cpu is present + FALSE if the Slave Cpu is not present + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketPresent ( + VOID + ); + +/** + Check if the slave socket is active + + @return BOOLEAN TRUE if the Slave CPU Socket is active. + FALSE if the Slave CPU Socket is not active. + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketActive ( + VOID + ); + +/** + Check if the CPU product ID is Ac01 + @return BOOLEAN TRUE if the Product ID is Ac01 + FALSE otherwise. + +**/ +BOOLEAN +EFIAPI +IsAc01Processor ( + VOID + ); + +#endif /* AMPERE_CPU_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h new file mode 100644 index 000000000000..2750487f3e96 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h @@ -0,0 +1,172 @@ +/** @file + The library implements the hardware Mailbox (Doorbell) interface for communication + between the Application Processor (ARMv8) and the System Control Processors (SMpro/PMpro). + + A transfer to SMpro/PMpro is performed on a doorbell channel which is implemented through + hardware doorbell registers. Each transfer can be up to 12 bytes long, including 4 bytes + for the message and two 4 bytes for additional data. + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MAILBOX_INTERFACE_LIB_H_ +#define MAILBOX_INTERFACE_LIB_H_ + +#define SMPRO_DB_MAX 8 +#define PMPRO_DB_MAX 8 +#define NUMBER_OF_DOORBELLS_PER_SOCKET (SMPRO_DB_MAX + PMPRO_DB_MAX) + +// +// General address offset of Doorbell registers +// +#define DB_IN_REG_OFST 0x00000000 // Doorbell In +#define DB_DIN0_REG_OFST 0x00000004 // Doorbell In Data +#define DB_DIN1_REG_OFST 0x00000008 // Doorbell In Data +#define DB_OUT_REG_OFST 0x00000010 // Doorbell Out +#define DB_DOUT0_REG_OFST 0x00000014 // Doorbell Out Data +#define DB_DOUT1_REG_OFST 0x00000018 // Doorbell Out Data +#define DB_STATUS_REG_OFST 0x00000020 // Doorbell Interrupt Status +#define DB_STATUS_MASK_REG_OFST 0x00000024 // Doorbell Interrupt Status Mask + +// +// List of supported doorbells +// +typedef enum { + // + // PMpro Doorbells + // + PMproDoorbellChannel0 = 0, + PMproDoorbellChannel1, + PMproDoorbellChannel2, + PMproDoorbellChannel3, + PMproDoorbellChannel4, + PMproDoorbellChannel5, + PMproDoorbellChannel6, + PMproDoorbellChannel7, + // + // SMpro Doorbells + // + SMproDoorbellChannel0 = PMPRO_DB_MAX, + SMproDoorbellChannel1, + SMproDoorbellChannel2, + SMproDoorbellChannel3, + SMproDoorbellChannel4, + SMproDoorbellChannel5, + SMproDoorbellChannel6, + SMproDoorbellChannel7 +} DOORBELL_CHANNELS; + +#pragma pack(1) +// +// Mailbox Message Data +// +// A mailbox transaction supports up to 12 bytes long, +// including 4 bytes for message and two 4 bytes for extended data. +// +typedef struct { + UINT32 Data; + UINT32 ExtendedData[2]; +} MAILBOX_MESSAGE_DATA; + +#pragma pack() + +// +// Timeout configuration when waiting for an doorbell interrupt status +// +#define MAILBOX_POLL_TIMEOUT_US 10000000 +#define MAILBOX_POLL_INTERVAL_US 1000 +#define MAILBOX_POLL_COUNT (MAILBOX_POLL_TIMEOUT_US / MAILBOX_POLL_INTERVAL_US) + +/** + Get the base address of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with the SMpro/PMpro. + + @retval UINT32 The base address of the doorbell. + The returned value is 0 indicate that the input parameters are invalid. + +**/ +UINTN +EFIAPI +MailboxGetDoorbellAddress ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ); + +/** + Get the interrupt number of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with the SMpro/PMpro. + + @retval UINT32 The interrupt number. + The returned value is 0 indicate that the input parameters are invalid. + +**/ +UINT32 +EFIAPI +MailboxGetDoorbellInterruptNumber ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ); + +/** + Read a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with the SMpro/PMpro. + @param[out] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Read the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for available message in the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxRead ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + OUT MAILBOX_MESSAGE_DATA *Message + ); + +/** + Write a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbel channel for communication with the SMpro/PMpro. + @param[in] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Write the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for acknowledge signal from the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxWrite ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + IN MAILBOX_MESSAGE_DATA *Message + ); + +/** + Unmask the Doorbell interrupt status. + + @param Socket Active socket index. + @param Doorbell Doorbel channel for communication with the SMpro/PMpro. + + @retval EFI_SUCCESS Unmask the Doorbell interrupt successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +MailboxUnmaskInterrupt ( + IN UINT8 Socket, + IN UINT16 Doorbell + ); + +#endif /* MAILBOX_INTERFACE_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h new file mode 100644 index 000000000000..9bae501b3382 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h @@ -0,0 +1,19 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_COMMUNICATION_LIB_H_ +#define MM_COMMUNICATION_LIB_H_ + +EFI_STATUS +EFIAPI +MmCommunicationCommunicate ( + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommSize OPTIONAL + ); + +#endif /* MM_COMMUNICATION_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h new file mode 100644 index 000000000000..d0c2a6e3bffa --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h @@ -0,0 +1,133 @@ +/** @file + + The non-volatile parameter layout in SPI-NOR is shown below. There is + two copies. The master copy is changeable by the user. The Last Known + copy is handled by the fail safe future. It is a last know bootable copy. + + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + | w/o failsafe support | + --------------------------- + | Master Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + | Last Known Copy | 16KB + | Pre-boot parameters | + --------------------------- + | | 16KB + --------------------------- + | Last Known Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + + As each non-volatile parameter requires 8 bytes, there is a total of 8K + parameters. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef NV_PARAM_LIB_H_ +#define NV_PARAM_LIB_H_ + +#define NV_PARAM_MAX_SIZE (64 * 1024) +#define NV_PARAM_ENTRYSIZE 8 + +#define NV_PERM_ALL 0xFFFF /* Allowed for all */ +#define NV_PERM_ATF 0x0001 /* Allowed for EL3 code */ +#define NV_PERM_OPTEE 0x0004 /* Allowed for secure El1 */ +#define NV_PERM_BIOS 0x0008 /* Allowed for EL2 non-secure */ +#define NV_PERM_MANU 0x0010 /* Allowed for manufactory interface */ +#define NV_PERM_BMC 0x0020 /* Allowed for BMC interface */ + +#define NVPARAM_SIZE 0x8 + +/* + * Retrieve a non-volatile parameter + * + * @param: Parameter ID to retrieve + * @acl_rd: Permission for read operation. See NV_PERM_XXX. + * @val: Pointer to an UINT32 to store the value + * @return: EFI_INVALID_PARAMETER if parameter is invalid + * EFI_NOT_FOUND if value is not set + * EFI_UNSUPPORTED if service unavailable + * EFI_ACCESS_DENIED if permission not allowed + * Otherwise, 0 for success + * + * NOTE: If you need a signed value, cast it. It is expected that the + * caller will carry the correct permission over various call sequences. + * + */ +EFI_STATUS +NVParamGet ( + IN UINT32 Param, + IN UINT16 ACLRd, + OUT UINT32 *Val + ); + +/* + * Set a non-volatile parameter + * + * @param: Parameter ID to set + * @acl_rd: Permission for read operation + * @acl_wr: Permission for write operation + * @val: Unsigned int value to set. + * @return: EFI_INVALID_PARAMETER if parameter is invalid + * EFI_UNSUPPORTED if service unavailable + * EFI_ACCESS_DENIED if permission not allowed + * Otherwise, 0 for success + * + * NOTE: If you have a signed value, cast to unsigned. If the parameter has + * not being created before, the provied permission is used to create the + * parameter. Otherwise, it is checked for access. It is expected that the + * caller will carry the correct permission over various call sequences. + * + */ +EFI_STATUS +NVParamSet ( + IN UINT32 Param, + IN UINT16 ACLRd, + IN UINT16 ACLWr, + IN UINT32 Val + ); + +/* + * Clear a non-volatile parameter + * + * @param: Parameter ID to set + * @acl_wr: Permission for write operation + * @return: EFI_INVALID_PARAMETER if parameter is invalid + * EFI_UNSUPPORTED if service unavailable + * EFI_ACCESS_DENIED if permission not allowed + * Otherwise, 0 for success + * + * NOTE: It is expected that the caller will carry the correct permission + * over various call sequences. + * + */ +EFI_STATUS +NVParamClr ( + IN UINT32 Param, + IN UINT16 ACLWr + ); + +/* + * Clear all non-volatile parameters + * + * @return: EFI_UNSUPPORTED if service unavailable + * Otherwise, 0 for success + */ +EFI_STATUS +NVParamClrAll ( + VOID + ); + +#endif /* NV_PARAM_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h new file mode 100644 index 000000000000..ce96c2a6b4b6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h @@ -0,0 +1,282 @@ +/** @file + Provides functions for communication with System Firmware (SMpro/PMpro) + via interfaces like Mailbox. + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SYSTEM_FIRMWARE_INTERFACE_LIB_H_ +#define SYSTEM_FIRMWARE_INTERFACE_LIB_H_ + +// +// Common mailbox message format +// Bit 31:28 - Message type +// Bit 27:24 - Message subtype +// Bit 23:16 - Message control byte +// Bit 15:0 - Message data specific +// +#define MAILBOX_MESSAGE_TYPE_SHIFT 28 +#define MAILBOX_MESSAGE_SUBTYPE_SHIFT 24 +#define MAILBOX_MESSAGE_CONTROL_BYTE_SHIFT 16 + +#define COMMON_MESSAGE_ENCODE(Type,Subtype,Control) \ + ( \ + ((Type) << MAILBOX_MESSAGE_TYPE_SHIFT) | \ + ((Subtype) << MAILBOX_MESSAGE_SUBTYPE_SHIFT) | \ + ((Control) << MAILBOX_MESSAGE_CONTROL_BYTE_SHIFT) \ + ) + +#define MAILBOX_MESSAGE_CONTROL_URGENT BIT7 +#define MAILBOX_MESSAGE_CONTROL_TYPICAL 0 + +// +// Mailbox Message Types +// +#define MAILBOX_MESSAGE_TYPE_DEBUG 0x00 +#define MAILBOX_MESSAGE_TYPE_ADDRESS 0x05 +#define MAILBOX_MESSAGE_TYPE_USER 0x06 + +// +// Mailbox Message Type 0x00 - Debug message +// +#define MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_READ 0x01 +#define MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_WRITE 0x02 + +// +// Debug message data format +// Bit 31:16 - Refer to definition of COMMON_MESSAGE_ENCODE +// Bit 15:0 - Store lower 16-bit of the upper 64-bit address +// +#define MAILBOX_DEBUG_MESSAGE_ENCODE(Subtype,Address) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_DEBUG, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_TYPICAL)) | \ + ((Address) & 0xFFFF) \ + ) + +// +// Mailbox Message Type 0x05 - Address message +// +#define MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC 0x03 + +// +// Address message data format +// Bit 31:16 - Refer to definition of COMMON_MESSAGE_ENCODE +// Bit 15:8 - Message Parameter +// Bit 7:4 - Address message control bit +// 0x4: 256 alignment +// 0x0: No alignment +// Bit 3:0 - Unused +// +#define MAILBOX_ADDRESS_MESSAGE_ENCODE(Subtype,Param,Align) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_ADDRESS, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_TYPICAL)) | \ + ((Param) << 8) | \ + ((Align) << 4) \ + ) + +#define MAILBOX_ADDRESS_URGENT_MESSAGE_ENCODE(Subtype,Param,Align) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_ADDRESS, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_URGENT)) | \ + ((Param) << 8) | \ + ((Align) << 4) \ + ) + +#define MAILBOX_ADDRESS_256_ALIGNMENT 0x4 +#define MAILBOX_ADDRESS_NO_ALIGNMENT 0x0 + +#define MAILBOX_ADDRESS_MESSAGE_PARAM_CPPC 0x01 + +#define MAILBOX_URGENT_CPPC_MESSAGE \ + ( \ + MAILBOX_ADDRESS_URGENT_MESSAGE_ENCODE ( \ + MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC, \ + MAILBOX_ADDRESS_MESSAGE_PARAM_CPPC, \ + MAILBOX_ADDRESS_256_ALIGNMENT) \ + ) + +#define MAILBOX_TYPICAL_PCC_MESSAGE \ + ( \ + MAILBOX_ADDRESS_MESSAGE_ENCODE ( \ + MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC, \ + 0, \ + MAILBOX_ADDRESS_256_ALIGNMENT) \ + ) + +// +// Mailbox Message Type 0x06 - User message +// +#define MAILBOX_USER_MESSAGE_SUBTYPE_SET_CONFIGURATION 0x02 +#define MAILBOX_USER_MESSAGE_SUBTYPE_BOOT_PROGRESS 0x06 +#define MAILBOX_USER_MESSAGE_SUBTYPE_TRNG_PROXY 0x07 + +// +// User message data format +// Bit 31:16 - Refer to definition of COMMON_MESSAGE_ENCODE +// Bit 15:8 - Message Parameter 0 +// Bit 7:0 - Message Parameter 1 +// +#define MAILBOX_USER_MESSAGE_ENCODE(Subtype,Param0,Param1) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_USER, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_TYPICAL)) | \ + ((Param0) << 8) | \ + (Param1) \ + ) + +// +// Parameters for True RNG Proxy Message +// Param0: 1 - Get a random number +// Param1: Unused +// +#define MAILBOX_TRNG_PROXY_GET_RANDOM_NUMBER 1 + +// +// Parameters for Boot Progress +// Param0: 1 - Set boot state +// Param1: Boot stage value +// 0x08: BL33/UEFI Stage +// +#define MAILBOX_BOOT_PROGRESS_COMMAND_SET 1 +#define MAILBOX_BOOT_PROGRESS_STAGE_UEFI 8 + +// +// Parameters for Set Configuration +// Param0: Configuration type +// 20: Turbo configuration +// Param1: Unused +// +#define MAILBOX_SET_CONFIGURATION_TURBO 20 + +/** + Read a register which is not accessible from the non-secure world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be read. + @param[out] Value A pointer to the read value. + + @retval EFI_SUCCESS Read the register successfully. + @retval EFI_UNSUPPORTED The register is not allowed. + @retval Otherwise Errors returned from MailboxWrite/MailboxRead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterRead ( + IN UINT8 Socket, + IN UINTN Address, + OUT UINT32 *Value + ); + +/** + Write a value to a register which is not accessible from the non-secure world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be written. + @param[in] Value The value to be written to the register. + + @retval EFI_SUCCESS Write the register successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() function. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterWrite ( + IN UINT8 Socket, + IN UINTN Address, + IN UINT32 Value + ); + +/** + Set the PCC shared Memory Address to service handlers in the System Control Processors, + using for communication between the System Firmware and OSPM. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell index which is numbered like DOORBELL_CHANNELS. + @param[in] AddressAlign256 Enable/Disable 256 alignment. + @param[in] Address The shared memory address. + + @retval EFI_SUCCESS Set the shared memory address successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetPccSharedMem ( + IN UINT8 Socket, + IN UINT8 Doorbell, + IN BOOLEAN AddressAlign256, + IN UINTN Address + ); + +/** + The True RNG is provided by the SMpro processor. This function is to send a mailbox + message to the SMpro to request a 64-bit random number. + + @param[out] Buffer A pointer to the read 64-bit random number. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite/MailboxRead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgGetRandomNumber64 ( + OUT UINT8 *Buffer + ); + +/** + Report the UEFI boot progress to the SMpro. + + @param[in] Socket Active socket index. + @param[in] BootStatus The status of the UEFI boot. + @param[in] Checkpoint The UEFI Checkpoint value. + + @retval EFI_SUCCESS Set the boot progress successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetBootProgress ( + IN UINT8 Socket, + IN UINT8 BootStatus, + IN UINT32 Checkpoint + ); + +/** + Configure the Turbo (Max Performance) mode. + + @param[in] Socket Active socket index. + @param[in] Enable Enable/Disable the Turbo (Max performance) mode. + + @retval EFI_SUCCESS Configure the Turbo successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgTurboConfig ( + IN UINT8 Socket, + IN BOOLEAN Enable + ); + +#endif /* SYSTEM_FIRMWARE_INTERFACE_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h new file mode 100644 index 000000000000..b478986cb032 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h @@ -0,0 +1,31 @@ +/** @file + RNG (Random Number Generator) Library that uses Hardware RNG in SMpro. + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef TRNG_LIB_H_ +#define TRNG_LIB_H_ + +/** + Generates a random number by using Hardware RNG in SMpro. + + @param[out] Buffer Buffer to receive the random number. + @param[in] BufferSize Number of bytes in Buffer. + + @retval EFI_SUCCESS The random value was returned successfully. + @retval EFI_DEVICE_ERROR A random value could not be retrieved + due to a hardware or firmware error. + @retval EFI_INVALID_PARAMETER Buffer is NULL or BufferSize is zero. +**/ +EFI_STATUS +EFIAPI +GenerateRandomNumbers ( + OUT UINT8 *Buffer, + IN UINTN BufferSize + ); + +#endif /* TRNG_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h new file mode 100644 index 000000000000..e348b71b5e58 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h @@ -0,0 +1,79 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_LIB_H_ +#define MM_LIB_H_ + +enum { + MM_SPINOR_FUNC_GET_INFO, + MM_SPINOR_FUNC_READ, + MM_SPINOR_FUNC_WRITE, + MM_SPINOR_FUNC_ERASE, + MM_SPINOR_FUNC_GET_NVRAM_INFO, + MM_SPINOR_FUNC_GET_NVRAM2_INFO, + MM_SPINOR_FUNC_GET_FAILSAFE_INFO +}; + +enum { + MM_NVPARAM_FUNC_READ = 1, + MM_NVPARAM_FUNC_WRITE, + MM_NVPARAM_FUNC_CLEAR, + MM_NVPARAM_FUNC_CLEAR_ALL +}; + +#define MM_SPINOR_RES_SUCCESS 0xAABBCC00 +#define MM_SPINOR_RES_FAIL 0xAABBCCFF + +#define MM_NVPARAM_RES_SUCCESS 0xAABBCC00 +#define MM_NVPARAM_RES_NOT_SET 0xAABBCC01 +#define MM_NVPARAM_RES_NO_PERM 0xAABBCC02 +#define MM_NVPARAM_RES_FAIL 0xAABBCCFF + +#define EFI_MM_MAX_PAYLOAD_U64_E 10 +#define EFI_MM_MAX_PAYLOAD_SIZE (EFI_MM_MAX_PAYLOAD_U64_E * sizeof(UINT64)) +#define EFI_MM_MAX_TMP_BUF_SIZE 0x1000000 + +typedef struct { + /* Allows for disambiguation of the message format */ + EFI_GUID HeaderGuid; + /* + * Describes the size of Data (in bytes) and does not include the size + * of the header + */ + UINTN MsgLength; +} EFI_MM_COMM_HEADER_NOPAYLOAD; + +typedef struct { + UINT64 Data[EFI_MM_MAX_PAYLOAD_U64_E]; +} EFI_MM_COMM_PAYLOAD; + +typedef struct { + EFI_MM_COMM_HEADER_NOPAYLOAD EfiMmHdr; + EFI_MM_COMM_PAYLOAD PayLoad; +} EFI_MM_COMM_REQUEST; + +typedef struct { + UINT64 Status; + UINT64 DeviceBase; + UINT64 PageSize; + UINT64 SectorSize; + UINT64 DeviceSize; +} EFI_MM_COMMUNICATE_SPINOR_RES; + +typedef struct { + UINT64 Status; + UINT64 NVBase; + UINT64 NVSize; +} EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES; + +typedef struct { + UINT64 Status; + UINT64 Value; +} EFI_MM_COMMUNICATE_NVPARAM_RES; + +#endif /* MM_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h b/Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h new file mode 100644 index 000000000000..ceeb0c28c69e --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h @@ -0,0 +1,525 @@ +/** @file + + The non-volatile parameter layout in SPI-NOR is shown below. There is + two copies. The master copy is changeable by the user. The Last Known + copy is handled by the fail safe future. It is a last know bootable copy. + + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + | w/o failsafe support | + --------------------------- + | Master Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + | Last Known Copy | 16KB + | Pre-boot parameters | + --------------------------- + | | 16KB + --------------------------- + | Last Known Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + + As each non-volatile parameter requires 8 bytes, there is a total of 8K + parameters. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef NVPARAMDEF_H_ +#define NVPARAMDEF_H_ + +typedef enum { + /* + * SoC validation pre-boot non-volatile setting + * + * These parameters will reset to default value on failsafe. + * They are not used in production life cycle. + */ + NV_PREBOOT_PARAM_START = 0x000000, + NV_SI_PCP_VDMC = (1 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_FAILSAFE_RETRY = (2 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PPR_EN = (3 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RESERVED0 = (4 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RESERVED1 = (5 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_LOG_LEVEL = (6 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RESERVED2 = (7 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RD_DBI_EN = (8 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WR_DBI_EN = (9 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RETRY_EN = (10 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_BANK_HASH_EN = (11 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RESERVED3 = (12 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RCD_PARITY_EN = (13 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WRPATH_CLK_GATE_EN = (14 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_IOCAL_MARGIN = (15 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RTR_S_MARGIN = (16 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RTR_L_MARGIN = (17 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RTR_CS_MARGIN = (18 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WTW_S_MARGIN = (19 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WTW_L_MARGIN = (20 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WTW_CS_MARGIN = (21 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RTW_S_MARGIN = (22 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RTW_L_MARGIN = (23 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RTW_CS_MARGIN = (24 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WTR_S_MARGIN = (25 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WTR_L_MARGIN = (26 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WTR_CS_MARGIN = (27 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PARITY_EN = (28 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_SLC_DISABLE = (29 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_SLC_SIZE = (30 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_SLC_SCRUB = (31 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_CCIX_DISABLE = (32 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_ESM_RESERVED = (33 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PHY_CAL_MODE = (34 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_RAS_TEST_EN = (35 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_EYE_SCREEN_TEST_EN = (36 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_EYE_MASK_RD_MARGIN = (37 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_EYE_MASK_WR_MARGIN = (38 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RDODT_ON_MARGIN = (39 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RDODT_OFF_MARGIN = (40 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WRODT_ON_MARGIN = (41 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WRODT_OFF_MARGIN = (42 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_SLC_OCM_EN = (43 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_ESM_WIDTH = (44 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_TM2_DISABLE = (45 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_CPUPLL_FREQ_MHZ = (46 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_ERR_INJECT_MASK_SK0 = (47 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_ERR_INJECT_MASK_SK1 = (48 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_CXG_DISABLE_EARLY_COMPACK = (49 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_CXG_ENABLE_SAME_ADDR_COMP_ORDER = (50 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_TURNAROUND_CONTROL = (51 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_HIT_TURNAROUND_CONTROL = (52 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_QOS_CLASS_CONTROL = (53 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_ESCALATION_CONTROL = (54 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_QV_CONTROL_31_00 = (55 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_QV_CONTROL_63_32 = (56 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_CREDIT_CONTROL = (57 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WRITE_PRIORITY_CONTROL_31_00 = (58 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_WRITE_PRIORITY_CONTROL_63_32 = (59 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_QUEUE_THRESHOLD_CONTROL_31_00 = (60 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_QUEUE_THRESHOLD_CONTROL_63_32 = (61 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_ATF_FAILURE_FAILSAFE = (62 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_UEFI_FAILURE_FAILSAFE = (63 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_STRIPE_DECODE = (64 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_DEBUG_CTRL = (65 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_CXG_RA_DEVNR_ORD_WFC_DIS = (66 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PHY_DLL_TRACK_UPD_THRESHOLD = (67 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PHY_DLL_TRACK_UPD_THRESHOLD_AC = (68 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PHY_INIT_UPDATE_CONFIG = (69 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PHY_UPDATE_CONTROL = (70 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_PROFILE_EN = (71 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_PCIE_PHY_SETTING = (72 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PHY_CAL_THRESHOLD = (73 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_PHY_CAL_INTERVAL_CNT = (74 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_RESERVED = (75 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_S0_RHS_RCA_EN = (76 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_S1_RHS_RCA_EN = (77 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_2P_DPLL = (78 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_2P_ALI_CFG = (79 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_2P_ALI_CFG_LINK_RETRAIN = (80 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_2P_ALI_CFG_CRC = (81 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RT_CONTROL_31_00 = (82 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_RT_CONTROL_63_32 = (83 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_DDR_TIMEOUT_CONTROL = (84 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_CPU_LPI_FREQ_DISABLE = (85 * 8) + NV_PREBOOT_PARAM_START, + NV_SI_CPU_LPI_FREQ_ENERGY_THRSHLD = (86 * 8) + NV_PREBOOT_PARAM_START, + NV_PMPRO_REGION1_LOAD_START = NV_SI_SLC_DISABLE, + NV_PMPRO_REGION1_LOAD_END = NV_SI_CPU_LPI_FREQ_ENERGY_THRSHLD, + /* NOTE: Add before NV_PREBOOT_PARAM_MAX and increase its value */ + NV_PREBOOT_PARAM_MAX = (86 * 8) + NV_PREBOOT_PARAM_START, + + /* + * Manufactory non-volatile memory + * + * These parameters will reset to default value on failsafe. + */ + NV_MANU_PARAM_START = 0x004000, + NV_SI_DDR_VMARGIN = (0 * 8) + NV_MANU_PARAM_START, + NV_PMPRO_REGION2_LOAD_START = NV_SI_DDR_VMARGIN, + NV_SI_SOC_VMARGIN = (1 * 8) + NV_MANU_PARAM_START, + NV_SI_AVS_VMARGIN = (2 * 8) + NV_MANU_PARAM_START, + NV_SI_TPC_TM1_MARGIN = (3 * 8) + NV_MANU_PARAM_START, + NV_SI_TPC_TM2_MARGIN = (4 * 8) + NV_MANU_PARAM_START, + NV_SI_TPC_FREQ_THROTTLE = (5 * 8) + NV_MANU_PARAM_START, + NV_SI_T_LTLM_EN = (6 * 8) + NV_MANU_PARAM_START, + NV_SI_T_LTLM_THRSHLD = (7 * 8) + NV_MANU_PARAM_START, + NV_SI_T_GTLM_THRSHLD = (8 * 8) + NV_MANU_PARAM_START, + NV_SI_P_LM_EN = (9 * 8) + NV_MANU_PARAM_START, + NV_SI_P_LM_THRSHLD = (10 * 8) + NV_MANU_PARAM_START, + NV_SI_TPC_OVERTEMP_ISR_DISABLE = (11 * 8) + NV_MANU_PARAM_START, + NV_SI_VPP_VMARGIN = (12 * 8) + NV_MANU_PARAM_START, + NV_SI_PMPRO_FAILURE_FAILSAFE = (13 * 8) + NV_MANU_PARAM_START, + NV_SI_FAILSAFE_DISABLE = (14 * 8) + NV_MANU_PARAM_START, + NV_SI_PLIMIT_APM_DS_PERCENTAGE = (15 * 8) + NV_MANU_PARAM_START, + NV_SI_PLIMIT_APM_EP_MS = (16 * 8) + NV_MANU_PARAM_START, + NV_SI_PLIMIT_APM_PM1_PERCENTAGE_TDP = (17 * 8) + NV_MANU_PARAM_START, + NV_SI_CPU_LPI_RESERVED0 = (18 * 8) + NV_MANU_PARAM_START, + NV_SI_CPU_LPI_RESERVED1 = (19 * 8) + NV_MANU_PARAM_START, + NV_SI_CCIX_OPT_CONFIG = (20 * 8) + NV_MANU_PARAM_START, + NV_SI_MESH_FREQ_MARGIN = (21 * 8) + NV_MANU_PARAM_START, + NV_SI_MESH_TURBO_EN = (22 * 8) + NV_MANU_PARAM_START, + NV_SI_PWR_HEADROOM_WATT = (23 * 8) + NV_MANU_PARAM_START, + NV_SI_EXTRA_PCP_VOLT_MV = (24 * 8) + NV_MANU_PARAM_START, + NV_SI_CPU_LPI_HYST_CNT = (25 * 8) + NV_MANU_PARAM_START, + NV_SI_DVFS_VOLT_INC_STEP_MV = (26 * 8) + NV_MANU_PARAM_START, + NV_SI_DVFS_VOLT_DEC_STEP_MV = (27 * 8) + NV_MANU_PARAM_START, + NV_SI_PLIMIT_APM_TEMP_THLD = (28 * 8) + NV_MANU_PARAM_START, + NV_SI_PLIMIT_APM_EN = (29 * 8) + NV_MANU_PARAM_START, + NV_SI_VDM_EN = (30 * 8) + NV_MANU_PARAM_START, + NV_SI_VDM_VMARGIN_MV = (31 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_EN = (32 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_SOCKET = (33 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_MCU_MASK = (34 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_RANK_MASK = (35 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_SLICE_MASK = (36 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_BIT_MASK = (37 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_X_PARAM = (38 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_Y_PARAM = (39 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_X_LEFT = (40 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_X_RIGHT = (41 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_X_STEP = (42 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_Y_BOTTOM = (43 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_Y_TOP = (44 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_Y_STEP = (45 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_START_ADDR_LO = (46 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_START_ADDR_UP = (47 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_SIZE = (48 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_THREAD_CNT = (49 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_SCREEN = (50 * 8) + NV_MANU_PARAM_START, + NV_SI_PLT_RSVD = (51 * 8) + NV_MANU_PARAM_START, + NV_SI_DVFS_VOLT_CHANGE_BY_STEP_EN = (52 * 8) + NV_MANU_PARAM_START, + NS_SI_DVFS_TCAL_F_LIMIT = (53 * 8) + NV_MANU_PARAM_START, + NS_SI_DVFS_TCAL_T_LIMIT = (54 * 8) + NV_MANU_PARAM_START, + NV_SI_CCIX_DIAG_CTRL1 = (55 * 8) + NV_MANU_PARAM_START, + NV_SI_CCIX_DIAG_CTRL2 = (56 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_EN = (57 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_DIMM_LOW_TEMP_THRESHOLD = (58 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_DIMM_HIGH_TEMP_THRESHOLD = (59 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_MCU_LOW_TEMP_THRESHOLD = (60 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_MCU_HIGH_TEMP_THRESHOLD = (61 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_LOW_TEMP_VOLT_OFF_MV = (62 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_PERIOD_SEC = (63 * 8) + NV_MANU_PARAM_START, + NV_SI_DDR_TCAL_SOC_VOLT_CAP_MV = (64 * 8) + NV_MANU_PARAM_START, + NV_SI_ALTRAMAX_ICCMAX_EN = (65 * 8) + NV_MANU_PARAM_START, + NV_SI_MESH_TURBO_ACTIVITY_THRESHOLD = (66 * 8) + NV_MANU_PARAM_START, + NV_PMPRO_REGION2_LOAD_END = NV_SI_MESH_TURBO_ACTIVITY_THRESHOLD, + /* NOTE: Add before NV_MANU_PARAM_MAX and increase its value */ + NV_MANU_PARAM_MAX = (66 * 8) + NV_MANU_PARAM_START, + + /* + * User non-volatile memory + * + * These parameters will reset to default value on failsafe. + */ + NV_USER_PARAM_START = 0x008000, + NV_SI_S0_PCP_ACTIVECPM_0_31 = (0 * 8) + NV_USER_PARAM_START, + NV_SI_S0_PCP_ACTIVECPM_32_63 = (1 * 8) + NV_USER_PARAM_START, + NV_SI_S1_PCP_ACTIVECPM_0_31 = (2 * 8) + NV_USER_PARAM_START, + NV_SI_S1_PCP_ACTIVECPM_32_63 = (3 * 8) + NV_USER_PARAM_START, + NV_SI_WDT_BIOS_EXP_MINS = (4 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_CE_RAS_THRESHOLD = (5 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_CE_RAS_INTERVAL = (6 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_SPEED = (7 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_SCRUB_EN = (8 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_ECC_MODE = (9 * 8) + NV_USER_PARAM_START, + NV_SI_S0_RCA_PCI_DEVMAP = (10 * 8) + NV_USER_PARAM_START, + NV_SI_S0_RCB_PCI_DEVMAP = (11 * 8) + NV_USER_PARAM_START, + NV_SI_S1_RCA_PCI_DEVMAP = (12 * 8) + NV_USER_PARAM_START, + NV_SI_S1_RCB_PCI_DEVMAP = (13 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_ERRCTRL = (14 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_REFRESH_GRANULARITY = (15 * 8) + NV_USER_PARAM_START, + NV_SI_SUBNUMA_MODE = (16 * 8) + NV_USER_PARAM_START, + NV_SI_ERRATUM_1542419_WA = (17 * 8) + NV_USER_PARAM_START, + NV_SI_NEAR_ATOMIC_DISABLE = (18 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_SLAVE_32BIT_MEM_EN = (19 * 8) + NV_USER_PARAM_START, + NV_SI_CPUECTLR_EL1_0_31 = (20 * 8) + NV_USER_PARAM_START, + NV_SI_CPUECTLR_EL1_32_63 = (21 * 8) + NV_USER_PARAM_START, + NV_SI_HARDWARE_EINJ = (22 * 8) + NV_USER_PARAM_START, + NV_SI_2P_CE_RAS_THRESHOLD = (23 * 8) + NV_USER_PARAM_START, + NV_SI_2P_CE_RAS_INTERVAL = (24 * 8) + NV_USER_PARAM_START, + NV_SI_RAS_BERT_ENABLED = (25 * 8) + NV_USER_PARAM_START, + NV_SI_HNF_AUX_CTL_0_31 = (26 * 8) + NV_USER_PARAM_START, + NV_SI_HNF_AUX_CTL_32_63 = (27 * 8) + NV_USER_PARAM_START, + NV_SI_CPM_CE_RAS_THRESHOLD = (28 * 8) + NV_USER_PARAM_START, + NV_SI_CPM_CE_RAS_INTERVAL = (29 * 8) + NV_USER_PARAM_START, + NV_SI_HNF_AUX_CTL_0_31_WR_EN_MASK = (30 * 8) + NV_USER_PARAM_START, + NV_SI_HNF_AUX_CTL_32_63_WR_EN_MASK = (31 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_WR_BACK_EN = (32 * 8) + NV_USER_PARAM_START, + NV_SI_CPUECTLR_EL1_0_31_WR_EN_MASK = (33 * 8) + NV_USER_PARAM_START, + NV_SI_CPUECTLR_EL1_32_63_WR_EN_MASK = (34 * 8) + NV_USER_PARAM_START, + NV_SI_LINK_ERR_THRESHOLD = (35 * 8) + NV_USER_PARAM_START, + NV_SI_SEC_WDT_BIOS_EXP_MINS = (36 * 8) + NV_USER_PARAM_START, + NV_SI_NVDIMM_MODE = (37 * 8) + NV_USER_PARAM_START, + NV_SI_RAS_SDEI_ENABLED = (38 * 8) + NV_USER_PARAM_START, + NV_SI_NVDIMM_PROV_MASK_S0 = (39 * 8) + NV_USER_PARAM_START, + NV_SI_NVDIMM_PROV_MASK_S1 = (40 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_ZQCS_EN = (41 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_CRC_MODE = (42 * 8) + NV_USER_PARAM_START, + NV_SI_CXG_RA_AUX_CTL_0_31 = (43 * 8) + NV_USER_PARAM_START, + NV_SI_CXG_RA_AUX_CTL_32_63 = (44 * 8) + NV_USER_PARAM_START, + NV_SI_CXG_RA_AUX_CTL_0_31_WR_EN_MASK = (45 * 8) + NV_USER_PARAM_START, + NV_SI_CXG_RA_AUX_CTL_32_63_WR_EN_MASK = (46 * 8) + NV_USER_PARAM_START, + NV_SI_CXLA_AUX_CTL_0_31 = (47 * 8) + NV_USER_PARAM_START, + NV_SI_CXLA_AUX_CTL_32_63 = (48 * 8) + NV_USER_PARAM_START, + NV_SI_CXLA_AUX_CTL_0_31_WR_EN_MASK = (49 * 8) + NV_USER_PARAM_START, + NV_SI_CXLA_AUX_CTL_32_63_WR_EN_MASK = (50 * 8) + NV_USER_PARAM_START, + NV_SI_DDR_LOW_POWER_CFG = (51 * 8) + NV_USER_PARAM_START, + NV_SI_ALERT_DIMM_SHUTDOWN_EN = (52 * 8) + NV_USER_PARAM_START, + NV_SI_DFS_EN = (53 * 8) + NV_USER_PARAM_START, + NV_SI_RAS_PCIE_AER_FW_FIRST = (54 * 8) + NV_USER_PARAM_START, + NV_SI_RAS_DRAM_EINJ_NOTRIGGER = (55 * 8) + NV_USER_PARAM_START, + NV_SI_RAS_AEST_PROC_EN = (56 * 8) + NV_USER_PARAM_START, + NV_SI_MESH_S0_CXG_RC_STRONG_ORDERING_EN = (57 * 8) + NV_USER_PARAM_START, + NV_SI_MESH_S1_CXG_RC_STRONG_ORDERING_EN = (58 * 8) + NV_USER_PARAM_START, + NV_SI_2P_RESERVED0 = (59 * 8) + NV_USER_PARAM_START, + NV_SI_2P_RESERVED1 = (60 * 8) + NV_USER_PARAM_START, + NV_SI_2P_RESERVED2 = (61 * 8) + NV_USER_PARAM_START, + NV_SI_HCR_EL2_CTL_LOW = (62 * 8) + NV_USER_PARAM_START, + NV_SI_HCR_EL2_CTL_HIGH = (63 * 8) + NV_USER_PARAM_START, + NV_SI_ESM_SPEED = (64 * 8) + NV_USER_PARAM_START, + /* NOTE: Add before NV_USER_PARAM_MAX and increase its value */ + NV_USER_PARAM_MAX = (64 * 8) + NV_USER_PARAM_START, + NV_PMPRO_REGION3_LOAD_START = NV_USER_PARAM_START, + NV_PMPRO_REGION3_LOAD_END = NV_USER_PARAM_MAX, + + /* + * Non-volatile board read-only setting + * + * These parameters do not support failsafe and will always read + * from its location. Please note that the physical base address + * location for board setting is not the same as above region. This + * allows packaging these board setting along with the firmware + * image itself. See SPI-NOR flash layout design for more info. + * + * Please note that script will parse these and generate + * board setting. The keyword "Default: " is used to provide + * the default value. + */ + NV_BOARD_PARAM_START = 0x00C000, + NV_SI_RO_BOARD_VENDOR = (0 * 8) + NV_BOARD_PARAM_START, /* Default: 0x0000CD3A - Follow BMC FRU format */ + NV_PMPRO_REGION4_LOAD_START = NV_SI_RO_BOARD_VENDOR, + NV_SI_RO_BOARD_TYPE = (1 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 - Follow BMC FRU format */ + NV_SI_RO_BOARD_REV = (2 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 Follow BMC FRU format */ + NV_SI_RO_BOARD_CFG = (3 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 Follow BMC FRU format */ + NV_SI_RO_BOARD_S0_DIMM_AVAIL = (4 * 8) + NV_BOARD_PARAM_START, /* Default: 0x0000FFFF */ + NV_SI_RO_BOARD_S1_DIMM_AVAIL = (5 * 8) + NV_BOARD_PARAM_START, /* Default: 0x0000FFFF */ + NV_SI_RO_BOARD_SPI0CS0_FREQ_KHZ = (6 * 8) + NV_BOARD_PARAM_START, /* Default: 33000 */ + NV_SI_RO_BOARD_SPI0CS1_FREQ_KHZ = (7 * 8) + NV_BOARD_PARAM_START, /* Default: 33000 */ + NV_SI_RO_BOARD_SPI1CS0_FREQ_KHZ = (8 * 8) + NV_BOARD_PARAM_START, /* Default: 10000 */ + NV_SI_RO_BOARD_SPI1CS1_FREQ_KHZ = (9 * 8) + NV_BOARD_PARAM_START, /* Default: 10000 */ + NV_SI_RO_BOARD_TPM_LOC = (10 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C0_FREQ_KHZ = (11 * 8) + NV_BOARD_PARAM_START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C1_FREQ_KHZ = (12 * 8) + NV_BOARD_PARAM_START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C2_10_FREQ_KHZ = (13 * 8) + NV_BOARD_PARAM_START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C3_FREQ_KHZ = (14 * 8) + NV_BOARD_PARAM_START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C9_FREQ_KHZ = (15 * 8) + NV_BOARD_PARAM_START, /* Default: 400 */ + NV_SI_RO_BOARD_2P_CFG = (16 * 8) + NV_BOARD_PARAM_START, /* Default: 0xFFFFFF01 */ + NV_SI_RO_BOARD_S0_RCA0_CFG = (17 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA1_CFG = (18 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA2_CFG = (19 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000004 */ + NV_SI_RO_BOARD_S0_RCA3_CFG = (20 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000004 */ + NV_SI_RO_BOARD_S0_RCB0_LO_CFG = (21 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB0_HI_CFG = (22 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB1_LO_CFG = (23 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB1_HI_CFG = (24 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB2_LO_CFG = (25 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB2_HI_CFG = (26 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S0_RCB3_LO_CFG = (27 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S0_RCB3_HI_CFG = (28 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCA0_CFG = (29 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA1_CFG = (30 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA2_CFG = (31 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA3_CFG = (32 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00030003 */ + NV_SI_RO_BOARD_S1_RCB0_LO_CFG = (33 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S1_RCB0_HI_CFG = (34 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB1_LO_CFG = (35 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB1_HI_CFG = (36 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S1_RCB2_LO_CFG = (37 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB2_HI_CFG = (38 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB3_LO_CFG = (39 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB3_HI_CFG = (40 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P0 = (41 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000001 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P1 = (42 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000002 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P2 = (43 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P3 = (44 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000004 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_M1 = (45 * 8) + NV_BOARD_PARAM_START, /* Default: 0xFFFFFFFF */ + NV_SI_RO_BOARD_T_LTLM_DELTA_M2 = (46 * 8) + NV_BOARD_PARAM_START, /* Default: 0xFFFFFFFE */ + NV_SI_RO_BOARD_T_LTLM_DELTA_M3 = (47 * 8) + NV_BOARD_PARAM_START, /* Default: 0xFFFFFFFD */ + NV_SI_RO_BOARD_P_LM_PID_P = (48 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_P_LM_PID_I = (49 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_P_LM_PID_I_L_THOLD = (50 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_P_LM_PID_I_H_THOLD = (51 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_P_LM_PID_D = (52 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_P_LM_EXP_SMOOTH_CONST = (53 * 8) + NV_BOARD_PARAM_START, + /* + * NV_SI_RO_BOARD_TPM_ALG_ID: 0=Default to SHA256, 1=SHA1, 2=SHA256 + * Any other value will lead to default digest. + */ + NV_SI_RO_BOARD_TPM_ALG_ID = (54 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000002 */ + NV_SI_RO_BOARD_DDR_SPEED_GRADE = (55 * 8) + NV_BOARD_PARAM_START, /* Default: 3200 */ + NV_SI_RO_BOARD_DDR_S0_RTT_WR = (56 * 8) + NV_BOARD_PARAM_START, /* Default: 0x20020000 */ + NV_SI_RO_BOARD_DDR_S1_RTT_WR = (57 * 8) + NV_BOARD_PARAM_START, /* Default: 0x20020000 */ + NV_SI_RO_BOARD_DDR_S0_RTT_NOM = (58 * 8) + NV_BOARD_PARAM_START, /* Default: 0x31060177 */ + NV_SI_RO_BOARD_DDR_S1_RTT_NOM = (59 * 8) + NV_BOARD_PARAM_START, /* Default: 0x31060177 */ + NV_SI_RO_BOARD_DDR_S0_RTT_PARK = (60 * 8) + NV_BOARD_PARAM_START, /* Default: 0x30060070 */ + NV_SI_RO_BOARD_DDR_S1_RTT_PARK = (61 * 8) + NV_BOARD_PARAM_START, /* Default: 0x30060070 */ + NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_1DPC = (62 * 8) + NV_BOARD_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_1DPC = (63 * 8) + NV_BOARD_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_1DPC = (64 * 8) + NV_BOARD_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_1DPC = (65 * 8) + NV_BOARD_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_2DPC = (66 * 8) + NV_BOARD_PARAM_START, /* Default: 0x044C0CCC */ + NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_2DPC = (67 * 8) + NV_BOARD_PARAM_START, /* Default: 0x084C0CCC */ + NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_2DPC = (68 * 8) + NV_BOARD_PARAM_START, /* Default: 0x04130333 */ + NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_2DPC = (69 * 8) + NV_BOARD_PARAM_START, /* Default: 0x08130333 */ + NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_1DPC = (70 * 8) + NV_BOARD_PARAM_START, /* Default: 0x01130333 */ + NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_1DPC = (71 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02230333 */ + NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_1DPC = (72 * 8) + NV_BOARD_PARAM_START, /* Default: 0x01430333 */ + NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_1DPC = (73 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02830333 */ + NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_2DPC = (74 * 8) + NV_BOARD_PARAM_START, /* Default: 0x055EDEED */ + NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_2DPC = (75 * 8) + NV_BOARD_PARAM_START, /* Default: 0x0A5DEDDE */ + NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_2DPC = (76 * 8) + NV_BOARD_PARAM_START, /* Default: 0x055B7BB7 */ + NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_2DPC = (77 * 8) + NV_BOARD_PARAM_START, /* Default: 0x0A57B77B */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_1DPC = (78 * 8) + NV_BOARD_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_1DPC = (79 * 8) + NV_BOARD_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_1DPC = (80 * 8) + NV_BOARD_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_1DPC = (81 * 8) + NV_BOARD_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_2DPC = (82 * 8) + NV_BOARD_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_2DPC = (83 * 8) + NV_BOARD_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_2DPC = (84 * 8) + NV_BOARD_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_2DPC = (85 * 8) + NV_BOARD_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_1DPC = (86 * 8) + NV_BOARD_PARAM_START, /* Default: 0x24 */ + NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_1DPC = (87 * 8) + NV_BOARD_PARAM_START, /* Default: 0x001A001A */ + NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_2DPC = (88 * 8) + NV_BOARD_PARAM_START, /* Default: 0x50 */ + NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_2DPC = (89 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00240020 */ + NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_DEFAULT = (90 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02800280 */ + NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_DEFAULT = (91 * 8) + NV_BOARD_PARAM_START, /* Default: 0x90909090 */ + NV_SI_RO_BOARD_DDR_WRDQS_SHIFT_DEFAULT = (92 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_ADCMD_DLY_DEFAULT = (93 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00C000C0 */ + NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_ADJ = (94 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_ADJ = (95 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_PHY_VREF_ADJ = (96 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_DRAM_VREF_ADJ = (97 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_WR_PREAMBLE_CYCLE = (98 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02010201 */ + NV_SI_RO_BOARD_DDR_ADCMD_2T_MODE = (99 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C_VRD_CONFIG_INFO = (100 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_DDR_PHY_FEATURE_CTRL = (101 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_BMC_HANDSHAKE_SPI_ACCESS = (102 * 8) + NV_BOARD_PARAM_START, /* Default: 0x01050106 */ + NV_SI_RO_BOARD_DIMM_TEMP_THRESHOLD = (103 * 8) + NV_BOARD_PARAM_START, /* Default: 0x5F4 */ + NV_SI_RO_BOARD_DIMM_SPD_COMPARE_DISABLE = (104 * 8) + NV_BOARD_PARAM_START, /* Default: 0x0 */ + NV_SI_RO_BOARD_S0_PCIE_CLK_CFG = (105 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA4_CFG = (106 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S0_RCA5_CFG = (107 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S0_RCA6_CFG = (108 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S0_RCA7_CFG = (109 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020003 */ + NV_SI_RO_BOARD_S0_RCA0_TXRX_G3PRESET = (110 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA1_TXRX_G3PRESET = (111 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA2_TXRX_G3PRESET = (112 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA3_TXRX_G3PRESET = (113 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB0A_TXRX_G3PRESET = (114 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB0B_TXRX_G3PRESET = (115 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB1A_TXRX_G3PRESET = (116 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB1B_TXRX_G3PRESET = (117 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB2A_TXRX_G3PRESET = (118 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB2B_TXRX_G3PRESET = (119 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB3A_TXRX_G3PRESET = (120 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB3B_TXRX_G3PRESET = (121 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA4_TXRX_G3PRESET = (122 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA5_TXRX_G3PRESET = (123 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA6_TXRX_G3PRESET = (124 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA7_TXRX_G3PRESET = (125 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA0_TXRX_G4PRESET = (126 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA1_TXRX_G4PRESET = (127 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA2_TXRX_G4PRESET = (128 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA3_TXRX_G4PRESET = (129 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB0A_TXRX_G4PRESET = (130 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB0B_TXRX_G4PRESET = (131 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB1A_TXRX_G4PRESET = (132 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB1B_TXRX_G4PRESET = (133 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB2A_TXRX_G4PRESET = (134 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB2B_TXRX_G4PRESET = (135 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB3A_TXRX_G4PRESET = (136 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB3B_TXRX_G4PRESET = (137 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA4_TXRX_G4PRESET = (138 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA5_TXRX_G4PRESET = (139 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA6_TXRX_G4PRESET = (140 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA7_TXRX_G4PRESET = (141 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_PCIE_CLK_CFG = (142 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA4_CFG = (143 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA5_CFG = (144 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA6_CFG = (145 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA7_CFG = (146 * 8) + NV_BOARD_PARAM_START, /* Default: 0x02020003 */ + NV_SI_RO_BOARD_S1_RCA2_TXRX_G3PRESET = (147 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA3_TXRX_G3PRESET = (148 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB0A_TXRX_G3PRESET = (149 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB0B_TXRX_G3PRESET = (150 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB1A_TXRX_G3PRESET = (151 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB1B_TXRX_G3PRESET = (152 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB2A_TXRX_G3PRESET = (153 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB2B_TXRX_G3PRESET = (154 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB3A_TXRX_G3PRESET = (155 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB3B_TXRX_G3PRESET = (156 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA4_TXRX_G3PRESET = (157 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA5_TXRX_G3PRESET = (158 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA6_TXRX_G3PRESET = (159 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA7_TXRX_G3PRESET = (160 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA2_TXRX_G4PRESET = (161 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA3_TXRX_G4PRESET = (162 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB0A_TXRX_G4PRESET = (163 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB0B_TXRX_G4PRESET = (164 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB1A_TXRX_G4PRESET = (165 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB1B_TXRX_G4PRESET = (166 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB2A_TXRX_G4PRESET = (167 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB2B_TXRX_G4PRESET = (168 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB3A_TXRX_G4PRESET = (169 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB3B_TXRX_G4PRESET = (170 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA4_TXRX_G4PRESET = (171 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA5_TXRX_G4PRESET = (172 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA6_TXRX_G4PRESET = (173 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA7_TXRX_G4PRESET = (174 * 8) + NV_BOARD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_2P_CE_MASK_THRESHOLD = (175 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_2P_CE_MASK_INTERVAL = (176 * 8) + NV_BOARD_PARAM_START, /* Default: 0x000001A4 */ + NV_SI_RO_BOARD_SX_PHY_CFG_SETTING = (177 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_DDR_PHY_DC_CLK = (178 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00018000 */ + NV_SI_RO_BOARD_DDR_PHY_DC_DATA = (179 * 8) + NV_BOARD_PARAM_START, /* Default: 0x80018000 */ + NV_SI_RO_BOARD_SX_RCA0_TXRX_20GPRESET = (180 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA1_TXRX_20GPRESET = (181 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA2_TXRX_20GPRESET = (182 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA3_TXRX_20GPRESET = (183 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA0_TXRX_25GPRESET = (184 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA1_TXRX_25GPRESET = (185 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA2_TXRX_25GPRESET = (186 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA3_TXRX_25GPRESET = (187 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_DDR_2X_REFRESH_TEMP_THRESHOLD = (188 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00550055 */ + NV_SI_RO_BOARD_PCP_VRD_VOUT_WAIT_US = (189 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000064 */ + NV_SI_RO_BOARD_PCP_VRD_VOUT_RESOLUTION_MV = (190 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000005 */ + NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_EN = (191 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000001 */ + NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_TIME = (192 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000002 */ + NV_SI_RO_BOARD_DVFS_VOUT_20MV_RAMP_TIME_US = (193 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000005 */ + NV_SI_RO_BOARD_PCIE_AER_FW_FIRST = (194 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_RTC_GPI_LOCK_BYPASS = (195 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_TPM_DISABLE = (196 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_MESH_S0_CXG_RC_STRONG_ORDERING_EN = (197 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_MESH_S1_CXG_RC_STRONG_ORDERING_EN = (198 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_GPIO_SW_WATCHDOG_EN = (199 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_PCIE_HP_DISABLE = (200 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C_VRD_VOUT_FORMAT = (201 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C_VRD_SMBUS_CMD_FLAGS = (202 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_CUST_SPM_LOCATION = (203 * 8) + NV_BOARD_PARAM_START, + NV_SI_RO_BOARD_RAS_DDR_CE_WINDOW = (204 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_RAS_DDR_CE_TH1 = (205 * 8) + NV_BOARD_PARAM_START, /* Default: 0x000001F4 */ + NV_SI_RO_BOARD_RAS_DDR_CE_TH2 = (206 * 8) + NV_BOARD_PARAM_START, /* Default: 0x00001388 */ + NV_PMPRO_REGION4_LOAD_END = NV_SI_RO_BOARD_RAS_DDR_CE_TH2, + /* NOTE: Add before NV_BOARD_PARAM_MAX and increase its value */ + NV_BOARD_PARAM_MAX = (206 * 8) + NV_BOARD_PARAM_START, +} NVPARAM; + +#endif /* NVPARAMDEF_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h new file mode 100644 index 000000000000..66286bfff145 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -0,0 +1,317 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_AC01_H_ +#define PLATFORM_AC01_H_ + +// +// Number of supported sockets in the platform +// +#define PLATFORM_CPU_MAX_SOCKET 2 + +// +// Maximum number of CPMs in the chip. +// +#define PLATFORM_CPU_MAX_CPM (FixedPcdGet32 (PcdClusterCount)) + +// +// Number of cores per CPM. +// +#define PLATFORM_CPU_NUM_CORES_PER_CPM (FixedPcdGet32 (PcdCoreCount) / PLATFORM_CPU_MAX_CPM) + +// +// Socket bit offset of core UID. +// +#define PLATFORM_SOCKET_UID_BIT_OFFSET 16 + +// +// CPM bit offset of core UID. +// +#define PLATFORM_CPM_UID_BIT_OFFSET 8 + +// +// Maximum number of cores supported. +// +#define PLATFORM_CPU_MAX_NUM_CORES (PLATFORM_CPU_MAX_SOCKET * PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_NUM_CORES_PER_CPM) + +// +// Maximum number of memory region +// +#define PLATFORM_DRAM_INFO_MAX_REGION 16 + +// +// Maximum number of DDR slots supported +// +#define PLATFORM_DIMM_INFO_MAX_SLOT 32 + +// +// Maximum number of memory supported. +// +#define PLATFORM_MAX_MEMORY_REGION 4 + +// +// The Array of Soc Gpio Base Address +// +#define GPIO_DWAPB_BASE_ADDR 0x1000026f0000, 0x1000026e0000, 0x1000027b0000, 0x1000026d0000, 0x5000026f0000, 0x5000026e0000, 0x5000027b0000, 0x5000026d0000 + +// +// The Array of Soc Gpi Base Address +// +#define GPI_DWAPB_BASE_ADDR 0x1000026d0000, 0x5000026d0000 + +// +// Number of Pins Per Each Contoller +// +#define GPIO_DWAPB_PINS_PER_CONTROLLER 8 + +// +// Number of Pins Each Socket +// +#define GPIO_DWAPB_PINS_PER_SOCKET 32 + +// +// The maximum number of I2C bus +// +#define MAX_PLATFORM_I2C_BUS_NUM 2 + +// +// The base address of DW I2C +// +#define PLATFORM_I2C_REGISTER_BASE 0x1000026B0000ULL, 0x100002750000ULL + +// +// Offset of failsafe testing feature +// +#define NV_UEFI_FAILURE_FAILSAFE_OFFSET 0x1F8 + +// +// Maximum number of memory controller supports NVDIMM-N per socket +// +#define PLATFORM_NVDIMM_MCU_MAX_PER_SK 2 + +// +// Maximum number of NVDIMM-N per memory controller +// +#define PLATFORM_NVDIMM_NUM_MAX_PER_MCU 1 + +// +// Maximum number of NVDIMM region per socket +// +#define PLATFORM_NVDIMM_REGION_MAX_PER_SK 2 + +// +// Socket 0 base address of NVDIMM non-hashed region 0 +// +#define PLATFORM_NVDIMM_SK0_NHASHED_REGION0 0x0B0000000000ULL + +// +// Socket 0 base address of NVDIMM non-hashed region 1 +// +#define PLATFORM_NVDIMM_SK0_NHASHED_REGION1 0x0F0000000000ULL + +// +// Socket 1 base address of NVDIMM non-hashed region 0 +// +#define PLATFORM_NVDIMM_SK1_NHASHED_REGION0 0x430000000000ULL + +// +// Socket 1 base address of NVDIMM non-hashed region 1 +// +#define PLATFORM_NVDIMM_SK1_NHASHED_REGION1 0x470000000000ULL + +// +// DIMM ID of NVDIMM-N device 1 +// +#define PLATFORM_NVDIMM_NVD1_DIMM_ID 6 + +// +// DIMM ID of NVDIMM-N device 2 +// +#define PLATFORM_NVDIMM_NVD2_DIMM_ID 14 + +// +// DIMM ID of NVDIMM-N device 3 +// +#define PLATFORM_NVDIMM_NVD3_DIMM_ID 22 + +// +// DIMM ID of NVDIMM-N device 4 +// +#define PLATFORM_NVDIMM_NVD4_DIMM_ID 30 + +// +// NFIT device handle of NVDIMM-N device 1 +// +#define PLATFORM_NVDIMM_NVD1_DEVICE_HANDLE 0x0330 + +// +// NFIT device handle of NVDIMM-N device 2 +// +#define PLATFORM_NVDIMM_NVD2_DEVICE_HANDLE 0x0770 + +// +// NFIT device handle of NVDIMM-N device 3 +// +#define PLATFORM_NVDIMM_NVD3_DEVICE_HANDLE 0x1330 + +// +// NFIT device handle of NVDIMM-N device 4 +// +#define PLATFORM_NVDIMM_NVD4_DEVICE_HANDLE 0x1770 + +// +// Interleave ways of non-hashed NVDIMM-N +// +#define PLATFORM_NVDIMM_NHASHED_INTERLEAVE_WAYS 1 + +// +// Interleave ways of hashed NVDIMM-N +// +#define PLATFORM_NVDIMM_HASHED_INTERLEAVE_WAYS 2 + +// +// Region offset of hashed NVDIMM-N +// +#define PLATFORM_NVDIMM_HASHED_REGION_OFFSET 512 + +// +// The base address of master socket GIC redistributor registers +// +#define GICR_MASTER_BASE_REG 0x100100140000 + +// +// The base address of GIC distributor registers +// +#define GICD_BASE_REG 0x100100000000 + +// +// The base address of slave socket GIC redistributor registers +// +#define GICR_SLAVE_BASE_REG 0x500100140000 + +// +// The base address of slave socket GIC distributor registers +// +#define GICD_SLAVE_BASE_REG 0x500100000000 + +// +// CSR Address base for slave socket +// +#define SLAVE_SOCKET_BASE_ADDRESS_OFFSET 0x400000000000 + +// +// Socket 0 first RC +// +#define SOCKET0_FIRST_RC 2 + +// +// Socket 0 last RC +// +#define SOCKET0_LAST_RC 7 + +// +// Socket 1 first RC +// +#define SOCKET1_FIRST_RC 10 + +// +// Socket 1 last RC +// +#define SOCKET1_LAST_RC 15 + +// +// SMpro EFUSE Shadow register +// +#define SMPRO_EFUSE_SHADOW0 (FixedPcdGet64 (PcdSmproEfuseShadow0)) + +// +// 2P Configuration Register +// +#define CFG2P_OFFSET 0x200 + +// +// Slave socket present +// +#define SLAVE_PRESENT_N BIT1 + +// +// Max number for AC01 PCIE Root Complexes per socket +// +#define AC01_MAX_RCS_PER_SOCKET 8 + +// +// Max number for AC01 PCIE Root Complexes +// +#define AC01_MAX_PCIE_ROOT_COMPLEX 16 + +// +// Max number for AC01 PCIE Root Bridge under each Root Complex +// +#define AC01_MAX_PCIE_ROOT_BRIDGE 1 + +// +// The base address of {TCU, CSR, MMCONFIG} Registers +// +#define AC01_PCIE_REGISTER_BASE 0x33FFE0000000, 0x37FFE0000000, 0x3BFFE0000000, 0x3FFFE0000000, 0x23FFE0000000, 0x27FFE0000000, 0x2BFFE0000000, 0x2FFFE0000000, 0x73FFE0000000, 0x77FFE0000000, 0x7BFFE0000000, 0x7FFFE0000000, 0x63FFE0000000, 0x67FFE0000000, 0x6BFFE0000000, 0x6FFFE0000000 + +// +// The base address of MMIO Registers +// +#define AC01_PCIE_MMIO_BASE 0x300000000000, 0x340000000000, 0x380000000000, 0x3C0000000000, 0x200000000000, 0x240000000000, 0x280000000000, 0x2C0000000000, 0x700000000000, 0x740000000000, 0x780000000000, 0x7C0000000000, 0x600000000000, 0x640000000000, 0x680000000000, 0x6C0000000000 + +// +// The base address of MMIO32 Registers +// +#define AC01_PCIE_MMIO32_BASE 0x000020000000, 0x000028000000, 0x000030000000, 0x000038000000, 0x000001000000, 0x000008000000, 0x000010000000, 0x000018000000, 0x000060000000, 0x000068000000, 0x000070000000, 0x000078000000, 0x000040000000, 0x000048000000, 0x000050000000, 0x000058000000 + +// +// The base address of MMIO32 Registers +// +#define AC01_PCIE_MMIO32_BASE_1P 0x000040000000, 0x000050000000, 0x000060000000, 0x000070000000, 0x000001000000, 0x000010000000, 0x000020000000, 0x000030000000, 0, 0, 0, 0, 0, 0, 0, 0 + +// +// DSDT RCA2 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCA2_QMEM 0x0000000000000000, 0x0000000060000000, 0x000000006FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCA3 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCA3_QMEM 0x0000000000000000, 0x0000000070000000, 0x000000007FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB0 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB0_QMEM 0x0000000000000000, 0x0000000001000000, 0x000000000FFFFFFF, 0x0000000000000000, 0x000000000F000000 + +// +// DSDT RCB1 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB1_QMEM 0x0000000000000000, 0x0000000010000000, 0x000000001FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB2 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB2_QMEM 0x0000000000000000, 0x0000000020000000, 0x000000002FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB3 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB3_QMEM 0x0000000000000000, 0x0000000030000000, 0x000000003FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// The start of TBU PMU IRQ array. +// +#define AC01_SMMU_TBU_PMU_IRQS 224, 230, 236, 242, 160, 170, 180, 190, 544, 550, 556, 562, 480, 490, 500, 510 + +// +// The start of TCU PMU IRQ array +// +#define AC01_SMMU_TCU_PMU_IRQS 256, 257, 258, 259, 260, 261, 262, 263, 576, 577, 578, 579, 580, 581, 582, 583 + +#endif /* PLATFORM_AC01_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h b/Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h new file mode 100644 index 000000000000..f8abcb92a17c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h @@ -0,0 +1,182 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_INFO_HOB_H_ +#define PLATFORM_INFO_HOB_H_ + +#include <IndustryStandard/Tpm20.h> +#include <Platform/Ac01.h> + +/* DIMM type */ +enum { + UDIMM, + RDIMM, + SODIMM, + RSODIMM, + LRDIMM, + NVRDIMM +}; + +/* DIMM status */ +enum { + DIMM_NOT_INSTALLED = 0, + DIMM_INSTALLED_OPERATIONAL, /* installed and operational */ + DIMM_INSTALLED_NONOPERATIONAL, /* installed and non-operational */ + DIMM_INSTALLED_FAILED /* installed and failed */ +}; + +typedef struct { + UINT32 NumRegion; + UINT64 TotalSize; + UINT64 Base[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT64 Size[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT64 Node[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT64 Socket[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT32 MaxSpeed; + UINT32 McuMask[PLATFORM_CPU_MAX_SOCKET]; + UINT32 NvdRegion[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT32 NvdimmMode[PLATFORM_CPU_MAX_SOCKET]; +} PLATFORM_DRAM_INFO; + +typedef struct { + CHAR8 PartNumber[32]; + UINT64 DimmSize; + UINT16 DimmMfcId; + UINT16 Reserved; + UINT8 DimmNrRank; + UINT8 DimmType; + UINT8 DimmStatus; + UINT8 DimmDevType; +} PLATFORM_DIMM_INFO; + +typedef struct { + UINT8 Data[512]; +} PLATFORM_DIMM_SPD_DATA; + +typedef struct { + PLATFORM_DIMM_INFO Info; + PLATFORM_DIMM_SPD_DATA SpdData; + UINT32 NodeId; +} PLATFORM_DIMM; + +typedef struct { + UINT32 BoardDimmSlots; + PLATFORM_DIMM Dimm[PLATFORM_DIMM_INFO_MAX_SLOT]; +} PLATFORM_DIMM_LIST; + +typedef struct { + UINT32 EnableMask[4]; +} PLATFORM_CLUSTER_EN; + +// +// Algorithm ID defined in pre-UEFI firmware +// +typedef enum { + PLATFORM_ALGORITHM_SHA1 = 1, + PLATFORM_ALGORITHM_SHA256 +} PLATFORM_ALGORITHM_ID; + +// +// Platform digest data definition +// +typedef union { + unsigned char Sha1[SHA1_DIGEST_SIZE]; + unsigned char Sha256[SHA256_DIGEST_SIZE]; +} PLATFORM_TPM_DIGEST; + +#define MAX_VIRTUAL_PCR_INDEX 0x0002 + +#pragma pack(1) +typedef struct { + PLATFORM_ALGORITHM_ID AlgorithmId; + struct { + PLATFORM_TPM_DIGEST Hash; + } VPcr[MAX_VIRTUAL_PCR_INDEX]; // vPCR 0 or 1 +} PLATFORM_VPCR_HASH_INFO; + +typedef struct { + UINT8 InterfaceType; // If I/F is CRB then CRB parameters are expected + UINT64 InterfaceParametersAddress; // Physical address of interface, by Value */ + UINT64 InterfaceParametersLength; + UINT32 SupportedAlgorithmsBitMask; + UINT64 EventLogAddress; + UINT64 EventLogLength; + UINT8 Reserved[3]; +} PLATFORM_TPM2_CONFIG_DATA; + +typedef struct { + UINT32 CurrentRequest; + UINT32 LastRequest; + UINT32 LastRequestStatus; +} PLATFORM_TPM2_PPI_REQUEST; + +typedef struct { + UINT64 AddressOfControlArea; + UINT64 ControlAreaLength; + UINT8 InterruptMode; + UINT8 Reserved[3]; + UINT32 InterruptNumber; // Should have a value of zero polling + UINT32 SmcFunctionId; // SMC Function ID + UINT64 PpiRequestNotifyAddress; // Doorbell/Interrupt Address + PLATFORM_TPM2_PPI_REQUEST *PpiRequest; // PPI Request +} PLATFORM_TPM2_CRB_INTERFACE_PARAMETERS; + +typedef struct { + PLATFORM_TPM2_CONFIG_DATA Tpm2ConfigData; + PLATFORM_TPM2_CRB_INTERFACE_PARAMETERS Tpm2CrbInterfaceParams; + PLATFORM_VPCR_HASH_INFO Tpm2VPcrHashInfo; +} PLATFORM_TPM2_INFO; +#pragma pack() + +typedef struct { + UINT8 MajorNumber; + UINT8 MinorNumber; + UINT64 PcpClk; + UINT64 CpuClk; + UINT64 SocClk; + UINT64 AhbClk; + UINT64 SysClk; + UINT8 CpuInfo[128]; + UINT8 CpuVer[32]; + UINT8 SmPmProVer[32]; + UINT8 SmPmProBuild[32]; + PLATFORM_DRAM_INFO DramInfo; + PLATFORM_DIMM_LIST DimmList; + PLATFORM_CLUSTER_EN ClusterEn[2]; + UINT32 FailSafeStatus; + UINT32 RcDisableMask[2]; + UINT8 ResetStatus; + UINT16 CoreVoltage[2]; + UINT16 SocVoltage[2]; + UINT16 Dimm1Voltage[2]; + UINT16 Dimm2Voltage[2]; + + /* Chip information */ + UINT32 ScuProductId[2]; + UINT8 MaxNumOfCore[2]; + UINT8 Warranty[2]; + UINT8 SubNumaMode[2]; + UINT8 AvsEnable[2]; + UINT32 AvsVoltageMV[2]; + UINT8 TurboCapability[2]; + UINT32 TurboFrequency[2]; + + UINT8 SkuMaxTurbo[2]; + UINT8 SkuMaxCore[2]; + UINT32 AHBCId[2]; + + /* TPM2 Info */ + PLATFORM_TPM2_INFO Tpm2Info; + + /* 2P link info for RCA0/RCA1 */ + UINT8 Link2PSpeed[2]; + UINT8 Link2PWidth[2]; + +} PLATFORM_INFO_HOB; + +#endif /* PLATFORM_INFO_HOB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMap.h b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMap.h new file mode 100644 index 000000000000..23b52653f30b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMap.h @@ -0,0 +1,135 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_MEMORY_MAP_H_ +#define PLATFORM_MEMORY_MAP_H_ + +//******************************************************************* +// Platform Memory Map +//******************************************************************* +// +// Device Memory (Socket 0) +// +#define AC01_DEVICE_MEMORY_S0_BASE 0x100000000000ULL +#define AC01_DEVICE_MEMORY_S0_SIZE 0x102000000ULL + +// +// Device Memory (Socket 1) +// +#define AC01_DEVICE_MEMORY_S1_BASE 0x500000000000ULL +#define AC01_DEVICE_MEMORY_S1_SIZE 0x101000000ULL + +// +// BERT memory +// +#define AC01_BERT_MEMORY_BASE 0x88230000ULL +#define AC01_BERT_MEMORY_SIZE 0x50000ULL + +//******************************************************************* +// Socket 0 PCIe Device Memory +//******************************************************************* +// +// PCIe RCA0 Device memory +// +#define AC01_RCA0_DEVICE_MEMORY_S0_BASE 0x33FFE0000000ULL +#define AC01_RCA0_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCA1 Device memory +// +#define AC01_RCA1_DEVICE_MEMORY_S0_BASE 0x37FFE0000000ULL +#define AC01_RCA1_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCA2 Device memory +// +#define AC01_RCA2_DEVICE_MEMORY_S0_BASE 0x3BFFE0000000ULL +#define AC01_RCA2_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCA3 Device memory +// +#define AC01_RCA3_DEVICE_MEMORY_S0_BASE 0x3FFFE0000000ULL +#define AC01_RCA3_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB0 Device memory +// +#define AC01_RCB0_DEVICE_MEMORY_S0_BASE 0x23FFE0000000ULL +#define AC01_RCB0_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB1 Device memory +// +#define AC01_RCB1_DEVICE_MEMORY_S0_BASE 0x27FFE0000000ULL +#define AC01_RCB1_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB2 Device memory +// +#define AC01_RCB2_DEVICE_MEMORY_S0_BASE 0x2BFFE0000000ULL +#define AC01_RCB2_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB3 Device memory +// +#define AC01_RCB3_DEVICE_MEMORY_S0_BASE 0x2FFFE0000000ULL +#define AC01_RCB3_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +//******************************************************************* +// Socket 1 PCIe Device Memory +//******************************************************************* +// +// PCIe RCA0 Device memory +// +#define AC01_RCA0_DEVICE_MEMORY_S1_BASE 0x73FFE0000000ULL +#define AC01_RCA0_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCA1 Device memory +// +#define AC01_RCA1_DEVICE_MEMORY_S1_BASE 0x77FFE0000000ULL +#define AC01_RCA1_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCA2 Device memory +// +#define AC01_RCA2_DEVICE_MEMORY_S1_BASE 0x7BFFE0000000ULL +#define AC01_RCA2_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCA3 Device memory +// +#define AC01_RCA3_DEVICE_MEMORY_S1_BASE 0x7FFFE0000000ULL +#define AC01_RCA3_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB0 Device memory +// +#define AC01_RCB0_DEVICE_MEMORY_S1_BASE 0x63FFE0000000ULL +#define AC01_RCB0_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB1 Device memory +// +#define AC01_RCB1_DEVICE_MEMORY_S1_BASE 0x67FFE0000000ULL +#define AC01_RCB1_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB2 Device memory +// +#define AC01_RCB2_DEVICE_MEMORY_S1_BASE 0x6BFFE0000000ULL +#define AC01_RCB2_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB3 Device memory +// +#define AC01_RCB3_DEVICE_MEMORY_S1_BASE 0x6FFFE0000000ULL +#define AC01_RCB3_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +#endif /* PLATFORM_MEMORY_MAP_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c new file mode 100644 index 000000000000..04def9fa2e42 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c @@ -0,0 +1,52 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> + +#include <Guid/PlatformInfoHobGuid.h> +#include <Library/BaseLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/PcdLib.h> +#include <Library/PeimEntryPoint.h> +#include <Library/PeiServicesLib.h> +#include <PlatformInfoHob.h> +#include <Uefi/UefiBaseType.h> + +VOID +BuildPlatformInformationHob ( + VOID + ) +{ + VOID *Hob; + + /* The ATF HOB handoff base is at PcdSystemMemoryBase */ + Hob = GetNextGuidHob ( + &gPlatformHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (Hob != NULL) { + BuildGuidDataHob ( + &gPlatformHobGuid, + GET_GUID_HOB_DATA (Hob), + GET_GUID_HOB_DATA_SIZE (Hob) + ); + } +} + +EFI_STATUS +EFIAPI +InitializeATFHobPeim ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + BuildPlatformInformationHob (); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.c new file mode 100644 index 000000000000..4098b4664bf8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.c @@ -0,0 +1,151 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> + +/* + * The protocols, PPI and GUID defintions for this module + */ +#include <Guid/MemoryTypeInformation.h> +#include <Guid/PlatformInfoHobGuid.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/PcdLib.h> +#include <Library/PeimEntryPoint.h> +#include <Library/PeiServicesLib.h> +#include <PlatformInfoHob.h> +#include <Ppi/BootInRecoveryMode.h> +#include <Ppi/MasterBootMode.h> + +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ); + +VOID +BuildMemoryTypeInformationHob ( + VOID + ) +{ + EFI_MEMORY_TYPE_INFORMATION Info[10]; + + Info[0].Type = EfiACPIReclaimMemory; + Info[0].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory); + Info[1].Type = EfiACPIMemoryNVS; + Info[1].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS); + Info[2].Type = EfiReservedMemoryType; + Info[2].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiReservedMemoryType); + Info[3].Type = EfiRuntimeServicesData; + Info[3].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesData); + Info[4].Type = EfiRuntimeServicesCode; + Info[4].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode); + Info[5].Type = EfiBootServicesCode; + Info[5].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesCode); + Info[6].Type = EfiBootServicesData; + Info[6].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiBootServicesData); + Info[7].Type = EfiLoaderCode; + Info[7].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderCode); + Info[8].Type = EfiLoaderData; + Info[8].NumberOfPages = PcdGet32 (PcdMemoryTypeEfiLoaderData); + + /* Terminator for the list */ + Info[9].Type = EfiMaxMemoryType; + Info[9].NumberOfPages = 0; + + BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, &Info, sizeof (Info)); +} + +EFI_STATUS +EFIAPI +InitializeMemory ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + UINTN SystemMemoryBase; + UINTN SystemMemoryTop; + UINTN FdBase; + UINTN FdTop; + UINTN UefiMemoryBase; + UINTN Index; + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + DEBUG ((DEBUG_INFO, "Memory Init PEIM Loaded\n")); + + Hob = GetFirstGuidHob (&gPlatformHobGuid); + ASSERT (Hob != NULL); + if (Hob == NULL) { + return EFI_DEVICE_ERROR; + } + + PlatformHob = (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + /* Find system memory top of the first node */ + SystemMemoryTop = 0; + for (Index = 0; Index < PlatformHob->DramInfo.NumRegion; Index++) { + if (SystemMemoryTop <= PlatformHob->DramInfo.Base[Index] && + PlatformHob->DramInfo.Node[Index] == 0 && + (PlatformHob->DramInfo.Base[Index] + + PlatformHob->DramInfo.Size[Index] - 1) <= 0xFFFFFFFF) + { + SystemMemoryTop = PlatformHob->DramInfo.Base[Index] + PlatformHob->DramInfo.Size[Index]; + } + } + + DEBUG ((DEBUG_INFO, "PEIM memory configuration.\n")); + + SystemMemoryBase = (UINTN)FixedPcdGet64 (PcdSystemMemoryBase); + FdBase = (UINTN)PcdGet64 (PcdFdBaseAddress); + FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize); + + // In case the firmware has been shadowed in the System Memory + if ((FdBase >= SystemMemoryBase) && (FdTop <= SystemMemoryTop)) { + // + // Check if there is enough space between the top of the system memory and the top of the + // firmware to place the UEFI memory (for PEI & DXE phases) + // + if (SystemMemoryTop - FdTop >= FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)) { + UefiMemoryBase = SystemMemoryTop - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); + } else { + // Check there is enough space for the UEFI memory + ASSERT (SystemMemoryBase + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize) <= FdBase); + + UefiMemoryBase = FdBase - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); + } + } else { + // Check the Firmware does not overlapped with the system memory + ASSERT ((FdBase < SystemMemoryBase) || (FdBase >= SystemMemoryTop)); + ASSERT ((FdTop <= SystemMemoryBase) || (FdTop > SystemMemoryTop)); + + UefiMemoryBase = SystemMemoryTop - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); + } + + Status = PeiServicesInstallPeiMemory ( + UefiMemoryBase, + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize) + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Error: Failed to install Pei Memory\n")); + } else { + DEBUG ((DEBUG_INFO, "Info: Installed Pei Memory\n")); + } + ASSERT_EFI_ERROR (Status); + + // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) + Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Error: Failed to initialize MMU and Memory HOBS\n")); + } + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c new file mode 100644 index 000000000000..6f5a604180dd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c @@ -0,0 +1,43 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> +#include <Uefi.h> + +#include <Guid/PlatformInfoHobGuid.h> +#include <Library/AmpereCpuLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <PlatformInfoHob.h> + +VOID *mPlatformInfoHob = NULL; + +/** + Get the platform HOB data. + + @return PLATFORM_INFO_HOB The pointer to the platform HOB data. + +**/ +PLATFORM_INFO_HOB * +GetPlatformHob ( + VOID + ) +{ + if (mPlatformInfoHob == NULL) { + mPlatformInfoHob = GetNextGuidHob ( + &gPlatformHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (mPlatformInfoHob == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get gPlatformHobGuid!\n", __FUNCTION__)); + return NULL; + } + } + + return ((PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (mPlatformInfoHob)); +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c new file mode 100644 index 000000000000..a2aeb3fc725c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c @@ -0,0 +1,637 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> +#include <Uefi.h> + +#include <Library/AmpereCpuLib.h> +#include <Library/ArmLib/ArmLibPrivate.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/IoLib.h> +#include <Library/NVParamLib.h> +#include <NVParamDef.h> +#include <Platform/Ac01.h> +#include <PlatformInfoHob.h> + +PLATFORM_INFO_HOB * +GetPlatformHob ( + VOID + ); + +/** + Get current CPU frequency. + + @param Socket Socket index. + @return UINTN Current CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetCurrentFreq ( + UINT8 Socket + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + ASSERT (PlatformHob != NULL); + + return PlatformHob->CpuClk; +} + +/** + Get maximum CPU frequency. + + @param Socket Socket index. + @return UINTN Maximum CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetMaxFreq ( + UINT8 Socket + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + ASSERT (PlatformHob != NULL); + + if (PlatformHob->TurboCapability[Socket]) { + return PlatformHob->TurboFrequency[Socket]; + } + + return PlatformHob->CpuClk; +} + +/** + Get CPU voltage. + + @param Socket Socket index. + @return UINT8 CPU voltage. + +**/ +UINT8 +EFIAPI +CpuGetVoltage ( + UINT8 Socket + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + UINT8 Voltage; + + PlatformHob = GetPlatformHob (); + ASSERT (PlatformHob != NULL); + + Voltage = 0x80 | (PlatformHob->CoreVoltage[Socket] / 100); + + return Voltage; +} + +/** + Get the SubNUMA mode. + + @return UINT8 The SubNUMA mode. + +**/ +UINT8 +EFIAPI +CpuGetSubNumaMode ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + if (PlatformHob == NULL) { + return SUBNUMA_MODE_MONOLITHIC; + } + + return PlatformHob->SubNumaMode[0]; +} + +/** + Get the number of SubNUMA region. + + @return UINT8 The number of SubNUMA region. + +**/ +UINT8 +EFIAPI +CpuGetNumberOfSubNumaRegion ( + VOID + ) +{ + UINT8 SubNumaMode; + UINT8 NumberOfSubNumaRegion; + + SubNumaMode = CpuGetSubNumaMode (); + ASSERT (SubNumaMode <= SUBNUMA_MODE_QUADRANT); + + switch (SubNumaMode) { + case SUBNUMA_MODE_MONOLITHIC: + NumberOfSubNumaRegion = MONOLITIC_NUM_OF_REGION; + break; + + case SUBNUMA_MODE_HEMISPHERE: + NumberOfSubNumaRegion = HEMISPHERE_NUM_OF_REGION; + break; + + case SUBNUMA_MODE_QUADRANT: + NumberOfSubNumaRegion = QUADRANT_NUM_OF_REGION; + break; + + default: + // Should never reach there. + NumberOfSubNumaRegion = 0; + ASSERT (FALSE); + break; + } + + return NumberOfSubNumaRegion; +} + +/** + Get the SubNUMA node of a CPM. + + @param SocketId Socket index. + @param Cpm CPM index. + @return UINT8 The SubNUMA node of a CPM. + +**/ +UINT8 +EFIAPI +CpuGetSubNumNode ( + UINT8 SocketId, + UINT16 Cpm + ) +{ + BOOLEAN IsAsymMesh; + UINT8 SubNumaNode; + UINT16 MaxNumberOfCPM; + UINT8 MiddleRow; + UINT8 QuadrantHigherRowNodeNumber[NUM_OF_CPM_PER_MESH_ROW] = {1, 1, 1, 1, 3, 3, 3, 3}; + UINT8 QuadrantLowerRowNodeNumber[NUM_OF_CPM_PER_MESH_ROW] = {0, 0, 0, 0, 2, 2, 2, 2}; + UINT8 QuadrantMiddleRowNodeNumber[NUM_OF_CPM_PER_MESH_ROW] = {0, 0, 1, 1, 3, 3, 2, 2}; + UINT8 SubNumaMode; + + MaxNumberOfCPM = GetMaximumNumberOfCPMs (); + SubNumaMode = CpuGetSubNumaMode (); + ASSERT (SubNumaMode <= SUBNUMA_MODE_QUADRANT); + + switch (SubNumaMode) { + case SUBNUMA_MODE_MONOLITHIC: + SubNumaNode = (SocketId == 0) ? 0 : 1; + break; + + case SUBNUMA_MODE_HEMISPHERE: + if (CPM_PER_ROW_OFFSET (Cpm) >= SUBNUMA_CPM_REGION_SIZE) { + SubNumaNode = 1; + } else { + SubNumaNode = 0; + } + + if (SocketId == 1) { + SubNumaNode += HEMISPHERE_NUM_OF_REGION; + } + break; + + case SUBNUMA_MODE_QUADRANT: + // + // CPM Mesh Rows + // + // |---------------------------------------| + // | 00 ----------- 03 | 04 ----------- 07 | Row 0 + // |-------------------|-------------------| + // | 08 ----------- 11 | 12 ----------- 15 | Row 1 + // |-------------------|-------------------| + // | 16 - 17 | 18 - 19 | 20 - 21 | 22 - 23 | Middle Row + // |-------------------|-------------------| + // | 24 ----------- 27 | 28 ----------- 31 | Row 3 + // |-------------------|-------------------| + // | 32 ----------- 35 | 36 ----------- 39 | Row 4 + // |---------------------------------------| + // + + IsAsymMesh = (BOOLEAN)(CPM_ROW_NUMBER (MaxNumberOfCPM) % 2 != 0); + MiddleRow = CPM_ROW_NUMBER (MaxNumberOfCPM) / 2; + if (IsAsymMesh + && CPM_ROW_NUMBER (Cpm) == MiddleRow) + { + SubNumaNode = QuadrantMiddleRowNodeNumber[CPM_PER_ROW_OFFSET (Cpm)]; + + } else if (CPM_ROW_NUMBER (Cpm) >= MiddleRow) { + SubNumaNode = QuadrantHigherRowNodeNumber[CPM_PER_ROW_OFFSET (Cpm)]; + + } else { + SubNumaNode = QuadrantLowerRowNodeNumber[CPM_PER_ROW_OFFSET (Cpm)]; + } + + if (SocketId == 1) { + SubNumaNode += QUADRANT_NUM_OF_REGION; + } + break; + + default: + // Should never reach there. + SubNumaNode = 0; + ASSERT (FALSE); + break; + } + + return SubNumaNode; +} + +/** + Get the number of supported socket. + + @return UINT8 Number of supported socket. + +**/ +UINT8 +EFIAPI +GetNumberOfSupportedSockets ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + if (PlatformHob == NULL) { + // + // By default, the number of supported sockets is 1. + // + return 1; + } + + return (sizeof (PlatformHob->ClusterEn) / sizeof (PLATFORM_CLUSTER_EN)); +} + +/** + Get the number of active socket. + + @return UINT8 Number of active socket. + +**/ +UINT8 +EFIAPI +GetNumberOfActiveSockets ( + VOID + ) +{ + UINT8 NumberOfActiveSockets, Count, Index, Index1; + PLATFORM_CLUSTER_EN *Socket; + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + if (PlatformHob == NULL) { + // + // By default, the number of active sockets is 1. + // + return 1; + } + + NumberOfActiveSockets = 0; + + for (Index = 0; Index < GetNumberOfSupportedSockets (); Index++) { + Socket = &PlatformHob->ClusterEn[Index]; + Count = ARRAY_SIZE (Socket->EnableMask); + for (Index1 = 0; Index1 < Count; Index1++) { + if (Socket->EnableMask[Index1] != 0) { + NumberOfActiveSockets++; + break; + } + } + } + + return NumberOfActiveSockets; +} + +/** + Get the number of active CPM per socket. + + @param SocketId Socket index. + @return UINT16 Number of CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCPMsPerSocket ( + UINT8 SocketId + ) +{ + UINT16 NumberOfCPMs, Count, Index; + UINT32 Val32; + PLATFORM_CLUSTER_EN *Socket; + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + if (PlatformHob == NULL) { + return 0; + } + + if (SocketId >= GetNumberOfActiveSockets ()) { + return 0; + } + + NumberOfCPMs = 0; + Socket = &PlatformHob->ClusterEn[SocketId]; + Count = ARRAY_SIZE (Socket->EnableMask); + for (Index = 0; Index < Count; Index++) { + Val32 = Socket->EnableMask[Index]; + while (Val32 > 0) { + if ((Val32 & 0x1) != 0) { + NumberOfCPMs++; + } + Val32 >>= 1; + } + } + + return NumberOfCPMs; +} + +/** + Get the number of configured CPM per socket. This number + should be the same for all sockets. + + @param SocketId Socket index. + @return UINT8 Number of configured CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfConfiguredCPMs ( + UINT8 SocketId + ) +{ + EFI_STATUS Status; + UINT32 Value; + UINT32 Param, ParamStart, ParamEnd; + UINT16 Count; + + Count = 0; + ParamStart = NV_SI_S0_PCP_ACTIVECPM_0_31 + SocketId * NV_PARAM_ENTRYSIZE * (PLATFORM_CPU_MAX_CPM / 32); + ParamEnd = ParamStart + NV_PARAM_ENTRYSIZE * (PLATFORM_CPU_MAX_CPM / 32); + for (Param = ParamStart; Param < ParamEnd; Param += NV_PARAM_ENTRYSIZE) { + Status = NVParamGet ( + Param, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + break; + } + while (Value != 0) { + if ((Value & 0x01) != 0) { + Count++; + } + Value >>= 1; + } + } + + return Count; +} + +/** + Set the number of configured CPM per socket. + + @param SocketId Socket index. + @param NumberOfCPMs Number of CPM to be configured. + @return EFI_SUCCESS Operation succeeded. + @return Others An error has occurred. + +**/ +EFI_STATUS +EFIAPI +SetNumberOfConfiguredCPMs ( + UINT8 SocketId, + UINT16 NumberOfCPMs + ) +{ + EFI_STATUS Status; + UINT32 Value; + UINT32 Param, ParamStart, ParamEnd; + BOOLEAN IsClear; + + IsClear = FALSE; + if (NumberOfCPMs == 0) { + IsClear = TRUE; + } + + Status = EFI_SUCCESS; + + ParamStart = NV_SI_S0_PCP_ACTIVECPM_0_31 + SocketId * NV_PARAM_ENTRYSIZE * (PLATFORM_CPU_MAX_CPM / 32); + ParamEnd = ParamStart + NV_PARAM_ENTRYSIZE * (PLATFORM_CPU_MAX_CPM / 32); + for (Param = ParamStart; Param < ParamEnd; Param += NV_PARAM_ENTRYSIZE) { + if (NumberOfCPMs >= 32) { + Value = 0xffffffff; + NumberOfCPMs -= 32; + } else { + Value = 0; + while (NumberOfCPMs > 0) { + Value |= (1 << (--NumberOfCPMs)); + } + } + if (IsClear) { + /* Clear this param */ + Status = NVParamClr ( + Param, + NV_PERM_BIOS | NV_PERM_MANU + ); + } else { + Status = NVParamSet ( + Param, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + } + } + + return Status; +} + +/** + Get the maximum number of core per socket. + + @return UINT16 Maximum number of core. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCores ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + if (PlatformHob == NULL) { + return 0; + } + + return PlatformHob->MaxNumOfCore[0]; +} + +/** + Get the maximum number of CPM per socket. This number + should be the same for all sockets. + + @return UINT16 Maximum number of CPM. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCPMs ( + VOID + ) +{ + return GetMaximumNumberOfCores () / PLATFORM_CPU_NUM_CORES_PER_CPM; +} + +/** + Get the number of active cores of a sockets. + + @param SocketId Socket Index. + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCoresPerSocket ( + UINT8 SocketId + ) +{ + return GetNumberOfActiveCPMsPerSocket (SocketId) * PLATFORM_CPU_NUM_CORES_PER_CPM; +} + +/** + Get the number of active cores of all sockets. + + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCores ( + VOID + ) +{ + UINT16 NumberOfActiveCores; + UINT8 Index; + + NumberOfActiveCores = 0; + + for (Index = 0; Index < GetNumberOfActiveSockets (); Index++) { + NumberOfActiveCores += GetNumberOfActiveCoresPerSocket (Index); + } + + return NumberOfActiveCores; +} + +/** + Check if the logical CPU is enabled or not. + + @param CpuId The logical Cpu ID. Started from 0. + @return BOOLEAN TRUE if the Cpu enabled + FALSE if the Cpu disabled. + +**/ +BOOLEAN +EFIAPI +IsCpuEnabled ( + UINT16 CpuId + ) +{ + PLATFORM_CLUSTER_EN *Socket; + PLATFORM_INFO_HOB *PlatformHob; + UINT8 SocketId; + UINT16 ClusterId; + + SocketId = SOCKET_ID (CpuId); + ClusterId = CLUSTER_ID (CpuId); + + PlatformHob = GetPlatformHob (); + if (PlatformHob == NULL) { + return FALSE; + } + + if (SocketId >= GetNumberOfActiveSockets ()) { + return FALSE; + } + + Socket = &PlatformHob->ClusterEn[SocketId]; + if ((Socket->EnableMask[ClusterId / 32] & (1 << (ClusterId % 32))) != 0) { + return TRUE; + } + + return FALSE; +} + +/** + Check if the slave socket is present + + @return BOOLEAN TRUE if the Slave Cpu is present + FALSE if the Slave Cpu is not present + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketPresent ( + VOID + ) +{ + UINT32 Value; + + Value = MmioRead32 (SMPRO_EFUSE_SHADOW0 + CFG2P_OFFSET); + + return ((Value & SLAVE_PRESENT_N) != 0) ? FALSE : TRUE; +} + +/** + Check if the slave socket is active + + @return BOOLEAN TRUE if the Slave CPU Socket is active. + FALSE if the Slave CPU Socket is not active. + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketActive ( + VOID + ) +{ + return (GetNumberOfActiveSockets () > 1) ? TRUE : FALSE; +} + +/** + Check if the CPU product ID is Ac01 + @return BOOLEAN TRUE if the Product ID is Ac01 + FALSE otherwise. + +**/ +BOOLEAN +EFIAPI +IsAc01Processor ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob = GetPlatformHob (); + ASSERT (PlatformHob != NULL); + + if (PlatformHob != NULL) { + if ((PlatformHob->ScuProductId[0] & 0xFF) == 0x01) { + return TRUE; + } + } + + return FALSE; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.c new file mode 100644 index 000000000000..fb8b7161a072 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.c @@ -0,0 +1,138 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> +#include <Uefi.h> + +#include <Guid/PlatformInfoHobGuid.h> +#include <Library/AmpereCpuLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeLib.h> +#include <PlatformInfoHob.h> + +EFI_EVENT mRuntimeAmpereCpuLibVirtualNotifyEvent = NULL; +VOID *mPlatformInfoHob = NULL; + +/** + Get the platform HOB data. + + @return PLATFORM_INFO_HOB The pointer to the platform HOB data. + +**/ +PLATFORM_INFO_HOB * +GetPlatformHob ( + VOID + ) +{ + ASSERT (mPlatformInfoHob != NULL); + return (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (mPlatformInfoHob); +} + +/** + Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context + +**/ +VOID +EFIAPI +RuntimeAmpereCpuLibVirtualNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + // + // Convert the platform HOB address to a virtual address. + // + Status = EfiConvertPointer (0, (VOID **)&mPlatformInfoHob); + + ASSERT_EFI_ERROR (Status); +} + +/** + Constructor of Runtime Ampere CPU Library Instance. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor completed successfully. + @retval Others The constructor did not complete successfully. + +**/ +EFI_STATUS +EFIAPI +RuntimeAmpereCpuLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *Hob; + + Hob = GetNextGuidHob ( + &gPlatformHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (Hob == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get gPlatformHobGuid!\n", __FUNCTION__)); + return EFI_DEVICE_ERROR; + } + + mPlatformInfoHob = AllocateRuntimeCopyPool (sizeof (PLATFORM_INFO_HOB), Hob); + ASSERT (mPlatformInfoHob != NULL); + + // + // Register notify function for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE + // + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + RuntimeAmpereCpuLibVirtualNotify, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mRuntimeAmpereCpuLibVirtualNotifyEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Destructor of Runtime Ampere CPU Library Instance. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The destructor completed successfully. + @retval Others The destructor did not complete successfully. + +**/ +EFI_STATUS +EFIAPI +RuntimeAmpereCpuLibDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Close the Set Virtual Address Map event + // + Status = gBS->CloseEvent (mRuntimeAmpereCpuLibVirtualNotifyEvent); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c new file mode 100644 index 000000000000..8c1eb93f00fd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c @@ -0,0 +1,169 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Guid/PlatformInfoHobGuid.h> +#include <Library/AmpereCpuLib.h> +#include <Library/ArmLib.h> +#include <Library/ArmPlatformLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/IoLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/PcdLib.h> +#include <Library/PL011UartLib.h> +#include <Library/SerialPortLib.h> +#include <Platform/Ac01.h> +#include <PlatformInfoHob.h> +#include <Ppi/ArmMpCoreInfo.h> +#include <Ppi/TemporaryRamSupport.h> + +ARM_CORE_INFO mArmPlatformMpCoreInfoTable[PLATFORM_CPU_MAX_NUM_CORES]; + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + + @return Return the current Boot Mode of the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Initialize controllers that must setup in the normal world + + This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei + in the PEI phase. + +**/ +EFI_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + RETURN_STATUS Status; + UINT64 BaudRate; + UINT32 ReceiveFifoDepth; + EFI_PARITY_TYPE Parity; + UINT8 DataBits; + EFI_STOP_BITS_TYPE StopBits; + + Status = EFI_SUCCESS; + + if (FixedPcdGet64 (PcdSerialRegisterBase) != 0) { + /* Debug port should use the same parameters with console */ + BaudRate = FixedPcdGet64 (PcdUartDefaultBaudRate); + ReceiveFifoDepth = FixedPcdGet32 (PcdUartDefaultReceiveFifoDepth); + Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity); + DataBits = FixedPcdGet8 (PcdUartDefaultDataBits); + StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits); + + /* Initialize uart debug port */ + Status = PL011UartInitializePort ( + (UINTN)FixedPcdGet64 (PcdSerialRegisterBase), + FixedPcdGet32 (PL011UartClkInHz), + &BaudRate, + &ReceiveFifoDepth, + &Parity, + &DataBits, + &StopBits + ); + } + + return Status; +} + +EFI_STATUS +PrePeiCoreGetMpCoreInfo ( + OUT UINTN *CoreCount, + OUT ARM_CORE_INFO **ArmCoreTable + ) +{ + UINTN mArmPlatformCoreCount; + UINTN ClusterId; + UINTN SocketId; + UINTN Index; + + ASSERT (CoreCount != NULL); + ASSERT (ArmCoreTable != NULL); + ASSERT (*ArmCoreTable != NULL); + + mArmPlatformCoreCount = 0; + for (Index = 0; Index < PLATFORM_CPU_MAX_NUM_CORES; Index++) { + if (!IsCpuEnabled (Index)) { + continue; + } + SocketId = SOCKET_ID (Index); + ClusterId = CLUSTER_ID (Index); + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].ClusterId = SocketId; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].CoreId = + (ClusterId << 8) | (Index % PLATFORM_CPU_NUM_CORES_PER_CPM); + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxClearAddress = 0; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxClearValue = 0; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxGetAddress = 0; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxSetAddress = 0; + mArmPlatformCoreCount++; + } + + *CoreCount = mArmPlatformCoreCount; + + *ArmCoreTable = mArmPlatformMpCoreInfoTable; + ASSERT (*ArmCoreTable != NULL); + + return EFI_SUCCESS; +} + +// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore +EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID; +ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo }; + +EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &mArmMpCoreInfoPpiGuid, + &mMpCoreInfoPpi + }, +}; + +/** + Return the Platform specific PPIs + + This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed + to the PeiCore by PrePeiCore. + + @param[out] PpiListSize Size in Bytes of the Platform PPI List + @param[out] PpiList Platform PPI List + +**/ +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + ASSERT (PpiListSize != NULL); + ASSERT (PpiList != NULL); + ASSERT (*PpiList != NULL); + + if (ArmIsMpCore ()) { + *PpiListSize = sizeof (gPlatformPpiTable); + *PpiList = gPlatformPpiTable; + } else { + *PpiListSize = 0; + *PpiList = NULL; + } +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMemory.c b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMemory.c new file mode 100644 index 000000000000..4a03ab4319af --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMemory.c @@ -0,0 +1,257 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Guid/PlatformInfoHobGuid.h> +#include <Library/AmpereCpuLib.h> +#include <Library/ArmPlatformLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/PcdLib.h> +#include <PlatformInfoHob.h> + +#include "PlatformMemoryMap.h" + +/* Number of Virtual Memory Map Descriptors */ +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 50 + +/* DDR attributes */ +#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK +#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- + Virtual Memory mapping. This array must be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ) +{ + UINTN Index = 0; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + UINT32 NumRegion; + UINTN Count; + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + Hob = GetFirstGuidHob (&gPlatformHobGuid); + ASSERT (Hob != NULL); + if (Hob == NULL) { + return; + } + + PlatformHob = (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + ASSERT (VirtualMemoryMap != NULL); + + VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR *)AllocatePages (EFI_SIZE_TO_PAGES (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); + if (VirtualMemoryTable == NULL) { + return; + } + + /* For Address space 0x1000_0000_0000 to 0x1001_00FF_FFFF + * - Device memory + */ + VirtualMemoryTable[Index].PhysicalBase = AC01_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* For Address space 0x5000_0000_0000 to 0x5001_00FF_FFFF + * - Device memory + */ + if (IsSlaveSocketActive ()) + { + VirtualMemoryTable[++Index].PhysicalBase = AC01_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + } + + /* + * - PCIe RCA0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA0_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA0_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA0_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCA1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA1_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA1_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA1_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCA2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA2_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA2_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA2_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCA3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA3_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA3_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA3_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB0_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB0_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB0_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB1_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB1_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB1_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB2_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB2_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB2_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB3_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB3_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB3_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + if (IsSlaveSocketActive ()) { + // Slave socket exist + /* + * - PCIe RCA0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA0_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA0_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA0_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCA1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA1_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA1_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA1_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCA2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA2_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA2_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA2_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCA3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCA3_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCA3_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCA3_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB0_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB0_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB0_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB1_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB1_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB1_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB2_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB2_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB2_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - PCIe RCB3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_RCB3_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_RCB3_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length = AC01_RCB3_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + } + + /* + * - BERT memory region + */ + VirtualMemoryTable[++Index].PhysicalBase = AC01_BERT_MEMORY_BASE; + VirtualMemoryTable[Index].VirtualBase = AC01_BERT_MEMORY_BASE; + VirtualMemoryTable[Index].Length = AC01_BERT_MEMORY_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + /* + * - DDR memory region + */ + NumRegion = PlatformHob->DramInfo.NumRegion; + Count = 0; + while (NumRegion-- > 0) { + if (PlatformHob->DramInfo.NvdRegion[Count]) { /* Skip NVDIMM Region */ + Count++; + continue; + } + + VirtualMemoryTable[++Index].PhysicalBase = PlatformHob->DramInfo.Base[Count]; + VirtualMemoryTable[Index].VirtualBase = PlatformHob->DramInfo.Base[Count]; + VirtualMemoryTable[Index].Length = PlatformHob->DramInfo.Size[Count]; + VirtualMemoryTable[Index].Attributes = DDR_ATTRIBUTES_CACHED; + Count++; + } + + /* SPM MM NS Buffer for MmCommunicateDxe */ + VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdMmBufferBase); + VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdMmBufferBase); + VirtualMemoryTable[Index].Length = PcdGet64 (PcdMmBufferSize); + VirtualMemoryTable[Index].Attributes = DDR_ATTRIBUTES_CACHED; + + /* End of Table */ + VirtualMemoryTable[++Index].PhysicalBase = 0; + VirtualMemoryTable[Index].VirtualBase = 0; + VirtualMemoryTable[Index].Length = 0; + VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0; + + ASSERT ((Index + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap = VirtualMemoryTable; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.c new file mode 100644 index 000000000000..b2117d77a0aa --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.c @@ -0,0 +1,281 @@ +/** @file + The library implements the hardware Mailbox (Doorbell) interface for communication + between the Application Processor (ARMv8) and the System Control Processors (SMpro/PMpro). + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Library/AmpereCpuLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/MailboxInterfaceLib.h> +#include <Library/TimerLib.h> +#include <Library/IoLib.h> +#include <Platform/Ac01.h> + +// +// Hardware Doorbells +// +#define SMPRO_DB0_IRQ_OFST 40 +#define SMPRO_DB0_BASE_ADDRESS (FixedPcdGet64 (PcdSmproDbBaseReg)) + +#define PMPRO_DB0_IRQ_OFST 56 +#define PMPRO_DB0_BASE_ADDRESS (FixedPcdGet64 (PcdPmproDbBaseReg)) + +// +// The base SPI interrupt number of the Slave socket +// +#define SLAVE_SOCKET_SPI_INTERRUPT 352 + +#define SLAVE_SOCKET_DOORBELL_INTERRUPT_BASE(Socket) ((Socket) * SLAVE_SOCKET_SPI_INTERRUPT - 32) + +// +// Doorbell base register stride size +// +#define DB_BASE_REG_STRIDE 0x00001000 + +#define SMPRO_DBx_ADDRESS(socket, db) \ + ((socket) * SLAVE_SOCKET_BASE_ADDRESS_OFFSET + SMPRO_DB0_BASE_ADDRESS + DB_BASE_REG_STRIDE * (db)) + +#define PMPRO_DBx_ADDRESS(socket, db) \ + ((socket) * SLAVE_SOCKET_BASE_ADDRESS_OFFSET + PMPRO_DB0_BASE_ADDRESS + DB_BASE_REG_STRIDE * (db)) + +// +// Doorbell Status Bits +// +#define DB_STATUS_AVAIL_BIT BIT16 +#define DB_STATUS_ACK_BIT BIT0 + +/** + Get the base address of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with the SMpro/PMpro. + + @retval UINT32 The base address of the doorbell. + The returned value is 0 indicate that the input parameters are invalid. + +**/ +UINTN +EFIAPI +MailboxGetDoorbellAddress ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ) +{ + UINTN DoorbellAddress; + + if (Socket >= GetNumberOfActiveSockets () + || Doorbell >= NUMBER_OF_DOORBELLS_PER_SOCKET) + { + return 0; + } + + if (Doorbell >= SMproDoorbellChannel0) { + DoorbellAddress = SMPRO_DBx_ADDRESS (Socket, (UINT8)(Doorbell - SMproDoorbellChannel0)); + } else { + DoorbellAddress = PMPRO_DBx_ADDRESS (Socket, (UINT8)Doorbell); + } + + return DoorbellAddress; +} + +/** + Get the interrupt number of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with the SMpro/PMpro. + + @retval UINT32 The interrupt number. + The returned value is 0 indicate that the input parameters are invalid. + +**/ +UINT32 +EFIAPI +MailboxGetDoorbellInterruptNumber ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ) +{ + UINT32 DoorbellInterruptNumber; + + if (Socket >= GetNumberOfActiveSockets () + || Doorbell >= NUMBER_OF_DOORBELLS_PER_SOCKET) + { + return 0; + } + + DoorbellInterruptNumber = 0; + + if (Socket > 0) { + DoorbellInterruptNumber = SLAVE_SOCKET_DOORBELL_INTERRUPT_BASE (Socket); + } + + if (Doorbell >= SMproDoorbellChannel0) { + DoorbellInterruptNumber += SMPRO_DB0_IRQ_OFST + (UINT8)(Doorbell - SMproDoorbellChannel0); + } else { + DoorbellInterruptNumber += PMPRO_DB0_IRQ_OFST + (UINT8)Doorbell; + } + + return DoorbellInterruptNumber; +} + +/** + Read a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with the SMpro/PMpro. + @param[out] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Read the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for available message in the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxRead ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + OUT MAILBOX_MESSAGE_DATA *Message + ) +{ + UINTN TimeoutCount; + UINTN DoorbellAddress; + + if (Socket >= GetNumberOfActiveSockets () + || Doorbell >= NUMBER_OF_DOORBELLS_PER_SOCKET + || Message == NULL) + { + return EFI_INVALID_PARAMETER; + } + + TimeoutCount = MAILBOX_POLL_COUNT; + + DoorbellAddress = MailboxGetDoorbellAddress (Socket, Doorbell); + ASSERT (DoorbellAddress != 0); + + // + // Polling Doorbell status + // + while ((MmioRead32 ((DoorbellAddress + DB_STATUS_REG_OFST)) & DB_STATUS_AVAIL_BIT) == 0) { + MicroSecondDelay (MAILBOX_POLL_INTERVAL_US); + if (--TimeoutCount == 0) { + return EFI_TIMEOUT; + } + } + + Message->ExtendedData[0] = MmioRead32 (DoorbellAddress + DB_DIN0_REG_OFST); + Message->ExtendedData[1] = MmioRead32 (DoorbellAddress + DB_DIN1_REG_OFST); + Message->Data = MmioRead32 (DoorbellAddress + DB_IN_REG_OFST); + + // + // Write 1 to clear the AVAIL status + // + MmioWrite32 (DoorbellAddress + DB_STATUS_REG_OFST, DB_STATUS_AVAIL_BIT); + + return EFI_SUCCESS; +} + +/** + Write a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbel channel for communication with the SMpro/PMpro. + @param[in] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Write the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for acknowledge signal from the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxWrite ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + IN MAILBOX_MESSAGE_DATA *Message + ) +{ + UINTN TimeoutCount; + UINTN DoorbellAddress; + + if (Socket >= GetNumberOfActiveSockets () + || Doorbell >= NUMBER_OF_DOORBELLS_PER_SOCKET + || Message == NULL) + { + return EFI_INVALID_PARAMETER; + } + + TimeoutCount = MAILBOX_POLL_COUNT; + + DoorbellAddress = MailboxGetDoorbellAddress (Socket, Doorbell); + ASSERT (DoorbellAddress != 0); + + // + // Clear previous pending ack if any + // + if ((MmioRead32 (DoorbellAddress + DB_STATUS_REG_OFST) & DB_STATUS_ACK_BIT) != 0) { + MmioWrite32 (DoorbellAddress + DB_STATUS_REG_OFST, DB_STATUS_ACK_BIT); + } + + // + // Send message + // + MmioWrite32 (DoorbellAddress + DB_DOUT0_REG_OFST, Message->ExtendedData[0]); + MmioWrite32 (DoorbellAddress + DB_DOUT1_REG_OFST, Message->ExtendedData[1]); + MmioWrite32 (DoorbellAddress + DB_OUT_REG_OFST, Message->Data); + + // + // Wait for ACK + // + while ((MmioRead32 (DoorbellAddress + DB_STATUS_REG_OFST) & DB_STATUS_ACK_BIT) == 0) { + MicroSecondDelay (MAILBOX_POLL_INTERVAL_US); + if (--TimeoutCount == 0) { + return EFI_TIMEOUT; + } + } + + // + // Write 1 to clear the ACK status + // + MmioWrite32 (DoorbellAddress + DB_STATUS_REG_OFST, DB_STATUS_ACK_BIT); + + return EFI_SUCCESS; +} + +/** + Unmask the Doorbell interrupt status. + + @param Socket Active socket index. + @param Doorbell Doorbel channel for communication with the SMpro/PMpro. + + @retval EFI_SUCCESS Unmask the Doorbell interrupt successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +MailboxUnmaskInterrupt ( + IN UINT8 Socket, + IN UINT16 Doorbell + ) +{ + UINTN DoorbellAddress; + + if (Socket >= GetNumberOfActiveSockets () + || Doorbell >= NUMBER_OF_DOORBELLS_PER_SOCKET) + { + return EFI_INVALID_PARAMETER; + } + + DoorbellAddress = MailboxGetDoorbellAddress (Socket, Doorbell); + ASSERT (DoorbellAddress != 0); + + MmioWrite32 (DoorbellAddress + DB_STATUS_MASK_REG_OFST, ~DB_STATUS_AVAIL_BIT); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c new file mode 100644 index 000000000000..98aa1e77b3b4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c @@ -0,0 +1,93 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> + +#include <Library/ArmMmuLib.h> +#include <Library/ArmPlatformLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/PcdLib.h> + +STATIC +VOID +InitMmu ( + IN ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable + ) +{ + VOID *TranslationTableBase; + UINTN TranslationTableSize; + RETURN_STATUS Status; + + // Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() + // the MMU Page Table resides in DRAM (even at the top of DRAM as it is the first + // permanent memory allocation) + // + Status = ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Error: Failed to enable MMU\n")); + } + + BuildMemoryAllocationHob ( + (EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, + EFI_SIZE_TO_PAGES (TranslationTableSize) * EFI_PAGE_SIZE, + EfiBootServicesData + ); +} + +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ) +{ + ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; + UINTN Index; + + /* Get Virtual Memory Map from the Platform Library */ + ArmPlatformGetVirtualMemoryMap (&MemoryTable); + + Index = 0; + while (MemoryTable[Index].Length != 0) { + if (MemoryTable[Index].Attributes == ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK) { + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_TESTED, + MemoryTable[Index].PhysicalBase, + MemoryTable[Index].Length + ); + } else if (MemoryTable[Index].Attributes == ARM_MEMORY_REGION_ATTRIBUTE_DEVICE) { + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, + MemoryTable[Index].PhysicalBase, + MemoryTable[Index].Length + ); + } + Index++; + } + + BuildMemoryAllocationHob ( + PcdGet64 (PcdFdBaseAddress), + PcdGet32 (PcdFdSize), + EfiRuntimeServicesData + ); + + InitMmu (MemoryTable); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.c new file mode 100644 index 000000000000..81506f00512c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.c @@ -0,0 +1,184 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <IndustryStandard/ArmStdSmc.h> +#include <Library/ArmLib.h> +#include <Library/ArmSmcLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/MmCommunicationLib.h> +#include <Library/PcdLib.h> +#include <Protocol/MmCommunication.h> + +// +// Address, Length of the pre-allocated buffer for communication with the secure +// world. +// +STATIC ARM_MEMORY_REGION_DESCRIPTOR mNsCommBuffMemRegion; + +EFI_STATUS +EFIAPI +MmCommunicationLibConstructor ( + VOID + ) +{ + mNsCommBuffMemRegion.PhysicalBase = PcdGet64 (PcdMmBufferBase); + // During UEFI boot, virtual and physical address are the same + mNsCommBuffMemRegion.VirtualBase = mNsCommBuffMemRegion.PhysicalBase; + mNsCommBuffMemRegion.Length = PcdGet64 (PcdMmBufferSize); + + return EFI_SUCCESS; +} + +/** + Communicates with a registered handler. + + This function provides an interface to send and receive messages to the + Standalone MM environment in UEFI PEI phase. + + @param[in, out] CommBuffer A pointer to the buffer to convey + into MMRAM. + @param[in, out] CommSize The size of the data buffer being + passed in. This is optional. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer size is incorrect for the MM + implementation. If this error is + returned, the MessageLength field in + the CommBuffer header or the integer + pointed by CommSize are updated to reflect + the maximum payload size the + implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter + or CommSize parameter, if not omitted, + are in address range that cannot be + accessed by the MM environment +**/ +EFI_STATUS +EFIAPI +MmCommunicationCommunicate ( + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommSize OPTIONAL + ) +{ + EFI_MM_COMMUNICATE_HEADER *CommunicateHeader; + ARM_SMC_ARGS CommunicateSmcArgs; + EFI_STATUS Status; + UINTN BufferSize; + + Status = EFI_ACCESS_DENIED; + BufferSize = 0; + + ZeroMem (&CommunicateSmcArgs, sizeof (ARM_SMC_ARGS)); + + // + // Check parameters + // + if (CommBuffer == NULL) { + return EFI_INVALID_PARAMETER; + } + + CommunicateHeader = CommBuffer; + // CommBuffer is a mandatory parameter. Hence, Rely on + // MessageLength + Header to ascertain the + // total size of the communication payload rather than + // rely on optional CommSize parameter + BufferSize = CommunicateHeader->MessageLength + + sizeof (CommunicateHeader->HeaderGuid) + + sizeof (CommunicateHeader->MessageLength); + + // If the length of the CommBuffer is 0 then return the expected length. + if (CommSize != NULL) { + // This case can be used by the consumer of this driver to find out the + // max size that can be used for allocating CommBuffer. + if ((*CommSize == 0) || + (*CommSize > mNsCommBuffMemRegion.Length)) + { + *CommSize = mNsCommBuffMemRegion.Length; + return EFI_BAD_BUFFER_SIZE; + } + // + // CommSize must match MessageLength + sizeof (EFI_MM_COMMUNICATE_HEADER); + // + if (*CommSize != BufferSize) { + return EFI_INVALID_PARAMETER; + } + } + + // + // If the buffer size is 0 or greater than what can be tolerated by the MM + // environment then return the expected size. + // + if ((BufferSize == 0) || + (BufferSize > mNsCommBuffMemRegion.Length)) + { + CommunicateHeader->MessageLength = mNsCommBuffMemRegion.Length - + sizeof (CommunicateHeader->HeaderGuid) - + sizeof (CommunicateHeader->MessageLength); + return EFI_BAD_BUFFER_SIZE; + } + + // SMC Function ID + CommunicateSmcArgs.Arg0 = ARM_SMC_ID_MM_COMMUNICATE_AARCH64; + + // Cookie + CommunicateSmcArgs.Arg1 = 0; + + // Copy Communication Payload + CopyMem ((VOID *)mNsCommBuffMemRegion.VirtualBase, CommBuffer, BufferSize); + + // comm_buffer_address (64-bit physical address) + CommunicateSmcArgs.Arg2 = (UINTN)mNsCommBuffMemRegion.PhysicalBase; + + // comm_size_address (not used, indicated by setting to zero) + CommunicateSmcArgs.Arg3 = 0; + + // Call the Standalone MM environment. + ArmCallSmc (&CommunicateSmcArgs); + + switch (CommunicateSmcArgs.Arg0) { + case ARM_SMC_MM_RET_SUCCESS: + ZeroMem (CommBuffer, BufferSize); + // On successful return, the size of data being returned is inferred from + // MessageLength + Header. + CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)mNsCommBuffMemRegion.VirtualBase; + BufferSize = CommunicateHeader->MessageLength + + sizeof (CommunicateHeader->HeaderGuid) + + sizeof (CommunicateHeader->MessageLength); + + CopyMem ( + CommBuffer, + (VOID *)mNsCommBuffMemRegion.VirtualBase, + BufferSize + ); + Status = EFI_SUCCESS; + break; + + case ARM_SMC_MM_RET_INVALID_PARAMS: + Status = EFI_INVALID_PARAMETER; + break; + + case ARM_SMC_MM_RET_DENIED: + Status = EFI_ACCESS_DENIED; + break; + + case ARM_SMC_MM_RET_NO_MEMORY: + // Unexpected error since the CommSize was checked for zero length + // prior to issuing the SMC + Status = EFI_OUT_OF_RESOURCES; + ASSERT (0); + break; + + default: + Status = EFI_ACCESS_DENIED; + ASSERT (0); + } + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c new file mode 100644 index 000000000000..794a0a77c25f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c @@ -0,0 +1,202 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/ArmLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/MmCommunicationLib.h> +#include <Library/NVParamLib.h> +#include <MmLib.h> + +EFI_MM_COMM_REQUEST mCommBuffer; + +STATIC VOID +UefiMmCreateNVParamReq ( + IN VOID *Data, + IN UINT64 Size + ) +{ + CopyGuid (&mCommBuffer.EfiMmHdr.HeaderGuid, &gNVParamMmGuid); + mCommBuffer.EfiMmHdr.MsgLength = Size; + + if (Size != 0) { + ASSERT (Data); + ASSERT (Size <= EFI_MM_MAX_PAYLOAD_SIZE); + + CopyMem (mCommBuffer.PayLoad.Data, Data, Size); + } +} + +EFI_STATUS +NVParamGet ( + IN UINT32 Param, + IN UINT16 ACLRd, + OUT UINT32 *Val + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] = MM_NVPARAM_FUNC_READ; + MmData[1] = Param; + MmData[2] = (UINT64)ACLRd; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + + Size = sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status = MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes = (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + switch (MmNVParamRes->Status) { + case MM_NVPARAM_RES_SUCCESS: + *Val = (UINT32)MmNVParamRes->Value; + return EFI_SUCCESS; + + case MM_NVPARAM_RES_NOT_SET: + return EFI_NOT_FOUND; + + case MM_NVPARAM_RES_NO_PERM: + return EFI_ACCESS_DENIED; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} + +EFI_STATUS +NVParamSet ( + IN UINT32 Param, + IN UINT16 ACLRd, + IN UINT16 ACLWr, + IN UINT32 Val + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] = MM_NVPARAM_FUNC_WRITE; + MmData[1] = Param; + MmData[2] = (UINT64)ACLRd; + MmData[3] = (UINT64)ACLWr; + MmData[4] = (UINT64)Val; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + Size = sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status = MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes = (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + switch (MmNVParamRes->Status) { + case MM_NVPARAM_RES_SUCCESS: + return EFI_SUCCESS; + + case MM_NVPARAM_RES_NO_PERM: + return EFI_ACCESS_DENIED; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} + +EFI_STATUS +NVParamClr ( + IN UINT32 Param, + IN UINT16 ACLWr + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] = MM_NVPARAM_FUNC_CLEAR; + MmData[1] = Param; + MmData[2] = 0; + MmData[3] = (UINT64)ACLWr; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + Size = sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status = MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes = (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + switch (MmNVParamRes->Status) { + case MM_NVPARAM_RES_SUCCESS: + return EFI_SUCCESS; + + case MM_NVPARAM_RES_NO_PERM: + return EFI_ACCESS_DENIED; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} + +EFI_STATUS +NVParamClrAll ( + VOID + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] = MM_NVPARAM_FUNC_CLEAR_ALL; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + Size = sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status = MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes = (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + switch (MmNVParamRes->Status) { + case MM_NVPARAM_RES_SUCCESS: + return EFI_SUCCESS; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.c new file mode 100644 index 000000000000..3ae3ecd60719 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -0,0 +1,40 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiDxe.h> +#include <PiPei.h> + +#include <Library/ArmLib.h> +#include <Library/ArmPlatformLib.h> +#include <Library/ArmSmcLib.h> +#include <Library/BaseLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/HobLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/PcdLib.h> +#include <Library/PeiServicesLib.h> + +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ) +{ + UINT64 FvMainBase; + UINT32 FvMainSize; + + // Build FV_MAIN Hand-off block (HOB) to let DXE IPL pick up correctly + FvMainBase = FixedPcdGet64 (PcdFvBaseAddress); + FvMainSize = FixedPcdGet32 (PcdFvSize); + ASSERT (FvMainSize != 0); + + BuildFvHob (FvMainBase, FvMainSize); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c new file mode 100644 index 000000000000..f7e6fb6092a6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c @@ -0,0 +1,141 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Library/DebugLib.h> +#include <Library/RngLib.h> +#include <Library/TrngLib.h> + +/** + Generates a 16-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 16-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber16 ( + OUT UINT16 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand != NULL); + if (Rand == NULL) { + return FALSE; + } + + Status = GenerateRandomNumbers ((UINT8 *)Rand, sizeof (UINT16)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} + +/** + Generates a 32-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 32-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber32 ( + OUT UINT32 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand != NULL); + if (Rand == NULL) { + return FALSE; + } + + Status = GenerateRandomNumbers ((UINT8 *)Rand, sizeof (UINT32)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} + +/** + Generates a 64-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 64-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber64 ( + OUT UINT64 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand != NULL); + if (Rand == NULL) { + return FALSE; + } + + Status = GenerateRandomNumbers ((UINT8 *)Rand, sizeof (UINT64)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} + +/** + Generates a 128-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 128-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber128 ( + OUT UINT64 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand != NULL); + if (Rand == NULL) { + return FALSE; + } + + Status = GenerateRandomNumbers ((UINT8 *)Rand, 2 * sizeof (UINT64)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.c new file mode 100644 index 000000000000..9cab653418fb --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.c @@ -0,0 +1,328 @@ +/** @file + Provides functions for communication with System Firmware (SMpro/PMpro and ATF). + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Library/AmpereCpuLib.h> +#include <Library/BaseLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/MailboxInterfaceLib.h> +#include <Library/SystemFirmwareInterfaceLib.h> + +/** + Read a register which is not accessible from the non-secure world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be read. + @param[out] Value A pointer to the read value. + + @retval EFI_SUCCESS Read the register successfully. + @retval EFI_UNSUPPORTED The register is not allowed. + @retval Otherwise Errors returned from MailboxWrite/MailboxRead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterRead ( + IN UINT8 Socket, + IN UINTN Address, + OUT UINT32 *Value + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + UINT32 AddressLower32Bit; + UINT32 AddressUpper32Bit; + + if (Socket >= GetNumberOfActiveSockets ()) { + return EFI_INVALID_PARAMETER; + } + + AddressLower32Bit = (UINT32)(Address & 0xFFFFFFFF); + AddressUpper32Bit = (UINT32)RShiftU64 ((UINT64)Address, 32); + + Message.Data = MAILBOX_DEBUG_MESSAGE_ENCODE ( + MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_READ, + (UINT16)(AddressUpper32Bit & 0xFFFF) + ); + + Message.ExtendedData[0] = AddressLower32Bit; + Message.ExtendedData[1] = 0; + + Status = MailboxWrite (Socket, SMproDoorbellChannel0, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = MailboxRead (Socket, SMproDoorbellChannel0, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + if ((Message.Data & 0xFF00) == 0) { + return EFI_UNSUPPORTED; + } + + if (Value != NULL) { + *Value = Message.ExtendedData[0]; + } + + return EFI_SUCCESS; +} + +/** + Write a value to a register which is not accessible from the non-secure world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be written. + @param[in] Value The value to be written to the register. + + @retval EFI_SUCCESS Write the register successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() function. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterWrite ( + IN UINT8 Socket, + IN UINTN Address, + IN UINT32 Value + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + UINT32 AddressLower32Bit; + UINT32 AddressUpper32Bit; + + if (Socket >= GetNumberOfActiveSockets ()) { + return EFI_INVALID_PARAMETER; + } + + AddressLower32Bit = (UINT32)(Address & 0xFFFFFFFF); + AddressUpper32Bit = (UINT32)RShiftU64 ((UINT64)Address, 32); + + Message.Data = MAILBOX_DEBUG_MESSAGE_ENCODE ( + MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_WRITE, + (UINT16)(AddressUpper32Bit & 0xFFFF) + ); + + Message.ExtendedData[0] = AddressLower32Bit; + Message.ExtendedData[1] = Value; + + Status = MailboxWrite (Socket, SMproDoorbellChannel0, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Set the PCC shared Memory Address to service handlers in the System Control Processors, + using for communication between the System Firmware and OSPM. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell index which is numbered like DOORBELL_CHANNELS. + @param[in] AddressAlign256 Enable/Disable 256 alignment. + @param[in] Address The shared memory address. + + @retval EFI_SUCCESS Set the shared memory address successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetPccSharedMem ( + IN UINT8 Socket, + IN UINT8 Doorbell, + IN BOOLEAN AddressAlign256, + IN UINTN Address + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + UINT8 AlignBit; + UINT8 AlignControl; + + if (Socket >= GetNumberOfActiveSockets () || Doorbell >= NUMBER_OF_DOORBELLS_PER_SOCKET) { + return EFI_INVALID_PARAMETER; + } + + if (AddressAlign256) { + AlignBit = 8; + AlignControl = MAILBOX_ADDRESS_256_ALIGNMENT; + } else { + AlignBit = 0; + AlignControl = MAILBOX_ADDRESS_NO_ALIGNMENT; + } + + Message.Data = MAILBOX_ADDRESS_MESSAGE_ENCODE ( + MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC, + 0, + AlignControl + ); + + Message.ExtendedData[0] = (UINT32)(RShiftU64 ((UINT64)Address, AlignBit) & 0xFFFFFFFF); + Message.ExtendedData[1] = (UINT32)(RShiftU64 ((UINT64)Address, 32 + AlignBit)); + + Status = MailboxWrite (Socket, Doorbell, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + The True RNG is provided by the SMpro processor. This function is to send a mailbox + message to the SMpro to request a 64-bit random number. + + @param[out] Buffer A pointer to the read 64-bit random number. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite/MailboxRead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgGetRandomNumber64 ( + OUT UINT8 *Buffer + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; + } + + Message.Data = MAILBOX_USER_MESSAGE_ENCODE ( + MAILBOX_USER_MESSAGE_SUBTYPE_TRNG_PROXY, + MAILBOX_TRNG_PROXY_GET_RANDOM_NUMBER, + 0 + ); + Message.ExtendedData[0] = 0; + Message.ExtendedData[1] = 0; + + Status = MailboxWrite (0, SMproDoorbellChannel6, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = MailboxRead (0, SMproDoorbellChannel6, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + CopyMem (Buffer, &Message.ExtendedData[0], sizeof (UINT32)); + CopyMem (Buffer + sizeof (UINT32), &Message.ExtendedData[1], sizeof (UINT32)); + + return EFI_SUCCESS; +} + +/** + Report the UEFI boot progress to the SMpro. + + @param[in] Socket Active socket index. + @param[in] BootStatus The status of the UEFI boot. + @param[in] Checkpoint The UEFI Checkpoint value. + + @retval EFI_SUCCESS Set the boot progress successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetBootProgress ( + IN UINT8 Socket, + IN UINT8 BootStatus, + IN UINT32 Checkpoint + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + + if (Socket >= GetNumberOfActiveSockets ()) { + return EFI_INVALID_PARAMETER; + } + + Message.Data = MAILBOX_USER_MESSAGE_ENCODE ( + MAILBOX_USER_MESSAGE_SUBTYPE_BOOT_PROGRESS, + MAILBOX_BOOT_PROGRESS_COMMAND_SET, + MAILBOX_BOOT_PROGRESS_STAGE_UEFI + ); + + // + // Extended Data Format for Boot Progress Set + // + // Data 0: + // Bit 31:16 - Boot Status + // Bit 15:0 - UEFI Checkpoint lower 16-bit + // + // Data 1: + // Bit 31:16 - Unused + // Bit 15:0 - UEFI Checkpoint upper 16-bit + // + Message.ExtendedData[0] = ((UINT32)BootStatus & 0xFFFF) | (((UINT32)Checkpoint << 16) & 0xFFFF0000); + Message.ExtendedData[1] = (Checkpoint >> 16) & 0xFFFF; + + Status = MailboxWrite (Socket, SMproDoorbellChannel1, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Configure the Turbo (Max Performance) mode. + + @param[in] Socket Active socket index. + @param[in] Enable Enable/Disable the Turbo (Max performance) mode. + + @retval EFI_SUCCESS Configure the Turbo successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgTurboConfig ( + IN UINT8 Socket, + IN BOOLEAN Enable + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + + if (Socket >= GetNumberOfSupportedSockets ()) { + return EFI_INVALID_PARAMETER; + } + + Message.Data = MAILBOX_USER_MESSAGE_ENCODE ( + MAILBOX_USER_MESSAGE_SUBTYPE_SET_CONFIGURATION, + MAILBOX_SET_CONFIGURATION_TURBO, + 0 + ); + + // + // The Turbo configuration is written into the extended data 0. + // The extended data 1 is unused. + // + Message.ExtendedData[0] = Enable ? 1 : 0; + Message.ExtendedData[1] = 0; + + Status = MailboxWrite (Socket, PMproDoorbellChannel1, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c new file mode 100644 index 000000000000..55250ddcb86d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c @@ -0,0 +1,63 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Uefi.h> + +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/SystemFirmwareInterfaceLib.h> +#include <Library/TrngLib.h> + +/** + Generates a random number by using Hardware RNG in SMpro. + + @param[out] Buffer Buffer to receive the random number. + @param[in] BufferSize Number of bytes in Buffer. + + @retval EFI_SUCCESS The random value was returned successfully. + @retval EFI_DEVICE_ERROR A random value could not be retrieved + due to a hardware or firmware error. + @retval EFI_INVALID_PARAMETER Buffer is NULL or BufferSize is zero. +**/ +EFI_STATUS +EFIAPI +GenerateRandomNumbers ( + OUT UINT8 *Buffer, + IN UINTN BufferSize + ) +{ + UINTN Count; + UINTN RandSize; + UINT64 Value; + EFI_STATUS Status; + + if ((BufferSize == 0) || (Buffer == NULL)) { + return EFI_INVALID_PARAMETER; + } + + // + // SMpro only supports generating a 64-bits random number once. + // + RandSize = sizeof (UINT64); + for (Count = 0; Count < (BufferSize / sizeof (UINT64)) + 1; Count++) { + if (Count == (BufferSize / sizeof (UINT64))) { + RandSize = BufferSize % sizeof (UINT64); + } + + if (RandSize != 0) { + Status = MailboxMsgGetRandomNumber64 ((UINT8 *)&Value); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get random number!\n", __FUNCTION__)); + return EFI_DEVICE_ERROR; + } + CopyMem (Buffer + Count * sizeof (UINT64), &Value, RandSize); + } + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc b/Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc new file mode 100644 index 000000000000..027b3cf6dee4 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc @@ -0,0 +1,176 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Rules are used with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are the default +# rules for the different module type. User can add the customized rules to define the +# content of the FFS file. +# +################################################################################ + +############################################################################ +# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section # +############################################################################ +# +#[Rule.Common.DXE_DRIVER] +# FILE DRIVER = $(NAMED_GUID) { +# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex +# COMPRESS PI_STD { +# GUIDED { +# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi +# UI STRING="$(MODULE_NAME)" Optional +# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) +# } +# } +# } +# +############################################################################ + + +[Rule.Common.SEC] + FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED FIXED { + TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.PEI_CORE] + FILE PEI_CORE = $(NAMED_GUID) FIXED { + TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING ="$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM] + FILE PEIM = $(NAMED_GUID) FIXED { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM.Binary] + FILE PEIM = $(NAMED_GUID) { + PEI_DEPEX PEI_DEPEX Optional |.depex + TE TE Align = Auto |.efi + UI STRING="$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM.TIANOCOMPRESSED] + FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE = $(NAMED_GUID) { + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + RAW ACPI Optional |.acpi + RAW ASL Optional |.aml + } + } + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.DXE_RUNTIME_DRIVER.Binary] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION = $(NAMED_GUID) { + COMPRESS PI_STD { + GUIDED { + UI STRING ="$(MODULE_NAME)" Optional + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } + } + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + } + } + +[Rule.Common.UEFI_DRIVER.Binary] + FILE DRIVER = $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION = $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.USER_DEFINED.ACPITABLE] + FILE FREEFORM = $(NAMED_GUID) { + RAW ACPI Optional |.acpi + RAW ASL Optional |.aml + } + +[Rule.Common.PEIM.FMP_IMAGE_DESC] + FILE PEIM = $(NAMED_GUID) { + RAW BIN |.acpi + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 Align=4K $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } diff --git a/Platform/Ampere/JadePkg/JadeBoardSetting.cfg b/Platform/Ampere/JadePkg/JadeBoardSetting.cfg new file mode 100644 index 000000000000..3761930d0263 --- /dev/null +++ b/Platform/Ampere/JadePkg/JadeBoardSetting.cfg @@ -0,0 +1,224 @@ +## +# Mt. Jade Board Setting +# +# This is a collection of board and hardware configurations +# for an Altra-based ARM64 platform. It is stored in the persistent storage. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +# +# Name, offset (hex), value +# value can be hex or decimal +# + +NV_SI_RO_BOARD_VENDOR, 0x0000, 0x0000CD3A +NV_SI_RO_BOARD_TYPE, 0x0008, 0x00000000 +NV_SI_RO_BOARD_REV, 0x0010, 0x00000000 +NV_SI_RO_BOARD_CFG, 0x0018, 0x00000000 +NV_SI_RO_BOARD_S0_DIMM_AVAIL, 0x0020, 0x0000FFFF +NV_SI_RO_BOARD_S1_DIMM_AVAIL, 0x0028, 0x0000FFFF +NV_SI_RO_BOARD_SPI0CS0_FREQ_KHZ, 0x0030, 0x000080E8 +NV_SI_RO_BOARD_SPI0CS1_FREQ_KHZ, 0x0038, 0x000080E8 +NV_SI_RO_BOARD_SPI1CS0_FREQ_KHZ, 0x0040, 0x00002710 +NV_SI_RO_BOARD_SPI1CS1_FREQ_KHZ, 0x0048, 0x00002710 +NV_SI_RO_BOARD_TPM_LOC, 0x0050, 0x00000000 +NV_SI_RO_BOARD_I2C0_FREQ_KHZ, 0x0058, 0x00000190 +NV_SI_RO_BOARD_I2C1_FREQ_KHZ, 0x0060, 0x00000190 +NV_SI_RO_BOARD_I2C2_10_FREQ_KHZ, 0x0068, 0x00000190 +NV_SI_RO_BOARD_I2C3_FREQ_KHZ, 0x0070, 0x00000190 +NV_SI_RO_BOARD_I2C9_FREQ_KHZ, 0x0078, 0x00000190 +NV_SI_RO_BOARD_2P_CFG, 0x0080, 0xFFFFFF01 +NV_SI_RO_BOARD_S0_RCA0_CFG, 0x0088, 0x00000000 +NV_SI_RO_BOARD_S0_RCA1_CFG, 0x0090, 0x00000000 +NV_SI_RO_BOARD_S0_RCA2_CFG, 0x0098, 0x00000004 +NV_SI_RO_BOARD_S0_RCA3_CFG, 0x00A0, 0x00000004 +NV_SI_RO_BOARD_S0_RCB0_LO_CFG, 0x00A8, 0x00020002 +NV_SI_RO_BOARD_S0_RCB0_HI_CFG, 0x00B0, 0x00020002 +NV_SI_RO_BOARD_S0_RCB1_LO_CFG, 0x00B8, 0x00020002 +NV_SI_RO_BOARD_S0_RCB1_HI_CFG, 0x00C0, 0x00020002 +NV_SI_RO_BOARD_S0_RCB2_LO_CFG, 0x00C8, 0x00020002 +NV_SI_RO_BOARD_S0_RCB2_HI_CFG, 0x00D0, 0x00000003 +NV_SI_RO_BOARD_S0_RCB3_LO_CFG, 0x00D8, 0x00000003 +NV_SI_RO_BOARD_S0_RCB3_HI_CFG, 0x00E0, 0x00020002 +NV_SI_RO_BOARD_S1_RCA0_CFG, 0x00E8, 0x00000000 +NV_SI_RO_BOARD_S1_RCA1_CFG, 0x00F0, 0x00000000 +NV_SI_RO_BOARD_S1_RCA2_CFG, 0x00F8, 0x02020202 +NV_SI_RO_BOARD_S1_RCA3_CFG, 0x0100, 0x00030003 +NV_SI_RO_BOARD_S1_RCB0_LO_CFG, 0x0108, 0x00000003 +NV_SI_RO_BOARD_S1_RCB0_HI_CFG, 0x0110, 0x00020002 +NV_SI_RO_BOARD_S1_RCB1_LO_CFG, 0x0118, 0x00020002 +NV_SI_RO_BOARD_S1_RCB1_HI_CFG, 0x0120, 0x00000003 +NV_SI_RO_BOARD_S1_RCB2_LO_CFG, 0x0128, 0x00020002 +NV_SI_RO_BOARD_S1_RCB2_HI_CFG, 0x0130, 0x00020002 +NV_SI_RO_BOARD_S1_RCB3_LO_CFG, 0x0138, 0x00020002 +NV_SI_RO_BOARD_S1_RCB3_HI_CFG, 0x0140, 0x00020002 +NV_SI_RO_BOARD_T_LTLM_DELTA_P0, 0x0148, 0x00000001 +NV_SI_RO_BOARD_T_LTLM_DELTA_P1, 0x0150, 0x00000002 +NV_SI_RO_BOARD_T_LTLM_DELTA_P2, 0x0158, 0x00000003 +NV_SI_RO_BOARD_T_LTLM_DELTA_P3, 0x0160, 0x00000004 +NV_SI_RO_BOARD_T_LTLM_DELTA_M1, 0x0168, 0xFFFFFFFF +NV_SI_RO_BOARD_T_LTLM_DELTA_M2, 0x0170, 0xFFFFFFFE +NV_SI_RO_BOARD_T_LTLM_DELTA_M3, 0x0178, 0xFFFFFFFD +NV_SI_RO_BOARD_P_LM_PID_P, 0x0180, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_I, 0x0188, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_I_L_THOLD, 0x0190, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_I_H_THOLD, 0x0198, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_D, 0x01A0, 0x00000000 +NV_SI_RO_BOARD_P_LM_EXP_SMOOTH_CONST, 0x01A8, 0x00000000 +NV_SI_RO_BOARD_TPM_ALG_ID, 0x01B0, 0x00000002 +NV_SI_RO_BOARD_DDR_SPEED_GRADE, 0x01B8, 0x00000C80 +NV_SI_RO_BOARD_DDR_S0_RTT_WR, 0x01C0, 0x20020000 +NV_SI_RO_BOARD_DDR_S1_RTT_WR, 0x01C8, 0x20020000 +NV_SI_RO_BOARD_DDR_S0_RTT_NOM, 0x01D0, 0x31060177 +NV_SI_RO_BOARD_DDR_S1_RTT_NOM, 0x01D8, 0x31060177 +NV_SI_RO_BOARD_DDR_S0_RTT_PARK, 0x01E0, 0x30060070 +NV_SI_RO_BOARD_DDR_S1_RTT_PARK, 0x01E8, 0x30060070 +NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_1DPC, 0x01F0, 0x00000000 +NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_1DPC, 0x01F8, 0x00000000 +NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_1DPC, 0x0200, 0x00000000 +NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_1DPC, 0x0208, 0x00000000 +NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_2DPC, 0x0210, 0x044C0CCC +NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_2DPC, 0x0218, 0x084C0CCC +NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_2DPC, 0x0220, 0x04130333 +NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_2DPC, 0x0228, 0x08130333 +NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_1DPC, 0x0230, 0x01130333 +NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_1DPC, 0x0238, 0x02230333 +NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_1DPC, 0x0240, 0x01430333 +NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_1DPC, 0x0248, 0x02830333 +NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_2DPC, 0x0250, 0x055EDEED +NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_2DPC, 0x0258, 0x0A5DEDDE +NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_2DPC, 0x0260, 0x055B7BB7 +NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_2DPC, 0x0268, 0x0A57B77B +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_1DPC, 0x0270, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_1DPC, 0x0278, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_1DPC, 0x0280, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_1DPC, 0x0288, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_2DPC, 0x0290, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_2DPC, 0x0298, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_2DPC, 0x02A0, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_2DPC, 0x02A8, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_1DPC, 0x02B0, 0x00000024 +NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_1DPC, 0x02B8, 0x001A001A +NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_2DPC, 0x02C0, 0x00000050 +NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_2DPC, 0x02C8, 0x00240020 +NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_DEFAULT, 0x02D0, 0x02800280 +NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_DEFAULT, 0x02D8, 0x90909090 +NV_SI_RO_BOARD_DDR_WRDQS_SHIFT_DEFAULT, 0x02E0, 0x00000000 +NV_SI_RO_BOARD_DDR_ADCMD_DLY_DEFAULT, 0x02E8, 0x00C000C0 +NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_ADJ, 0x02F0, 0x00000000 +NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_ADJ, 0x02F8, 0x00000000 +NV_SI_RO_BOARD_DDR_PHY_VREF_ADJ, 0x0300, 0x00000000 +NV_SI_RO_BOARD_DDR_DRAM_VREF_ADJ, 0x0308, 0x00000000 +NV_SI_RO_BOARD_DDR_WR_PREAMBLE_CYCLE, 0x0310, 0x02010201 +NV_SI_RO_BOARD_DDR_ADCMD_2T_MODE, 0x0318, 0x00000000 +NV_SI_RO_BOARD_I2C_VRD_CONFIG_INFO, 0x0320, 0x00000000 +NV_SI_RO_BOARD_DDR_PHY_FEATURE_CTRL, 0x0328, 0x00000000 +NV_SI_RO_BOARD_BMC_HANDSHAKE_SPI_ACCESS, 0x0330, 0x01050106 +NV_SI_RO_BOARD_DIMM_TEMP_THRESHOLD, 0x0338, 0x000005F4 +NV_SI_RO_BOARD_DIMM_SPD_COMPARE_DISABLE, 0x0340, 0x00000000 +NV_SI_RO_BOARD_S0_PCIE_CLK_CFG, 0x0348, 0x00000000 +NV_SI_RO_BOARD_S0_RCA4_CFG, 0x0350, 0x02020202 +NV_SI_RO_BOARD_S0_RCA5_CFG, 0x0358, 0x02020202 +NV_SI_RO_BOARD_S0_RCA6_CFG, 0x0360, 0x02020202 +NV_SI_RO_BOARD_S0_RCA7_CFG, 0x0368, 0x02020003 +NV_SI_RO_BOARD_S0_RCA0_TXRX_G3PRESET, 0x0370, 0x00000000 +NV_SI_RO_BOARD_S0_RCA1_TXRX_G3PRESET, 0x0378, 0x00000000 +NV_SI_RO_BOARD_S0_RCA2_TXRX_G3PRESET, 0x0380, 0x00000000 +NV_SI_RO_BOARD_S0_RCA3_TXRX_G3PRESET, 0x0388, 0x00000000 +NV_SI_RO_BOARD_S0_RCB0A_TXRX_G3PRESET, 0x0390, 0x00000000 +NV_SI_RO_BOARD_S0_RCB0B_TXRX_G3PRESET, 0x0398, 0x00000000 +NV_SI_RO_BOARD_S0_RCB1A_TXRX_G3PRESET, 0x03A0, 0x00000000 +NV_SI_RO_BOARD_S0_RCB1B_TXRX_G3PRESET, 0x03A8, 0x00000000 +NV_SI_RO_BOARD_S0_RCB2A_TXRX_G3PRESET, 0x03B0, 0x00000000 +NV_SI_RO_BOARD_S0_RCB2B_TXRX_G3PRESET, 0x03B8, 0x00000000 +NV_SI_RO_BOARD_S0_RCB3A_TXRX_G3PRESET, 0x03C0, 0x00000000 +NV_SI_RO_BOARD_S0_RCB3B_TXRX_G3PRESET, 0x03C8, 0x00000000 +NV_SI_RO_BOARD_S0_RCA4_TXRX_G3PRESET, 0x03D0, 0x00000000 +NV_SI_RO_BOARD_S0_RCA5_TXRX_G3PRESET, 0x03D8, 0x00000000 +NV_SI_RO_BOARD_S0_RCA6_TXRX_G3PRESET, 0x03E0, 0x00000000 +NV_SI_RO_BOARD_S0_RCA7_TXRX_G3PRESET, 0x03E8, 0x00000000 +NV_SI_RO_BOARD_S0_RCA0_TXRX_G4PRESET, 0x03F0, 0x57575757 +NV_SI_RO_BOARD_S0_RCA1_TXRX_G4PRESET, 0x03F8, 0x57575757 +NV_SI_RO_BOARD_S0_RCA2_TXRX_G4PRESET, 0x0400, 0x57575757 +NV_SI_RO_BOARD_S0_RCA3_TXRX_G4PRESET, 0x0408, 0x57575757 +NV_SI_RO_BOARD_S0_RCB0A_TXRX_G4PRESET, 0x0410, 0x57575757 +NV_SI_RO_BOARD_S0_RCB0B_TXRX_G4PRESET, 0x0418, 0x57575757 +NV_SI_RO_BOARD_S0_RCB1A_TXRX_G4PRESET, 0x0420, 0x57575757 +NV_SI_RO_BOARD_S0_RCB1B_TXRX_G4PRESET, 0x0428, 0x57575757 +NV_SI_RO_BOARD_S0_RCB2A_TXRX_G4PRESET, 0x0430, 0x57575757 +NV_SI_RO_BOARD_S0_RCB2B_TXRX_G4PRESET, 0x0438, 0x57575757 +NV_SI_RO_BOARD_S0_RCB3A_TXRX_G4PRESET, 0x0440, 0x57575757 +NV_SI_RO_BOARD_S0_RCB3B_TXRX_G4PRESET, 0x0448, 0x57575757 +NV_SI_RO_BOARD_S0_RCA4_TXRX_G4PRESET, 0x0450, 0x57575757 +NV_SI_RO_BOARD_S0_RCA5_TXRX_G4PRESET, 0x0458, 0x57575757 +NV_SI_RO_BOARD_S0_RCA6_TXRX_G4PRESET, 0x0460, 0x57575757 +NV_SI_RO_BOARD_S0_RCA7_TXRX_G4PRESET, 0x0468, 0x57575757 +NV_SI_RO_BOARD_S1_PCIE_CLK_CFG, 0x0470, 0x00000000 +NV_SI_RO_BOARD_S1_RCA4_CFG, 0x0478, 0x02020202 +NV_SI_RO_BOARD_S1_RCA5_CFG, 0x0480, 0x02020202 +NV_SI_RO_BOARD_S1_RCA6_CFG, 0x0488, 0x02020202 +NV_SI_RO_BOARD_S1_RCA7_CFG, 0x0490, 0x02020003 +NV_SI_RO_BOARD_S1_RCA2_TXRX_G3PRESET, 0x0498, 0x00000000 +NV_SI_RO_BOARD_S1_RCA3_TXRX_G3PRESET, 0x04A0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB0A_TXRX_G3PRESET, 0x04A8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB0B_TXRX_G3PRESET, 0x04B0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB1A_TXRX_G3PRESET, 0x04B8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB1B_TXRX_G3PRESET, 0x04C0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB2A_TXRX_G3PRESET, 0x04C8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB2B_TXRX_G3PRESET, 0x04D0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB3A_TXRX_G3PRESET, 0x04D8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB3B_TXRX_G3PRESET, 0x04E0, 0x00000000 +NV_SI_RO_BOARD_S1_RCA4_TXRX_G3PRESET, 0x04E8, 0x00000000 +NV_SI_RO_BOARD_S1_RCA5_TXRX_G3PRESET, 0x04F0, 0x00000000 +NV_SI_RO_BOARD_S1_RCA6_TXRX_G3PRESET, 0x04F8, 0x00000000 +NV_SI_RO_BOARD_S1_RCA7_TXRX_G3PRESET, 0x0500, 0x00000000 +NV_SI_RO_BOARD_S1_RCA2_TXRX_G4PRESET, 0x0508, 0x57575757 +NV_SI_RO_BOARD_S1_RCA3_TXRX_G4PRESET, 0x0510, 0x57575757 +NV_SI_RO_BOARD_S1_RCB0A_TXRX_G4PRESET, 0x0518, 0x57575757 +NV_SI_RO_BOARD_S1_RCB0B_TXRX_G4PRESET, 0x0520, 0x57575757 +NV_SI_RO_BOARD_S1_RCB1A_TXRX_G4PRESET, 0x0528, 0x57575757 +NV_SI_RO_BOARD_S1_RCB1B_TXRX_G4PRESET, 0x0530, 0x57575757 +NV_SI_RO_BOARD_S1_RCB2A_TXRX_G4PRESET, 0x0538, 0x57575757 +NV_SI_RO_BOARD_S1_RCB2B_TXRX_G4PRESET, 0x0540, 0x57575757 +NV_SI_RO_BOARD_S1_RCB3A_TXRX_G4PRESET, 0x0548, 0x57575757 +NV_SI_RO_BOARD_S1_RCB3B_TXRX_G4PRESET, 0x0550, 0x57575757 +NV_SI_RO_BOARD_S1_RCA4_TXRX_G4PRESET, 0x0558, 0x57575757 +NV_SI_RO_BOARD_S1_RCA5_TXRX_G4PRESET, 0x0560, 0x57575757 +NV_SI_RO_BOARD_S1_RCA6_TXRX_G4PRESET, 0x0568, 0x57575757 +NV_SI_RO_BOARD_S1_RCA7_TXRX_G4PRESET, 0x0570, 0x57575757 +NV_SI_RO_BOARD_2P_CE_MASK_THRESHOLD, 0x0578, 0x00000003 +NV_SI_RO_BOARD_2P_CE_MASK_INTERVAL, 0x0580, 0x000001A4 +NV_SI_RO_BOARD_SX_PHY_CFG_SETTING, 0x0588, 0x00000000 +NV_SI_RO_BOARD_DDR_PHY_DC_CLK, 0x0590, 0x00018000 +NV_SI_RO_BOARD_DDR_PHY_DC_DATA, 0x0598, 0x80018000 +NV_SI_RO_BOARD_SX_RCA0_TXRX_20GPRESET, 0x05A0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA1_TXRX_20GPRESET, 0x05A8, 0x00000000 +NV_SI_RO_BOARD_SX_RCA2_TXRX_20GPRESET, 0x05B0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA3_TXRX_20GPRESET, 0x05B8, 0x00000000 +NV_SI_RO_BOARD_SX_RCA0_TXRX_25GPRESET, 0x05C0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA1_TXRX_25GPRESET, 0x05C8, 0x00000000 +NV_SI_RO_BOARD_SX_RCA2_TXRX_25GPRESET, 0x05D0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA3_TXRX_25GPRESET, 0x05D8, 0x00000000 +NV_SI_RO_BOARD_DDR_2X_REFRESH_TEMP_THRESHOLD, 0x05E0, 0x00550055 +NV_SI_RO_BOARD_PCP_VRD_VOUT_WAIT_US, 0x05E8, 0x00000064 +NV_SI_RO_BOARD_PCP_VRD_VOUT_RESOLUTION_MV, 0x05F0, 0x00000005 +NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_EN, 0x05F8, 0x00000001 +NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_TIME, 0x0600, 0x00000002 +NV_SI_RO_BOARD_DVFS_VOUT_20MV_RAMP_TIME_US, 0x0608, 0x00000005 +NV_SI_RO_BOARD_PCIE_AER_FW_FIRST, 0x0610, 0x00000000 +NV_SI_RO_BOARD_RTC_GPI_LOCK_BYPASS, 0x0618, 0x00000000 +NV_SI_RO_BOARD_TPM_DISABLE, 0x0620, 0x00000000 +NV_SI_RO_BOARD_MESH_S0_CXG_RC_STRONG_ORDERING_EN, 0x0628, 0x00000000 +NV_SI_RO_BOARD_MESH_S1_CXG_RC_STRONG_ORDERING_EN, 0x0630, 0x00000000 +NV_SI_RO_BOARD_GPIO_SW_WATCHDOG_EN, 0x0638, 0x00000000 +NV_SI_RO_BOARD_PCIE_HP_DISABLE, 0x0640, 0x00000000 +NV_SI_RO_BOARD_I2C_VRD_VOUT_FORMAT, 0x0648, 0x00000000 +NV_SI_RO_BOARD_I2C_VRD_SMBUS_CMD_FLAGS, 0x0650, 0x00000000 +NV_SI_RO_BOARD_CUST_SPM_LOCATION, 0x0658, 0x00000000 +NV_SI_RO_BOARD_RAS_DDR_CE_WINDOW, 0x0660, 0x00000000 +NV_SI_RO_BOARD_RAS_DDR_CE_TH1, 0x0668, 0x000001F4 +NV_SI_RO_BOARD_RAS_DDR_CE_TH2, 0x0670, 0x00001388 diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelper.S b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelper.S new file mode 100644 index 000000000000..770aa9424eed --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelper.S @@ -0,0 +1,45 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/** + * Derived from edk2/ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/ArmPlatformHelper.S + **/ + +#include <AsmMacroIoLibV8.h> +#include <Library/ArmLib.h> + +ASM_FUNC(ArmPlatformPeiBootAction) + ret + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore)) + ret + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_FUNC(ArmPlatformIsPrimaryCore) + ldr x0, =0x1 + ret + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +ASM_FUNC(ArmPlatformGetCorePosition) + and x1, x0, #ARM_CORE_MASK + and x0, x0, #ARM_CLUSTER_MASK + add x0, x1, x0, LSR #7 + ret + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni new file mode 100644 index 000000000000..dac06405dd58 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni @@ -0,0 +1,13 @@ +// /** @file +// Instance of RNG (Random Number Generator) Library. +// +// Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Instance of RNG Library" + +#string STR_MODULE_DESCRIPTION #language en-US "RngLib that uses Hardware RNG module from SMpro to generate random numbers." -- 2.17.1
|
|
[PATCH v3 03/28] AmperePlatformPkg: Implement FailSafe library
Nhi Pham
The Ampere Altra System Firmware provides a fail-safe feature to help
recover the system if there are setting changes such as Core voltage, DRAM parameters that cause the UEFI failed to boot. The FailSafeLib supports API calls to Secure World to: * Get the FailSafe region information. * Get the current FailSafe status. * Inform to FailSafe monitor that the system boots successfully. * Simulate UEFI boot failure due to config wrong NVPARAM for testing failsafe feature. This library will be consumed by FailSafe DXE driver. Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com> --- Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec | 3 + Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.inf | 41 +++ Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h | 62 ++++ Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c | 313 ++++++++++++++++++++ 4 files changed, 419 insertions(+) diff --git a/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec b/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec index 7c1d1f84f780..6e33d96c7ea5 100644 --- a/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec +++ b/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec @@ -22,7 +22,10 @@ [Defines] # ################################################################################ [Includes] + Include # Root include for the package [LibraryClasses] + ## @libraryclass Provides functions to support FailSafe operations. + FailSafeLib|Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h [Guids] diff --git a/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.inf b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.inf new file mode 100644 index 000000000000..456b9d5fc85b --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.inf @@ -0,0 +1,41 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = FailSafeLib + FILE_GUID = 3403D080-6D76-11E7-907B-A6006AD3DBA0 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = FailSafeLib + +[Sources] + FailSafeLib.c + +[Protocols] + gEfiMmCommunicationProtocolGuid ## CONSUMES + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmSmcLib + BaseLib + BaseMemoryLib + DebugLib + HobLib + IoLib + NVParamLib + +[Guids] + gSpiNorMmGuid diff --git a/Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h b/Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h new file mode 100644 index 000000000000..7ebd1c8a74a2 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h @@ -0,0 +1,62 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef FAILSAFE_LIB_H_ +#define FAILSAFE_LIB_H_ + +enum { + MM_SPINOR_FUNC_GET_INFO, + MM_SPINOR_FUNC_READ, + MM_SPINOR_FUNC_WRITE, + MM_SPINOR_FUNC_ERASE, + MM_SPINOR_FUNC_GET_NVRAM_INFO, + MM_SPINOR_FUNC_GET_NVRAM2_INFO, + MM_SPINOR_FUNC_GET_FAILSAFE_INFO +}; + +#define MM_SPINOR_RES_SUCCESS 0xAABBCC00 +#define MM_SPINOR_RES_FAIL 0xAABBCCFF + +enum { + FAILSAFE_BOOT_NORMAL = 0, + FAILSAFE_BOOT_LAST_KNOWN_SETTINGS, + FAILSAFE_BOOT_DEFAULT_SETTINGS, + FAILSAFE_BOOT_DDR_DOWNGRADE, + FAILSAFE_BOOT_SUCCESSFUL +}; + +/** + Get the FailSafe region information. +**/ +EFI_STATUS +EFIAPI +FailSafeGetRegionInfo ( + UINT64 *Offset, + UINT64 *Size + ); + +/** + Inform to FailSafe monitor that the system boots successfully. +**/ +EFI_STATUS +EFIAPI +FailSafeBootSuccessfully ( + VOID + ); + +/** + Simulate UEFI boot failure due to config wrong NVPARAM for + testing failsafe feature +**/ +EFI_STATUS +EFIAPI +FailSafeTestBootFailure ( + VOID + ); + +#endif /* FAILSAFE_LIB_H_ */ diff --git a/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c new file mode 100644 index 000000000000..d74962d73396 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c @@ -0,0 +1,313 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> +#include <Uefi.h> + +#include <Library/ArmSmcLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/FailSafeLib.h> +#include <Library/HobLib.h> +#include <Library/NVParamLib.h> +#include <Library/PcdLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeLib.h> +#include <Platform/Ac01.h> +#include <Protocol/MmCommunication.h> + +#define EFI_MM_MAX_PAYLOAD_U64_E 10 +#define EFI_MM_MAX_PAYLOAD_SIZE (EFI_MM_MAX_PAYLOAD_U64_E * sizeof (UINT64)) + +EFI_MM_COMMUNICATION_PROTOCOL *mFlashLibMmCommProtocol = NULL; + +typedef struct { + /* Allows for disambiguation of the message format */ + EFI_GUID HeaderGuid; + /* + * Describes the size of Data (in bytes) and does not include the size + * of the header + */ + UINTN MsgLength; +} EFI_MM_COMM_HEADER_NOPAYLOAD; + +typedef struct { + UINT64 Data[EFI_MM_MAX_PAYLOAD_U64_E]; +} EFI_MM_COMM_SPINOR_PAYLOAD; + +typedef struct { + EFI_MM_COMM_HEADER_NOPAYLOAD EfiMmHdr; + EFI_MM_COMM_SPINOR_PAYLOAD PayLoad; +} EFI_MM_COMM_REQUEST; + +typedef struct { + UINT64 Status; +} EFI_MM_COMMUNICATE_SPINOR_RES; + +typedef struct { + UINT64 Status; + UINT64 FailSafeBase; + UINT64 FailSafeSize; +} EFI_MM_COMMUNICATE_SPINOR_FAILSAFE_INFO_RES; + +EFI_MM_COMM_REQUEST mEfiMmSpiNorReq; + +#pragma pack(1) +typedef struct { + UINT8 ImgMajorVer; + UINT8 ImgMinorVer; + UINT32 NumRetry1; + UINT32 NumRetry2; + UINT32 MaxRetry; + UINT8 Status; + /* + * Byte[3]: Reserved + * Byte[2]: Slave MCU Failure Mask + * Byte[1]: Reserved + * Byte[0]: Master MCU Failure Mask + */ + UINT32 MCUFailsMask; + UINT16 CRC16; + UINT8 Reserved[3]; +} FAIL_SAFE_CONTEXT; + +#pragma pack() + +STATIC +EFI_STATUS +UefiMmCreateSpiNorReq ( + VOID *Data, + UINT64 Size + ) +{ + CopyGuid (&mEfiMmSpiNorReq.EfiMmHdr.HeaderGuid, &gSpiNorMmGuid); + mEfiMmSpiNorReq.EfiMmHdr.MsgLength = Size; + + if (Size != 0) { + ASSERT (Data); + ASSERT (Size <= EFI_MM_MAX_PAYLOAD_SIZE); + + CopyMem (mEfiMmSpiNorReq.PayLoad.Data, Data, Size); + } + + return EFI_SUCCESS; +} + +STATIC +INTN +CheckCrc16 ( + UINT8 *Pointer, + INTN Count + ) +{ + INTN Crc = 0; + INTN Index; + + while (--Count >= 0) { + Crc = Crc ^ (INTN)*Pointer++ << 8; + for (Index = 0; Index < 8; ++Index) { + if ((Crc & 0x8000) != 0) { + Crc = Crc << 1 ^ 0x1021; + } else { + Crc = Crc << 1; + } + } + } + + return Crc & 0xFFFF; +} + +BOOLEAN +FailSafeValidCRC ( + FAIL_SAFE_CONTEXT *FailSafeBuf + ) +{ + UINT8 Valid; + UINT16 Crc; + UINT32 Len; + + Len = sizeof (FAIL_SAFE_CONTEXT); + Crc = FailSafeBuf->CRC16; + FailSafeBuf->CRC16 = 0; + + Valid = (Crc == CheckCrc16 ((UINT8 *)FailSafeBuf, Len)); + FailSafeBuf->CRC16 = Crc; + + return Valid; +} + +BOOLEAN +FailSafeFailureStatus ( + UINT8 Status + ) +{ + if ((Status == FAILSAFE_BOOT_LAST_KNOWN_SETTINGS) || + (Status == FAILSAFE_BOOT_DEFAULT_SETTINGS) || + (Status == FAILSAFE_BOOT_DDR_DOWNGRADE)) + { + return TRUE; + } + + return FALSE; +} + +EFI_STATUS +EFIAPI +FailSafeGetRegionInfo ( + UINT64 *Offset, + UINT64 *Size + ) +{ + EFI_MM_COMMUNICATE_SPINOR_FAILSAFE_INFO_RES *MmSpiNorFailSafeInfoRes; + UINT64 MmData[5]; + UINTN DataSize; + EFI_STATUS Status; + + if (mFlashLibMmCommProtocol == NULL) { + Status = gBS->LocateProtocol ( + &gEfiMmCommunicationProtocolGuid, + NULL, + (VOID **)&mFlashLibMmCommProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Can't locate gEfiMmCommunicationProtocolGuid\n", __FUNCTION__)); + return Status; + } + } + + MmData[0] = MM_SPINOR_FUNC_GET_FAILSAFE_INFO; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + DataSize = sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status = mFlashLibMmCommProtocol->Communicate ( + mFlashLibMmCommProtocol, + (VOID *)&mEfiMmSpiNorReq, + &DataSize + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorFailSafeInfoRes = (EFI_MM_COMMUNICATE_SPINOR_FAILSAFE_INFO_RES *)&mEfiMmSpiNorReq.PayLoad; + if (MmSpiNorFailSafeInfoRes->Status != MM_SPINOR_RES_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "%a: Get flash information failed: 0x%llx\n", + __FUNCTION__, + MmSpiNorFailSafeInfoRes->Status + )); + return EFI_DEVICE_ERROR; + } + + *Offset = MmSpiNorFailSafeInfoRes->FailSafeBase; + *Size = MmSpiNorFailSafeInfoRes->FailSafeSize; + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FailSafeBootSuccessfully ( + VOID + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RES *MmSpiNorRes; + UINT64 MmData[5]; + UINTN Size; + EFI_STATUS Status; + UINT64 FailSafeStartOffset; + UINT64 FailSafeSize; + FAIL_SAFE_CONTEXT FailSafeBuf; + + Status = FailSafeGetRegionInfo (&FailSafeStartOffset, &FailSafeSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get context region information\n", __FUNCTION__)); + return EFI_DEVICE_ERROR; + } + + MmData[0] = MM_SPINOR_FUNC_READ; + MmData[1] = FailSafeStartOffset; + MmData[2] = (UINT64)sizeof (FAIL_SAFE_CONTEXT); + MmData[3] = (UINT64)&FailSafeBuf; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size = sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status = mFlashLibMmCommProtocol->Communicate ( + mFlashLibMmCommProtocol, + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes = (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayLoad; + if (MmSpiNorRes->Status != MM_SPINOR_RES_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "%a: Read context failed: 0x%llx\n", + __FUNCTION__, + MmSpiNorRes->Status + )); + return EFI_DEVICE_ERROR; + } + + /* + * If failsafe context is valid, and: + * - The status indicate non-failure, then don't clear it + * - The status indicate a failure, then go and clear it + */ + if (FailSafeValidCRC (&FailSafeBuf) + && !FailSafeFailureStatus (FailSafeBuf.Status)) { + return EFI_SUCCESS; + } + + MmData[0] = MM_SPINOR_FUNC_ERASE; + MmData[1] = FailSafeStartOffset; + MmData[2] = FailSafeSize; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size = sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status = mFlashLibMmCommProtocol->Communicate ( + mFlashLibMmCommProtocol, + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes = (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayLoad; + if (MmSpiNorRes->Status != MM_SPINOR_RES_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "%a: Erase context failed: 0x%llx\n", + __FUNCTION__, + MmSpiNorRes->Status + )); + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FailSafeTestBootFailure ( + VOID + ) +{ + EFI_STATUS Status; + UINT32 Value = 0; + + /* + * Simulate UEFI boot failure due to config wrong NVPARAM for + * testing failsafe feature + */ + Status = NVParamGet (NV_UEFI_FAILURE_FAILSAFE_OFFSET, NV_PERM_ALL, &Value); + if (!EFI_ERROR (Status) && (Value == 1)) { + while (1) { + } + } + + return EFI_SUCCESS; +} -- 2.17.1
|
|
[PATCH v3 02/28] AmpereAltraPkg: Add MmCommunication modules
Nhi Pham
From: Vu Nguyen <vunguyen@os.amperecomputing.com>
The MmCommunicationDxe module is derived from ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf. The MmCommunication PEI and DXE modules implement the MM Communication protocol (EFI_MM_COMMUNICATION_PROTOCOL) as defined in the PI 1.5 specification for the interface between UEFI and MM services in the secure world. Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Vu Nguyen <vunguyen@os.amperecomputing.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com> --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 2 + Platform/Ampere/JadePkg/Jade.fdf | 3 + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf | 57 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.inf | 34 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicate.h | 22 + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 454 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.c | 37 ++ 8 files changed, 612 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec index f0a5bd04ec22..73097afaf841 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -38,5 +38,8 @@ [Guids] ## NVParam MM GUID gNVParamMmGuid = { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } + ## SPI NOR Proxy MM GUID + gSpiNorMmGuid = { 0xC8D76438, 0x4D3C, 0x4BEA, { 0xBF, 0x86, 0x92, 0x6B, 0x83, 0x07, 0xA2, 0x39 } } + ## Include/Guid/PlatformInfoHobGuid.h gPlatformHobGuid = { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0x76, 0x78, 0x30, 0x32, 0x6d, 0x79, 0xb4 } } diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 770b4a12bc0b..7dadf15b7825 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -525,6 +525,7 @@ [Components.common] ArmPlatformPkg/PlatformPei/PlatformPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.inf ArmPkg/Drivers/CpuPei/CpuPei.inf UefiCpuPkg/CpuIoPei/CpuIoPei.inf MdeModulePkg/Universal/Variable/Pei/VariablePei.inf @@ -573,6 +574,7 @@ [Components.common] EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf # # Environment Variables Protocol diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jade.fdf index 8ed6df381aed..905289844378 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -101,6 +101,7 @@ [FV.FVMAIN_COMPACT] INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf @@ -141,6 +142,7 @@ [FV.FvMain] INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf } INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -163,6 +165,7 @@ [FV.FvMain] INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf # # Environment Variables Protocol diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf new file mode 100644 index 000000000000..3efff142944f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf @@ -0,0 +1,57 @@ +#/** @file +# +# This module implements the MM Communication Protocol (EFI_MM_COMMUNICATION_PROTOCOL) +# as defined in the PI 1.5 specification. +# +# Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = ArmMmCommunication + FILE_GUID = 09EE81D3-F15E-43F4-85B4-CB9873DA5D6B + MODULE_TYPE = DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MmCommunicationInitialize + +# +# The following is for reference only and not required by +# build tools +# +# VALID_ARCHITECTURES = AARCH64 +# + +[Sources.AARCH64] + MmCommunicate.h + MmCommunication.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + ArmSmcLib + BaseMemoryLib + DebugLib + DxeServicesTableLib + HobLib + UefiDriverEntryPoint + +[Protocols] + gEfiMmCommunicationProtocolGuid ## PRODUCES + +[Guids] + gEfiEndOfDxeEventGroupGuid + gEfiEventExitBootServicesGuid + gEfiEventReadyToBootGuid + +[Pcd.common] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize + +[Depex] + gEfiCpuArchProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.inf new file mode 100644 index 000000000000..3a985840a0a0 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = MmCommunicationPei + FILE_GUID = B5AE0F80-DF81-11EA-8B6E-0800200C9A66 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + ENTRY_POINT = MmCommunicationPeiEntryPoint + +[Sources] + MmCommunicationPei.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + HobLib + PcdLib + PeimEntryPoint + +[Pcd] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicate.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicate.h new file mode 100644 index 000000000000..804ba58afb72 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicate.h @@ -0,0 +1,22 @@ +/** @file + + Copyright (c) 2016-2018, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_COMMUNICATE_H_ +#define MM_COMMUNICATE_H_ + +#define MM_MAJOR_VER_MASK 0xEFFF0000 +#define MM_MINOR_VER_MASK 0x0000FFFF +#define MM_MAJOR_VER_SHIFT 16 + +#define MM_MAJOR_VER(x) (((x) & MM_MAJOR_VER_MASK) >> MM_MAJOR_VER_SHIFT) +#define MM_MINOR_VER(x) ((x) & MM_MINOR_VER_MASK) + +#define MM_CALLER_MAJOR_VER 0x1UL +#define MM_CALLER_MINOR_VER 0x0 + +#endif /* MM_COMMUNICATE_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.c new file mode 100644 index 000000000000..271fc755548f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.c @@ -0,0 +1,454 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC + Copyright (c) 2016-2018, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <IndustryStandard/ArmStdSmc.h> +#include <Library/ArmLib.h> +#include <Library/ArmSmcLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Library/DxeServicesTableLib.h> +#include <Library/HobLib.h> +#include <Library/PcdLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> +#include <Protocol/MmCommunication.h> + +#include "MmCommunicate.h" + +#define MM_EARLY_MEM_ALLOCATE 1 + +// +// Address, Length of the pre-allocated buffer for communication with the secure +// world. +// +STATIC ARM_MEMORY_REGION_DESCRIPTOR mNsCommBuffMemRegion; + +// Notification event when virtual address map is set. +STATIC EFI_EVENT mSetVirtualAddressMapEvent; + +// +// Handle to install the MM Communication Protocol +// +STATIC EFI_HANDLE mMmCommunicateHandle; + +/** + Communicates with a registered handler. + + This function provides an interface to send and receive messages to the + Standalone MM environment on behalf of UEFI services. This function is part + of the MM Communication Protocol that may be called in physical mode prior to + SetVirtualAddressMap() and in virtual mode after SetVirtualAddressMap(). + + @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL + instance. + @param[in, out] CommBuffer A pointer to the buffer to convey + into MMRAM. + @param[in, out] CommSize The size of the data buffer being + passed in. This is optional. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer size is incorrect for the MM + implementation. If this error is + returned, the MessageLength field in + the CommBuffer header or the integer + pointed by CommSize are updated to reflect + the maximum payload size the + implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter + or CommSize parameter, if not omitted, + are in address range that cannot be + accessed by the MM environment +**/ +STATIC +EFI_STATUS +EFIAPI +MmCommunicationCommunicate ( + IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This, + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommSize OPTIONAL + ) +{ + EFI_MM_COMMUNICATE_HEADER *CommunicateHeader; + ARM_SMC_ARGS CommunicateSmcArgs; + EFI_STATUS Status; + UINTN BufferSize; + + Status = EFI_ACCESS_DENIED; + BufferSize = 0; + + ZeroMem (&CommunicateSmcArgs, sizeof (ARM_SMC_ARGS)); + + // + // Check parameters + // + if (CommBuffer == NULL) { + return EFI_INVALID_PARAMETER; + } + + CommunicateHeader = CommBuffer; + // CommBuffer is a mandatory parameter. Hence, rely on + // MessageLength + Header to ascertain the + // total size of the communication payload rather than + // relying on optional CommSize parameter + BufferSize = CommunicateHeader->MessageLength + + sizeof (CommunicateHeader->HeaderGuid) + + sizeof (CommunicateHeader->MessageLength); + + // If the length of the CommBuffer is 0 then return the expected length. + if (CommSize != NULL) { + // This case can be used by the consumer of this driver to find out the + // max size that can be used for allocating CommBuffer. + if ((*CommSize == 0) || + (*CommSize > mNsCommBuffMemRegion.Length)) + { + *CommSize = mNsCommBuffMemRegion.Length; + return EFI_BAD_BUFFER_SIZE; + } + // + // CommSize must match MessageLength + sizeof (EFI_MM_COMMUNICATE_HEADER); + // + if (*CommSize != BufferSize) { + return EFI_INVALID_PARAMETER; + } + } + + // + // If the buffer size is 0 or greater than what can be tolerated by the MM + // environment then return the expected size. + // + if ((BufferSize == 0) || + (BufferSize > mNsCommBuffMemRegion.Length)) + { + CommunicateHeader->MessageLength = mNsCommBuffMemRegion.Length - + sizeof (CommunicateHeader->HeaderGuid) - + sizeof (CommunicateHeader->MessageLength); + return EFI_BAD_BUFFER_SIZE; + } + + // SMC Function ID + CommunicateSmcArgs.Arg0 = ARM_SMC_ID_MM_COMMUNICATE_AARCH64; + + // Cookie + CommunicateSmcArgs.Arg1 = 0; + + // Copy Communication Payload + CopyMem ((VOID *)mNsCommBuffMemRegion.VirtualBase, CommBuffer, BufferSize); + + // comm_buffer_address (64-bit physical address) + CommunicateSmcArgs.Arg2 = (UINTN)mNsCommBuffMemRegion.PhysicalBase; + + // comm_size_address (not used, indicated by setting to zero) + CommunicateSmcArgs.Arg3 = 0; + + // Call the Standalone MM environment. + ArmCallSmc (&CommunicateSmcArgs); + + switch (CommunicateSmcArgs.Arg0) { + case ARM_SMC_MM_RET_SUCCESS: + ZeroMem (CommBuffer, BufferSize); + // On successful return, the size of data being returned is inferred from + // MessageLength + Header. + CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)mNsCommBuffMemRegion.VirtualBase; + BufferSize = CommunicateHeader->MessageLength + + sizeof (CommunicateHeader->HeaderGuid) + + sizeof (CommunicateHeader->MessageLength); + + CopyMem ( + CommBuffer, + (VOID *)mNsCommBuffMemRegion.VirtualBase, + BufferSize + ); + Status = EFI_SUCCESS; + break; + + case ARM_SMC_MM_RET_INVALID_PARAMS: + Status = EFI_INVALID_PARAMETER; + break; + + case ARM_SMC_MM_RET_DENIED: + Status = EFI_ACCESS_DENIED; + break; + + case ARM_SMC_MM_RET_NO_MEMORY: + // Unexpected error since the CommSize was checked for zero length + // prior to issuing the SMC + Status = EFI_OUT_OF_RESOURCES; + ASSERT (0); + break; + + default: + Status = EFI_ACCESS_DENIED; + ASSERT (0); + } + + return Status; +} + +// +// MM Communication Protocol instance +// +EFI_MM_COMMUNICATION_PROTOCOL mMmCommunication = { + MmCommunicationCommunicate +}; + +/** + Notification callback on SetVirtualAddressMap event. + + This function notifies the MM communication protocol interface on + SetVirtualAddressMap event and converts pointers used in this driver + from physical to virtual address. + + @param Event SetVirtualAddressMap event. + @param Context A context when the SetVirtualAddressMap triggered. + + @retval EFI_SUCCESS The function executed successfully. + @retval Other Some error occurred when executing this function. + +**/ +STATIC +VOID +EFIAPI +NotifySetVirtualAddressMap ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + Status = gRT->ConvertPointer ( + EFI_OPTIONAL_PTR, + (VOID **)&mNsCommBuffMemRegion.VirtualBase + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Unable to convert MM runtime pointer. Status:0x%r\n", + __FUNCTION__, + Status + )); + } + +} + +STATIC +EFI_STATUS +GetMmCompatibility () +{ + EFI_STATUS Status; + UINT32 MmVersion; + ARM_SMC_ARGS MmVersionArgs; + + // MM_VERSION uses SMC32 calling conventions + MmVersionArgs.Arg0 = ARM_SMC_ID_MM_VERSION_AARCH32; + + ArmCallSmc (&MmVersionArgs); + + MmVersion = MmVersionArgs.Arg0; + + if ((MM_MAJOR_VER (MmVersion) == MM_CALLER_MAJOR_VER) && + (MM_MINOR_VER (MmVersion) >= MM_CALLER_MINOR_VER)) + { + DEBUG (( + DEBUG_INFO, + "MM Version: Major=0x%x, Minor=0x%x\n", + MM_MAJOR_VER (MmVersion), + MM_MINOR_VER (MmVersion) + )); + Status = EFI_SUCCESS; + } else { + DEBUG (( + DEBUG_ERROR, + "Incompatible MM Versions.\n Current Version: Major=0x%x, " + "Minor=0x%x.\n Expected: Major=0x%x, Minor>=0x%x.\n", + MM_MAJOR_VER (MmVersion), + MM_MINOR_VER (MmVersion), + MM_CALLER_MAJOR_VER, + MM_CALLER_MINOR_VER + )); + Status = EFI_UNSUPPORTED; + } + + return Status; +} + +STATIC EFI_GUID *CONST mGuidedEventGuid[] = { + &gEfiEndOfDxeEventGroupGuid, + &gEfiEventExitBootServicesGuid, + &gEfiEventReadyToBootGuid, +}; + +STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)]; + +/** + Event notification that is fired when GUIDed Event Group is signaled. + + @param Event The Event that is being processed, not used. + @param Context Event Context, not used. + +**/ +STATIC +VOID +EFIAPI +MmGuidedEventNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_MM_COMMUNICATE_HEADER Header; + UINTN Size; + + // + // Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure + // + CopyGuid (&Header.HeaderGuid, Context); + Header.MessageLength = 1; + Header.Data[0] = 0; + + Size = sizeof (Header); + MmCommunicationCommunicate (&mMmCommunication, &Header, &Size); +} + +/** + The Entry Point for MM Communication + + This function installs the MM communication protocol interface and finds out + what type of buffer management will be required prior to invoking the + communication SMC. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval Other Some error occurred when executing this entry point. + +**/ +EFI_STATUS +EFIAPI +MmCommunicationInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINTN Index; + + // Check if we can make the MM call + Status = GetMmCompatibility (); + if (EFI_ERROR (Status)) { + goto ReturnErrorStatus; + } + + mNsCommBuffMemRegion.PhysicalBase = PcdGet64 (PcdMmBufferBase); + // During boot, virtual and physical are same + mNsCommBuffMemRegion.VirtualBase = mNsCommBuffMemRegion.PhysicalBase; + mNsCommBuffMemRegion.Length = PcdGet64 (PcdMmBufferSize); + + ASSERT (mNsCommBuffMemRegion.PhysicalBase != 0); + + ASSERT (mNsCommBuffMemRegion.Length != 0); + +#if !defined(MM_EARLY_MEM_ALLOCATE) + Status = gDS->AddMemorySpace ( + EfiGcdMemoryTypeReserved, + mNsCommBuffMemRegion.PhysicalBase, + mNsCommBuffMemRegion.Length, + EFI_MEMORY_WB | + EFI_MEMORY_XP | + EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to add MM-NS Buffer Memory Space\n", + __FUNCTION__ + )); + goto ReturnErrorStatus; + } + + Status = gDS->SetMemorySpaceAttributes ( + mNsCommBuffMemRegion.PhysicalBase, + mNsCommBuffMemRegion.Length, + EFI_MEMORY_WB | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to set MM-NS Buffer Memory attributes\n", + __FUNCTION__ + )); + goto CleanAddedMemorySpace; + } +#endif + + // Install the communication protocol + Status = gBS->InstallProtocolInterface ( + &mMmCommunicateHandle, + &gEfiMmCommunicationProtocolGuid, + EFI_NATIVE_INTERFACE, + &mMmCommunication + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to install MM communication protocol\n", + __FUNCTION__ + )); + goto CleanAddedMemorySpace; + } + + // Register notification callback when virtual address is associated + // with the physical address. + // Create a Set Virtual Address Map event. + Status = gBS->CreateEvent ( + EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, + TPL_NOTIFY, + NotifySetVirtualAddressMap, + NULL, + &mSetVirtualAddressMapEvent + ); + ASSERT_EFI_ERROR (Status); + + for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) { + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + MmGuidedEventNotify, + mGuidedEventGuid[Index], + mGuidedEventGuid[Index], + &mGuidedEvent[Index] + ); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + while (Index-- > 0) { + gBS->CloseEvent (mGuidedEvent[Index]); + } + goto UninstallProtocol; + } + } + return EFI_SUCCESS; + +UninstallProtocol: + gBS->UninstallProtocolInterface ( + mMmCommunicateHandle, + &gEfiMmCommunicationProtocolGuid, + &mMmCommunication + ); + +CleanAddedMemorySpace: +#if !defined(MM_EARLY_MEM_ALLOCATE) + gDS->RemoveMemorySpace ( + mNsCommBuffMemRegion.PhysicalBase, + mNsCommBuffMemRegion.Length + ); +#endif + +ReturnErrorStatus: + return EFI_INVALID_PARAMETER; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.c new file mode 100644 index 000000000000..d3925015612f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.c @@ -0,0 +1,37 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiPei.h> +#include <Uefi/UefiSpec.h> + +#include <Library/HobLib.h> +#include <Library/PeimEntryPoint.h> + +/** + Entry point function for the PEIM + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @return EFI_SUCCESS If we installed our PPI + +**/ +EFI_STATUS +EFIAPI +MmCommunicationPeiEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_PHYSICAL_ADDRESS MmBufferBase = PcdGet64 (PcdMmBufferBase); + UINT64 MmBufferSize = PcdGet64 (PcdMmBufferSize); + + BuildMemoryAllocationHob (MmBufferBase, MmBufferSize, EfiRuntimeServicesData); + + return EFI_SUCCESS; +} -- 2.17.1
|
|
[PATCH v3 00/28] Add new Ampere Mt. Jade platform
Nhi Pham
This patch series adds the support for the Mt. Jade platform based on Ampere's
Altra Family Processor. Notes: + The current patch series was tested with the edk2-stable202108 tag. + The IASL compiler version 20201217 is required to build. + The edk2-non-osi source is required to build. You can get code from https://github.com/AmpereComputing/edk2-platforms/tree/ampere-upstream-wip-v3 Cc: Vu Nguyen <vunguyen@os.amperecomputing.com> Cc: Nhi Pham <nhi@os.amperecomputing.com> Cc: Thang Nguyen <thang@os.amperecomputing.com> Cc: Chuong Tran <chuong@os.amperecomputing.com> Cc: Phong Vo <phong@os.amperecomputing.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> Changes since v2: + Addressed all Leif's feedback. Changes since v1: + Addressed all Leif's feedback in the thread https://edk2.groups.io/g/devel/message/70356. + Removed the LinuxBoot image as Leif's feedback in the thread https://edk2.groups.io/g/devel/message/68717. The image will be pre-produced by users as the instruction in the README before compiling. + Other major code improvements from in-house review: * Create new AmperePlatformPkg and AmpereSiliconPkg packages for containing common Platform/Silicon modules. * Remove SMProLib and PMProLib libraries which are replaced by the MailboxInterfaceLib and SystemFirmwareInterfaceLib libraries for the communication interface between UEFI and System Firmware. * Clean up and fix coding styles to conform to EDK II C Coding Standards Specification. Nhi Pham (5): AmperePlatformPkg: Implement FailSafe library AmperePlatformPkg: Add FailSafe and WDT support AmpereAltraPkg, JadePkg: Add ACPI support JadePkg: Add ASpeed GOP driver AmpereAltraPkg: Add configuration screen for ACPI Quan Nguyen (3): AmpereAltraPkg: Add BootProgress support JadePkg: Add SMBIOS tables support AmpereAltraPkg: Add configuration screen for RAS Vu Nguyen (20): Ampere: Initial support for Ampere Altra processor and Mt. Jade platform AmpereAltraPkg: Add MmCommunication modules AmpereAltraPkg: Add DwI2cLib library AmpereAltraPkg: Add DwGpioLib library JadePkg: Implement RealTimeClockLib for PCF85063 AmpereAltraPkg: Support UEFI non-volatile variable AmpereSiliconPkg: Add PlatformManagerUiLib library instance AmpereAltraPkg: Add Ac01PcieLib library instance JadePkg: Add BoardPcieLib library instance Ampere: PCIe: Add PciHostBridgeLib library instance Ampere: PCIe: Add PciSegmentLib library instance JadePkg: Enable PCIe-related libraries and device drivers Ampere: PCIe: Add PciPlatformDxe driver AmpereAltraPkg: Add Random Number Generator Support AmpereAltraPkg: Add DebugInfoPei module AmpereAltraPkg: Add platform info screen AmpereAltraPkg: Add configuration screen for memory AmpereAltraPkg: Add configuration screen for CPU AmpereAltraPkg: Add configuration screen for Watchdog timer AmpereAltraPkg: Add configuration screen for Pcie Devices .../AmperePlatformPkg/AmperePlatformPkg.dec | 31 + .../Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 72 + .../AmpereSiliconPkg/AmpereSiliconPkg.dec | 85 + .../AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 748 +++ Platform/Ampere/JadePkg/Jade.dsc | 205 + Platform/Ampere/JadePkg/Jade.fdf | 365 ++ .../Drivers/FailSafeDxe/FailSafeDxe.inf | 54 + .../Library/FailSafeLib/FailSafeLib.inf | 41 + .../Ampere/JadePkg/AcpiTables/AcpiTables.inf | 20 + .../AcpiPlatformDxe/AcpiPlatformDxe.inf | 78 + .../Drivers/PciPlatformDxe/PciPlatformDxe.inf | 37 + .../SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf | 45 + .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 52 + .../Library/BoardPcieLib/BoardPcieLib.inf | 59 + .../JadePkg/Library/OemMiscLib/OemMiscLib.inf | 36 + .../PCF85063RealTimeClockLib.inf | 44 + .../AcpiCommonTables/AcpiCommonTables.inf | 44 + .../Drivers/ATFHobPei/ATFHobPeim.inf | 41 + .../Drivers/AcpiConfigDxe/AcpiConfigDxe.inf | 58 + .../BootProgressDxe/BootProgressDxe.inf | 51 + .../BootProgressPeim/BootProgressPeim.inf | 49 + .../Drivers/CpuConfigDxe/CpuConfigDxe.inf | 58 + .../Drivers/DebugInfoPei/DebugInfoPei.inf | 40 + .../Drivers/FlashFvbDxe/FlashFvbDxe.inf | 54 + .../Drivers/FlashPei/FlashPei.inf | 52 + .../Drivers/MemInfoDxe/MemInfoDxe.inf | 59 + .../Drivers/MemoryInitPeim/MemoryInitPeim.inf | 64 + .../MmCommunicationDxe/MmCommunication.inf | 57 + .../MmCommunicationPei/MmCommunicationPei.inf | 34 + .../PlatformInfoDxe/PlatformInfoDxe.inf | 52 + .../PlatformPcieDeviceConfigDxe.inf | 59 + .../Drivers/RasConfigDxe/RasConfigDxe.inf | 56 + .../AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf | 43 + .../WatchdogConfigDxe/WatchdogConfigDxe.inf | 50 + .../Library/Ac01PcieLib/Ac01PcieLib.inf | 67 + .../Library/AmpereCpuLib/AmpereCpuLib.inf | 45 + .../AmpereCpuLib/RuntimeAmpereCpuLib.inf | 50 + .../Library/ArmPlatformLib/ArmPlatformLib.inf | 57 + .../Library/DwGpioLib/DwGpioLib.inf | 33 + .../Library/DwI2cLib/DwI2cLib.inf | 38 + .../Library/FlashLib/FlashLib.inf | 36 + .../MailboxInterfaceLib.inf | 37 + .../MemoryInitPeiLib/MemoryInitPeiLib.inf | 63 + .../MmCommunicationLib/MmCommunicationLib.inf | 35 + .../Library/NVParamLib/NVParamLib.inf | 32 + .../PciHostBridgeLib/PciHostBridgeLib.inf | 48 + .../PciSegmentLibPci/PciSegmentLibPci.inf | 28 + .../Library/PlatformPeiLib/PlatformPeiLib.inf | 42 + .../AmpereAltraPkg/Library/RngLib/RngLib.inf | 29 + .../SystemFirmwareInterfaceLib.inf | 30 + .../Library/TrngLib/TrngLib.inf | 29 + .../PlatformUiLib/PlatformManagerUiLib.inf | 47 + .../Drivers/FailSafeDxe/FailSafe.h | 20 + .../Drivers/FailSafeDxe/Watchdog.h | 29 + .../Include/Library/FailSafeLib.h | 62 + .../Drivers/AcpiPlatformDxe/AcpiApei.h | 126 + .../Drivers/AcpiPlatformDxe/AcpiNfit.h | 49 + .../Drivers/AcpiPlatformDxe/AcpiPlatform.h | 75 + .../JadePkg/Library/BoardPcieLib/BoardPcie.h | 45 + .../Library/BoardPcieLib/BoardPcieScreen.h | 114 + .../Library/BoardPcieLib/BoardPcieVfr.h | 99 + .../PCF85063RealTimeClockLib/PCF85063.h | 91 + .../Drivers/AcpiConfigDxe/AcpiConfigDxe.h | 62 + .../Drivers/CpuConfigDxe/CpuConfigDxe.h | 52 + .../CpuConfigDxe/CpuConfigNVDataStruc.h | 19 + .../Drivers/MemInfoDxe/MemInfoScreen.h | 170 + .../MemInfoDxe/MemInfoScreenNVDataStruct.h | 47 + .../MmCommunicationDxe/MmCommunicate.h | 22 + .../Drivers/PlatformInfoDxe/PlatformInfoHii.h | 22 + .../PlatformPcieDeviceConfigDxe.h | 78 + .../PlatformPcieDeviceConfigVfr.h | 56 + .../PlatformPcieHelper.h | 58 + .../Drivers/RasConfigDxe/RasConfigDxe.h | 61 + .../RasConfigDxe/RasConfigNVDataStruct.h | 46 + .../WatchdogConfigDxe/WatchdogConfigDxe.h | 82 + .../WatchdogConfigNVDataStruct.h | 27 + .../AmpereAltraPkg/Include/Ac01PcieCommon.h | 128 + .../Include/AcpiConfigNVDataStruct.h | 28 + .../AmpereAltraPkg/Include/AcpiHeader.h | 37 + .../Include/Guid/AcpiConfigFormSet.h | 19 + .../Include/Guid/CpuConfigHii.h | 19 + .../Include/Guid/PlatformInfoHobGuid.h | 17 + .../Guid/PlatformPcieDeviceConfigHii.h | 19 + .../Include/Guid/WatchdogConfigHii.h | 19 + .../Include/Library/Ac01PcieLib.h | 163 + .../Include/Library/AmpereCpuLib.h | 276 + .../Include/Library/BoardPcieLib.h | 92 + .../AmpereAltraPkg/Include/Library/FlashLib.h | 42 + .../AmpereAltraPkg/Include/Library/GpioLib.h | 76 + .../AmpereAltraPkg/Include/Library/I2cLib.h | 100 + .../Include/Library/MailboxInterfaceLib.h | 172 + .../Include/Library/MmCommunicationLib.h | 19 + .../Include/Library/NVParamLib.h | 133 + .../Library/SystemFirmwareInterfaceLib.h | 282 + .../AmpereAltraPkg/Include/Library/TrngLib.h | 31 + Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h | 79 + .../AmpereAltraPkg/Include/NVParamDef.h | 525 ++ .../AmpereAltraPkg/Include/Platform/Ac01.h | 332 + .../AmpereAltraPkg/Include/PlatformInfoHob.h | 182 + .../Library/Ac01PcieLib/PcieCore.h | 649 ++ .../Library/Ac01PcieLib/PcieCoreCapCfg.h | 63 + .../Library/Ac01PcieLib/PciePatchAcpi.h | 30 + .../ArmPlatformLib/PlatformMemoryMap.h | 135 + .../Include/Guid/PlatformManagerHii.h | 31 + .../Library/PlatformUiLib/PlatformManager.h | 51 + .../PlatformUiLib/PlatformManagerVfr.h | 28 + .../Library/BoardPcieLib/BoardPcieVfr.vfr | 217 + .../Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr | 69 + .../Drivers/CpuConfigDxe/CpuConfigVfr.vfr | 43 + .../Drivers/MemInfoDxe/MemInfoScreenVfr.vfr | 62 + .../PlatformInfoDxe/PlatformInfoVfr.vfr | 112 + .../PlatformPcieDeviceConfigVfr.vfr | 50 + .../Drivers/RasConfigDxe/RasConfigVfr.vfr | 95 + .../WatchdogConfigDxe/WatchdogConfigVfr.vfr | 58 + .../Drivers/FailSafeDxe/FailSafeDxe.c | 184 + .../Drivers/FailSafeDxe/Watchdog.c | 357 ++ .../Library/FailSafeLib/FailSafeLib.c | 313 + .../Drivers/AcpiPlatformDxe/AcpiApei.c | 468 ++ .../Drivers/AcpiPlatformDxe/AcpiDsdt.c | 601 ++ .../Drivers/AcpiPlatformDxe/AcpiMadt.c | 348 + .../Drivers/AcpiPlatformDxe/AcpiNfit.c | 596 ++ .../Drivers/AcpiPlatformDxe/AcpiPcct.c | 413 ++ .../Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c | 178 + .../Drivers/AcpiPlatformDxe/AcpiPptt.c | 333 + .../Drivers/AcpiPlatformDxe/AcpiSlit.c | 187 + .../Drivers/AcpiPlatformDxe/AcpiSrat.c | 271 + .../Drivers/PciPlatformDxe/PciPlatformDxe.c | 212 + .../SmbiosMemInfoDxe/SmbiosMemInfoDxe.c | 705 +++ .../SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1049 +++ .../JadePkg/Library/BoardPcieLib/BoardPcie.c | 436 ++ .../Library/BoardPcieLib/BoardPcieCommon.c | 329 + .../Library/BoardPcieLib/BoardPcieScreen.c | 1244 ++++ .../JadePkg/Library/OemMiscLib/OemMiscLib.c | 323 + .../PCF85063RealTimeClockLib/PCF85063.c | 317 + .../PCF85063RealTimeClockLib.c | 257 + .../Drivers/ATFHobPei/ATFHobPeim.c | 52 + .../Drivers/AcpiConfigDxe/AcpiConfigDxe.c | 729 +++ .../BootProgressDxe/BootProgressDxe.c | 211 + .../BootProgressPeim/BootProgressPeim.c | 210 + .../Drivers/CpuConfigDxe/CpuConfigDxe.c | 530 ++ .../Drivers/DebugInfoPei/DebugInfoPei.c | 210 + .../Drivers/FlashFvbDxe/FlashFvbDxe.c | 525 ++ .../Drivers/FlashPei/FlashPei.c | 273 + .../Drivers/MemInfoDxe/MemInfoNvramLib.c | 394 ++ .../Drivers/MemInfoDxe/MemInfoScreen.c | 1325 ++++ .../Drivers/MemoryInitPeim/MemoryInitPeim.c | 151 + .../MmCommunicationDxe/MmCommunication.c | 454 ++ .../MmCommunicationPei/MmCommunicationPei.c | 37 + .../Drivers/PlatformInfoDxe/PlatformInfoDxe.c | 391 ++ .../PlatformPcieDeviceConfigDxe.c | 1045 +++ .../PlatformPcieHelper.c | 191 + .../Drivers/RasConfigDxe/RasConfigDxe.c | 822 +++ .../AmpereAltraPkg/Drivers/RngDxe/RngDxe.c | 164 + .../WatchdogConfigDxe/WatchdogConfigDxe.c | 460 ++ .../Library/Ac01PcieLib/PcieCore.c | 1659 +++++ .../Library/Ac01PcieLib/PcieCoreLib.c | 556 ++ .../Library/Ac01PcieLib/PciePatchAcpi.c | 646 ++ .../Library/AmpereCpuLib/AmpereCpuLib.c | 43 + .../Library/AmpereCpuLib/AmpereCpuLibCommon.c | 637 ++ .../AmpereCpuLib/RuntimeAmpereCpuLib.c | 138 + .../Library/ArmPlatformLib/ArmPlatformLib.c | 169 + .../ArmPlatformLib/ArmPlatformLibMemory.c | 257 + .../Library/DwGpioLib/DwGpioLib.c | 314 + .../Library/DwI2cLib/DwI2cLib.c | 883 +++ .../Library/FlashLib/FlashLib.c | 358 ++ .../MailboxInterfaceLib/MailboxInterfaceLib.c | 281 + .../MemoryInitPeiLib/MemoryInitPeiLib.c | 93 + .../MmCommunicationLib/MmCommunicationLib.c | 184 + .../Library/NVParamLib/NVParamLib.c | 202 + .../PciHostBridgeLib/PciHostBridgeLib.c | 378 ++ .../Library/PciSegmentLibPci/PciSegmentLib.c | 1189 ++++ .../Library/PlatformPeiLib/PlatformPeiLib.c | 40 + .../AmpereAltraPkg/Library/RngLib/RngLib.c | 141 + .../SystemFirmwareInterfaceLib.c | 328 + .../AmpereAltraPkg/Library/TrngLib/TrngLib.c | 63 + .../Library/PlatformUiLib/PlatformManager.c | 354 ++ .../Ampere/AmperePlatformPkg/FvRules.fdf.inc | 176 + Platform/Ampere/JadePkg/AcpiTables/CPU-S0.asi | 5639 +++++++++++++++++ Platform/Ampere/JadePkg/AcpiTables/CPU-S1.asi | 5639 +++++++++++++++++ Platform/Ampere/JadePkg/AcpiTables/CPU.asi | 127 + Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl | 531 ++ .../Ampere/JadePkg/AcpiTables/PCI-PDRC.asi | 217 + .../JadePkg/AcpiTables/PCI-S0.Rca01.asi | 681 ++ Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi | 2078 ++++++ Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi | 2087 ++++++ Platform/Ampere/JadePkg/AcpiTables/PMU-S0.asi | 1303 ++++ Platform/Ampere/JadePkg/AcpiTables/PMU-S1.asi | 1303 ++++ Platform/Ampere/JadePkg/AcpiTables/PMU.asi | 10 + Platform/Ampere/JadePkg/JadeBoardSetting.cfg | 224 + .../Library/BoardPcieLib/BoardPcieScreen.uni | 102 + .../AmpereAltraPkg/AcpiCommonTables/Bert.aslc | 33 + .../AmpereAltraPkg/AcpiCommonTables/Dbg2.aslc | 87 + .../AmpereAltraPkg/AcpiCommonTables/Einj.asl | 165 + .../AmpereAltraPkg/AcpiCommonTables/Fadt.aslc | 87 + .../AmpereAltraPkg/AcpiCommonTables/Gtdt.aslc | 180 + .../AmpereAltraPkg/AcpiCommonTables/Hest.asl | 330 + .../AmpereAltraPkg/AcpiCommonTables/Sdei.asl | 17 + .../AmpereAltraPkg/AcpiCommonTables/Spcr.aslc | 81 + .../AmpereAltraPkg/AcpiCommonTables/Ssdt.asl | 15 + .../AcpiConfigDxe/AcpiConfigStrings.uni | 27 + .../BootProgressDxe/BootProgressDxe.uni | 16 + .../BootProgressPeim/BootProgressPeim.uni | 18 + .../Drivers/CpuConfigDxe/CpuConfigStrings.uni | 17 + .../Drivers/MemInfoDxe/MemInfoDxe.uni | 9 + .../Drivers/MemInfoDxe/MemInfoDxeExtra.uni | 9 + .../MemInfoDxe/MemInfoScreenStrings.uni | 64 + .../PlatformInfoDxe/PlatformInfoStrings.uni | 56 + .../PlatformPcieDeviceConfigDxe.uni | 24 + .../Drivers/RasConfigDxe/RasConfigStrings.uni | 38 + .../AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni | 10 + .../Drivers/RngDxe/RngDxeExtra.uni | 9 + .../WatchdogConfigStrings.uni | 26 + .../ArmPlatformLib/ArmPlatformHelper.S | 45 + .../AmpereAltraPkg/Library/RngLib/RngLib.uni | 13 + .../PlatformUiLib/PlatformManagerStrings.uni | 21 + .../PlatformUiLib/PlatformManagerUiLib.uni | 13 + .../PlatformUiLib/PlatformManagerVfr.Vfr | 29 + 217 files changed, 57398 insertions(+) create mode 100644 Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec create mode 100644 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec create mode 100644 Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec create mode 100644 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc create mode 100644 Platform/Ampere/JadePkg/Jade.dsc create mode 100644 Platform/Ampere/JadePkg/Jade.fdf create mode 100644 Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf create mode 100644 Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.inf create mode 100644 Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf create mode 100644 Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf create mode 100644 Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf create mode 100644 Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootProgressDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootProgressPeim.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDxe.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLibPci.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.inf create mode 100644 Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h create mode 100644 Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h create mode 100644 Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.h create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.h create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.h create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.h create mode 100644 Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigNVDataStruc.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenNVDataStruct.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicate.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigVfr.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieHelper.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigNVDataStruct.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDxe.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigNVDataStruct.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Ac01PcieCommon.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/AcpiHeader.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Guid/CpuConfigHii.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHobGuid.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformPcieDeviceConfigHii.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Guid/WatchdogConfigHii.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreCapCfg.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMap.h create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.h create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.h create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.vfr create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigVfr.vfr create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenVfr.vfr create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr.vfr create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigVfr.vfr create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigVfr.vfr create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigVfr.vfr create mode 100644 Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.c create mode 100644 Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c create mode 100644 Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMadt.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPcct.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPptt.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSlit.c create mode 100644 Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c create mode 100644 Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.c create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.c create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieCommon.c create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.c create mode 100644 Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c create mode 100644 Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c create mode 100644 Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootProgressDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootProgressPeim.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoNvramLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPei.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieHelper.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDxe.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMemory.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.c create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.c create mode 100644 Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc create mode 100644 Platform/Ampere/JadePkg/AcpiTables/CPU-S0.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/CPU-S1.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/CPU.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl create mode 100644 Platform/Ampere/JadePkg/AcpiTables/PCI-PDRC.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/PCI-S0.Rca01.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/PMU-S0.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/PMU-S1.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/PMU.asi create mode 100644 Platform/Ampere/JadePkg/JadeBoardSetting.cfg create mode 100644 Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Bert.aslc create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Dbg2.aslc create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Einj.asl create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Fadt.aslc create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Gtdt.aslc create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Hest.asl create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Sdei.asl create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Spcr.aslc create mode 100644 Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Ssdt.asl create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootProgressDxe.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootProgressPeim.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigStrings.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxeExtra.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenStrings.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigStrings.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigStrings.uni create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelper.S create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerStrings.uni create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib.uni create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.Vfr -- 2.17.1
|
|
Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/AcpiTables: Update structures for ACPI 6.3
Michael Kubacki
Well that's a large number of conflicts.
toggle quoted messageShow quoted text
I find it unprofessional that I have been waiting over a month for a MinPlatformPkg maintainer to review and merge my patch while the patches that were merged and cause conflicts were not reviewed by or merged by a MinPlatformPkg maintainer: https://github.com/tianocore/edk2-platforms/commit/f4e12862f7e5b190fc5cd3828999573995db2b4e https://github.com/tianocore/edk2-platforms/commit/353f3ed966abc267c4e77b46a3b5ab82a0a86488 Delays are one thing but the process should be followed consistently. I'll send a rebased patch soon. Thanks, Michael
On 9/14/2021 10:08 PM, Desimone, Nathaniel L wrote:
Hi Michael,
|
|
Re: [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
Bassa, Damian <damian.bassa@...>
Should we consider this workaround? I’m having issues interpreting this part of PCIe spec. My understanding of this quote is that this capability can exist in but it shouldn’t be considered. I would assume it’s possible option that it needs to be considered? Is that wrong?
Damian
From: Wu, Hao A <hao.a.wu@...>
Sent: Wednesday, September 8, 2021 9:17 AM To: Bassa, Damian <damian.bassa@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...> Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
Really sorry for the late response.
So this is a workaround for RCiEP device that is not compliant to the PCIe spec: |> ARI is an optional capability. This capability must be implemented by each |> Function in an ARI Device. It is not applicable to a Root Port, a Switch |> Downstream Port, an RCiEP, or a Root Complex Event Collector.
If this the case, could you help to: * Add a comment that briefly describe this workaround before the newly added code * Also mention this workaround information in the commit log message. * Send out a V2 version of the patch? Thanks in advance.
Hello Ray, please help to raise if you have concern on this.
Best Regards, Hao Wu
From: Bassa, Damian <damian.bassa@...>
It refers to access to the root port device that doesn’t exist in case we are dealing with RCiEP device. There can be specific case where RCiEP device has ARI extended capability ID (even though it’s unsupported in this case). In such a case PciSearchDevice goes to CreatePciIoDevice through GatherDeviceInfo. And in this case parent is PCI_IO_DEVICE instance created from CreateRootBridge function, which isn’t valid PCIe device and doesn’t have specific bus, only a range of buses. In that case enumerator tries to use this instance to read operation using default 0 bus number, which isn’t correct.
Damian
From: Wu, Hao A <hao.a.wu@...>
From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of Wu, Hao A
Really sorry,
Could you help to provide more information on the below statement? “undefined parent register accesses”
Thanks in advance.
Best Regards, Hao Wu
From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of Bassa, Damian
Before trying to access parent root port to check ARI capabilities, enumerator should see if Endpoint device is not Root Complex integrated to avoid undefined parent register accesses in these cases.
Signed-off-by: Damian Bassa damian.bassa@...
--- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index db1b35f8ef..6451fb8af9 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -2153,6 +2153,7 @@ CreatePciIoDevice ( PCI_IO_DEVICE *PciIoDevice; EFI_PCI_IO_PROTOCOL *PciIo; EFI_STATUS Status; + PCI_REG_PCIE_CAPABILITY Capability;
PciIoDevice = AllocateZeroPool (sizeof (PCI_IO_DEVICE)); if (PciIoDevice == NULL) { @@ -2229,7 +2230,16 @@ CreatePciIoDevice ( return NULL; }
- if (PcdGetBool (PcdAriSupport)) { + PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + PciIoDevice->PciExpressCapabilityOffset + OFFSET_OF (PCI_CAPABILITY_PCIEXP, Capability), + 1, + &Capability.Uint16 + ); + + if (PcdGetBool (PcdAriSupport) && + Capability.Bits.DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT) { // // Check if the device is an ARI device. // -- 2.27.0.windows.1
Intel Technology Poland sp. z o.o. Ta wiadomość wraz z załącznikami jest przeznaczona dla określonego adresata i może zawierać informacje poufne. W razie przypadkowego otrzymania
tej wiadomości, prosimy o powiadomienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przeglądanie lub rozpowszechnianie jest zabronione.
Intel Technology Poland sp. z o.o. ul. Słowackiego 173 | 80-298 Gdańsk | Sąd Rejonowy Gdańsk Północ | VII Wydział Gospodarczy Krajowego Rejestru Sądowego - KRS 101882 | NIP 957-07-52-316 | Kapitał zakładowy 200.000 PLN.
Ta wiadomość wraz z załącznikami jest przeznaczona dla określonego adresata i może zawierać informacje poufne. W razie przypadkowego otrzymania tej wiadomości, prosimy o powiadomienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przeglądanie lub rozpowszechnianie jest zabronione.
|
|
[PATCH 1/1] ArmPkg/ProcessorSubClassDxe: Fix the format of ProcessorId
Nhi Pham
According to SMBIOS 3.4, section 7.5.3.3 ARM64-class CPUs, if
SMCCC_ARCH_SOC_ID is supported, the first DWORD is the JEP-106 code and the second DWORD is the SoC revision value. But in the current implementation, they are set in reverse. This patch is to correct it. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Rebecca Cran <rebecca@nuviainc.com> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> --- ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c index 292f10bf97eb..d644cd33d249 100644 --- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c +++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c @@ -2,6 +2,7 @@ Functions for processor information common to ARM and AARCH64. Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR> + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -171,7 +172,7 @@ SmbiosGetProcessorId ( if (HasSmcArm64SocId ()) { SmbiosGetSmcArm64SocId (&Jep106Code, &SocRevision); - ProcessorId = ((UINT64)Jep106Code << 32) | SocRevision; + ProcessorId = ((UINT64)SocRevision << 32) | Jep106Code; } else { ProcessorId = ArmReadMidr (); } -- 2.17.1
|
|
Re: [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
Ni, Ray
Extending PciBus to support such case is valid.
But can you check if there is other pure software way to detect whether it’s an ECiEP?
From: Bassa, Damian <damian.bassa@...>
Sent: Wednesday, September 15, 2021 7:54 PM To: Wu, Hao A <hao.a.wu@...>; devel@edk2.groups.io; Ni, Ray <ray.ni@...> Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/PciBusDxe: Enumerator to check for RCiEP before looking for RP
Should we consider this workaround? I’m having issues interpreting this part of PCIe spec. My understanding of this quote is that this capability can exist in but it shouldn’t be considered. I would assume it’s possible option that it needs to be considered? Is that wrong?
Damian
From: Wu, Hao A <hao.a.wu@...>
Really sorry for the late response.
So this is a workaround for RCiEP device that is not compliant to the PCIe spec: |> ARI is an optional capability. This capability must be implemented by each |> Function in an ARI Device. It is not applicable to a Root Port, a Switch |> Downstream Port, an RCiEP, or a Root Complex Event Collector.
If this the case, could you help to: * Add a comment that briefly describe this workaround before the newly added code * Also mention this workaround information in the commit log message. * Send out a V2 version of the patch? Thanks in advance.
Hello Ray, please help to raise if you have concern on this.
Best Regards, Hao Wu
From: Bassa, Damian <damian.bassa@...>
It refers to access to the root port device that doesn’t exist in case we are dealing with RCiEP device. There can be specific case where RCiEP device has ARI extended capability ID (even though it’s unsupported in this case). In such a case PciSearchDevice goes to CreatePciIoDevice through GatherDeviceInfo. And in this case parent is PCI_IO_DEVICE instance created from CreateRootBridge function, which isn’t valid PCIe device and doesn’t have specific bus, only a range of buses. In that case enumerator tries to use this instance to read operation using default 0 bus number, which isn’t correct.
Damian
From: Wu, Hao A <hao.a.wu@...>
From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of Wu, Hao A
Really sorry,
Could you help to provide more information on the below statement? “undefined parent register accesses”
Thanks in advance.
Best Regards, Hao Wu
From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of Bassa, Damian
Before trying to access parent root port to check ARI capabilities, enumerator should see if Endpoint device is not Root Complex integrated to avoid undefined parent register accesses in these cases.
Signed-off-by: Damian Bassa damian.bassa@...
--- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index db1b35f8ef..6451fb8af9 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -2153,6 +2153,7 @@ CreatePciIoDevice ( PCI_IO_DEVICE *PciIoDevice; EFI_PCI_IO_PROTOCOL *PciIo; EFI_STATUS Status; + PCI_REG_PCIE_CAPABILITY Capability;
PciIoDevice = AllocateZeroPool (sizeof (PCI_IO_DEVICE)); if (PciIoDevice == NULL) { @@ -2229,7 +2230,16 @@ CreatePciIoDevice ( return NULL; }
- if (PcdGetBool (PcdAriSupport)) { + PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + PciIoDevice->PciExpressCapabilityOffset + OFFSET_OF (PCI_CAPABILITY_PCIEXP, Capability), + 1, + &Capability.Uint16 + ); + + if (PcdGetBool (PcdAriSupport) && + Capability.Bits.DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT) { // // Check if the device is an ARI device. // -- 2.27.0.windows.1
Intel Technology Poland sp. z o.o. Ta wiadomość wraz z załącznikami jest przeznaczona dla określonego adresata i może zawierać informacje poufne. W razie przypadkowego otrzymania
tej wiadomości, prosimy o powiadomienie nadawcy oraz trwałe jej usunięcie; jakiekolwiek przeglądanie lub rozpowszechnianie jest zabronione.
|
|
Re: [PATCH] OvmfPkg/BhyvePkg: add WorkAreaHeader PCD
Yao, Jiewen
Hi
toggle quoted messageShow quoted text
To avoid unnecessary change in DSC/FDF, can we change default size to be 4 in DEC? gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader|4|UINT32|0x51 We shall also add comment on 4 == sizeof(CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER) in OvmfPkg/Include/WorkArea.h. Thank you Yao Jiewen
-----Original Message-----
|
|
回复: [PATCH] [edk2-devel] RecordAssertion function parameter issue.
Gao Jie
Reviewed-by: Barton Gao <gaojie@byosoft.com.cn>
Thanks Barton -----邮件原件----- 发件人: bounce+27952+68636+5325328+9289841@groups.io <bounce+27952+68636+5325328+9289841@groups.io> 代表 Chen, ArvinX 发送时间: 2020年12月10日 16:01 收件人: devel@edk2.groups.io 抄送: G Edhaya Chandran <Edhaya.Chandran@arm.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; Eric Jin <eric.jin@intel.com>; Heinrich Schuchardt <xypron.glpk@gmx.de> 主题: [PATCH] [edk2-devel] RecordAssertion function parameter issue. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3082 Correct "RecordAssertion" argument issue to make SCT tool more stable. Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com> Cc: Eric Jin <eric.jin@intel.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: ArvinX Chen <arvinx.chen@intel.com> --- .../ProtocolHandlerBBTestFunction_3.c | 8 +++----- .../EfiCompliantBBTestPlatform_uefi.c | 2 +- .../AcpiTableProtocolBBTestFunction.c | 2 +- .../BlackBoxTest/BlockIo2BBTestFunction.c | 3 ++- .../BlackBoxTest/ComponentName2BBTestFunction.c | 6 +++--- .../DevicePathFromTextBBTestCoverage.c | 5 +++-- .../DevicePathUtilitiesBBTestConformance.c | 15 ++++++++++----- .../DriverDiagnostics2BBTestFunction.c | 4 ++-- .../BlackBoxTest/EraseBlockBBTestConformance.c | 8 ++++---- .../BlackBoxTest/GraphicsOutputBBTestFunction.c | 8 +++++--- .../BlackBoxTest/HIIFontBBTestConformance.c | 3 +-- .../BlackBoxTest/HIIImageBBTestConformance.c | 4 ++-- .../BlackBoxTest/HIIStringBBTestConformance.c | 3 +-- .../BlackBoxTest/IPsecConfigBBTestConformance.c | 8 ++++---- .../PciIo/BlackBoxTest/PciIoBBTestFunction_1.c | 5 +++-- .../BlackBoxTest/PxeBaseCodeBBTestFunction.c | 2 +- .../BlackBoxTest/SimpleFileSystemBBTestFunction.c | 2 +- .../SimpleFileSystemExBBTestFunction_OpenEx.c | 10 +++++----- .../BlackBoxTest/SimpleNetworkBBTestConformance.c | 2 +- .../UFSDeviceConfigBBTestConformance.c | 6 +++--- .../VariableServicesBBTestConformance.c | 6 ++++-- .../BlackBoxTest/BlockIo2BBTestFunction.c | 3 ++- .../BlackBoxTest/ComponentName2BBTestFunction.c | 6 +++--- .../DriverDiagnostics2BBTestFunction.c | 4 ++-- .../BlackBoxTest/GraphicsOutputBBTestFunction.c | 8 +++++--- .../BlackBoxTest/PxeBaseCodeBBTestFunction.c | 2 +- .../BlackBoxTest/SimpleFileSystemBBTestFunction.c | 2 +- .../SimpleFileSystemExBBTestFunction_OpenEx.c | 10 +++++----- .../BlackBoxTest/SimpleNetworkBBTestConformance.c | 2 +- 29 files changed, 80 insertions(+), 69 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/Bla ckBoxTest/ProtocolHandlerBBTestFunction_3.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/Bla ckBoxTest/ProtocolHandlerBBTestFunction_3.c index 8ad31f7f..94288b23 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/Bla ckBoxTest/ProtocolHandlerBBTestFunction_3.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ProtocolHandlerServices/Bla ckBoxTest/ProtocolHandlerBBTestFunction_3.c @@ -11672,7 +11672,6 @@ BBTestOpenProtocolInformationInterfaceTestCheckPoint1 ( L"%a:%d:TPL - %d", __FILE__, (UINTN)__LINE__, - EntryCount, TplArray[Index] ); // @@ -11825,7 +11824,6 @@ BBTestOpenProtocolInformationInterfaceTestCheckPoint1 ( L"%a:%d:TPL - %d", __FILE__, (UINTN)__LINE__, - EntryCount, TplArray[Index] ); // @@ -15398,11 +15396,11 @@ BBTestConnectControllerInterfaceTestCheckPoint14 ( EFI_TEST_ASSERTION_FAILED, gTestGenericFailureGuid, L"GetPlatformOverrideDriverImages - build environment", - L"%a:%d:Status - %r, NoHandles - %d", + L"%a:%d:Status - %r", __FILE__, (UINTN)__LINE__, Status - ); + ); goto Done; } @@ -15699,7 +15697,7 @@ BBTestConnectControllerInterfaceTestCheckPoint15 ( EFI_TEST_ASSERTION_FAILED, gTestGenericFailureGuid, L"GetPlatformOverrideDriverImages - build environment", - L"%a:%d:Status - %r, NoHandles - %d", + L"%a:%d:Status - %r", __FILE__, (UINTN)__LINE__, Status diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCom pliantBBTestPlatform_uefi.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCom pliantBBTestPlatform_uefi.c index 052f45b7..ffb8d8ea 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCom pliantBBTestPlatform_uefi.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCom pliantBBTestPlatform_uefi.c @@ -1017,7 +1017,7 @@ CheckConsoleProtocols ( AssertionType, gEfiCompliantBbTestPlatformAssertionGuid001, L"UEFI Compliant - Console protocols must be implemented", - L"%a:%d:Text Input - %s, Text Output - %s, Text InputEx", + L"%a:%d:Text Input - %s, Text Output - %s, Text InputEx - %s", __FILE__, (UINTN)__LINE__, ValueA ? L"Yes" : L"No", diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ACPITable/BlackBoxTest/AcpiTabl eProtocolBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ACPITable/BlackBoxTest/AcpiTabl eProtocolBBTestFunction.c index e1f5ccee..51ce391d 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ACPITable/BlackBoxTest/AcpiTabl eProtocolBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ACPITable/BlackBoxTest/AcpiTabl eProtocolBBTestFunction.c @@ -303,7 +303,7 @@ BBTestInstallAcpiTableFunctionTestCheckpoint1 ( __FILE__, (UINTN)__LINE__, Status - ); + ); if (EFI_SUCCESS == Status) { Status = AcpiTable->UninstallAcpiTable ( diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c index 8ccbfaf2..551f4671 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c @@ -4686,7 +4686,8 @@ BBTestFushBlocksExFunctionAutoTestCheckpoint1( __FILE__, (UINTN)__LINE__, 4, - EFI_SUCCESS + EFI_SUCCESS, + BlockIo2TokenBuffer[IndexI].TransactionStatus ); Status = gtBS->SetTimer (TimerEvent, TimerCancel, 0); diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c index 9d5d9ffc..3b653498 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c @@ -766,10 +766,10 @@ BBTestGetControllerNameFuncTestCheckpoint2 ( AssertionType, gComponentName2BBTestFunctionAssertionGuid003, L"Please Use Native RFC3066 which is preferable in UEFI 2.X\nCOMPONENT_NAME2_PROTOCOL.GetControllerName - GetControllerName() returns EFI_SUCCESS support language", - L"%a:%d: Language - %c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", - __FILE__, + L"%a:%d: Language - %c%c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", + __FILE__, (UINTN)__LINE__, - Lang, + Lang[0],Lang[1],Lang[2],Lang[3], Index, ChildIndex, (ControllerName == NULL) ? L"(NULL)" : ControllerName, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest /DevicePathFromTextBBTestCoverage.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest /DevicePathFromTextBBTestCoverage.c index 5058dc4a..9a7b908a 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest /DevicePathFromTextBBTestCoverage.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest /DevicePathFromTextBBTestCoverage.c @@ -2233,7 +2233,8 @@ DevicePathFromTextConvertTextToDeviceNodeCoverageTest ( L"EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL - ConvertDeviceNodeToText must correctly recover the converting ConvertTextToDeviceNode has acted on the device node string", L"%a:%d, Convert MemoryMapped(%d,0x123456789ABCDEF,0xFEDCBA9876543210)", __FILE__, - (UINTN)__LINE__ + (UINTN)__LINE__, + EfiMaxMemoryType ); // @@ -3414,7 +3415,7 @@ DevicePathFromTextConvertTextToDeviceNodeCoverageTest ( L"%a:%d, Convert SD(0)", __FILE__, (UINTN)__LINE__ - ); + ); // // Bluetooth(001320F5FA77) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathUtilities/BlackBoxTes t/DevicePathUtilitiesBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathUtilities/BlackBoxTes t/DevicePathUtilitiesBBTestConformance.c index d8d237a6..32122a78 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathUtilities/BlackBoxTes t/DevicePathUtilitiesBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathUtilities/BlackBoxTes t/DevicePathUtilitiesBBTestConformance.c @@ -90,7 +90,8 @@ DevicePathUtilitiesCreateDeviceNodeConformanceTest ( L"EFI_DEVICE_PATH_UTILITIES_PROTOCOL - CreatDeviceNode should not succeed with invalid NodeLength set", L"%a:%d:Status - %r", __FILE__, - (UINTN)__LINE__ + (UINTN)__LINE__, + Status ); return EFI_SUCCESS; @@ -284,7 +285,8 @@ DevicePathUtilitiesAppendDevicePathConformanceTest ( L"EFI_DEVICE_PATH_UTILITIES_PROTOCOL - SctAppendDevicePath should ignore Src1 when it is set NULL", L"%a:%d:Status - %r", __FILE__, - (UINTN)__LINE__ + (UINTN)__LINE__, + Status ); // @@ -326,7 +328,8 @@ DevicePathUtilitiesAppendDevicePathConformanceTest ( L"EFI_DEVICE_PATH_UTILITIES_PROTOCOL - SctAppendDevicePath should ignore Src2 when it is set NULL", L"%a:%d:Status - %r", __FILE__, - (UINTN)__LINE__ + (UINTN)__LINE__, + Status ); pDevicePath1 = DevicePathUtilities->AppendDevicePath (NULL, NULL); @@ -417,7 +420,8 @@ DevicePathUtilitiesAppendDevicePathInstanceConformanceTest ( L"EFI_DEVICE_PATH_UTILITIES_PROTOCOL - AppendDevicePathInstance should not succeed with DevicePathInstance set to be NULL", L"%a:%d:Status - %r", __FILE__, - (UINTN)__LINE__ + (UINTN)__LINE__, + Status ); return EFI_SUCCESS; @@ -473,7 +477,8 @@ DevicePathUtilitiesGetNextDevicePathInstanceConformanceTest ( L"EFI_DEVICE_PATH_UTILITIES_PROTOCOL - GetNextDevicePathInstance should not succeed with DevicePathInstance set to be NULL", L"%a:%d:Status - %r", __FILE__, - (UINTN)__LINE__ + (UINTN)__LINE__, + Status ); return EFI_SUCCESS; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c index 94c0d85f..80b24b2c 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c @@ -685,10 +685,10 @@ BBTestRunDiagnosticsFuncTestCheckpoint2 ( AssertionType, gFunctionAssertionGuid002, L"Please Use Native RFC3066 which is preferable in UEFI 2.X\nEFI_DRIVER_DIAGNOSTICS2_PROTOCOL.RunDiagnostics - RunDiagnostics() returns EFI_SUCCESS with supported language", - L"%a:%d: Language - %c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", + L"%a:%d: Language - %c%c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", __FILE__, (UINTN)__LINE__, - Lang, + Lang[0],Lang[1],Lang[2],Lang[3], Index, ChildIndex, (ControllerName == NULL) ? L"(NULL)" : ControllerName, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl ockBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl ockBBTestConformance.c index a6156b98..c49db682 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl ockBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBl ockBBTestConformance.c @@ -193,7 +193,7 @@ BBTestEraseBlocksConformanceTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); } else { Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1, 0, &Token, EraseSize); @@ -211,7 +211,7 @@ BBTestEraseBlocksConformanceTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1, LastBlock + 1, &Token, EraseSize); if (Status == EFI_MEDIA_CHANGED) @@ -228,7 +228,7 @@ BBTestEraseBlocksConformanceTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); Status = EraseBlock->EraseBlocks(EraseBlock, MediaId + 1, LastBlock - 10, &Token, EraseSize + 1); if (Status == EFI_MEDIA_CHANGED) @@ -245,7 +245,7 @@ BBTestEraseBlocksConformanceTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); Status = EraseBlock->EraseBlocks(EraseBlock, MediaId, LastBlock + 1, &Token, EraseSize); if (Status == EFI_INVALID_PARAMETER) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c index f1936755..edde3117 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c @@ -172,7 +172,7 @@ Returns: AssertionType, gEfiGraphicsOutputQueryModeBBTestFunctionAssertionGuid, L"EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode - SetMode() then QueryMode(), compare Info structure", - L"%a:%d: Status", + L"%a:%d: Status - %r", (UINTN) __FILE__, (UINTN) (UINTN)__LINE__, Status @@ -753,7 +753,8 @@ Returns: L"%a:%d:Status:%r, Expected:%r", (UINTN) __FILE__, (UINTN) (UINTN)__LINE__, - (UINTN) Status + (UINTN) Status, + EFI_SUCCESS ); return Status; } @@ -1474,7 +1475,8 @@ Returns: L"%a:%d:Status:%r, Expected:%r", (UINTN) __FILE__, (UINTN) (UINTN)__LINE__, - (UINTN) Status + (UINTN) Status, + EFI_SUCCESS ); continue; } diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIFont/BlackBoxTest/HIIFontBBT estConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIFont/BlackBoxTest/HIIFontBBT estConformance.c index 911c4a5c..e437f002 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIFont/BlackBoxTest/HIIFontBBT estConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIFont/BlackBoxTest/HIIFontBBT estConformance.c @@ -602,8 +602,7 @@ BBTestStringIdToImageConformanceTestCheckpoint1 ( __FILE__, (UINTN)__LINE__, Status - ); - + ); // // Call StringIdToImage with StringId not in PackageList, EFI_NOT_FOUND should be returned. // diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIImage/BlackBoxTest/HIIImageB BTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIImage/BlackBoxTest/HIIImageB BTestConformance.c index 20b24bc5..7b738c69 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIImage/BlackBoxTest/HIIImageB BTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIImage/BlackBoxTest/HIIImageB BTestConformance.c @@ -2333,7 +2333,7 @@ BBTestDrawImageIdConformanceTestCheckpoint1( __FILE__, (UINTN)__LINE__, Status - ); + ); // // Call DrawImageId with PackageList been NULL @@ -2362,7 +2362,7 @@ BBTestDrawImageIdConformanceTestCheckpoint1( __FILE__, (UINTN)__LINE__, Status - ); + ); // // Call DrawImageId with invalid ImageId diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIString/BlackBoxTest/HIIStrin gBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIString/BlackBoxTest/HIIStrin gBBTestConformance.c index ca9ed0b7..07ff28e1 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIString/BlackBoxTest/HIIStrin gBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIString/BlackBoxTest/HIIStrin gBBTestConformance.c @@ -607,8 +607,7 @@ BBTestGetStringConformanceTestCheckpoint1 ( __FILE__, (UINTN)__LINE__, Status - ); - + ); // // Remove the PackageList from the HII database // diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/IPsecConfig/BlackBoxTest/IPsecC onfigBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/IPsecConfig/BlackBoxTest/IPsecC onfigBBTestConformance.c index cac04b66..da910ff2 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/IPsecConfig/BlackBoxTest/IPsecC onfigBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/IPsecConfig/BlackBoxTest/IPsecC onfigBBTestConformance.c @@ -693,7 +693,7 @@ BBTestGetDataConformanceTestCheckpoint3 ( __FILE__, (UINTN)__LINE__, Status - ); + ); // // Clean Environment: Call IPsec->SetData with the same DataType(0)/Selector. @@ -902,7 +902,7 @@ BBTestGetDataConformanceTestCheckpoint4 ( __FILE__, (UINTN)__LINE__, Status - ); + ); // // Clean Environment: Call IPsec->SetData with the same DataType(1)/Selector. @@ -1066,7 +1066,7 @@ BBTestGetDataConformanceTestCheckpoint4 ( __FILE__, (UINTN)__LINE__, Status - ); + ); // // Clean Environment: Call IPsec->SetData with the same DataType(1)/Selector. @@ -1244,7 +1244,7 @@ BBTestGetDataConformanceTestCheckpoint5 ( __FILE__, (UINTN)__LINE__, Status - ); + ); // // Clean Environment: Call IPsec->SetData with the same DataType(2)/Selector. diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestF unction_1.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestF unction_1.c index d65ece24..457a9108 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestF unction_1.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PciIo/BlackBoxTest/PciIoBBTestF unction_1.c @@ -4480,7 +4480,7 @@ IoWrite_Func ( // //then read out the data in destination address range. // - PciIo->Io.Read ( + Status = PciIo->Io.Read ( PciIo, PciIoWidth, BarIndex, @@ -4508,7 +4508,8 @@ IoWrite_Func ( L"EFI_PCI_IO_PROTOCOL.Io.Write - the data read must equal with the data written", L"%a:%d:Status - %r", __FILE__, - (UINTN)__LINE__ + (UINTN)__LINE__, + Status ); // //write the data using EfiPciIoWidthFifoUintX. diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c index c1ea0d49..1f2f5305 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c @@ -1252,7 +1252,7 @@ BBTestNewStopFunctionTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); } // diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c index ed0d8743..f269b7be 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c @@ -1608,7 +1608,7 @@ BBTestReadOnlyTestCheckPoints ( AssertionType, gReadOnlyFileSystemBBTestAssertionGuid005, L"ReadOnly System: Dir SetInfo should return EFI_WRITE_PROTECTED", - L"%a:%d: Status - %r", + L"%a:%d: Status1 - %r Status2 - %r", __FILE__, (UINTN)__LINE__, Status1, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c index ab791f34..526ad906 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c @@ -1155,7 +1155,7 @@ BBTestOpenExBasicTestCheckpoint1_Test1_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid027, L"OpenEx() Basic Test - checkpoint1 ----Test1----Async", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d, Status - %r, File Name - %s", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -2152,7 +2152,7 @@ BBTestOpenExBasicTestCheckpoint1_Test3_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid039, L"OpenEx() Basic Test - checkpoint1 ---Async", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d,Status - %r,FileName - %s", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -2656,7 +2656,7 @@ BBTestOpenExBasicTestCheckpoint1_Test4_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid043, L"OpenEx() Basic Test - checkpoint1 ---Async -- Test4----Open File", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d,Status - %r,FileName - %s", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -3302,7 +3302,7 @@ BBTestOpenExBasicTestCheckpoint1_Test5_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid047, L"OpenEx() Basic Test - checkpoint1 ---Async -- Test5---Open File", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d,Status - %r,FileName - %s", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -10216,7 +10216,7 @@ BBTestOpenExBasicTestCheckpoint2_Test5_Sync ( FileIoEntity->StatusAsync, FileIoEntity->OpenMode, FileIoEntity->Name - ); + ); if (FileIoEntity->OpenMode == EFI_FILE_MODE_READ){ DirHandle2->Open ( DirHandle2, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c index 09b47ee6..1b4a0d34 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c @@ -1945,7 +1945,7 @@ BBTestTransmitConformanceTest ( __FILE__, (UINTN)__LINE__, StatusBuf[1] - ); + ); StandardLib->RecordAssertion ( StandardLib, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UF SDeviceConfigBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UF SDeviceConfigBBTestConformance.c index 4c8f7c58..b50fc63b 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UF SDeviceConfigBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UF SDeviceConfigBBTestConformance.c @@ -81,7 +81,7 @@ BBTestRwUfsDescriptorConfTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); Status = UFSDeviceConfig->RwUfsDescriptor(UFSDeviceConfig, TRUE, 0, 0, 0, &Descriptor, NULL); if (Status == EFI_INVALID_PARAMETER) @@ -159,7 +159,7 @@ BBTestRwUfsFlagConfTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); Status = UFSDeviceConfig->RwUfsFlag(UFSDeviceConfig, TRUE, 1, NULL); if (Status == EFI_INVALID_PARAMETER) @@ -237,7 +237,7 @@ BBTestRwUfsAttributeConfTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); Status = UFSDeviceConfig->RwUfsAttribute(UFSDeviceConfig, TRUE, 0, 0, 0, &Attribute, NULL); if (Status == EFI_INVALID_PARAMETER) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo xTest/VariableServicesBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo xTest/VariableServicesBBTestConformance.c index e2182c5c..fb966a87 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo xTest/VariableServicesBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo xTest/VariableServicesBBTestConformance.c @@ -3653,8 +3653,10 @@ HardwareErrorRecordConfTest ( L"RT.SetVariable - Retrive the Hardware Error Record variables, check the name of them", L"%a:%d:Status - %r, Expected - %r", __FILE__, - (UINTN)__LINE__ - ); + (UINTN)__LINE__, + Status, + EFI_SUCCESS + ); if (AssertionType == EFI_TEST_ASSERTION_FAILED) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c index 634246fc..21cf40f9 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/BlockIo2/BlackBoxTest/BlockIo2B BTestFunction.c @@ -4688,7 +4688,8 @@ BBTestFushBlocksExFunctionAutoTestCheckpoint1( __FILE__, (UINTN)__LINE__, 4, - EFI_SUCCESS + EFI_SUCCESS, + BlockIo2TokenBuffer[IndexI].TransactionStatus ); Status = gtBS->SetTimer (TimerEvent, TimerCancel, 0); diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c index 7b0cc6fc..000ad8f2 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/ComponentName2/BlackBoxTest/Com ponentName2BBTestFunction.c @@ -718,10 +718,10 @@ BBTestGetControllerNameFuncTestCheckpoint2 ( AssertionType, gComponentName2BBTestFunctionAssertionGuid003, L"Please Use Native RFC3066 which is preferable in UEFI 2.X\nCOMPONENT_NAME2_PROTOCOL.GetControllerName - GetControllerName() returns EFI_SUCCESS support language", - L"%a:%d: Language - %c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", - __FILE__, + L"%a:%d: Language - %c%c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", + __FILE__, (UINTN)__LINE__, - Lang, + Lang[0],Lang[1],Lang[2],Lang[3], Index, ChildIndex, (ControllerName == NULL) ? L"(NULL)" : ControllerName, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c index 4b4988ec..3d1c6ffe 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/DriverDiagnostics2/BlackBoxTest /DriverDiagnostics2BBTestFunction.c @@ -660,10 +660,10 @@ BBTestRunDiagnosticsFuncTestCheckpoint2 ( AssertionType, gFunctionAssertionGuid002, L"Please Use Native RFC3066 which is preferable in UEFI 2.X\nEFI_DRIVER_DIAGNOSTICS2_PROTOCOL.RunDiagnostics - RunDiagnostics() returns EFI_SUCCESS with supported language", - L"%a:%d: Language - %c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", + L"%a:%d: Language - %c%c%c%c, ControllerIndex - %d, ChildIndex - %d, ControllerName - %s, Status - %r", __FILE__, (UINTN)__LINE__, - Lang, + Lang[0],Lang[1],Lang[2],Lang[3], Index, ChildIndex, (ControllerName == NULL) ? L"(NULL)" : ControllerName, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c index d182ea69..9c3d2bad 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/Gra phicsOutputBBTestFunction.c @@ -171,7 +171,7 @@ Returns: AssertionType, gEfiGraphicsOutputQueryModeBBTestFunctionAssertionGuid, L"EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode - SetMode() then QueryMode(), compare Info structure", - L"%a:%d: Status", + L"%a:%d: Status - %r", (UINTN) __FILE__, (UINTN) (UINTN)__LINE__, Status @@ -752,7 +752,8 @@ Returns: L"%a:%d:Status:%r, Expected:%r", (UINTN) __FILE__, (UINTN) (UINTN)__LINE__, - (UINTN) Status + (UINTN) Status, + EFI_SUCCESS ); return Status; } @@ -1473,7 +1474,8 @@ Returns: L"%a:%d:Status:%r, Expected:%r", (UINTN) __FILE__, (UINTN) (UINTN)__LINE__, - (UINTN) Status + (UINTN) Status, + EFI_SUCCESS ); continue; } diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c index 27994144..51ac332c 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBas eCodeBBTestFunction.c @@ -1252,7 +1252,7 @@ BBTestNewStopFunctionTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); } // diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c index ed0d8743..21629c76 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemBBTestFunction.c @@ -1608,7 +1608,7 @@ BBTestReadOnlyTestCheckPoints ( AssertionType, gReadOnlyFileSystemBBTestAssertionGuid005, L"ReadOnly System: Dir SetInfo should return EFI_WRITE_PROTECTED", - L"%a:%d: Status - %r", + L"%a:%d: Status1 - %r, Status2 - %r", __FILE__, (UINTN)__LINE__, Status1, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c index 9dd1c845..aaa34ef9 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleFileSystem/BlackBoxTest/S impleFileSystemExBBTestFunction_OpenEx.c @@ -1155,7 +1155,7 @@ BBTestOpenExBasicTestCheckpoint1_Test1_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid027, L"OpenEx() Basic Test - checkpoint1 ----Test1----Async", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d, Status - %r, File Name - %", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -2152,7 +2152,7 @@ BBTestOpenExBasicTestCheckpoint1_Test3_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid039, L"OpenEx() Basic Test - checkpoint1 ---Async", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d,Status - %r,FileName - %s", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -2656,7 +2656,7 @@ BBTestOpenExBasicTestCheckpoint1_Test4_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid043, L"OpenEx() Basic Test - checkpoint1 ---Async -- Test4----Open File", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d,Status - %r,FileName - %s", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -3302,7 +3302,7 @@ BBTestOpenExBasicTestCheckpoint1_Test5_Async ( EFI_TEST_ASSERTION_FAILED, gSimpleFileSystemExBBTestFunctionAssertionGuid047, L"OpenEx() Basic Test - checkpoint1 ---Async -- Test5---Open File", - L"%a:%d: Tpl - %d, Status - %r, FileName - %s", + L"%a:%d: FileIoEntity->Tpl - %d,Status - %r,FileName - %s", __FILE__, (UINTN)__LINE__, FileIoEntity->Tpl, @@ -10216,7 +10216,7 @@ BBTestOpenExBasicTestCheckpoint2_Test5_Sync ( FileIoEntity->StatusAsync, FileIoEntity->OpenMode, FileIoEntity->Name - ); + ); if (FileIoEntity->OpenMode == EFI_FILE_MODE_READ){ DirHandle2->Open ( DirHandle2, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c index 682076ea..175fe11e 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Simp leNetworkBBTestConformance.c @@ -1945,7 +1945,7 @@ BBTestTransmitConformanceTest ( __FILE__, (UINTN)__LINE__, StatusBuf[1] - ); + ); StandardLib->RecordAssertion ( StandardLib, -- 2.26.2.windows.1 -=-=-=-=-=-= Groups.io Links: You receive all messages sent to this group. View/Reply Online (#68636): https://edk2.groups.io/g/devel/message/68636 Mute This Topic: https://groups.io/mt/78849743/5325328 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [gaojie@byosoft.com.cn] -=-=-=-=-=-=
|
|
Re: [PATCH] UefiPayloadPkg: Fix the warning when building UefiPayloadPkg with IA32+X64
Ni, Ray
Reviewed-by: Ray Ni <ray.ni@intel.com>
toggle quoted messageShow quoted text
-----Original Message-----
From: Tan, Dun <dun.tan@intel.com> Sent: Wednesday, September 15, 2021 4:55 PM To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io Cc: Dong, Guo <guo.dong@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com> Subject: RE: [PATCH] UefiPayloadPkg: Fix the warning when building UefiPayloadPkg with IA32+X64 Hi Ray, There are only "UniversalPayloadEntry.inf" and "UefiPayloadEntry.inf" under [Components.IA32] in UefiPayloadPkg.dsc. The [Packages] sections in these two .inf file only contain MdePkg, MdeModulePkg, UefiCpuPkg and UefiPayloadPkg. So the PCDs in .dec files of these four pkgs used in UefiPayloadPkg.dsc will not be treated as unspecified PCDs when building with IA32. In order to avoid warnings when building under IA32, the PCDs in the dec files other than these four pkgs needs to be placed in the PCD section with the 'X64' suffix in UefiPayloadPkg.dsc. The ' gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport' is in 'MdeModulePkg.dec '. So it won't be regarded as an unspecified PCD. Thanks, Dun -----Original Message----- From: Ni, Ray <ray.ni@intel.com> Sent: Tuesday, September 14, 2021 3:54 PM To: Tan, Dun <dun.tan@intel.com>; devel@edk2.groups.io Cc: Dong, Guo <guo.dong@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com> Subject: RE: [PATCH] UefiPayloadPkg: Fix the warning when building UefiPayloadPkg with IA32+X64 Dun, I am curious, why ' gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport' doesn't cause build warning? It is referenced by "MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf" under "[Components.X64]". Thanks, Ray -----Original Message-----
|
|
[PATCH] OvmfPkg/BhyvePkg: add WorkAreaHeader PCD
Corvin Köhne
SEC phase will throw an assertion in IsSevGuest if
PcdOvmfConfidentialComputingWorkAreaHeader doesn't match the sizeof CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER. Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com> --- OvmfPkg/Bhyve/BhyveDefines.fdf.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OvmfPkg/Bhyve/BhyveDefines.fdf.inc b/OvmfPkg/Bhyve/BhyveDefines.fdf.inc index 66e0e4d270..9f01ef797c 100644 --- a/OvmfPkg/Bhyve/BhyveDefines.fdf.inc +++ b/OvmfPkg/Bhyve/BhyveDefines.fdf.inc @@ -82,4 +82,10 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = $(BLOCK_SIZ SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = $(VARS_SPARE_SIZE) +# The OVMF WorkArea contains a fixed size header followed by the actual data. +# The size of header is accessed through a fixed PCD in the reset vector code. +# The value need to be kept in sync with the any changes to the Confidential +# Computing Work Area header defined in the Include/WorkArea.h +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader = 4 + DEFINE MEMFD_BASE_ADDRESS = 0x800000 -- 2.11.0 Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff Registered office: Verl, Germany | Register court: Guetersloh HRA 7075
|
|
Re: [PATCH] UefiPayloadPkg: Fix the warning when building UefiPayloadPkg with IA32+X64
duntan
Hi Ray,
toggle quoted messageShow quoted text
There are only "UniversalPayloadEntry.inf" and "UefiPayloadEntry.inf" under [Components.IA32] in UefiPayloadPkg.dsc. The [Packages] sections in these two .inf file only contain MdePkg, MdeModulePkg, UefiCpuPkg and UefiPayloadPkg. So the PCDs in .dec files of these four pkgs used in UefiPayloadPkg.dsc will not be treated as unspecified PCDs when building with IA32. In order to avoid warnings when building under IA32, the PCDs in the dec files other than these four pkgs needs to be placed in the PCD section with the 'X64' suffix in UefiPayloadPkg.dsc. The ' gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport' is in 'MdeModulePkg.dec '. So it won't be regarded as an unspecified PCD. Thanks, Dun
-----Original Message-----
From: Ni, Ray <ray.ni@intel.com> Sent: Tuesday, September 14, 2021 3:54 PM To: Tan, Dun <dun.tan@intel.com>; devel@edk2.groups.io Cc: Dong, Guo <guo.dong@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com> Subject: RE: [PATCH] UefiPayloadPkg: Fix the warning when building UefiPayloadPkg with IA32+X64 Dun, I am curious, why ' gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport' doesn't cause build warning? It is referenced by "MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf" under "[Components.X64]". Thanks, Ray -----Original Message-----
|
|
[PATCH v6] UefiCpuPkg: VTF0 Linear-Address Translation to a 1-GByte Page till 512GB
[edk2-devel] [PATCH V5]
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3473 X64 Reset Vector Code can access the memory range till 4GB using the Linear-Address Translation to a 2-MByte Page, when user wants to use more than 4G using 2M Page it will leads to use more number of Page table entries. using the 1-GByte Page table user can use more than 4G Memory by reducing the page table entries using 1-GByte Page, this patch attached can access memory range till 512GByte via Linear- Address Translation to a 1-GByte Page. Build Tool: if the nasm is not found it will throw Build errors like FileNotFoundError: [WinError 2]The system cannot find the file specified run the command wil try except block to get meaningful error message Test Result: Tested in both Simulation environment and Hardware both works fine without any issues. Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Debkumar De <debkumar.de@intel.com> Cc: Harry Han <harry.han@intel.com> Cc: Catharine West <catharine.west@intel.com> Cc: Sangeetha V <sangeetha.v@intel.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Cc: Sahil Dureja <sahil.dureja@intel.com> Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com> --- .../Vtf0/Bin/IA32/ResetVector.ia32.port80.raw | Bin 0 -> 484 bytes .../Vtf0/Bin/IA32/ResetVector.ia32.raw | Bin 0 -> 468 bytes .../Vtf0/Bin/IA32/ResetVector.ia32.serial.raw | Bin 0 -> 868 bytes .../Vtf0/Bin/ResetVector.ia32.port80.raw | Bin 516 -> 0 bytes .../ResetVector/Vtf0/Bin/ResetVector.ia32.raw | Bin 484 -> 0 bytes .../Vtf0/Bin/ResetVector.ia32.serial.raw | Bin 884 -> 0 bytes .../ResetVector/Vtf0/Bin/ResetVector.inf | 4 +- .../ResetVector/Vtf0/Bin/ResetVector1G.inf | 31 ++++++ .../PageTable1G/ResetVector.x64.port80.raw | Bin 0 -> 12292 bytes .../Bin/X64/PageTable1G/ResetVector.x64.raw | Bin 0 -> 12292 bytes .../PageTable1G/ResetVector.x64.serial.raw | Bin 0 -> 12292 bytes .../PageTable2M}/ResetVector.x64.port80.raw | Bin 28676 -> 28676 bytes .../{ => X64/PageTable2M}/ResetVector.x64.raw | Bin 28676 -> 28676 bytes .../PageTable2M}/ResetVector.x64.serial.raw | Bin 28676 -> 28676 bytes UefiCpuPkg/ResetVector/Vtf0/Build.py | 101 ++++++++++++------ UefiCpuPkg/ResetVector/Vtf0/PageTables.inc | 20 ++++ UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt | 2 +- UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb | 8 +- .../ResetVector/Vtf0/X64/1GPageTables.asm | 53 +++++++++ .../X64/{PageTables.asm => 2MPageTables.asm} | 14 +-- 20 files changed, 185 insertions(+), 48 deletions(-) create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw rename UefiCpuPkg/ResetVector/Vtf0/Bin/{ => X64/PageTable2M}/ResetVector.x64.port80.raw (56%) rename UefiCpuPkg/ResetVector/Vtf0/Bin/{ => X64/PageTable2M}/ResetVector.x64.raw (56%) rename UefiCpuPkg/ResetVector/Vtf0/Bin/{ => X64/PageTable2M}/ResetVector.x64.serial.raw (56%) create mode 100644 UefiCpuPkg/ResetVector/Vtf0/PageTables.inc create mode 100644 UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm rename UefiCpuPkg/ResetVector/Vtf0/X64/{PageTables.asm => 2MPageTables.asm} (74%) diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw new file mode 100644 index 0000000000000000000000000000000000000000..79b23c047bdc6e552d77d5c9e9aeae21ff04d91d GIT binary patch literal 484 zcmYk2!Alfz6vy8<IayG%i0DGXitWJ;8|{W-Y{r%pUBW$t3`U5Tfv)5HV2<-+SmEc& z_=8U3ztCYiIbg8Am<;oh;GvDB*b)cVcTo_jh@F0e1bz?i@%TPI-^b&e^P(s~24D&R z66-E?GS0!u3PI`&Of3)3ke}4au8p$=@|8NnwWzR1c0DH#WQRqnF+w7|76h>yHl)}V zcG*_&Hg-ER3P7>NzOzHK{_>8}w92SftcjYiOP;uF74pB9jiIw>#6GG&9iTswB!MfR z>~G3@yT|(CI{hlqFjo^qW81h>6zpT|jA+4e?AqPnMDkDNwGuY(iR``YMZ<N}jD17a ze!Eo9(*2YtLo1$8t#bY^wmfmkq?6C)NI~B)?kf>3S04kAoH{**Icc)Uq~+N;a$TM7 z^Te3G@j|=R#NJTGK*yH2U@&(7Y{IeM+FVL*o4PV&hBpB!`lv9EUde?FgcS`yA8iMv z*fqmG@SDEy+y0@yiw}4XxLlI&<|#6jJQ3ja=kvb)zpp~$Q5CN?9#*l}WFN2xf1}qi ex=GS`BMWOMaSFL0+&dpq=Irw)z&XCVVDo<yIpul) literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw new file mode 100644 index 0000000000000000000000000000000000000000..ce7faa502b858e99908bcdb397b776258205e1d5 GIT binary patch literal 468 zcmYk2ze^)g5XWb;8h;dS5Fr7Dh^EjYViZM*LR8di#1tYyISz|ku3q=S79u{D6wk=I zU?u(=f(r_HvMOqGf`yTwL`89(=88k^4$0mNLGfG6cVLFkcNp8Y?F5fQ2w)Tde661v zA>(mlgCI3pM%UYB$vrh9+XHNgTvMYh>&7q1g=xfqoHJL>v=bK_oV*Y_#xgthrX_$x zk=?RqHTShwDriZRQ`%sb>wPA#)8er|>zVMY+pfRlzO>Lg-}j;6Ouvy1^?-J@W;Dwr zh~X?JL3WDg3C>QkuOy(Cz2D+G0r_U~$nfcMX3da8daJ0-dS5O=A1WLXmNL1lC1Y<` zG<l6mhh`Q?T-nQvNG?sLCjm%Qp6J4;7&2F-$@vA+Bu~_vyi3_z40ac=))6t_tq9z| zefVV+_gDQMRguD~(+QALI=K4sT?|9uq=EoSM@e<+!75nXDp}9g1y0#fu*HIS>xU}H zio}TkTR*G5^X{9FA5UXrek_f(Dm%ge{zcRKQTBarR}@zApFT*{1~02#Vb0G@fo<c# G=av6&joI)3 literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw new file mode 100644 index 0000000000000000000000000000000000000000..6503a988abdac06f9aa88f0a65f2525e12233b0a GIT binary patch literal 868 zcma)4L2DC16n>krZCZ#4rO<$dgqlM|B1ucd5-YJ)(Sw+Slu!}T!yY`YJFv$tYmjZq zy5K>?Kj1O9hD6B7TCH9z^k5_?QBk@bSv|$5X~tQj(A|Ri4sZD8@xJ-K_r^3$v+@I# zZaI~2s02=>jY@*!-V8W)A4-!XL;z+1fJsxT5>Y;^tYE4tBeTn67w|h(iQb#mui{s# zGFGsXn|MQ05`drU7Rtx5MbC+q9rWozT>dJ$%-0+*PWf=ihliYUjfcKQyZV~9)lZf7 zweF>|vjKo~Lw}=hiN(t)p)Q@EC@akrh&-*40V$PeFXu;FR$SgLo*hx&GR9!=nfzLK zBnPCIOUf|9gZ5oMi2}j>`Z|4@Ci;^?3(t9li9R9!_9%D%&hQ`Bt_!X#`HDuOGwV0< zOA3m}2Y4QqCyP<_y=#U0&1wWmnM8*+G_p@rkDXt{$?$6axL~Q7+-U$DL-P|f#*4Zo zs+omFydTX6H8K%iz0`lGPW#H-J=mQtW53thcDI^#cB7*n6!M@U=X({t7>(*pc0>#d zqhk3WKsG#1#O=deV+6|Cet__J(>stU-$*BYc<-*oauAHVL5!xcWo*z>W(-XJ0RQYf zToZ2ap#a=@(L3+|Id4O4E=NPPlQ|j`^~ZLzLj$yBhnW4j!<b#&VN7qbk3FhinQr!g Q%eipz445W;xT|db1oCUYi~s-t literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw deleted file mode 100644 index 2c6ff655ded2a5855ca8f4428d559a7727eb6983..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 516 zcmXYu&r2IY6vyAXZffw5pki|H5Mn5LNHL07>yK(hDFtZ?MS?}4mxbPR-GRMz=a9oB zvMhKKFZ~nNlM5cQb+xr81!+kMl-SZG(_HkTQj62K>Vuhi^XB_L@6C*D+jh>&LL6WM z0E9M5jkxi9eVsI^(KS)(c}ad!Be^-u-jeUs=qdWy6LL(A42pq#X1-iV5sza!I8I=? z6*P9huZ0loz}XH=zA6FaYU~GVsO6;rsjAI!8P!wTWYN=~C=bxrhB8;BLgK<t>5cO9 zE_#aD5dEUpq>p-w_SG~xWD@0RR2DrFWrutZ1v!s>DqfI?a~7ETjdPBr+OZTuH6@AC z(ZjWOrXk1m6wV#`csWUbg<S05l@fNKy~zCI-!P=K;!dTH=NHLHY^N|T`E)Eli`VOy zXZrX<JiJvfU!`LUi=<PYX;b<z8ryjj>92AHT^9%NWrR81f%$hA&aB$5Egq>cDWST( zc->gqQ~#`>AP(+S1e4QsXD~2Tw+*bS<ym#BVIA|Qh_Ms!0d@E>_ZG54!{z}tj_%g2 yBd9#fH`^=I`DR3A`}nB*Qt<bJXK#eyC7f7Y1R<hXy90%ch1YX{k^Ou0?eZVP-{Nrq diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw deleted file mode 100644 index e34780a3a2c9b22bd10a1d5a405e344faaff94f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 484 zcmX9*OG_g`5Uz2YXi!K{AwfI@4Wb8^4I;k92Z}6+5k#W02QLkK9j9Rq9_&L7ZDbtq zqIePigaaNjIzCSdixLS)RFt&2cybqA?5!~cU5~H6s_N>tZQD+`9S{Z>1OTb`GBa#G zt*_G(GaClinx^RkGo#yGe2LyNvnlO${H9mTj3XK78TZswjJl#0BPWZ(PsE3m63x5< zkjV2pUL={H-<6y`Ayi}y>qBYR=+mmu*E{2X*HV!;FJ=@olMU=1D<ODc<ds9CLcd-$ z>r@&PjmS*9G|11z5fTzEKTW^U3gc6Jd}Rz>i=xwezWi&|RKrFLb)7MgiLyt(A5Nap z{K@){_&;%jkXDHiVLej|v^%t)8c;mepB%?^+SRc((Td402KNZ-pIe~y>R7ebhG=Mi zG0>h98oCZ15CogOAHb`XKiHDrNJxngrv+CGHM`_x1(RWLh67mGTp&(0SUJnJ3Rcm& z65UvCM_?B@w(a-w1uqM*d0DnQmyjJzmTIyi$x?vuV|+aEM~V$8raq+<d#HFpKI8Y< TrM$1pedcB-0FmP|Qr7<gpRvyd diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw deleted file mode 100644 index 6dfa68eabb48a44bc50a0b7fe678f80b5cdadfd5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 884 zcmbO*VZwx6znM3*zuWbbc>}|{T|byNFuntcu)ljL%WQZ+mqCDm!Ipu6;eU~3V}(G) z)1IEv*Nqh-wp}v*rH>jbBxag+CYIi8tdMCvtb4iiLSuyrP%%U4@y^4{5elUTUitue zX}kV1zgeMB@;wb?e$qQsz5yDa7md&LZpVHg=sf!J_y7O@JCCC3MmNn6O*f`#F9Vqv z7z}TB-s^mk)*WlWc%#VeB{R^K4n=mY2TH71*@5gLW0fCW5#rwtE0nzG_7G`&2(+1j z^JK|w#)BnHMOPatgqTY?U(N!mY&}rQ*?HpSA)o@o1D(fOzm+<nIxr2*L4>_q@(;fW zM0l~75#+LxB322Y6D>~^XEszY3zR4TNud&(Zi&XnApZb;9>@yvd6AdOpO@EwLaZ!6 zURtAtZ&ax{|MmzQ#>0))0j|L4)MR$nc&P@I1gq#goYrU^7F8<D?99Qc0Tkum9?hnC z<0UJQxdVt9UOxNx|35U+e}LlL@EtPG428#w!sB}PYd6D(zT3NJ{ntz5XB1D{p$v=~ zex(Cxuk3*?6kyolzy`EX=>cjO8KZ@=5gH#e8KmvtVCcKiccAY<-;2HrFU^6@7H3!h z3Ku8<vnHQs0MoP2GwgQ?c+I!pG2k_4TIZ3MC;k8v&C4(UUyA>KdG*i#|1Vel1t!i1 c|DR2GeH)mmfB<AnScn_LgbA;YKtv!U0PUT%*8l(j diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf index 8fc9564ebb..47ac07798b 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf +++ b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf @@ -22,10 +22,10 @@ # [Binaries.Ia32] - RAW|ResetVector.ia32.raw|* + RAW|IA32/ResetVector.ia32.raw|* [Binaries.X64] - RAW|ResetVector.x64.raw|* + RAW|X64/PageTable2M/ResetVector.x64.raw|* [UserExtensions.TianoCore."ExtraFiles"] ResetVectorExtra.uni diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf new file mode 100644 index 0000000000..75705cd344 --- /dev/null +++ b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf @@ -0,0 +1,31 @@ +## @file +# Reset Vector binary +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ResetVector + MODULE_UNI_FILE = ResetVector.uni + FILE_GUID = 1BA0062E-C779-4582-8566-336AE8F78F09 + MODULE_TYPE = SEC + VERSION_STRING = 1.1 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Binaries.Ia32] + RAW|IA32/ResetVector.ia32.raw|* + +[Binaries.X64] + RAW|X64/PageTable1G/ResetVector.x64.raw|* + +[UserExtensions.TianoCore."ExtraFiles"] + ResetVectorExtra.uni diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw new file mode 100644 index 0000000000000000000000000000000000000000..279ba03b0c01f552a0d3ed8900e06b91f2555901 GIT binary patch literal 12292 zcmeI&+i#oo0mkts4Go0>4qZpX=tz11%2=TdhrvQ2P!8c7PF+^UX)tetZH!=pH%^Zg z70DEZNZf$9;~&6W5#XW^3Pp^YRpNq96(~?GYU&$$gElnPylKDiKWus}#UDH0_!sB7 zvLnyT%*?Ex?{-yQ$_2^=$_2^=$_2^=$_2^=$_2^=$_2^=$_2^={;wA}z+YE5x^%P9 z7*tPjW2vJtsAY6C2GvVPV^GJ@(HPWnIvRuOqoXmX<LPJ&Y6TsQL7hNHV^Am3(HPVZ z=x7Y;Bsv;{I+>2fpiZHqF{lb1jY0L((HPXJbTkIFl8(lpen>}SP^;)@4C+U8GzN7V z9gRV)rlT>a0XiCkI-QQjpngn8V^C+%(HPVkIvRue2_20=ok>SyP=j<d1~o)SV^C}9 zX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ui4Q)sW`hmyx{8W3Qg~u&h-5B z!Rfu78_!X@_?hCP8b>cnPig6L^ivzJ{NtFff9IRre_6Y)9`BsE`>OHI@@ngY&a%#b z7N6=aR*rPLiw`Ybomc!(v&C0;Z0(0*Yxj(;{a~y$-(8rQId*z^T`o{AP%cm|P%cm| pP%cm|P%cm|P%cm|@V~ae;x~uCf8V(MuIn^2vv}axcaFWE{1))d6p#P_ literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw new file mode 100644 index 0000000000000000000000000000000000000000..9b09a80f225736a413b7146b0e7bd4aafc73abe1 GIT binary patch literal 12292 zcmeI&TaT0n0mkuXS=a)$%ob6$1>NOPOO>TS?QuaD5Zs;w6>+83+N$HB2ko-cj*9Y3 zR!jz(brR!+@k4mYS}u5+EluG@5-&uFW|e4I-W$1T)ELHh;oqd6p?N3S`Mop$*>`rH ztC`JoI-Smjxo%h0rCOj`pjx0>pjx0>pjx0>pjx0>pjx0>pjx0>;C;QoWnNwB=)z&C zF{qyMV4<Tis6})%2GvVPV^E9fXbfrz9gRWt(a{*xEp#*nwUmy=pqA0m7}Rn)8iV=( z9gRWVN=IW*x6#oU)CxKpgR0Td7*szUjX~W`M`KVc>1Yh<gLE_owTh0$pgu%LV^ANa zqcNz}bTkGvKu2RxchJ!o)SYxR2DOHc#-P^H(HPW6=x7Y;qjWR|HAqKeP(ySy2DOfk z#-P^I(HPVQIvRu8NJnE(chS)p)W_&(4C-z=8iU$IM`KX;(9syw$LVMc>JxM{2DO=v z#-N7jXbfr#9gRWVOGjf+Tj^*FY8xGmL2aj_F{u0KXbkF;bTkHaKOK!hJwQieP!H14 z7}P^_GzRrB9gRUfLPujzBXl$dwS$hvpmx&H7}TfeXbkGpbTkGvN=IW*yXa^PYBwE? zLG7WVF{sbb(HPWTIvRu8M@M5&pQWQQs4+SkgL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bin/X64/PageTable1G/ResetVector.x64.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw new file mode 100644 index 0000000000000000000000000000000000000000..d9b051ff06d1d30b0dfd585e05e75c98ebd88b03 GIT binary patch literal 12292 zcmeI&No<sL9LDjd3`;?ADxy?DDT|5=+Jc~nO9hv@f*V%cw{hR<jE?(n(hxJEwTTB~ zJbLjaH)}ocm<pm7Nj!)lnyS$-jA@J{h>9KGfv*W2je6GiJ<MnR^Ub{T{(sZMOf&uc z{r&TXYc-`uI)QWo=>*aVq!UOdkWL_-KsteR0_g<O38WK9C-9%1z&GqJv9o?RG0>={ z<W9X~pi$%K7-&?6j)6vvr(>W|6X+Od)I>T48a0WIfkrjcG0>>VbPP0V3LOKDI*5*e zMjcGYK%=J8G0><(=on~JmX3i&wa_ups6*)(Xw)=11{!r39RrP;PRBr_4yR+FQAf}* z(5M-73^b~hj)6uUNyk8=j-q3rQ8VcnXw)n^1{!rV9RrOzhK_+o&8B0ZQEhY#G-?hV z1C5$X$3Uaz(J|1d`E(34>R37k8g(2U1C2VKj)6ukpkts>C(tp_s1xZJXw*q`3^eLw zItCiGkdA>yokGVzqfVt`pi%8~3^b~Pj)6ukqGO;@i|H6>)M<1KG-?SQ1C3fr$3UY_ zr(>W|XV5XwsAY5vH0n$`1{$@Tj)6v<MaMv+&Zc9aQRmPx(5Q3i7-&={9RrOzkB)&x zt)OF|Q7h>fXw><13^eKjItChbAsqvax`>W}Ms?9K(5Q>)7--ZbbPP1=QaT12br~H4 zjk=tUfks_H$3UZ2(J|1d)pQIr>Pk8W8g&&N1C6?xj)6v9L&rd)uBBt3QETWJXw-Fd z3^b~nj)6v9Psc!`*3vQ1s2k`QXw;2#3^eK{ItChbGaUnsx`mE`M%_xsK%;J>W1vyD z(=pJfJLni_)SYw;H0mxo1{#&4W1vxY(=pJfd*~Qw)V*{JH0nM&1{!rg9RrPefR2Gi zJxIquqaLDTpivLgG0><-=oo0!qjU^3s)vq&Mm<KyK%??>3^b}h$3UYVr(>W|PtY;Y zs3IK$je3%ffkr(=$3UZ=remN{&(JZ@sAuUIXw-9b3^eL_ItIG#;IEktFN_TSoY|m} z!9AG`O(XS3CXG~H&U7RnFk7_m(?_jmajDo+{Pv}n3e{3^`q?keT2=VERBU~HN%^+I z=cVGTbwdk3Eo|*A&R5~%@=&I`tuR!*I5+rP=KHtW@;~M3XTE)8?7F>SJ+)yyWn^Gu za+Eh!N6VYWKDF^w9Su+Y^QkIZ#z`I9%U_mv<ksKR-n6afoNA`CXW2UEm-Kp4Py75m zFLuw^J=B)pxxQ<9>8o1utBA=T<-cfpKR>SLvnWo>6ed?*OXjuCg^A@Y)ek#d-n?#i zVa3=B%QalcKkqR=`uAt}7hC(WseW1cTYBBPY|CTaQOvaDXC}AP@{88DmcFTPCE0Ih zuQNT%=kKj<@Addx>5R+Q78YjT={~DzsI+|b1yW&lX61tF>?D?la;4>K))o%QtZeS} zg6umtOgv#*b;3ZhdsX(1)@s!Uvu(rK!5tH_bBEsz$=OB8syW-9ZF6#Gc6P3J-uz>& z)~d04TiP(4(;C))@wUxO_BNocwOV%WwrZKbr#<yQr;d>WS4+pNrjA)n8TsWs{m{4l zy&HF(lFK&D$PLU({+X3rWNzp9UA0<^20AB7$zH}@?c#>3Thy@r^VQ}Cn$@?h&wayv zJNmX(uRdOnB<D|lWOKk#A7cI3_p6&%KiTgafA}`*SF~}(>gv>u=dG?b=gJ>cy7yMc zRd-iLM=N*lt<@@ve@kv2Pu_`v<jt*h&Dq>FXH(al54y_3weJpit@_>lua@4X6G$hJ vP9U8?I)QWo=>*aVq!UOd@PC*<WpLNNZv^$duDRwy_4ila-2ce_FABc{a%3Ct literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw similarity index 56% rename from UefiCpuPkg/ResetVector/Vtf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index 56% rename from UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw rename to UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw index a78d5b407c8a106c221af127216d073cf8fdb99d..865846da42a45c16b69746f16963d47a6c6e71b0 100644 GIT binary patch literal 28676 zcmeI*_qU~YRmbriA`xs85hW^0AgEZPfZc#@MKpG77_ohAV{b8|qoVFHMjgO7_O4%h z?}aETTLTE#ut%|MjfLUbuwZ9ANnWny-+<>?YtHN3d+z%=b3XTnXPvv&+_`Y!!i8)0 zrAu)<jtd+YI4*Ep;JCnXf#U+l1&#|G7dS3(T;RCCae<fW1+Mwgd*1(F(|jK1_;Z1m z>Tmq<#T^$oE^u7nxWI9N;{wM8jtd+YI4*Ep;JCp5s|D`#YVVAz@4k0uBo~XD&0$=2 z*PTPp<YIBNIgEShnOrPxHivP!p2@}HW^))Xqi1rlxY-=Wz4c5k7B`#2xI)k5VsW!M zjF;6jxmet64&y$0CKrpF&0*YE&*WlpvpI~H(=)kP+-wfx<@HQ17B`#2cm+L^i^a|6 zFkVs5<YIBNIgD4*Gr3sYY!2g;p2@}HW^))<>X}?DZZ?PU%6cXji<`}1+)vNsVsW!M zj91Y!xmet64&(lMCKrpF&0)N%p2@}HW^)*?re|`oxY-=W1N2NT7B`#2xJu9DVsW!M zj91q)xmet64&ycSOfD8To5OfbJ(G*Y&E_y3sAqDqxY-=WYw4L>EN(W3@!EPO7mJ(C zVLV9B<YIBNIgG3IOfD8To5Of;9FD{FpUK7IW^))1(KESN+-wfx8a<PX#m(k09;#<@ zvAEeB#_Q;rTr6%jhw-|4CKrpF&0)Nrp2@}HW^))1(=)kP+-wfx_4Q0H7B`#2cmq9? zi^a|6Fy2tl<YIBNIgB^bGr3sYY!2gEJ(G*Y&E_!PSkL5QakDv$H_<b>Slnz5<KcQH z7mJ(CVLU?5<YIBNIgCf@nOrPxHiz-1dL|c(o6TXonV!kT;%0LgZ?0!@vAEeB##`u_ zTr6%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ue%;5Y}4bKp1!{-4c(!><51uHz0Ici^}K#~nECz;OqTJ8;~A z;|?5m;J5?F9r!=60}np@I*H379(DNE#Ko&0e*WBL=l=Ye&pdm}`E&Pp)YI?v__HrN zf9~?HecKBka`yMnpS#z!H$L#U&c68kx%(atj<dgT;l@j!a>dy`d5y!P8=iMq7hZ7k z?-ws#Jn-yGA|Cvb3x9m!<}=TD+Ji2+>FURxTzWVvuYQMX`<k~ub?3wVs~>XTe|h>- z?)l0auej#sXIyoU^DjM=ao1nG<|UW>+%<Q&`giKw-7Y<Q*OS*j9C>Y@z3YV+o&5aa zfCu-57he0yvv;`WRVR-=oZ|3eSD(84aLB`7^eG=*=PteMnkx>scf011&$#^jpWga< zhciF%)U9W}`f>ODkCWd$Jay`hhev15KkPl9diJ5GpYxPQUUK94M?B#%hkwokE`9X< zPwsd4!`qIyaO0Wtk9hJ^&))sgN8jbt{SVKce$EHn=>a#LoI2dS;qVbBXAUoRL(IjC zr?0%}^c8dZr*1xV`pWsqis;jCeRy=2(+@g*MIY|m`}CFl@&_J{zC2EzbtwPsx$$?` zz2vzcckwOHoWA6qXKr}o!@e92IrH)-9*(&zZpb?w&UWRTx#2Ex-A&i^b#vX#*S+}U zafkBWQHMkR_nYeQ^lj_5pTa-u*W)(7{=fafc-}id;g(l_-a9?vmOGuf@chFk;pCq$ zo_yBDlT)v{c=6<^x86ML@RC>EaJaec+jCdl=Y?0@=LJ{Y=lNG%n2UdLIMppT-hRGY SPx9m^JvI){eBb~48~hhX6Rzk0 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.serial.raw similarity index 56% rename from UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw rename to UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.serial.raw index 61c71349a8a599916f3eeae8c5dee92efb56db71..f1d6536cec924d0e167cf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@!kU<R`D3Jo?JXOW%9t%E>M7JAA3bjNX3F;bkBC7rNV@_NLpP_Qu<v j_J-Rp&Xu=6c;CbCb@e@7{+Tb1OP3z}mY;w3OP78Y>oK+# diff --git a/UefiCpuPkg/ResetVector/Vtf0/Build.py b/UefiCpuPkg/ResetVector/Vtf0/Build.py index b791d32762..3f1d5cd2c8 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/Build.py +++ b/UefiCpuPkg/ResetVector/Vtf0/Build.py @@ -6,45 +6,84 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # -import glob import os import subprocess import sys +PAGE_TABLE_2M = 'PageTable2M' +PAGE_TABLE_1G = 'PageTable1G' +FILE_FORMAT = '.raw' +ALL_RAW_FORMAT = '*' + FILE_FORMAT +IA32 = 'IA32' +X64 = 'X64' + +# Pre-Define a Macros for Page Table +PAGE_TABLES = { + PAGE_TABLE_2M : "PAGE_TABLE_2M", + PAGE_TABLE_1G : "PAGE_TABLE_1G" +} + def RunCommand(commandLine): - #print ' '.join(commandLine) return subprocess.call(commandLine) -for filename in glob.glob(os.path.join('Bin', '*.raw')): - os.remove(filename) +# Check for all raw binaries and delete them +for root, dirs, files in os.walk('Bin'): + for file in files: + if file.endswith(FILE_FORMAT): + os.remove(os.path.join(root, file)) for arch in ('ia32', 'x64'): for debugType in (None, 'port80', 'serial'): - output = os.path.join('Bin', 'ResetVector') - output += '.' + arch - if debugType is not None: - output += '.' + debugType - output += '.raw' - commandLine = ( - 'nasm', - '-D', 'ARCH_%s' % arch.upper(), - '-D', 'DEBUG_%s' % str(debugType).upper(), - '-o', output, - 'Vtf0.nasmb', - ) - print(f"Command : {' '.join(commandLine)}") - ret = RunCommand(commandLine) - if ret != 0: - print(f"something went wrong while executing {commandLine[-1]}") - sys.exit() - print('\tASM\t' + output) - - commandLine = ( - 'python', - 'Tools/FixupForRawSection.py', - output, - ) - print('\tFIXUP\t' + output) - ret = RunCommand(commandLine) - if ret != 0: sys.exit(ret) + for pageTable in PAGE_TABLES.keys(): + ret = True + if arch.lower() == X64.lower(): + directory = os.path.join('Bin', X64, pageTable) + else: + directory = os.path.join('Bin', IA32) + + # output raw binary name with arch type + fileName = 'ResetVector' + '.' + arch + + if debugType is not None: + fileName += '.' + debugType + fileName += FILE_FORMAT + + output = os.path.join(directory, fileName) + + # if the directory not exists then create it + if not os.path.isdir(directory): + os.makedirs(directory) + + # Prepare the command to execute the nasmb + commandLine = ( + 'nasm', + '-D', 'ARCH_%s' % arch.upper(), + '-D', 'DEBUG_%s' % str(debugType).upper(), + '-D', PAGE_TABLES[pageTable].upper(), + '-o', output, + 'Vtf0.nasmb', + ) + + print(f"Command : {' '.join(commandLine)}") + + try: + ret = RunCommand(commandLine) + except FileNotFoundError: + print("NASM not found") + except: + pass + + if ret != 0: + print(f"something went wrong while executing {commandLine[-1]}") + sys.exit() + print('\tASM\t' + output) + + commandLine = ( + 'python', + 'Tools/FixupForRawSection.py', + output, + ) + print('\tFIXUP\t' + output) + ret = RunCommand(commandLine) + if ret != 0: sys.exit(ret) diff --git a/UefiCpuPkg/ResetVector/Vtf0/PageTables.inc b/UefiCpuPkg/ResetVector/Vtf0/PageTables.inc new file mode 100644 index 0000000000..31958ae878 --- /dev/null +++ b/UefiCpuPkg/ResetVector/Vtf0/PageTables.inc @@ -0,0 +1,20 @@ +;------------------------------------------------------------------------------ +; @file +; Definitions of Page Table Entry for the reset vector module +; +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;------------------------------------------------------------------------------ + +%define PAGE_PRESENT 0x01 +%define PAGE_READ_WRITE 0x02 +%define PAGE_USER_SUPERVISOR 0x04 +%define PAGE_WRITE_THROUGH 0x08 +%define PAGE_CACHE_DISABLE 0x010 +%define PAGE_ACCESSED 0x020 +%define PAGE_DIRTY 0x040 +%define PAGE_SIZE 0x080 +%define PAGE_GLOBAL 0x0100 +%define PAGE_2M_PAT 0x01000 + diff --git a/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt b/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt index e6e5b54243..97f4600968 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt +++ b/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt @@ -29,7 +29,7 @@ EBP/RBP - Pointer to the start of the Boot Firmware Volume === HOW TO BUILD VTF0 === Dependencies: -* Python 2.5~2.7 +* Python 3 or newer * Nasm 2.03 or newer To rebuild the VTF0 binaries: diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb index 493738c79c..2cdaa14507 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb @@ -35,8 +35,14 @@ %include "PostCodes.inc" +%include "PageTables.inc" + %ifdef ARCH_X64 -%include "X64/PageTables.asm" + %ifdef PAGE_TABLE_1G + %include "X64/1GPageTables.asm" + %else + %include "X64/2MPageTables.asm" + %endif %endif %ifdef DEBUG_PORT80 diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm b/UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm new file mode 100644 index 0000000000..19bd3d5a92 --- /dev/null +++ b/UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------ +; @file +; Emits Page Tables for 1:1 mapping of the addresses 0 - 0x8000000000 (512GB) +; +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +; SPDX-License-Identifier: BSD-2-Clause-Patent +; Linear-Address Translation to a 1-GByte Page +; +;------------------------------------------------------------------------------ + +BITS 64 + +%define ALIGN_TOP_TO_4K_FOR_PAGING + +%define PAGE_PDP_ATTR (PAGE_ACCESSED + \ + PAGE_READ_WRITE + \ + PAGE_PRESENT) + +%define PAGE_PDP_1G_ATTR (PAGE_ACCESSED + \ + PAGE_READ_WRITE + \ + PAGE_DIRTY + \ + PAGE_PRESENT + \ + PAGE_SIZE) + +%define PGTBLS_OFFSET(x) ((x) - TopLevelPageDirectory) +%define PGTBLS_ADDR(x) (ADDR_OF(TopLevelPageDirectory) + (x)) + +%define PDP(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \ + PAGE_PDP_ATTR) + +%define PDP_1G(x) ((x << 30) + PAGE_PDP_1G_ATTR) + +ALIGN 16 + +TopLevelPageDirectory: + + ; + ; Top level Page Directory Pointers (1 * 512GB entry) + ; + DQ PDP(0x1000) + + TIMES 0x1000-PGTBLS_OFFSET($) DB 0 + ; + ; Next level Page Directory Pointers (512 * 1GB entries => 512GB) + ; +%assign i 0 +%rep 512 + DQ PDP_1G(i) + %assign i i+1 +%endrep + TIMES 0x2000-PGTBLS_OFFSET($) DB 0 + +EndOfPageTables: diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm b/UefiCpuPkg/ResetVector/Vtf0/X64/2MPageTables.asm similarity index 74% rename from UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm rename to UefiCpuPkg/ResetVector/Vtf0/X64/2MPageTables.asm index 5bc3093f90..b97df384ac 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm +++ b/UefiCpuPkg/ResetVector/Vtf0/X64/2MPageTables.asm @@ -11,19 +11,7 @@ BITS 64 %define ALIGN_TOP_TO_4K_FOR_PAGING -%define PAGE_PRESENT 0x01 -%define PAGE_READ_WRITE 0x02 -%define PAGE_USER_SUPERVISOR 0x04 -%define PAGE_WRITE_THROUGH 0x08 -%define PAGE_CACHE_DISABLE 0x010 -%define PAGE_ACCESSED 0x020 -%define PAGE_DIRTY 0x040 -%define PAGE_PAT 0x080 -%define PAGE_GLOBAL 0x0100 -%define PAGE_2M_MBO 0x080 -%define PAGE_2M_PAT 0x01000 - -%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \ +%define PAGE_2M_PDE_ATTR (PAGE_SIZE + \ PAGE_ACCESSED + \ PAGE_DIRTY + \ PAGE_READ_WRITE + \ -- 2.30.2.windows.1
|
|
[PATCH v5] UefiCpuPkg: VTF0 Linear-Address Translation to a 1-GByte Page till 512GB
[edk2-devel] [PATCH V5]
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3473 X64 Reset Vector Code can access the memory range till 4GB using the Linear-Address Translation to a 2-MByte Page, when user wants to use more than 4G using 2M Page it will leads to use more number of Page table entries. using the 1-GByte Page table user can use more than 4G Memory by reducing the page table entries using 1-GByte Page, this patch attached can access memory range till 512GByte via Linear- Address Translation to a 1-GByte Page. Build Tool: if the nasm is not found it will throw Build errors like FileNotFoundError: [WinError 2]The system cannot find the file specified run the command wil try except block to get meaningful error message Test Result: Tested in both Simulation environment and Hardware both works fine without any issues. Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Debkumar De <debkumar.de@intel.com> Cc: Harry Han <harry.han@intel.com> Cc: Catharine West <catharine.west@intel.com> Cc: Sangeetha V <sangeetha.v@intel.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Cc: Sahil Dureja <sahil.dureja@intel.com> Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com> --- .../Vtf0/Bin/IA32/ResetVector.ia32.port80.raw | Bin 0 -> 484 bytes .../Vtf0/Bin/IA32/ResetVector.ia32.raw | Bin 0 -> 468 bytes .../Vtf0/Bin/IA32/ResetVector.ia32.serial.raw | Bin 0 -> 868 bytes .../Vtf0/Bin/ResetVector.ia32.port80.raw | Bin 516 -> 0 bytes .../ResetVector/Vtf0/Bin/ResetVector.ia32.raw | Bin 484 -> 0 bytes .../Vtf0/Bin/ResetVector.ia32.serial.raw | Bin 884 -> 0 bytes .../ResetVector/Vtf0/Bin/ResetVector.inf | 4 +- .../ResetVector/Vtf0/Bin/ResetVector1G.inf | 31 ++++++ .../PageTable1G/ResetVector.x64.port80.raw | Bin 0 -> 12292 bytes .../Bin/X64/PageTable1G/ResetVector.x64.raw | Bin 0 -> 12292 bytes .../PageTable1G/ResetVector.x64.serial.raw | Bin 0 -> 12292 bytes .../PageTable2M}/ResetVector.x64.port80.raw | Bin 28676 -> 28676 bytes .../{ => X64/PageTable2M}/ResetVector.x64.raw | Bin 28676 -> 28676 bytes .../PageTable2M}/ResetVector.x64.serial.raw | Bin 28676 -> 28676 bytes UefiCpuPkg/ResetVector/Vtf0/Build.py | 101 ++++++++++++------ UefiCpuPkg/ResetVector/Vtf0/PageTables.inc | 20 ++++ UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt | 2 +- UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb | 8 +- .../ResetVector/Vtf0/X64/1GPageTables.asm | 53 +++++++++ .../X64/{PageTables.asm => 2MPageTables.asm} | 14 +-- 20 files changed, 185 insertions(+), 48 deletions(-) create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw create mode 100644 UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw rename UefiCpuPkg/ResetVector/Vtf0/Bin/{ => X64/PageTable2M}/ResetVector.x64.port80.raw (56%) rename UefiCpuPkg/ResetVector/Vtf0/Bin/{ => X64/PageTable2M}/ResetVector.x64.raw (56%) rename UefiCpuPkg/ResetVector/Vtf0/Bin/{ => X64/PageTable2M}/ResetVector.x64.serial.raw (56%) create mode 100644 UefiCpuPkg/ResetVector/Vtf0/PageTables.inc create mode 100644 UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm rename UefiCpuPkg/ResetVector/Vtf0/X64/{PageTables.asm => 2MPageTables.asm} (74%) diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw new file mode 100644 index 0000000000000000000000000000000000000000..79b23c047bdc6e552d77d5c9e9aeae21ff04d91d GIT binary patch literal 484 zcmYk2!Alfz6vy8<IayG%i0DGXitWJ;8|{W-Y{r%pUBW$t3`U5Tfv)5HV2<-+SmEc& z_=8U3ztCYiIbg8Am<;oh;GvDB*b)cVcTo_jh@F0e1bz?i@%TPI-^b&e^P(s~24D&R z66-E?GS0!u3PI`&Of3)3ke}4au8p$=@|8NnwWzR1c0DH#WQRqnF+w7|76h>yHl)}V zcG*_&Hg-ER3P7>NzOzHK{_>8}w92SftcjYiOP;uF74pB9jiIw>#6GG&9iTswB!MfR z>~G3@yT|(CI{hlqFjo^qW81h>6zpT|jA+4e?AqPnMDkDNwGuY(iR``YMZ<N}jD17a ze!Eo9(*2YtLo1$8t#bY^wmfmkq?6C)NI~B)?kf>3S04kAoH{**Icc)Uq~+N;a$TM7 z^Te3G@j|=R#NJTGK*yH2U@&(7Y{IeM+FVL*o4PV&hBpB!`lv9EUde?FgcS`yA8iMv z*fqmG@SDEy+y0@yiw}4XxLlI&<|#6jJQ3ja=kvb)zpp~$Q5CN?9#*l}WFN2xf1}qi ex=GS`BMWOMaSFL0+&dpq=Irw)z&XCVVDo<yIpul) literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw new file mode 100644 index 0000000000000000000000000000000000000000..ce7faa502b858e99908bcdb397b776258205e1d5 GIT binary patch literal 468 zcmYk2ze^)g5XWb;8h;dS5Fr7Dh^EjYViZM*LR8di#1tYyISz|ku3q=S79u{D6wk=I zU?u(=f(r_HvMOqGf`yTwL`89(=88k^4$0mNLGfG6cVLFkcNp8Y?F5fQ2w)Tde661v zA>(mlgCI3pM%UYB$vrh9+XHNgTvMYh>&7q1g=xfqoHJL>v=bK_oV*Y_#xgthrX_$x zk=?RqHTShwDriZRQ`%sb>wPA#)8er|>zVMY+pfRlzO>Lg-}j;6Ouvy1^?-J@W;Dwr zh~X?JL3WDg3C>QkuOy(Cz2D+G0r_U~$nfcMX3da8daJ0-dS5O=A1WLXmNL1lC1Y<` zG<l6mhh`Q?T-nQvNG?sLCjm%Qp6J4;7&2F-$@vA+Bu~_vyi3_z40ac=))6t_tq9z| zefVV+_gDQMRguD~(+QALI=K4sT?|9uq=EoSM@e<+!75nXDp}9g1y0#fu*HIS>xU}H zio}TkTR*G5^X{9FA5UXrek_f(Dm%ge{zcRKQTBarR}@zApFT*{1~02#Vb0G@fo<c# G=av6&joI)3 literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw new file mode 100644 index 0000000000000000000000000000000000000000..6503a988abdac06f9aa88f0a65f2525e12233b0a GIT binary patch literal 868 zcma)4L2DC16n>krZCZ#4rO<$dgqlM|B1ucd5-YJ)(Sw+Slu!}T!yY`YJFv$tYmjZq zy5K>?Kj1O9hD6B7TCH9z^k5_?QBk@bSv|$5X~tQj(A|Ri4sZD8@xJ-K_r^3$v+@I# zZaI~2s02=>jY@*!-V8W)A4-!XL;z+1fJsxT5>Y;^tYE4tBeTn67w|h(iQb#mui{s# zGFGsXn|MQ05`drU7Rtx5MbC+q9rWozT>dJ$%-0+*PWf=ihliYUjfcKQyZV~9)lZf7 zweF>|vjKo~Lw}=hiN(t)p)Q@EC@akrh&-*40V$PeFXu;FR$SgLo*hx&GR9!=nfzLK zBnPCIOUf|9gZ5oMi2}j>`Z|4@Ci;^?3(t9li9R9!_9%D%&hQ`Bt_!X#`HDuOGwV0< zOA3m}2Y4QqCyP<_y=#U0&1wWmnM8*+G_p@rkDXt{$?$6axL~Q7+-U$DL-P|f#*4Zo zs+omFydTX6H8K%iz0`lGPW#H-J=mQtW53thcDI^#cB7*n6!M@U=X({t7>(*pc0>#d zqhk3WKsG#1#O=deV+6|Cet__J(>stU-$*BYc<-*oauAHVL5!xcWo*z>W(-XJ0RQYf zToZ2ap#a=@(L3+|Id4O4E=NPPlQ|j`^~ZLzLj$yBhnW4j!<b#&VN7qbk3FhinQr!g Q%eipz445W;xT|db1oCUYi~s-t literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw deleted file mode 100644 index 2c6ff655ded2a5855ca8f4428d559a7727eb6983..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 516 zcmXYu&r2IY6vyAXZffw5pki|H5Mn5LNHL07>yK(hDFtZ?MS?}4mxbPR-GRMz=a9oB zvMhKKFZ~nNlM5cQb+xr81!+kMl-SZG(_HkTQj62K>Vuhi^XB_L@6C*D+jh>&LL6WM z0E9M5jkxi9eVsI^(KS)(c}ad!Be^-u-jeUs=qdWy6LL(A42pq#X1-iV5sza!I8I=? z6*P9huZ0loz}XH=zA6FaYU~GVsO6;rsjAI!8P!wTWYN=~C=bxrhB8;BLgK<t>5cO9 zE_#aD5dEUpq>p-w_SG~xWD@0RR2DrFWrutZ1v!s>DqfI?a~7ETjdPBr+OZTuH6@AC z(ZjWOrXk1m6wV#`csWUbg<S05l@fNKy~zCI-!P=K;!dTH=NHLHY^N|T`E)Eli`VOy zXZrX<JiJvfU!`LUi=<PYX;b<z8ryjj>92AHT^9%NWrR81f%$hA&aB$5Egq>cDWST( zc->gqQ~#`>AP(+S1e4QsXD~2Tw+*bS<ym#BVIA|Qh_Ms!0d@E>_ZG54!{z}tj_%g2 yBd9#fH`^=I`DR3A`}nB*Qt<bJXK#eyC7f7Y1R<hXy90%ch1YX{k^Ou0?eZVP-{Nrq diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw deleted file mode 100644 index e34780a3a2c9b22bd10a1d5a405e344faaff94f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 484 zcmX9*OG_g`5Uz2YXi!K{AwfI@4Wb8^4I;k92Z}6+5k#W02QLkK9j9Rq9_&L7ZDbtq zqIePigaaNjIzCSdixLS)RFt&2cybqA?5!~cU5~H6s_N>tZQD+`9S{Z>1OTb`GBa#G zt*_G(GaClinx^RkGo#yGe2LyNvnlO${H9mTj3XK78TZswjJl#0BPWZ(PsE3m63x5< zkjV2pUL={H-<6y`Ayi}y>qBYR=+mmu*E{2X*HV!;FJ=@olMU=1D<ODc<ds9CLcd-$ z>r@&PjmS*9G|11z5fTzEKTW^U3gc6Jd}Rz>i=xwezWi&|RKrFLb)7MgiLyt(A5Nap z{K@){_&;%jkXDHiVLej|v^%t)8c;mepB%?^+SRc((Td402KNZ-pIe~y>R7ebhG=Mi zG0>h98oCZ15CogOAHb`XKiHDrNJxngrv+CGHM`_x1(RWLh67mGTp&(0SUJnJ3Rcm& z65UvCM_?B@w(a-w1uqM*d0DnQmyjJzmTIyi$x?vuV|+aEM~V$8raq+<d#HFpKI8Y< TrM$1pedcB-0FmP|Qr7<gpRvyd diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw deleted file mode 100644 index 6dfa68eabb48a44bc50a0b7fe678f80b5cdadfd5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 884 zcmbO*VZwx6znM3*zuWbbc>}|{T|byNFuntcu)ljL%WQZ+mqCDm!Ipu6;eU~3V}(G) z)1IEv*Nqh-wp}v*rH>jbBxag+CYIi8tdMCvtb4iiLSuyrP%%U4@y^4{5elUTUitue zX}kV1zgeMB@;wb?e$qQsz5yDa7md&LZpVHg=sf!J_y7O@JCCC3MmNn6O*f`#F9Vqv z7z}TB-s^mk)*WlWc%#VeB{R^K4n=mY2TH71*@5gLW0fCW5#rwtE0nzG_7G`&2(+1j z^JK|w#)BnHMOPatgqTY?U(N!mY&}rQ*?HpSA)o@o1D(fOzm+<nIxr2*L4>_q@(;fW zM0l~75#+LxB322Y6D>~^XEszY3zR4TNud&(Zi&XnApZb;9>@yvd6AdOpO@EwLaZ!6 zURtAtZ&ax{|MmzQ#>0))0j|L4)MR$nc&P@I1gq#goYrU^7F8<D?99Qc0Tkum9?hnC z<0UJQxdVt9UOxNx|35U+e}LlL@EtPG428#w!sB}PYd6D(zT3NJ{ntz5XB1D{p$v=~ zex(Cxuk3*?6kyolzy`EX=>cjO8KZ@=5gH#e8KmvtVCcKiccAY<-;2HrFU^6@7H3!h z3Ku8<vnHQs0MoP2GwgQ?c+I!pG2k_4TIZ3MC;k8v&C4(UUyA>KdG*i#|1Vel1t!i1 c|DR2GeH)mmfB<AnScn_LgbA;YKtv!U0PUT%*8l(j diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf index 8fc9564ebb..47ac07798b 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf +++ b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf @@ -22,10 +22,10 @@ # [Binaries.Ia32] - RAW|ResetVector.ia32.raw|* + RAW|IA32/ResetVector.ia32.raw|* [Binaries.X64] - RAW|ResetVector.x64.raw|* + RAW|X64/PageTable2M/ResetVector.x64.raw|* [UserExtensions.TianoCore."ExtraFiles"] ResetVectorExtra.uni diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf new file mode 100644 index 0000000000..75705cd344 --- /dev/null +++ b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector1G.inf @@ -0,0 +1,31 @@ +## @file +# Reset Vector binary +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ResetVector + MODULE_UNI_FILE = ResetVector.uni + FILE_GUID = 1BA0062E-C779-4582-8566-336AE8F78F09 + MODULE_TYPE = SEC + VERSION_STRING = 1.1 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Binaries.Ia32] + RAW|IA32/ResetVector.ia32.raw|* + +[Binaries.X64] + RAW|X64/PageTable1G/ResetVector.x64.raw|* + +[UserExtensions.TianoCore."ExtraFiles"] + ResetVectorExtra.uni diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw new file mode 100644 index 0000000000000000000000000000000000000000..279ba03b0c01f552a0d3ed8900e06b91f2555901 GIT binary patch literal 12292 zcmeI&+i#oo0mkts4Go0>4qZpX=tz11%2=TdhrvQ2P!8c7PF+^UX)tetZH!=pH%^Zg z70DEZNZf$9;~&6W5#XW^3Pp^YRpNq96(~?GYU&$$gElnPylKDiKWus}#UDH0_!sB7 zvLnyT%*?Ex?{-yQ$_2^=$_2^=$_2^=$_2^=$_2^=$_2^=$_2^={;wA}z+YE5x^%P9 z7*tPjW2vJtsAY6C2GvVPV^GJ@(HPWnIvRuOqoXmX<LPJ&Y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&2Ya_|><kvMHCJtpY~N8orFYwkscfvgeNW%H`#Q^Ki+!|MD~{`I zsSM3m-aWXyvTptzOQ{SO_f}LkSB6sD7_6+zq4C4r?tt147timF;&HRu+wE4??d$Am zpSIv{-qTmp``>%x@cGqB&+6*z`r_Xy#e=GcUML>bui4Q)sW`hmyx{8W3Qg~u&h-5B z!Rfu78_!X@_?hCP8b>cnPig6L^ivzJ{NtFff9IRre_6Y)9`BsE`>OHI@@ngY&a%#b z7N6=aR*rPLiw`Ybomc!(v&C0;Z0(0*Yxj(;{a~y$-(8rQId*z^T`o{AP%cm|P%cm| pP%cm|P%cm|P%cm|@V~ae;x~uCf8V(MuIn^2vv}axcaFWE{1))d6p#P_ literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw new file mode 100644 index 0000000000000000000000000000000000000000..9b09a80f225736a413b7146b0e7bd4aafc73abe1 GIT binary patch literal 12292 zcmeI&TaT0n0mkuXS=a)$%ob6$1>NOPOO>TS?QuaD5Zs;w6>+83+N$HB2ko-cj*9Y3 zR!jz(brR!+@k4mYS}u5+EluG@5-&uFW|e4I-W$1T)ELHh;oqd6p?N3S`Mop$*>`rH ztC`JoI-Smjxo%h0rCOj`pjx0>pjx0>pjx0>pjx0>pjx0>pjx0>;C;QoWnNwB=)z&C zF{qyMV4<Tis6})%2GvVPV^E9fXbfrz9gRWt(a{*xEp#*nwUmy=pqA0m7}Rn)8iV=( z9gRWVN=IW*x6#oU)CxKpgR0Td7*szUjX~W`M`KVc>1Yh<gLE_owTh0$pgu%LV^ANa zqcNz}bTkGvKu2RxchJ!o)SYxR2DOHc#-P^H(HPW6=x7Y;qjWR|HAqKeP(ySy2DOfk z#-P^I(HPVQIvRu8NJnE(chS)p)W_&(4C-z=8iU$IM`KX;(9syw$LVMc>JxM{2DO=v z#-N7jXbfr#9gRWVO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X?p9b5O-*t)Z0 z>)sq|&vpO#p7Y;)mg>4%pjx0>pjx0>pjx0>pjx0>pjx0>pjzPlvcUYGuPuD6yz#m6 S(7}D`bmnJo-gD#b&i?@{82-Ef literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw new file mode 100644 index 0000000000000000000000000000000000000000..d9b051ff06d1d30b0dfd585e05e75c98ebd88b03 GIT binary patch literal 12292 zcmeI&No<sL9LDjd3`;?ADxy?DDT|5=+Jc~nO9hv@f*V%cw{hR<jE?(n(hxJEwTTB~ zJbLjaH)}ocm<pm7Nj!)lnyS$-jA@J{h>9KGfv*W2je6GiJ<MnR^Ub{T{(sZMOf&uc z{r&TXYc-`uI)QWo=>*aVq!UOdkWL_-KsteR0_g<O38WK9C-9%1z&GqJv9o?RG0>={ z<W9X~pi$%K7-&?6j)6vvr(>W|6X+Od)I>T48a0WIfkrjcG0>>VbPP0V3LOKDI*5*e zMjcGYK%=J8G0><(=on~JmX3i&wa_ups6*)(Xw)=11{!r39RrP;PRBr_4yR+FQAf}* z(5M-73^b~hj)6uUNyk8=j-q3rQ8VcnXw)n^1{!rV9RrOzhK_+o&8B0ZQEhY#G-?hV z1C5$X$3Uaz(J|1d`E(34>R37k8g(2U1C2VKj)6ukpkts>C(tp_s1xZJXw*q`3^eLw zItCiGkdA>yokGVzqfVt`pi%8~3^b~Pj)6ukqGO;@i|H6>)M<1KG-?SQ1C3fr$3UY_ zr(>W|XV5XwsAY5vH0n$`1{$@Tj)6v<MaMv+&Zc9aQRmPx(5Q3i7-&={9RrOzkB)&x zt)OF|Q7h>fXw><13^eKjItChbAsqvax`>W}Ms?9K(5Q>)7--ZbbPP1=QaT12br~H4 zjk=tUfks_H$3UZ2(J|1d)pQIr>Pk8W8g&&N1C6?xj)6v9L&rd)uBBt3QETWJXw-Fd z3^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FABc{a%3Ct literal 0 HcmV?d00001 diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw similarity index 56% rename from UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw rename to UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw index 6c0bcc47ebff84830b59047790c70d96e9488296..0e53a574fab74db6973d7ea41a6a495266a4d0ae 100644 GIT binary patch literal 28676 zcmeI*`@iM)RoC&AhK2&t38m6#D@l_eMJzNyu#grOl$OXfa;c#Re7Fq?-biQcc!M>B z0MnLqpei@Tk5z7pGAP<W)h<X=OGPQ55UAjS(Ae~-G@un~>A2H8;eP=3=kb{H+-GK9 z-+lIbe)vB2JRWoA;>C*>Z`hYF$MGB&I4*Ep;JCnXf#U+l1&#|G7dS3(T;RCCae?Ck zzo!?t;nJh;|8Ho%fph$Of#1`A@W&T-T;RCCae?Ck#|4fH92Yn)a9rTHz;S`&0>7^o zc)+WDAg+7YqX#0nSlnz5<BCTf9C{`fi<`}1JVwvtVsW!Mj4Sm_E*3YN!+1A6lZ(a8 z<}e<sXL7N)*&N1IdL|c(o6TXoyPnC#;%0LgkJB@`Slnz5<303DE*3YN!+1|UlZ(a8 z<}lt%&*WlpvpI}Epl5QixY-=Wd+V88EN(W3@pwIxi^a|6Fiz>2Tr6%jhjF!@$;IMk za~SWVXL7N)*&N0b^h_=mH=DzFUp<qH#m(k0o~UPXvAEeB#vjx(xmet64&(jwOfD8T zo5OgLp2@}HW^)+V=$TwBZZ?PUhxAM?7B`#2_``Z87mJ(CVLVyS<YIBNIgF?1nOrPx zHiz*?^h_=mH=DzFe?60n#m(k0uGKTSSlnz5<2pT)i^a|6FrFHRbGZLAxmet64&!<~ zlZ(a8<}hy1Gr3sYY!2f_J(G*Y&E_yZK+oi2akDv$KdNVPvAEeB#s}(|Tr6%jhw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!Afc-4JgaMgXDf7RK!aP#5(z4gXBPU72M<jL><xHvrWL;v%%{x6Nr BvabLD diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw similarity index 56% rename from UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw rename to UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw index a78d5b407c8a106c221af127216d073cf8fdb99d..865846da42a45c16b69746f16963d47a6c6e71b0 100644 GIT binary patch literal 28676 zcmeI*_qU~YRmbriA`xs85hW^0AgEZPfZc#@MKpG77_ohAV{b8|qoVFHMjgO7_O4%h z?}aETTLTE#ut%|MjfLUbuwZ9ANnWny-+<>?YtHN3d+z%=b3XTnXPvv&+_`Y!!i8)0 zrAu)<jtd+YI4*Ep;JCnXf#U+l1&#|G7dS3(T;RCCae<fW1+Mwgd*1(F(|jK1_;Z1m z>Tmq<#T^$oE^u7nxWI9N;{wM8jtd+YI4*Ep;JCp5s|D`#YVVAz@4k0uBo~XD&0$=2 z*PTPp<YIBNIgEShnOrPxHivP!p2@}HW^))Xqi1rlxY-=Wz4c5k7B`#2xI)k5VsW!M zjF;6jxmet64&y$0CKrpF&0*YE&*WlpvpI~H(=)kP+-wfx<@HQ17B`#2cm+L^i^a|6 zFkVs5<YIBNIgD4*Gr3sYY!2g;p2@}HW^))<>X}?DZZ?PU%6cXji<`}1+)vNsVsW!M zj91Y!xmet64&(lMCKrpF&0)N%p2@}HW^)*?re|`oxY-=W1N2NT7B`#2xJu9DVsW!M zj91q)xmet64&ycSOfD8To5OfbJ(G*Y&E_y3sAqDqxY-=WYw4L>EN(W3@!EPO7mJ(C zVLV9B<YIBNIgG3IOfD8To5Of;9FD{FpUK7IW^))1(KESN+-wfx8a<PX#m(k09;#<@ zvAEeB#_Q;rTr6%jhw-|4CKrpF&0)Nrp2@}HW^))1(=)kP+-wfx_4Q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64.serial.raw similarity index 56% rename from UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw rename to UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.serial.raw index 61c71349a8a599916f3eeae8c5dee92efb56db71..f1d6536cec924d0e167cf1ee4e9309ed5fd7ad60 100644 GIT binary patch literal 28676 zcmeI*d-SE}RnYOBPA_S-OsLgHTW#7@C}J^bX{DCprWFh*Pz6gYw+Gb08;W5D$18h` z5vMI70*Z*>qj<q90WS@y+Kp*T!3$MXf)(5l!A=K9Y_$|f^Ycveajj->sei+H{y3lW z{APXM^S=9>wcd4Rt@+J8_uO;O&HLmej_Wvq;{=WqI8NX=f#U>@6F5%bIDz8?juSXe z;5dQf1b$Xe;O2WD{r-P*^X;7D-wXV#e&df9cbvd+0>=p)Cvcp=aRSE)94By`z;Ob{ z2^=Tzb7}$)x!Q-~rVl)OD3XiC&E_z!yZYqNGr3sYY!2gbdL|c(o6TXI(lfbO+-wfx z@p>i~i<`}1JVDRoVsW!Mj3?@uTr6%jhw&smlZ(a8<}j|;Gr3sYY!2hedL|c(o6TW7 zMbG47akDv$pQmSXvAEeB#?RL?xmet64&$kMCKrpF&0&0qp2@}HW^)*)^-L}nH=Dz_ zLC@r3akDv$57jfdSlnz5<7s*(7mJ(CVf+F;lZ(a8<}jYFXL7N)*&N0%)HAtQ+-wfx z7wMT?EN(W3@eDnai^a|6FmBW{xmet64&xW=nOrPxHiz*`^h_=mH=DzFrk=^g;%0Lg z&(brwSlnz5<Cp50Tr6%jhw;nwOfD8To5Ogvp2@}HW^))f>6u(CZZ?PUoH(q*{h!Ij z;%0Lg&($-zSlnz5<7PdRi^a|6FrKGpa<RDC9L6u#Gr3sYY!2hY^h_=mH=D!wa6OZY z#m(k0p08(evAEeB#z*LxTr6%jhw&@)OfD8To5T1>J(G*Y&E_zErJl*f;%0LgFVHi& zSlnz5<D>LUE*3YN!}wKtCKrpF&0*Z4XL7N)*&N2LdL|c(o6T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HrsdZ+qPr zUiqjqr>}eRnR`C$a6KFj?aVu#beNVK<DPuX;Vf^NM}9E3U2{y&zGnLu9^;vN9v64r ze^=i%cRg^|TTWhbn5#=qjXJ!?&o3@lC-CZc=zrnA?0X*e>weB}jn}{MWe<MP>p$^j z58iO*;u}u#y@!kU<R`D3Jo?JXOW%9t%E>M7JAA3bjNX3F;bkBC7rNV@_NLpP_Qu<v j_J-Rp&Xu=6c;CbCb@e@7{+Tb1OP3z}mY;w3OP78Y>oK+# diff --git a/UefiCpuPkg/ResetVector/Vtf0/Build.py b/UefiCpuPkg/ResetVector/Vtf0/Build.py index b791d32762..197680addf 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/Build.py +++ b/UefiCpuPkg/ResetVector/Vtf0/Build.py @@ -6,45 +6,84 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # -import glob import os import subprocess import sys +PAGE_TABLE_2M = 'PageTable2M' +PAGE_TABLE_1G = 'PageTable1G' +FILE_FORMAT = '.raw' +ALL_RAW_FORMAT = '*' + FILE_FORMAT +IA32 = 'IA32' +X64 = 'X64' + +# Pre-Define a Macros for Page Table +PAGE_TABLES = { + PAGE_TABLE_2M : "PAGE_TABLE_2M", + PAGE_TABLE_1G : "PAGE_TABLE_1G" +} + def RunCommand(commandLine): - #print ' '.join(commandLine) return subprocess.call(commandLine) -for filename in glob.glob(os.path.join('Bin', '*.raw')): - os.remove(filename) +# Check for all raw binaries and delete them +for root, dirs, files in os.walk('Bin'): + for file in files: + if file.endswith(FILE_FORMAT): + os.remove(os.path.join(root, file)) for arch in ('ia32', 'x64'): for debugType in (None, 'port80', 'serial'): - output = os.path.join('Bin', 'ResetVector') - output += '.' + arch - if debugType is not None: - output += '.' + debugType - output += '.raw' - commandLine = ( - 'nasm', - '-D', 'ARCH_%s' % arch.upper(), - '-D', 'DEBUG_%s' % str(debugType).upper(), - '-o', output, - 'Vtf0.nasmb', - ) - print(f"Command : {' '.join(commandLine)}") - ret = RunCommand(commandLine) - if ret != 0: - print(f"something went wrong while executing {commandLine[-1]}") - sys.exit() - print('\tASM\t' + output) - - commandLine = ( - 'python', - 'Tools/FixupForRawSection.py', - output, - ) - print('\tFIXUP\t' + output) - ret = RunCommand(commandLine) - if ret != 0: sys.exit(ret) + for pageTable in PAGE_TABLES.keys(): + ret = True + if arch.lower() == X64.lower(): + directory = os.path.join('Bin', X64, pageTable) + else: + directory = os.path.join('Bin', IA32) + + # output raw binary name with arch type + fileName = 'ResetVector' + '.' + arch + + if debugType is not None: + fileName += '.' + debugType + fileName += FILE_FORMAT + + output = os.path.join(directory, fileName) + + # if the directory not exists then create it + if not os.path.isdir(directory): + os.makedirs(directory) + + # Prepare the command to execute the nasmb + commandLine = ( + 'c:\\nasm\\nasm', + '-D', 'ARCH_%s' % arch.upper(), + '-D', 'DEBUG_%s' % str(debugType).upper(), + '-D', PAGE_TABLES[pageTable].upper(), + '-o', output, + 'Vtf0.nasmb', + ) + + print(f"Command : {' '.join(commandLine)}") + + try: + ret = RunCommand(commandLine) + except FileNotFoundError: + print("NASM not found") + except: + pass + + if ret != 0: + print(f"something went wrong while executing {commandLine[-1]}") + sys.exit() + print('\tASM\t' + output) + + commandLine = ( + 'python', + 'Tools/FixupForRawSection.py', + output, + ) + print('\tFIXUP\t' + output) + ret = RunCommand(commandLine) + if ret != 0: sys.exit(ret) diff --git a/UefiCpuPkg/ResetVector/Vtf0/PageTables.inc b/UefiCpuPkg/ResetVector/Vtf0/PageTables.inc new file mode 100644 index 0000000000..31958ae878 --- /dev/null +++ b/UefiCpuPkg/ResetVector/Vtf0/PageTables.inc @@ -0,0 +1,20 @@ +;------------------------------------------------------------------------------ +; @file +; Definitions of Page Table Entry for the reset vector module +; +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;------------------------------------------------------------------------------ + +%define PAGE_PRESENT 0x01 +%define PAGE_READ_WRITE 0x02 +%define PAGE_USER_SUPERVISOR 0x04 +%define PAGE_WRITE_THROUGH 0x08 +%define PAGE_CACHE_DISABLE 0x010 +%define PAGE_ACCESSED 0x020 +%define PAGE_DIRTY 0x040 +%define PAGE_SIZE 0x080 +%define PAGE_GLOBAL 0x0100 +%define PAGE_2M_PAT 0x01000 + diff --git a/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt b/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt index e6e5b54243..97f4600968 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt +++ b/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt @@ -29,7 +29,7 @@ EBP/RBP - Pointer to the start of the Boot Firmware Volume === HOW TO BUILD VTF0 === Dependencies: -* Python 2.5~2.7 +* Python 3 or newer * Nasm 2.03 or newer To rebuild the VTF0 binaries: diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb index 493738c79c..2cdaa14507 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb @@ -35,8 +35,14 @@ %include "PostCodes.inc" +%include "PageTables.inc" + %ifdef ARCH_X64 -%include "X64/PageTables.asm" + %ifdef PAGE_TABLE_1G + %include "X64/1GPageTables.asm" + %else + %include "X64/2MPageTables.asm" + %endif %endif %ifdef DEBUG_PORT80 diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm b/UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm new file mode 100644 index 0000000000..19bd3d5a92 --- /dev/null +++ b/UefiCpuPkg/ResetVector/Vtf0/X64/1GPageTables.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------ +; @file +; Emits Page Tables for 1:1 mapping of the addresses 0 - 0x8000000000 (512GB) +; +; Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +; SPDX-License-Identifier: BSD-2-Clause-Patent +; Linear-Address Translation to a 1-GByte Page +; +;------------------------------------------------------------------------------ + +BITS 64 + +%define ALIGN_TOP_TO_4K_FOR_PAGING + +%define PAGE_PDP_ATTR (PAGE_ACCESSED + \ + PAGE_READ_WRITE + \ + PAGE_PRESENT) + +%define PAGE_PDP_1G_ATTR (PAGE_ACCESSED + \ + PAGE_READ_WRITE + \ + PAGE_DIRTY + \ + PAGE_PRESENT + \ + PAGE_SIZE) + +%define PGTBLS_OFFSET(x) ((x) - TopLevelPageDirectory) +%define PGTBLS_ADDR(x) (ADDR_OF(TopLevelPageDirectory) + (x)) + +%define PDP(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \ + PAGE_PDP_ATTR) + +%define PDP_1G(x) ((x << 30) + PAGE_PDP_1G_ATTR) + +ALIGN 16 + +TopLevelPageDirectory: + + ; + ; Top level Page Directory Pointers (1 * 512GB entry) + ; + DQ PDP(0x1000) + + TIMES 0x1000-PGTBLS_OFFSET($) DB 0 + ; + ; Next level Page Directory Pointers (512 * 1GB entries => 512GB) + ; +%assign i 0 +%rep 512 + DQ PDP_1G(i) + %assign i i+1 +%endrep + TIMES 0x2000-PGTBLS_OFFSET($) DB 0 + +EndOfPageTables: diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm b/UefiCpuPkg/ResetVector/Vtf0/X64/2MPageTables.asm similarity index 74% rename from UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm rename to UefiCpuPkg/ResetVector/Vtf0/X64/2MPageTables.asm index 5bc3093f90..b97df384ac 100644 --- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm +++ b/UefiCpuPkg/ResetVector/Vtf0/X64/2MPageTables.asm @@ -11,19 +11,7 @@ BITS 64 %define ALIGN_TOP_TO_4K_FOR_PAGING -%define PAGE_PRESENT 0x01 -%define PAGE_READ_WRITE 0x02 -%define PAGE_USER_SUPERVISOR 0x04 -%define PAGE_WRITE_THROUGH 0x08 -%define PAGE_CACHE_DISABLE 0x010 -%define PAGE_ACCESSED 0x020 -%define PAGE_DIRTY 0x040 -%define PAGE_PAT 0x080 -%define PAGE_GLOBAL 0x0100 -%define PAGE_2M_MBO 0x080 -%define PAGE_2M_PAT 0x01000 - -%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \ +%define PAGE_2M_PDE_ATTR (PAGE_SIZE + \ PAGE_ACCESSED + \ PAGE_DIRTY + \ PAGE_READ_WRITE + \ -- 2.30.2.windows.1
|
|
Re: [PATCH 1/2] MdePkg: Introduce TdProtocol for TD-Guest firmware
Min Xu
Hi, Liming
toggle quoted messageShow quoted text
TD Protocol is defined in below spec (Section 4.3.2) https://software.intel.com/content/dam/develop/external/us/en/documents/intel-tdx-guest-hypervisor-communication-interface.pdf This patch-set is the detailed implementation of TD Protocol. The spec is being updated. Because there are other updates besides the TD Protocol, it need more time to complete the updating. Thanks for your understanding.
-----Original Message-----
|
|