public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver
@ 2023-05-12  4:06 Chang, Abner
  2023-05-12  4:06 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg Chang, Abner
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Chang, Abner @ 2023-05-12  4:06 UTC (permalink / raw)
  To: devel; +Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang, Tinh Nguyen

From: Abner Chang <abner.chang@amd.com>

IpmiOsWdt is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/OsWdt in order to consolidate
edk2 system manageability support in one place.
Uncustify is applied to C files and no functionalities
are changed in this patch.

We will still keep the one under IpmiFeaturePkg/OsWdt
until the reference to this instance are removed from
platforms.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
---
 .../Universal/IpmiOsWdt/OsWdt.inf             |  33 ++++++
 .../Universal/IpmiOsWdt/OsWdt.c               | 112 ++++++++++++++++++
 2 files changed, 145 insertions(+)
 create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
 create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c

diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
new file mode 100644
index 0000000000..b5af3b25e1
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for IPMI OS watch dog timer driver.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = OsWdt
+  FILE_GUID                      = BA4FD21F-8443-4017-8D13-70EC92F4BD4C
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = DriverInit
+
+[Sources]
+  OsWdt.c
+
+[Packages]
+  ManageabilityPkg/ManageabilityPkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  DebugLib
+  IpmiCommandLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
+
+[Depex]
+  TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
new file mode 100644
index 0000000000..e2bbd95b83
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
@@ -0,0 +1,112 @@
+/** @file
+  IPMI Os watchdog timer Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+BOOLEAN  mOsWdtFlag = FALSE;
+
+EFI_EVENT  mExitBootServicesEvent;
+
+/*++
+
+Routine Description:
+  Enable the OS Boot Watchdog Timer.
+  Is called only on legacy or EFI OS boot.
+
+Arguments:
+  Event    - Event type
+  *Context - Context for the event
+
+Returns:
+  None
+
+--*/
+VOID
+EFIAPI
+EnableEfiOsBootWdtHandler (
+  IN EFI_EVENT  Event,
+  IN VOID       *Context
+  )
+{
+  EFI_STATUS                        Status;
+  IPMI_SET_WATCHDOG_TIMER_REQUEST   SetWatchdogTimer;
+  UINT8                             CompletionCode;
+  IPMI_GET_WATCHDOG_TIMER_RESPONSE  GetWatchdogTimer;
+  static BOOLEAN                    OsWdtEventHandled = FALSE;
+
+  DEBUG ((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
+
+  //
+  // Make sure it processes once only. And proceess it only if OsWdtFlag==TRUE;
+  //
+  if (OsWdtEventHandled || !mOsWdtFlag) {
+    return;
+  }
+
+  OsWdtEventHandled = TRUE;
+
+  Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+  if (EFI_ERROR (Status)) {
+    return;
+  }
+
+  ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer));
+  //
+  // Just flip the Timer Use bit. This should release the timer.
+  //
+  SetWatchdogTimer.TimerUse.Bits.TimerRunning    = 1;
+  SetWatchdogTimer.TimerUse.Bits.TimerUse        = IPMI_WATCHDOG_TIMER_OS_LOADER;
+  SetWatchdogTimer.TimerActions.Uint8            = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
+  SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;
+  SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
+  SetWatchdogTimer.InitialCountdownValue         = 600; // 100ms / count
+
+  Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+  return;
+}
+
+/*++
+
+Routine Description:
+  This is the standard EFI driver point. This function intitializes
+  the private data required for creating ASRR Driver.
+
+Arguments:
+  As required for DXE driver enrty routine.
+  ImageHandle - ImageHandle of the loaded driver
+  SystemTable - Pointer to the System Table
+
+Returns:
+  @retval EFI_SUCCESS           Protocol successfully started and installed.
+  @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
+
+--*/
+EFI_STATUS
+EFIAPI
+DriverInit (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = gBS->CreateEvent (
+                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
+                  TPL_NOTIFY,
+                  EnableEfiOsBootWdtHandler,
+                  NULL,
+                  &mExitBootServicesEvent
+                  );
+
+  return Status;
+}
-- 
2.37.1.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg
  2023-05-12  4:06 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Chang, Abner
@ 2023-05-12  4:06 ` Chang, Abner
  2023-05-12  7:32   ` Nickle Wang
                     ` (2 more replies)
  2023-05-12  7:30 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Nickle Wang
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 8+ messages in thread
From: Chang, Abner @ 2023-05-12  4:06 UTC (permalink / raw)
  To: devel; +Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang

From: Abner Chang <abner.chang@amd.com>

Add IpmiOsWdt to ManageabilityPkg.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
---
 Features/ManageabilityPkg/ManageabilityPkg.dec      | 1 +
 Features/ManageabilityPkg/Include/Manageability.dsc | 4 ++++
 Features/ManageabilityPkg/ManageabilityPkg.dsc      | 2 ++
 Features/ManageabilityPkg/Include/PostMemory.fdf    | 4 ++++
 4 files changed, 11 insertions(+)

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 38813c5f48..0a1c527107 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -79,4 +79,5 @@
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BOOLEAN|0x10000004
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOLEAN|0x10000005
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|FALSE|BOOLEAN|0x10000006
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt|FALSE|BOOLEAN|0x10000008
 
diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc b/Features/ManageabilityPkg/Include/Manageability.dsc
index a432b0ff26..439f3be1ce 100644
--- a/Features/ManageabilityPkg/Include/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Manageability.dsc
@@ -51,3 +51,7 @@
 !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
   ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 !endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt == TRUE
+  ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
+!endif
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index e3baf27f2a..177c900360 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -37,6 +37,7 @@
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable              |TRUE
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable              |TRUE
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|TRUE
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt               |TRUE
 
 #
 # Include common libraries
@@ -53,5 +54,6 @@
 
 [LibraryClasses]
   ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
+  IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
 
 !include Include/Manageability.dsc
diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf b/Features/ManageabilityPkg/Include/PostMemory.fdf
index 9100cb2646..1a2fed2253 100644
--- a/Features/ManageabilityPkg/Include/PostMemory.fdf
+++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
@@ -26,3 +26,7 @@
 !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
   INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 !endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt == TRUE
+  INF ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
+!endif
-- 
2.37.1.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver
  2023-05-12  4:06 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Chang, Abner
  2023-05-12  4:06 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg Chang, Abner
@ 2023-05-12  7:30 ` Nickle Wang
  2023-05-14 17:01 ` [edk2-devel] " Tinh Nguyen
  2023-05-19  3:12 ` Isaac Oram
  3 siblings, 0 replies; 8+ messages in thread
From: Nickle Wang @ 2023-05-12  7:30 UTC (permalink / raw)
  To: abner.chang@amd.com, devel@edk2.groups.io
  Cc: Isaac Oram, Abdul Lateef Attar, Tinh Nguyen

Reviewed-by: Nickle Wang <nicklew@nvidia.com>

Regards,
Nickle

> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Friday, May 12, 2023 12:07 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram <isaac.w.oram@intel.com>; Abdul Lateef Attar
> <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Tinh Nguyen
> <tinhnguyen@os.amperecomputing.com>
> Subject: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS
> Watchdog timer Driver
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang <abner.chang@amd.com>
> 
> IpmiOsWdt is cloned from
> edk2-platforms/Features/Intel/OutOfBandManagement/
> IpmiFeaturePkg/OsWdt in order to consolidate
> edk2 system manageability support in one place.
> Uncustify is applied to C files and no functionalities are changed in this patch.
> 
> We will still keep the one under IpmiFeaturePkg/OsWdt until the reference to this
> instance are removed from platforms.
> 
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
> ---
>  .../Universal/IpmiOsWdt/OsWdt.inf             |  33 ++++++
>  .../Universal/IpmiOsWdt/OsWdt.c               | 112 ++++++++++++++++++
>  2 files changed, 145 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
>  create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
> 
> diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> new file mode 100644
> index 0000000000..b5af3b25e1
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> @@ -0,0 +1,33 @@
> +### @file
> +# Component description file for IPMI OS watch dog timer driver.
> +#
> +# Copyright (c) 2018 - 2019, Intel Corporation. All rights
> +reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ###
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = OsWdt
> +  FILE_GUID                      = BA4FD21F-8443-4017-8D13-70EC92F4BD4C
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = DriverInit
> +
> +[Sources]
> +  OsWdt.c
> +
> +[Packages]
> +  ManageabilityPkg/ManageabilityPkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  DebugLib
> +  IpmiCommandLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +  UefiLib
> +
> +[Depex]
> +  TRUE
> diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
> b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
> new file mode 100644
> index 0000000000..e2bbd95b83
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
> @@ -0,0 +1,112 @@
> +/** @file
> +  IPMI Os watchdog timer Driver.
> +
> +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Uefi.h>
> +#include <Library/DebugLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/IpmiCommandLib.h>
> +#include <IndustryStandard/Ipmi.h>
> +
> +BOOLEAN  mOsWdtFlag = FALSE;
> +
> +EFI_EVENT  mExitBootServicesEvent;
> +
> +/*++
> +
> +Routine Description:
> +  Enable the OS Boot Watchdog Timer.
> +  Is called only on legacy or EFI OS boot.
> +
> +Arguments:
> +  Event    - Event type
> +  *Context - Context for the event
> +
> +Returns:
> +  None
> +
> +--*/
> +VOID
> +EFIAPI
> +EnableEfiOsBootWdtHandler (
> +  IN EFI_EVENT  Event,
> +  IN VOID       *Context
> +  )
> +{
> +  EFI_STATUS                        Status;
> +  IPMI_SET_WATCHDOG_TIMER_REQUEST   SetWatchdogTimer;
> +  UINT8                             CompletionCode;
> +  IPMI_GET_WATCHDOG_TIMER_RESPONSE  GetWatchdogTimer;
> +  static BOOLEAN                    OsWdtEventHandled = FALSE;
> +
> +  DEBUG ((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
> +
> +  //
> +  // Make sure it processes once only. And proceess it only if
> + OsWdtFlag==TRUE;  //  if (OsWdtEventHandled || !mOsWdtFlag) {
> +    return;
> +  }
> +
> +  OsWdtEventHandled = TRUE;
> +
> +  Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);  if (EFI_ERROR
> + (Status)) {
> +    return;
> +  }
> +
> +  ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer));  //  // Just
> + flip the Timer Use bit. This should release the timer.
> +  //
> +  SetWatchdogTimer.TimerUse.Bits.TimerRunning    = 1;
> +  SetWatchdogTimer.TimerUse.Bits.TimerUse        =
> IPMI_WATCHDOG_TIMER_OS_LOADER;
> +  SetWatchdogTimer.TimerActions.Uint8            =
> IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
> +  SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;
> + SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
> +  SetWatchdogTimer.InitialCountdownValue         = 600; // 100ms / count
> +
> +  Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
> +  return;
> +}
> +
> +/*++
> +
> +Routine Description:
> +  This is the standard EFI driver point. This function intitializes
> +  the private data required for creating ASRR Driver.
> +
> +Arguments:
> +  As required for DXE driver enrty routine.
> +  ImageHandle - ImageHandle of the loaded driver
> +  SystemTable - Pointer to the System Table
> +
> +Returns:
> +  @retval EFI_SUCCESS           Protocol successfully started and installed.
> +  @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
> +
> +--*/
> +EFI_STATUS
> +EFIAPI
> +DriverInit (
> +  IN EFI_HANDLE        ImageHandle,
> +  IN EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  Status = gBS->CreateEvent (
> +                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
> +                  TPL_NOTIFY,
> +                  EnableEfiOsBootWdtHandler,
> +                  NULL,
> +                  &mExitBootServicesEvent
> +                  );
> +
> +  return Status;
> +}
> --
> 2.37.1.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg
  2023-05-12  4:06 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg Chang, Abner
@ 2023-05-12  7:32   ` Nickle Wang
  2023-05-14 17:01   ` [edk2-devel] " Tinh Nguyen
  2023-05-19  3:12   ` Isaac Oram
  2 siblings, 0 replies; 8+ messages in thread
From: Nickle Wang @ 2023-05-12  7:32 UTC (permalink / raw)
  To: abner.chang@amd.com, devel@edk2.groups.io; +Cc: Isaac Oram, Abdul Lateef Attar

Reviewed-by: Nickle Wang <nicklew@nvidia.com>

Regards,
Nickle


> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Friday, May 12, 2023 12:07 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram <isaac.w.oram@intel.com>; Abdul Lateef Attar
> <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>
> Subject: [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to
> ManageabilityPkg
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang <abner.chang@amd.com>
> 
> Add IpmiOsWdt to ManageabilityPkg.
> 
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> ---
>  Features/ManageabilityPkg/ManageabilityPkg.dec      | 1 +
>  Features/ManageabilityPkg/Include/Manageability.dsc | 4 ++++
>  Features/ManageabilityPkg/ManageabilityPkg.dsc      | 2 ++
>  Features/ManageabilityPkg/Include/PostMemory.fdf    | 4 ++++
>  4 files changed, 11 insertions(+)
> 
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 38813c5f48..0a1c527107 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -79,4 +79,5 @@
> 
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BO
> OLEAN|0x10000004
> 
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BO
> OLEAN|0x10000005
> 
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEna
> ble|FALSE|BOOLEAN|0x10000006
> +
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt|FALSE|BOO
> LEAN|0x10000008
> 
> diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Manageability.dsc
> index a432b0ff26..439f3be1ce 100644
> --- a/Features/ManageabilityPkg/Include/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Manageability.dsc
> @@ -51,3 +51,7 @@
>  !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable ==
> TRUE
>    ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
>  !endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt ==
> TRUE
> +  ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> +!endif
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index e3baf27f2a..177c900360 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -37,6 +37,7 @@
>    gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable
> |TRUE
>    gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable
> |TRUE
> 
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEna
> ble|TRUE
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt
> |TRUE
> 
>  #
>  # Include common libraries
> @@ -53,5 +54,6 @@
> 
>  [LibraryClasses]
> 
> ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransp
> ortNullLib/BaseManageabilityTransportNull.inf
> +  IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
> 
>  !include Include/Manageability.dsc
> diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf
> b/Features/ManageabilityPkg/Include/PostMemory.fdf
> index 9100cb2646..1a2fed2253 100644
> --- a/Features/ManageabilityPkg/Include/PostMemory.fdf
> +++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
> @@ -26,3 +26,7 @@
>  !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable ==
> TRUE
>    INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
>  !endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt ==
> TRUE
> +  INF ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> +!endif
> --
> 2.37.1.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver
  2023-05-12  4:06 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Chang, Abner
  2023-05-12  4:06 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg Chang, Abner
  2023-05-12  7:30 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Nickle Wang
@ 2023-05-14 17:01 ` Tinh Nguyen
  2023-05-19  3:12 ` Isaac Oram
  3 siblings, 0 replies; 8+ messages in thread
From: Tinh Nguyen @ 2023-05-14 17:01 UTC (permalink / raw)
  To: devel, abner.chang
  Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang, Tinh Nguyen

Reviewed-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>

Regards,

- Tinh

On 12/05/2023 11:06, Chang, Abner via groups.io wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> IpmiOsWdt is cloned from
> edk2-platforms/Features/Intel/OutOfBandManagement/
> IpmiFeaturePkg/OsWdt in order to consolidate
> edk2 system manageability support in one place.
> Uncustify is applied to C files and no functionalities
> are changed in this patch.
>
> We will still keep the one under IpmiFeaturePkg/OsWdt
> until the reference to this instance are removed from
> platforms.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
> ---
>   .../Universal/IpmiOsWdt/OsWdt.inf             |  33 ++++++
>   .../Universal/IpmiOsWdt/OsWdt.c               | 112 ++++++++++++++++++
>   2 files changed, 145 insertions(+)
>   create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
>   create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
>
> diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> new file mode 100644
> index 0000000000..b5af3b25e1
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> @@ -0,0 +1,33 @@
> +### @file
> +# Component description file for IPMI OS watch dog timer driver.
> +#
> +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +###
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = OsWdt
> +  FILE_GUID                      = BA4FD21F-8443-4017-8D13-70EC92F4BD4C
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = DriverInit
> +
> +[Sources]
> +  OsWdt.c
> +
> +[Packages]
> +  ManageabilityPkg/ManageabilityPkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  DebugLib
> +  IpmiCommandLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +  UefiLib
> +
> +[Depex]
> +  TRUE
> diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
> new file mode 100644
> index 0000000000..e2bbd95b83
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
> @@ -0,0 +1,112 @@
> +/** @file
> +  IPMI Os watchdog timer Driver.
> +
> +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Uefi.h>
> +#include <Library/DebugLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/IpmiCommandLib.h>
> +#include <IndustryStandard/Ipmi.h>
> +
> +BOOLEAN  mOsWdtFlag = FALSE;
> +
> +EFI_EVENT  mExitBootServicesEvent;
> +
> +/*++
> +
> +Routine Description:
> +  Enable the OS Boot Watchdog Timer.
> +  Is called only on legacy or EFI OS boot.
> +
> +Arguments:
> +  Event    - Event type
> +  *Context - Context for the event
> +
> +Returns:
> +  None
> +
> +--*/
> +VOID
> +EFIAPI
> +EnableEfiOsBootWdtHandler (
> +  IN EFI_EVENT  Event,
> +  IN VOID       *Context
> +  )
> +{
> +  EFI_STATUS                        Status;
> +  IPMI_SET_WATCHDOG_TIMER_REQUEST   SetWatchdogTimer;
> +  UINT8                             CompletionCode;
> +  IPMI_GET_WATCHDOG_TIMER_RESPONSE  GetWatchdogTimer;
> +  static BOOLEAN                    OsWdtEventHandled = FALSE;
> +
> +  DEBUG ((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
> +
> +  //
> +  // Make sure it processes once only. And proceess it only if OsWdtFlag==TRUE;
> +  //
> +  if (OsWdtEventHandled || !mOsWdtFlag) {
> +    return;
> +  }
> +
> +  OsWdtEventHandled = TRUE;
> +
> +  Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
> +  if (EFI_ERROR (Status)) {
> +    return;
> +  }
> +
> +  ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer));
> +  //
> +  // Just flip the Timer Use bit. This should release the timer.
> +  //
> +  SetWatchdogTimer.TimerUse.Bits.TimerRunning    = 1;
> +  SetWatchdogTimer.TimerUse.Bits.TimerUse        = IPMI_WATCHDOG_TIMER_OS_LOADER;
> +  SetWatchdogTimer.TimerActions.Uint8            = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
> +  SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;
> +  SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
> +  SetWatchdogTimer.InitialCountdownValue         = 600; // 100ms / count
> +
> +  Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
> +  return;
> +}
> +
> +/*++
> +
> +Routine Description:
> +  This is the standard EFI driver point. This function intitializes
> +  the private data required for creating ASRR Driver.
> +
> +Arguments:
> +  As required for DXE driver enrty routine.
> +  ImageHandle - ImageHandle of the loaded driver
> +  SystemTable - Pointer to the System Table
> +
> +Returns:
> +  @retval EFI_SUCCESS           Protocol successfully started and installed.
> +  @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
> +
> +--*/
> +EFI_STATUS
> +EFIAPI
> +DriverInit (
> +  IN EFI_HANDLE        ImageHandle,
> +  IN EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  Status = gBS->CreateEvent (
> +                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
> +                  TPL_NOTIFY,
> +                  EnableEfiOsBootWdtHandler,
> +                  NULL,
> +                  &mExitBootServicesEvent
> +                  );
> +
> +  return Status;
> +}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg
  2023-05-12  4:06 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg Chang, Abner
  2023-05-12  7:32   ` Nickle Wang
@ 2023-05-14 17:01   ` Tinh Nguyen
  2023-05-19  3:12   ` Isaac Oram
  2 siblings, 0 replies; 8+ messages in thread
From: Tinh Nguyen @ 2023-05-14 17:01 UTC (permalink / raw)
  To: devel, abner.chang; +Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang

Reviewed-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>

Regards,

- Tinh

On 12/05/2023 11:06, Chang, Abner via groups.io wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> Add IpmiOsWdt to ManageabilityPkg.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> ---
>   Features/ManageabilityPkg/ManageabilityPkg.dec      | 1 +
>   Features/ManageabilityPkg/Include/Manageability.dsc | 4 ++++
>   Features/ManageabilityPkg/ManageabilityPkg.dsc      | 2 ++
>   Features/ManageabilityPkg/Include/PostMemory.fdf    | 4 ++++
>   4 files changed, 11 insertions(+)
>
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 38813c5f48..0a1c527107 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -79,4 +79,5 @@
>     gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BOOLEAN|0x10000004
>     gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOLEAN|0x10000005
>     gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|FALSE|BOOLEAN|0x10000006
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt|FALSE|BOOLEAN|0x10000008
>   
> diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc b/Features/ManageabilityPkg/Include/Manageability.dsc
> index a432b0ff26..439f3be1ce 100644
> --- a/Features/ManageabilityPkg/Include/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Manageability.dsc
> @@ -51,3 +51,7 @@
>   !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
>     ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
>   !endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt == TRUE
> +  ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> +!endif
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index e3baf27f2a..177c900360 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -37,6 +37,7 @@
>     gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable              |TRUE
>     gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable              |TRUE
>     gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|TRUE
> +  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt               |TRUE
>   
>   #
>   # Include common libraries
> @@ -53,5 +54,6 @@
>   
>   [LibraryClasses]
>     ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
> +  IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
>   
>   !include Include/Manageability.dsc
> diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf b/Features/ManageabilityPkg/Include/PostMemory.fdf
> index 9100cb2646..1a2fed2253 100644
> --- a/Features/ManageabilityPkg/Include/PostMemory.fdf
> +++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
> @@ -26,3 +26,7 @@
>   !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
>     INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
>   !endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt == TRUE
> +  INF ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
> +!endif

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver
  2023-05-12  4:06 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Chang, Abner
                   ` (2 preceding siblings ...)
  2023-05-14 17:01 ` [edk2-devel] " Tinh Nguyen
@ 2023-05-19  3:12 ` Isaac Oram
  3 siblings, 0 replies; 8+ messages in thread
From: Isaac Oram @ 2023-05-19  3:12 UTC (permalink / raw)
  To: devel@edk2.groups.io, abner.chang@amd.com
  Cc: Abdul Lateef Attar, Nickle Wang, Tinh Nguyen

Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang, Abner via groups.io
Sent: Thursday, May 11, 2023 9:07 PM
To: devel@edk2.groups.io
Cc: Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver

From: Abner Chang <abner.chang@amd.com>

IpmiOsWdt is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/OsWdt in order to consolidate
edk2 system manageability support in one place.
Uncustify is applied to C files and no functionalities are changed in this patch.

We will still keep the one under IpmiFeaturePkg/OsWdt until the reference to this instance are removed from platforms.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
---
 .../Universal/IpmiOsWdt/OsWdt.inf             |  33 ++++++
 .../Universal/IpmiOsWdt/OsWdt.c               | 112 ++++++++++++++++++
 2 files changed, 145 insertions(+)
 create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
 create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c

diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
new file mode 100644
index 0000000000..b5af3b25e1
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for IPMI OS watch dog timer driver.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights 
+reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = OsWdt
+  FILE_GUID                      = BA4FD21F-8443-4017-8D13-70EC92F4BD4C
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = DriverInit
+
+[Sources]
+  OsWdt.c
+
+[Packages]
+  ManageabilityPkg/ManageabilityPkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  DebugLib
+  IpmiCommandLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
+
+[Depex]
+  TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
new file mode 100644
index 0000000000..e2bbd95b83
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c
@@ -0,0 +1,112 @@
+/** @file
+  IPMI Os watchdog timer Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+BOOLEAN  mOsWdtFlag = FALSE;
+
+EFI_EVENT  mExitBootServicesEvent;
+
+/*++
+
+Routine Description:
+  Enable the OS Boot Watchdog Timer.
+  Is called only on legacy or EFI OS boot.
+
+Arguments:
+  Event    - Event type
+  *Context - Context for the event
+
+Returns:
+  None
+
+--*/
+VOID
+EFIAPI
+EnableEfiOsBootWdtHandler (
+  IN EFI_EVENT  Event,
+  IN VOID       *Context
+  )
+{
+  EFI_STATUS                        Status;
+  IPMI_SET_WATCHDOG_TIMER_REQUEST   SetWatchdogTimer;
+  UINT8                             CompletionCode;
+  IPMI_GET_WATCHDOG_TIMER_RESPONSE  GetWatchdogTimer;
+  static BOOLEAN                    OsWdtEventHandled = FALSE;
+
+  DEBUG ((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
+
+  //
+  // Make sure it processes once only. And proceess it only if 
+ OsWdtFlag==TRUE;  //  if (OsWdtEventHandled || !mOsWdtFlag) {
+    return;
+  }
+
+  OsWdtEventHandled = TRUE;
+
+  Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);  if (EFI_ERROR 
+ (Status)) {
+    return;
+  }
+
+  ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer));  //  // Just 
+ flip the Timer Use bit. This should release the timer.
+  //
+  SetWatchdogTimer.TimerUse.Bits.TimerRunning    = 1;
+  SetWatchdogTimer.TimerUse.Bits.TimerUse        = IPMI_WATCHDOG_TIMER_OS_LOADER;
+  SetWatchdogTimer.TimerActions.Uint8            = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
+  SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;  
+ SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
+  SetWatchdogTimer.InitialCountdownValue         = 600; // 100ms / count
+
+  Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+  return;
+}
+
+/*++
+
+Routine Description:
+  This is the standard EFI driver point. This function intitializes
+  the private data required for creating ASRR Driver.
+
+Arguments:
+  As required for DXE driver enrty routine.
+  ImageHandle - ImageHandle of the loaded driver
+  SystemTable - Pointer to the System Table
+
+Returns:
+  @retval EFI_SUCCESS           Protocol successfully started and installed.
+  @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
+
+--*/
+EFI_STATUS
+EFIAPI
+DriverInit (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS  Status;
+
+  Status = gBS->CreateEvent (
+                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
+                  TPL_NOTIFY,
+                  EnableEfiOsBootWdtHandler,
+                  NULL,
+                  &mExitBootServicesEvent
+                  );
+
+  return Status;
+}
--
2.37.1.windows.1







^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg
  2023-05-12  4:06 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg Chang, Abner
  2023-05-12  7:32   ` Nickle Wang
  2023-05-14 17:01   ` [edk2-devel] " Tinh Nguyen
@ 2023-05-19  3:12   ` Isaac Oram
  2 siblings, 0 replies; 8+ messages in thread
From: Isaac Oram @ 2023-05-19  3:12 UTC (permalink / raw)
  To: abner.chang@amd.com, devel@edk2.groups.io; +Cc: Abdul Lateef Attar, Nickle Wang

Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>

-----Original Message-----
From: abner.chang@amd.com <abner.chang@amd.com> 
Sent: Thursday, May 11, 2023 9:07 PM
To: devel@edk2.groups.io
Cc: Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg

From: Abner Chang <abner.chang@amd.com>

Add IpmiOsWdt to ManageabilityPkg.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
---
 Features/ManageabilityPkg/ManageabilityPkg.dec      | 1 +
 Features/ManageabilityPkg/Include/Manageability.dsc | 4 ++++
 Features/ManageabilityPkg/ManageabilityPkg.dsc      | 2 ++
 Features/ManageabilityPkg/Include/PostMemory.fdf    | 4 ++++
 4 files changed, 11 insertions(+)

diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 38813c5f48..0a1c527107 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -79,4 +79,5 @@
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BOOLEAN|0x10000004
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOLEAN|0x10000005
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|FALSE|BOOLEAN|0x10000006
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt|FALSE|BOOLEAN|0x10000008
 
diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc b/Features/ManageabilityPkg/Include/Manageability.dsc
index a432b0ff26..439f3be1ce 100644
--- a/Features/ManageabilityPkg/Include/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Manageability.dsc
@@ -51,3 +51,7 @@
 !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
   ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 !endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt == TRUE
+  ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
+!endif
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index e3baf27f2a..177c900360 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -37,6 +37,7 @@
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable              |TRUE
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable              |TRUE
   gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|TRUE
+  gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt               |TRUE
 
 #
 # Include common libraries
@@ -53,5 +54,6 @@
 
 [LibraryClasses]
   ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
+  IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
 
 !include Include/Manageability.dsc
diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf b/Features/ManageabilityPkg/Include/PostMemory.fdf
index 9100cb2646..1a2fed2253 100644
--- a/Features/ManageabilityPkg/Include/PostMemory.fdf
+++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
@@ -26,3 +26,7 @@
 !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
   INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
 !endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiOsWdt == TRUE
+  INF ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf
+!endif
-- 
2.37.1.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-19  3:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12  4:06 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Chang, Abner
2023-05-12  4:06 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiOsWdt: Add to ManageabilityPkg Chang, Abner
2023-05-12  7:32   ` Nickle Wang
2023-05-14 17:01   ` [edk2-devel] " Tinh Nguyen
2023-05-19  3:12   ` Isaac Oram
2023-05-12  7:30 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver Nickle Wang
2023-05-14 17:01 ` [edk2-devel] " Tinh Nguyen
2023-05-19  3:12 ` Isaac Oram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox