public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
@ 2017-06-29  8:32 Ruiyu Ni
  2017-06-29  8:32 ` [PATCH 1/3] MdePkg: Add ResetNotification protocol definition Ruiyu Ni
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Ruiyu Ni @ 2017-06-29  8:32 UTC (permalink / raw)
  To: edk2-devel

Ruiyu Ni (3):
  MdePkg: Add ResetNotification protocol definition
  MdeModulePkg/ResetSystem: Remove unnecessary global variable
  MdeModulePkg/ResetSystem: Implement ResetNotification protocol

 .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 146 +++++++++++++++++++--
 .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 ++-
 .../ResetSystemRuntimeDxe.inf                      |   5 +-
 MdePkg/Include/Protocol/ResetNotification.h        |  86 ++++++++++++
 MdePkg/MdePkg.dec                                  |   3 +
 5 files changed, 247 insertions(+), 14 deletions(-)
 create mode 100644 MdePkg/Include/Protocol/ResetNotification.h

-- 
2.12.2.windows.2



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

* [PATCH 1/3] MdePkg: Add ResetNotification protocol definition
  2017-06-29  8:32 [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
@ 2017-06-29  8:32 ` Ruiyu Ni
  2017-06-29 14:10   ` Zeng, Star
  2017-06-29  8:32 ` [PATCH 2/3] MdeModulePkg/ResetSystem: Remove unnecessary global variable Ruiyu Ni
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Ruiyu Ni @ 2017-06-29  8:32 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 MdePkg/Include/Protocol/ResetNotification.h | 86 +++++++++++++++++++++++++++++
 MdePkg/MdePkg.dec                           |  3 +
 2 files changed, 89 insertions(+)
 create mode 100644 MdePkg/Include/Protocol/ResetNotification.h

diff --git a/MdePkg/Include/Protocol/ResetNotification.h b/MdePkg/Include/Protocol/ResetNotification.h
new file mode 100644
index 0000000000..ade0eee34a
--- /dev/null
+++ b/MdePkg/Include/Protocol/ResetNotification.h
@@ -0,0 +1,86 @@
+/** @file
+  EFI Reset Notification Protocol as defined in UEFI 2.7.
+  This protocol provides services to register for a notification when ResetSystem is called.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials are licensed and made available under
+  the terms and conditions of the BSD License that accompanies this distribution.
+  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.7
+
+**/
+
+#ifndef __EFI_RESET_NOTIFICATION_H__
+#define __EFI_RESET_NOTIFICATION_H__
+
+#define EFI_RESET_NOTIFICATION_PROTOCOL_GUID \
+  { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } }
+
+typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL EFI_RESET_NOTIFICATION_PROTOCOL;
+
+/**
+  Register a notification function to be called when ResetSystem() is called.
+
+  The RegisterResetNotify() function registers a notification function that is called when
+  ResetSystem()is called and prior to completing the reset of the platform.
+  The registered functions must not perform a platform reset themselves. These
+  notifications are intended only for the notification of components which may need some
+  special-purpose maintenance prior to the platform resetting.
+  The list of registered reset notification functions are processed if ResetSystem()is called
+  before ExitBootServices(). The list of registered reset notification functions is ignored if
+  ResetSystem()is called after ExitBootServices().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     Points to the function to be called when a ResetSystem() is executed.
+
+  @retval EFI_SUCCESS           The reset notification function was successfully registered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to register the reset notification function.
+  @retval EFI_ALREADY_STARTED   The reset notification function specified by ResetFunction has already been registered.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REGISTER_RESET_NOTIFY) (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+);
+
+/**
+  Unregister a notification function.
+
+  The UnregisterResetNotify() function removes the previously registered
+  notification using RegisterResetNotify().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     The pointer to the ResetFunction being unregistered.
+
+  @retval EFI_SUCCESS           The reset notification function was unregistered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously
+                                registered using RegisterResetNotify().
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNREGISTER_RESET_NOTIFY) (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+);
+
+typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL {
+  EFI_REGISTER_RESET_NOTIFY   RegisterResetNotify;
+  EFI_UNREGISTER_RESET_NOTIFY UnRegisterResetNotify;
+} EFI_RESET_NOTIFICATION_PROTOCOL;
+
+
+extern EFI_GUID gEfiResetNotificationProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 4abbbd8888..2bdfebf36f 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1669,6 +1669,9 @@ [Protocols]
   ## Include/Protocol/HttpBootCallback.h
   gEfiHttpBootCallbackProtocolGuid   = {0xba23b311, 0x343d, 0x11e6, {0x91, 0x85, 0x58, 0x20, 0xb1, 0xd6, 0x52, 0x99}}
 
+  ## Include/Protocol/ResetNotification.h
+  gEfiResetNotificationProtocolGuid         = { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } }
+
   #
   # Protocols defined in Shell2.0
   #
-- 
2.12.2.windows.2



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

* [PATCH 2/3] MdeModulePkg/ResetSystem: Remove unnecessary global variable
  2017-06-29  8:32 [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
  2017-06-29  8:32 ` [PATCH 1/3] MdePkg: Add ResetNotification protocol definition Ruiyu Ni
@ 2017-06-29  8:32 ` Ruiyu Ni
  2017-06-29 14:11   ` Zeng, Star
  2017-06-29  8:32 ` [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
  2017-07-01 21:04 ` [PATCH 0/3] " Laszlo Ersek
  3 siblings, 1 reply; 14+ messages in thread
From: Ruiyu Ni @ 2017-06-29  8:32 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
index f61e65e151..64f2da5ce9 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
@@ -1,7 +1,7 @@
 /** @file
   Reset Architectural Protocol implementation
 
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -15,11 +15,6 @@
 
 #include "ResetSystem.h"
 
-//
-// The handle onto which the Reset Architectural Protocol is installed
-//
-EFI_HANDLE  mResetHandle = NULL;
-
 /**
   The driver's entry point.
 
@@ -40,6 +35,7 @@ InitializeResetSystem (
   )
 {
   EFI_STATUS  Status;
+  EFI_HANDLE  Handle;
 
   //
   // Make sure the Reset Architectural Protocol is not already installed in the system
@@ -54,8 +50,9 @@ InitializeResetSystem (
   //
   // Now install the Reset RT AP on a new handle
   //
+  Handle = NULL;
   Status = gBS->InstallMultipleProtocolInterfaces (
-                  &mResetHandle,
+                  &Handle,
                   &gEfiResetArchProtocolGuid,
                   NULL,
                   NULL
-- 
2.12.2.windows.2



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

* [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-06-29  8:32 [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
  2017-06-29  8:32 ` [PATCH 1/3] MdePkg: Add ResetNotification protocol definition Ruiyu Ni
  2017-06-29  8:32 ` [PATCH 2/3] MdeModulePkg/ResetSystem: Remove unnecessary global variable Ruiyu Ni
@ 2017-06-29  8:32 ` Ruiyu Ni
  2017-06-29 14:30   ` Zeng, Star
  2017-07-01 21:04 ` [PATCH 0/3] " Laszlo Ersek
  3 siblings, 1 reply; 14+ messages in thread
From: Ruiyu Ni @ 2017-06-29  8:32 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 137 ++++++++++++++++++++-
 .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 +++-
 .../ResetSystemRuntimeDxe.inf                      |   5 +-
 3 files changed, 155 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
index 64f2da5ce9..36c3238301 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
@@ -16,6 +16,121 @@
 #include "ResetSystem.h"
 
 /**
+  Register a notification function to be called when ResetSystem() is called.
+
+  The RegisterResetNotify() function registers a notification function that is called when
+  ResetSystem()is called and prior to completing the reset of the platform.
+  The registered functions must not perform a platform reset themselves. These
+  notifications are intended only for the notification of components which may need some
+  special-purpose maintenance prior to the platform resetting.
+  The list of registered reset notification functions are processed if ResetSystem()is called
+  before ExitBootServices(). The list of registered reset notification functions is ignored if
+  ResetSystem()is called after ExitBootServices().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     Points to the function to be called when a ResetSystem() is executed.
+
+  @retval EFI_SUCCESS           The reset notification function was successfully registered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to register the reset notification function.
+  @retval EFI_ALREADY_STARTED   The reset notification function specified by ResetFunction has already been registered.
+
+**/
+EFI_STATUS
+EFIAPI
+RegisterResetNotify (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+  )
+{
+  RESET_NOTIFICATION_INSTANCE        *Instance;
+  LIST_ENTRY                         *Link;
+  RESET_NOTIFY_ENTRY                 *Entry;
+
+  if (ResetFunction == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Instance = RESET_NOTIFICATION_INSTANCE_FROM_THIS (This);
+
+  for ( Link = GetFirstNode (&Instance->ResetNotifies)
+      ; !IsNull (&Instance->ResetNotifies, Link)
+      ; Link = GetNextNode (&Instance->ResetNotifies, Link)
+      ) {
+    Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
+    if (Entry->ResetNotify == ResetFunction) {
+      return EFI_ALREADY_STARTED;
+    }
+  }
+
+  ASSERT (IsNull (&Instance->ResetNotifies, Link));
+  Entry = AllocatePool (sizeof (*Entry));
+  if (Entry == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  Entry->Signature   = RESET_NOTIFY_ENTRY_SIGNATURE;
+  Entry->ResetNotify = ResetFunction;
+  InsertTailList (&Instance->ResetNotifies, &Entry->Link);
+  return EFI_SUCCESS;
+}
+
+/**
+  Unregister a notification function.
+
+  The UnregisterResetNotify() function removes the previously registered
+  notification using RegisterResetNotify().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     The pointer to the ResetFunction being unregistered.
+
+  @retval EFI_SUCCESS           The reset notification function was unregistered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously
+                                registered using RegisterResetNotify().
+
+**/
+EFI_STATUS
+EFIAPI
+UnregisterResetNotify (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+  )
+{
+  RESET_NOTIFICATION_INSTANCE        *Instance;
+  LIST_ENTRY                         *Link;
+  RESET_NOTIFY_ENTRY                 *Entry;
+
+  if (ResetFunction == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Instance = RESET_NOTIFICATION_INSTANCE_FROM_THIS (This);
+
+  for ( Link = GetFirstNode (&Instance->ResetNotifies)
+      ; !IsNull (&Instance->ResetNotifies, Link)
+      ; Link = GetNextNode (&Instance->ResetNotifies, Link)
+      ) {
+    Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
+    if (Entry->ResetNotify == ResetFunction) {
+      RemoveEntryList (&Entry->Link);
+      FreePool (Entry);
+      return EFI_SUCCESS;
+    }
+  }
+
+  return EFI_INVALID_PARAMETER;
+}
+
+RESET_NOTIFICATION_INSTANCE mResetNotification = {
+  RESET_NOTIFICATION_INSTANCE_SIGNATURE,
+  {
+    RegisterResetNotify,
+    UnregisterResetNotify
+  },
+  INITIALIZE_LIST_HEAD_VARIABLE (mResetNotification.ResetNotifies)
+};
+
+/**
   The driver's entry point.
 
   It initializes the Reset Architectural Protocol.
@@ -53,8 +168,8 @@ InitializeResetSystem (
   Handle = NULL;
   Status = gBS->InstallMultipleProtocolInterfaces (
                   &Handle,
-                  &gEfiResetArchProtocolGuid,
-                  NULL,
+                  &gEfiResetArchProtocolGuid,         NULL,
+                  &gEfiResetNotificationProtocolGuid, &mResetNotification.ResetNotification,
                   NULL
                   );
   ASSERT_EFI_ERROR (Status);
@@ -102,15 +217,27 @@ ResetSystem (
   IN VOID             *ResetData OPTIONAL
   )
 {
-  EFI_STATUS    Status;
-  UINTN         Size;
-  UINTN         CapsuleDataPtr;
+  EFI_STATUS          Status;
+  UINTN               Size;
+  UINTN               CapsuleDataPtr;
+  LIST_ENTRY          *Link;
+  RESET_NOTIFY_ENTRY  *Entry;
   
   //
   // Indicate reset system runtime service is called.
   //
   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM));
 
+  if (!EfiAtRuntime ()) {
+    for ( Link = GetFirstNode (&mResetNotification.ResetNotifies)
+        ; !IsNull (&mResetNotification.ResetNotifies, Link)
+        ; Link = GetNextNode (&mResetNotification.ResetNotifies, Link)
+        ) {
+      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
+      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);
+    }
+  }
+
   switch (ResetType) {
   case EfiResetWarm:
 
diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
index c3a2a7f127..73e657d4e0 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -19,6 +19,7 @@
 #include <PiDxe.h>
 
 #include <Protocol/Reset.h>
+#include <Protocol/ResetNotification.h>
 #include <Guid/CapsuleVendor.h>
 
 #include <Library/BaseLib.h>
@@ -31,6 +32,24 @@
 #include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/ResetSystemLib.h>
 #include <Library/ReportStatusCodeLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+typedef struct {
+  UINT32                   Signature;
+  LIST_ENTRY               Link;
+  EFI_RESET_SYSTEM         ResetNotify;
+} RESET_NOTIFY_ENTRY;
+#define RESET_NOTIFY_ENTRY_SIGNATURE    SIGNATURE_32('r', 's', 't', 'n')
+#define RESET_NOTIFY_ENTRY_FROM_LINK(a) CR (a, RESET_NOTIFY_ENTRY, Link, RESET_NOTIFY_ENTRY_SIGNATURE)
+
+typedef struct {
+  UINT32                          Signature;
+  EFI_RESET_NOTIFICATION_PROTOCOL ResetNotification;
+  LIST_ENTRY                      ResetNotifies;
+} RESET_NOTIFICATION_INSTANCE;
+#define RESET_NOTIFICATION_INSTANCE_SIGNATURE    SIGNATURE_32('r', 's', 't', 'i')
+#define RESET_NOTIFICATION_INSTANCE_FROM_THIS(a) \
+  CR (a, RESET_NOTIFICATION_INSTANCE, ResetNotification, RESET_NOTIFICATION_INSTANCE_SIGNATURE)
 
 /**
   The driver's entry point.
diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
index 7ef52b3283..e63dc4467a 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 # This driver implements Reset Architectural Protocol.
 #
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are
 # licensed and made available under the terms and conditions of the BSD License
@@ -48,7 +48,7 @@ [LibraryClasses]
   DebugLib
   BaseLib
   ReportStatusCodeLib
-
+  MemoryAllocationLib
 
 [Guids]
   gEfiCapsuleVendorGuid                         ## SOMETIMES_CONSUMES   ## Variable:L"CapsuleUpdateData"
@@ -56,6 +56,7 @@ [Guids]
 
 [Protocols]
   gEfiResetArchProtocolGuid                     ## PRODUCES
+  gEfiResetNotificationProtocolGuid             ## PRODUCES
 
 
 [Depex]
-- 
2.12.2.windows.2



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

* Re: [PATCH 1/3] MdePkg: Add ResetNotification protocol definition
  2017-06-29  8:32 ` [PATCH 1/3] MdePkg: Add ResetNotification protocol definition Ruiyu Ni
@ 2017-06-29 14:10   ` Zeng, Star
  0 siblings, 0 replies; 14+ messages in thread
From: Zeng, Star @ 2017-06-29 14:10 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Thursday, June 29, 2017 4:32 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [PATCH 1/3] MdePkg: Add ResetNotification protocol definition

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 MdePkg/Include/Protocol/ResetNotification.h | 86 +++++++++++++++++++++++++++++
 MdePkg/MdePkg.dec                           |  3 +
 2 files changed, 89 insertions(+)
 create mode 100644 MdePkg/Include/Protocol/ResetNotification.h

diff --git a/MdePkg/Include/Protocol/ResetNotification.h b/MdePkg/Include/Protocol/ResetNotification.h
new file mode 100644
index 0000000000..ade0eee34a
--- /dev/null
+++ b/MdePkg/Include/Protocol/ResetNotification.h
@@ -0,0 +1,86 @@
+/** @file
+  EFI Reset Notification Protocol as defined in UEFI 2.7.
+  This protocol provides services to register for a notification when ResetSystem is called.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>  This 
+ program and the accompanying materials are licensed and made available 
+ under  the terms and conditions of the BSD License that accompanies this distribution.
+  The full text of the license may be found at  
+ http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,  
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.7
+
+**/
+
+#ifndef __EFI_RESET_NOTIFICATION_H__
+#define __EFI_RESET_NOTIFICATION_H__
+
+#define EFI_RESET_NOTIFICATION_PROTOCOL_GUID \
+  { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 
+0x44, 0xbe } }
+
+typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL 
+EFI_RESET_NOTIFICATION_PROTOCOL;
+
+/**
+  Register a notification function to be called when ResetSystem() is called.
+
+  The RegisterResetNotify() function registers a notification function 
+ that is called when  ResetSystem()is called and prior to completing the reset of the platform.
+  The registered functions must not perform a platform reset 
+ themselves. These  notifications are intended only for the 
+ notification of components which may need some  special-purpose maintenance prior to the platform resetting.
+  The list of registered reset notification functions are processed if 
+ ResetSystem()is called  before ExitBootServices(). The list of 
+ registered reset notification functions is ignored if  ResetSystem()is called after ExitBootServices().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     Points to the function to be called when a ResetSystem() is executed.
+
+  @retval EFI_SUCCESS           The reset notification function was successfully registered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to register the reset notification function.
+  @retval EFI_ALREADY_STARTED   The reset notification function specified by ResetFunction has already been registered.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REGISTER_RESET_NOTIFY) (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+);
+
+/**
+  Unregister a notification function.
+
+  The UnregisterResetNotify() function removes the previously 
+ registered  notification using RegisterResetNotify().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     The pointer to the ResetFunction being unregistered.
+
+  @retval EFI_SUCCESS           The reset notification function was unregistered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously
+                                registered using RegisterResetNotify().
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNREGISTER_RESET_NOTIFY) (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+);
+
+typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL {
+  EFI_REGISTER_RESET_NOTIFY   RegisterResetNotify;
+  EFI_UNREGISTER_RESET_NOTIFY UnRegisterResetNotify; } 
+EFI_RESET_NOTIFICATION_PROTOCOL;
+
+
+extern EFI_GUID gEfiResetNotificationProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 4abbbd8888..2bdfebf36f 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1669,6 +1669,9 @@ [Protocols]
   ## Include/Protocol/HttpBootCallback.h
   gEfiHttpBootCallbackProtocolGuid   = {0xba23b311, 0x343d, 0x11e6, {0x91, 0x85, 0x58, 0x20, 0xb1, 0xd6, 0x52, 0x99}}
 
+  ## Include/Protocol/ResetNotification.h
+  gEfiResetNotificationProtocolGuid         = { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } }
+
   #
   # Protocols defined in Shell2.0
   #
--
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH 2/3] MdeModulePkg/ResetSystem: Remove unnecessary global variable
  2017-06-29  8:32 ` [PATCH 2/3] MdeModulePkg/ResetSystem: Remove unnecessary global variable Ruiyu Ni
@ 2017-06-29 14:11   ` Zeng, Star
  0 siblings, 0 replies; 14+ messages in thread
From: Zeng, Star @ 2017-06-29 14:11 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Thursday, June 29, 2017 4:32 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH 2/3] MdeModulePkg/ResetSystem: Remove unnecessary global variable

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
index f61e65e151..64f2da5ce9 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
@@ -1,7 +1,7 @@
 /** @file
   Reset Architectural Protocol implementation
 
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License @@ -15,11 +15,6 @@
 
 #include "ResetSystem.h"
 
-//
-// The handle onto which the Reset Architectural Protocol is installed -// -EFI_HANDLE  mResetHandle = NULL;
-
 /**
   The driver's entry point.
 
@@ -40,6 +35,7 @@ InitializeResetSystem (
   )
 {
   EFI_STATUS  Status;
+  EFI_HANDLE  Handle;
 
   //
   // Make sure the Reset Architectural Protocol is not already installed in the system @@ -54,8 +50,9 @@ InitializeResetSystem (
   //
   // Now install the Reset RT AP on a new handle
   //
+  Handle = NULL;
   Status = gBS->InstallMultipleProtocolInterfaces (
-                  &mResetHandle,
+                  &Handle,
                   &gEfiResetArchProtocolGuid,
                   NULL,
                   NULL
--
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-06-29  8:32 ` [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
@ 2017-06-29 14:30   ` Zeng, Star
  2017-06-30  1:27     ` Ni, Ruiyu
  0 siblings, 1 reply; 14+ messages in thread
From: Zeng, Star @ 2017-06-29 14:30 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Zeng, Star

How about to also update the description in ResetSystemRuntimeDxe.inf/ResetSystem.c/ResetSystemRuntimeDxe.uni? :)
For example in *.inf:
# This driver implements Reset Architectural Protocol.
->
# This driver implements Reset Architectural and Notification Protocol.

With that update, Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: Ni, Ruiyu 
Sent: Thursday, June 29, 2017 4:32 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>
Subject: [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 137 ++++++++++++++++++++-  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 +++-
 .../ResetSystemRuntimeDxe.inf                      |   5 +-
 3 files changed, 155 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
index 64f2da5ce9..36c3238301 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
@@ -16,6 +16,121 @@
 #include "ResetSystem.h"
 
 /**
+  Register a notification function to be called when ResetSystem() is called.
+
+  The RegisterResetNotify() function registers a notification function 
+ that is called when  ResetSystem()is called and prior to completing the reset of the platform.
+  The registered functions must not perform a platform reset 
+ themselves. These  notifications are intended only for the 
+ notification of components which may need some  special-purpose maintenance prior to the platform resetting.
+  The list of registered reset notification functions are processed if 
+ ResetSystem()is called  before ExitBootServices(). The list of 
+ registered reset notification functions is ignored if  ResetSystem()is called after ExitBootServices().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     Points to the function to be called when a ResetSystem() is executed.
+
+  @retval EFI_SUCCESS           The reset notification function was successfully registered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to register the reset notification function.
+  @retval EFI_ALREADY_STARTED   The reset notification function specified by ResetFunction has already been registered.
+
+**/
+EFI_STATUS
+EFIAPI
+RegisterResetNotify (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+  )
+{
+  RESET_NOTIFICATION_INSTANCE        *Instance;
+  LIST_ENTRY                         *Link;
+  RESET_NOTIFY_ENTRY                 *Entry;
+
+  if (ResetFunction == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Instance = RESET_NOTIFICATION_INSTANCE_FROM_THIS (This);
+
+  for ( Link = GetFirstNode (&Instance->ResetNotifies)
+      ; !IsNull (&Instance->ResetNotifies, Link)
+      ; Link = GetNextNode (&Instance->ResetNotifies, Link)
+      ) {
+    Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
+    if (Entry->ResetNotify == ResetFunction) {
+      return EFI_ALREADY_STARTED;
+    }
+  }
+
+  ASSERT (IsNull (&Instance->ResetNotifies, Link));
+  Entry = AllocatePool (sizeof (*Entry));
+  if (Entry == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  Entry->Signature   = RESET_NOTIFY_ENTRY_SIGNATURE;
+  Entry->ResetNotify = ResetFunction;
+  InsertTailList (&Instance->ResetNotifies, &Entry->Link);
+  return EFI_SUCCESS;
+}
+
+/**
+  Unregister a notification function.
+
+  The UnregisterResetNotify() function removes the previously 
+ registered  notification using RegisterResetNotify().
+
+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
+  @param[in]  ResetFunction     The pointer to the ResetFunction being unregistered.
+
+  @retval EFI_SUCCESS           The reset notification function was unregistered.
+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
+  @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously
+                                registered using RegisterResetNotify().
+
+**/
+EFI_STATUS
+EFIAPI
+UnregisterResetNotify (
+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
+  IN EFI_RESET_SYSTEM                ResetFunction
+  )
+{
+  RESET_NOTIFICATION_INSTANCE        *Instance;
+  LIST_ENTRY                         *Link;
+  RESET_NOTIFY_ENTRY                 *Entry;
+
+  if (ResetFunction == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Instance = RESET_NOTIFICATION_INSTANCE_FROM_THIS (This);
+
+  for ( Link = GetFirstNode (&Instance->ResetNotifies)
+      ; !IsNull (&Instance->ResetNotifies, Link)
+      ; Link = GetNextNode (&Instance->ResetNotifies, Link)
+      ) {
+    Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
+    if (Entry->ResetNotify == ResetFunction) {
+      RemoveEntryList (&Entry->Link);
+      FreePool (Entry);
+      return EFI_SUCCESS;
+    }
+  }
+
+  return EFI_INVALID_PARAMETER;
+}
+
+RESET_NOTIFICATION_INSTANCE mResetNotification = {
+  RESET_NOTIFICATION_INSTANCE_SIGNATURE,
+  {
+    RegisterResetNotify,
+    UnregisterResetNotify
+  },
+  INITIALIZE_LIST_HEAD_VARIABLE (mResetNotification.ResetNotifies)
+};
+
+/**
   The driver's entry point.
 
   It initializes the Reset Architectural Protocol.
@@ -53,8 +168,8 @@ InitializeResetSystem (
   Handle = NULL;
   Status = gBS->InstallMultipleProtocolInterfaces (
                   &Handle,
-                  &gEfiResetArchProtocolGuid,
-                  NULL,
+                  &gEfiResetArchProtocolGuid,         NULL,
+                  &gEfiResetNotificationProtocolGuid, 
+ &mResetNotification.ResetNotification,
                   NULL
                   );
   ASSERT_EFI_ERROR (Status);
@@ -102,15 +217,27 @@ ResetSystem (
   IN VOID             *ResetData OPTIONAL
   )
 {
-  EFI_STATUS    Status;
-  UINTN         Size;
-  UINTN         CapsuleDataPtr;
+  EFI_STATUS          Status;
+  UINTN               Size;
+  UINTN               CapsuleDataPtr;
+  LIST_ENTRY          *Link;
+  RESET_NOTIFY_ENTRY  *Entry;
   
   //
   // Indicate reset system runtime service is called.
   //
   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM));
 
+  if (!EfiAtRuntime ()) {
+    for ( Link = GetFirstNode (&mResetNotification.ResetNotifies)
+        ; !IsNull (&mResetNotification.ResetNotifies, Link)
+        ; Link = GetNextNode (&mResetNotification.ResetNotifies, Link)
+        ) {
+      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
+      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);
+    }
+  }
+
   switch (ResetType) {
   case EfiResetWarm:
 
diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
index c3a2a7f127..73e657d4e0 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License @@ -19,6 +19,7 @@  #include <PiDxe.h>
 
 #include <Protocol/Reset.h>
+#include <Protocol/ResetNotification.h>
 #include <Guid/CapsuleVendor.h>
 
 #include <Library/BaseLib.h>
@@ -31,6 +32,24 @@
 #include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/ResetSystemLib.h>
 #include <Library/ReportStatusCodeLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+typedef struct {
+  UINT32                   Signature;
+  LIST_ENTRY               Link;
+  EFI_RESET_SYSTEM         ResetNotify;
+} RESET_NOTIFY_ENTRY;
+#define RESET_NOTIFY_ENTRY_SIGNATURE    SIGNATURE_32('r', 's', 't', 'n')
+#define RESET_NOTIFY_ENTRY_FROM_LINK(a) CR (a, RESET_NOTIFY_ENTRY, 
+Link, RESET_NOTIFY_ENTRY_SIGNATURE)
+
+typedef struct {
+  UINT32                          Signature;
+  EFI_RESET_NOTIFICATION_PROTOCOL ResetNotification;
+  LIST_ENTRY                      ResetNotifies;
+} RESET_NOTIFICATION_INSTANCE;
+#define RESET_NOTIFICATION_INSTANCE_SIGNATURE    SIGNATURE_32('r', 's', 't', 'i')
+#define RESET_NOTIFICATION_INSTANCE_FROM_THIS(a) \
+  CR (a, RESET_NOTIFICATION_INSTANCE, ResetNotification, 
+RESET_NOTIFICATION_INSTANCE_SIGNATURE)
 
 /**
   The driver's entry point.
diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
index 7ef52b3283..e63dc4467a 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe
+++ .inf
@@ -1,7 +1,7 @@
 ## @file
 # This driver implements Reset Architectural Protocol.
 #
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights 
+reserved.<BR>
 #
 # This program and the accompanying materials are  # licensed and made available under the terms and conditions of the BSD License @@ -48,7 +48,7 @@ [LibraryClasses]
   DebugLib
   BaseLib
   ReportStatusCodeLib
-
+  MemoryAllocationLib
 
 [Guids]
   gEfiCapsuleVendorGuid                         ## SOMETIMES_CONSUMES   ## Variable:L"CapsuleUpdateData"
@@ -56,6 +56,7 @@ [Guids]
 
 [Protocols]
   gEfiResetArchProtocolGuid                     ## PRODUCES
+  gEfiResetNotificationProtocolGuid             ## PRODUCES
 
 
 [Depex]
--
2.12.2.windows.2



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

* Re: [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-06-29 14:30   ` Zeng, Star
@ 2017-06-30  1:27     ` Ni, Ruiyu
  0 siblings, 0 replies; 14+ messages in thread
From: Ni, Ruiyu @ 2017-06-30  1:27 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org

I fully agree. Sorry I missed that part.
I will update all of them before checking the code in.

Regards,
Ray

>-----Original Message-----
>From: Zeng, Star
>Sent: Thursday, June 29, 2017 10:30 PM
>To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
>Cc: Zeng, Star <star.zeng@intel.com>
>Subject: RE: [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
>
>How about to also update the description in ResetSystemRuntimeDxe.inf/ResetSystem.c/ResetSystemRuntimeDxe.uni? :)
>For example in *.inf:
># This driver implements Reset Architectural Protocol.
>->
># This driver implements Reset Architectural and Notification Protocol.
>
>With that update, Reviewed-by: Star Zeng <star.zeng@intel.com>
>
>Thanks,
>Star
>-----Original Message-----
>From: Ni, Ruiyu
>Sent: Thursday, June 29, 2017 4:32 PM
>To: edk2-devel@lists.01.org
>Cc: Zeng, Star <star.zeng@intel.com>
>Subject: [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
>Cc: Star Zeng <star.zeng@intel.com>
>---
> .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 137
>++++++++++++++++++++-  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 +++-
> .../ResetSystemRuntimeDxe.inf                      |   5 +-
> 3 files changed, 155 insertions(+), 8 deletions(-)
>
>diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
>b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
>index 64f2da5ce9..36c3238301 100644
>--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
>+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
>@@ -16,6 +16,121 @@
> #include "ResetSystem.h"
>
> /**
>+  Register a notification function to be called when ResetSystem() is called.
>+
>+  The RegisterResetNotify() function registers a notification function
>+ that is called when  ResetSystem()is called and prior to completing the reset of the platform.
>+  The registered functions must not perform a platform reset
>+ themselves. These  notifications are intended only for the
>+ notification of components which may need some  special-purpose maintenance prior to the platform resetting.
>+  The list of registered reset notification functions are processed if
>+ ResetSystem()is called  before ExitBootServices(). The list of
>+ registered reset notification functions is ignored if  ResetSystem()is called after ExitBootServices().
>+
>+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
>+  @param[in]  ResetFunction     Points to the function to be called when a ResetSystem() is executed.
>+
>+  @retval EFI_SUCCESS           The reset notification function was successfully registered.
>+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
>+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to register the reset notification function.
>+  @retval EFI_ALREADY_STARTED   The reset notification function specified by ResetFunction has already been
>registered.
>+
>+**/
>+EFI_STATUS
>+EFIAPI
>+RegisterResetNotify (
>+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
>+  IN EFI_RESET_SYSTEM                ResetFunction
>+  )
>+{
>+  RESET_NOTIFICATION_INSTANCE        *Instance;
>+  LIST_ENTRY                         *Link;
>+  RESET_NOTIFY_ENTRY                 *Entry;
>+
>+  if (ResetFunction == NULL) {
>+    return EFI_INVALID_PARAMETER;
>+  }
>+
>+  Instance = RESET_NOTIFICATION_INSTANCE_FROM_THIS (This);
>+
>+  for ( Link = GetFirstNode (&Instance->ResetNotifies)
>+      ; !IsNull (&Instance->ResetNotifies, Link)
>+      ; Link = GetNextNode (&Instance->ResetNotifies, Link)
>+      ) {
>+    Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
>+    if (Entry->ResetNotify == ResetFunction) {
>+      return EFI_ALREADY_STARTED;
>+    }
>+  }
>+
>+  ASSERT (IsNull (&Instance->ResetNotifies, Link));
>+  Entry = AllocatePool (sizeof (*Entry));
>+  if (Entry == NULL) {
>+    return EFI_OUT_OF_RESOURCES;
>+  }
>+  Entry->Signature   = RESET_NOTIFY_ENTRY_SIGNATURE;
>+  Entry->ResetNotify = ResetFunction;
>+  InsertTailList (&Instance->ResetNotifies, &Entry->Link);
>+  return EFI_SUCCESS;
>+}
>+
>+/**
>+  Unregister a notification function.
>+
>+  The UnregisterResetNotify() function removes the previously
>+ registered  notification using RegisterResetNotify().
>+
>+  @param[in]  This              A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
>+  @param[in]  ResetFunction     The pointer to the ResetFunction being unregistered.
>+
>+  @retval EFI_SUCCESS           The reset notification function was unregistered.
>+  @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
>+  @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously
>+                                registered using RegisterResetNotify().
>+
>+**/
>+EFI_STATUS
>+EFIAPI
>+UnregisterResetNotify (
>+  IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
>+  IN EFI_RESET_SYSTEM                ResetFunction
>+  )
>+{
>+  RESET_NOTIFICATION_INSTANCE        *Instance;
>+  LIST_ENTRY                         *Link;
>+  RESET_NOTIFY_ENTRY                 *Entry;
>+
>+  if (ResetFunction == NULL) {
>+    return EFI_INVALID_PARAMETER;
>+  }
>+
>+  Instance = RESET_NOTIFICATION_INSTANCE_FROM_THIS (This);
>+
>+  for ( Link = GetFirstNode (&Instance->ResetNotifies)
>+      ; !IsNull (&Instance->ResetNotifies, Link)
>+      ; Link = GetNextNode (&Instance->ResetNotifies, Link)
>+      ) {
>+    Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
>+    if (Entry->ResetNotify == ResetFunction) {
>+      RemoveEntryList (&Entry->Link);
>+      FreePool (Entry);
>+      return EFI_SUCCESS;
>+    }
>+  }
>+
>+  return EFI_INVALID_PARAMETER;
>+}
>+
>+RESET_NOTIFICATION_INSTANCE mResetNotification = {
>+  RESET_NOTIFICATION_INSTANCE_SIGNATURE,
>+  {
>+    RegisterResetNotify,
>+    UnregisterResetNotify
>+  },
>+  INITIALIZE_LIST_HEAD_VARIABLE (mResetNotification.ResetNotifies)
>+};
>+
>+/**
>   The driver's entry point.
>
>   It initializes the Reset Architectural Protocol.
>@@ -53,8 +168,8 @@ InitializeResetSystem (
>   Handle = NULL;
>   Status = gBS->InstallMultipleProtocolInterfaces (
>                   &Handle,
>-                  &gEfiResetArchProtocolGuid,
>-                  NULL,
>+                  &gEfiResetArchProtocolGuid,         NULL,
>+                  &gEfiResetNotificationProtocolGuid,
>+ &mResetNotification.ResetNotification,
>                   NULL
>                   );
>   ASSERT_EFI_ERROR (Status);
>@@ -102,15 +217,27 @@ ResetSystem (
>   IN VOID             *ResetData OPTIONAL
>   )
> {
>-  EFI_STATUS    Status;
>-  UINTN         Size;
>-  UINTN         CapsuleDataPtr;
>+  EFI_STATUS          Status;
>+  UINTN               Size;
>+  UINTN               CapsuleDataPtr;
>+  LIST_ENTRY          *Link;
>+  RESET_NOTIFY_ENTRY  *Entry;
>
>   //
>   // Indicate reset system runtime service is called.
>   //
>   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE |
>EFI_SW_RS_PC_RESET_SYSTEM));
>
>+  if (!EfiAtRuntime ()) {
>+    for ( Link = GetFirstNode (&mResetNotification.ResetNotifies)
>+        ; !IsNull (&mResetNotification.ResetNotifies, Link)
>+        ; Link = GetNextNode (&mResetNotification.ResetNotifies, Link)
>+        ) {
>+      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);
>+      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);
>+    }
>+  }
>+
>   switch (ResetType) {
>   case EfiResetWarm:
>
>diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
>b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
>index c3a2a7f127..73e657d4e0 100644
>--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
>+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
>@@ -1,6 +1,6 @@
> /** @file
>
>-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
>+  Copyright (c) 2006 - 2017, Intel Corporation. All rights
>+ reserved.<BR>
>
>   This program and the accompanying materials
>   are licensed and made available under the terms and conditions of the BSD License @@ -19,6 +19,7 @@  #include
><PiDxe.h>
>
> #include <Protocol/Reset.h>
>+#include <Protocol/ResetNotification.h>
> #include <Guid/CapsuleVendor.h>
>
> #include <Library/BaseLib.h>
>@@ -31,6 +32,24 @@
> #include <Library/UefiRuntimeServicesTableLib.h>
> #include <Library/ResetSystemLib.h>
> #include <Library/ReportStatusCodeLib.h>
>+#include <Library/MemoryAllocationLib.h>
>+
>+typedef struct {
>+  UINT32                   Signature;
>+  LIST_ENTRY               Link;
>+  EFI_RESET_SYSTEM         ResetNotify;
>+} RESET_NOTIFY_ENTRY;
>+#define RESET_NOTIFY_ENTRY_SIGNATURE    SIGNATURE_32('r', 's', 't', 'n')
>+#define RESET_NOTIFY_ENTRY_FROM_LINK(a) CR (a, RESET_NOTIFY_ENTRY,
>+Link, RESET_NOTIFY_ENTRY_SIGNATURE)
>+
>+typedef struct {
>+  UINT32                          Signature;
>+  EFI_RESET_NOTIFICATION_PROTOCOL ResetNotification;
>+  LIST_ENTRY                      ResetNotifies;
>+} RESET_NOTIFICATION_INSTANCE;
>+#define RESET_NOTIFICATION_INSTANCE_SIGNATURE    SIGNATURE_32('r', 's', 't', 'i')
>+#define RESET_NOTIFICATION_INSTANCE_FROM_THIS(a) \
>+  CR (a, RESET_NOTIFICATION_INSTANCE, ResetNotification,
>+RESET_NOTIFICATION_INSTANCE_SIGNATURE)
>
> /**
>   The driver's entry point.
>diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
>b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
>index 7ef52b3283..e63dc4467a 100644
>--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
>+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe
>+++ .inf
>@@ -1,7 +1,7 @@
> ## @file
> # This driver implements Reset Architectural Protocol.
> #
>-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
>+# Copyright (c) 2006 - 2017, Intel Corporation. All rights
>+reserved.<BR>
> #
> # This program and the accompanying materials are  # licensed and made available under the terms and conditions of the
>BSD License @@ -48,7 +48,7 @@ [LibraryClasses]
>   DebugLib
>   BaseLib
>   ReportStatusCodeLib
>-
>+  MemoryAllocationLib
>
> [Guids]
>   gEfiCapsuleVendorGuid                         ## SOMETIMES_CONSUMES   ##
>Variable:L"CapsuleUpdateData"
>@@ -56,6 +56,7 @@ [Guids]
>
> [Protocols]
>   gEfiResetArchProtocolGuid                     ## PRODUCES
>+  gEfiResetNotificationProtocolGuid             ## PRODUCES
>
>
> [Depex]
>--
>2.12.2.windows.2



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

* Re: [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-06-29  8:32 [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
                   ` (2 preceding siblings ...)
  2017-06-29  8:32 ` [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
@ 2017-07-01 21:04 ` Laszlo Ersek
  2017-07-03 11:49   ` Ard Biesheuvel
  2017-07-03 12:09   ` Leif Lindholm
  3 siblings, 2 replies; 14+ messages in thread
From: Laszlo Ersek @ 2017-07-01 21:04 UTC (permalink / raw)
  To: Ard Biesheuvel, Leif Lindholm (Linaro address)
  Cc: Ruiyu Ni, edk2-devel, Hao Wu, Jordan Justen (Intel address),
	Andrew Fish

Ard, Leif,

On 06/29/17 10:32, Ruiyu Ni wrote:
> Ruiyu Ni (3):
>   MdePkg: Add ResetNotification protocol definition
>   MdeModulePkg/ResetSystem: Remove unnecessary global variable
>   MdeModulePkg/ResetSystem: Implement ResetNotification protocol
> 
>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 146 +++++++++++++++++++--
>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 ++-
>  .../ResetSystemRuntimeDxe.inf                      |   5 +-
>  MdePkg/Include/Protocol/ResetNotification.h        |  86 ++++++++++++
>  MdePkg/MdePkg.dec                                  |   3 +
>  5 files changed, 247 insertions(+), 14 deletions(-)
>  create mode 100644 MdePkg/Include/Protocol/ResetNotification.h
> 

I think we should
- either port this feature (patch 3/3) to EmbeddedPkg/ResetRuntimeDxe,
- or else rebase all platforms that consume EmbeddedPkg/ResetRuntimeDxe
to MdeModulePkg/Universal/ResetSystemRuntimeDxe, and delete
EmbeddedPkg/ResetRuntimeDxe from the tree.

What do you guys think?

Other producers of gEfiResetArchProtocolGuid could be affected as well
(just from a quick grep):
- DuetPkg/AcpiResetDxe
- EmulatorPkg/ResetRuntimeDxe
- Nt32Pkg/ResetRuntimeDxe

Thanks
Laszlo


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

* Re: [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-07-01 21:04 ` [PATCH 0/3] " Laszlo Ersek
@ 2017-07-03 11:49   ` Ard Biesheuvel
  2017-07-03 12:09   ` Leif Lindholm
  1 sibling, 0 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2017-07-03 11:49 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Leif Lindholm (Linaro address), Ruiyu Ni, edk2-devel@lists.01.org,
	Hao Wu, Jordan Justen (Intel address), Andrew Fish

On 1 July 2017 at 21:04, Laszlo Ersek <lersek@redhat.com> wrote:
> Ard, Leif,
>
> On 06/29/17 10:32, Ruiyu Ni wrote:
>> Ruiyu Ni (3):
>>   MdePkg: Add ResetNotification protocol definition
>>   MdeModulePkg/ResetSystem: Remove unnecessary global variable
>>   MdeModulePkg/ResetSystem: Implement ResetNotification protocol
>>
>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 146 +++++++++++++++++++--
>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 ++-
>>  .../ResetSystemRuntimeDxe.inf                      |   5 +-
>>  MdePkg/Include/Protocol/ResetNotification.h        |  86 ++++++++++++
>>  MdePkg/MdePkg.dec                                  |   3 +
>>  5 files changed, 247 insertions(+), 14 deletions(-)
>>  create mode 100644 MdePkg/Include/Protocol/ResetNotification.h
>>
>
> I think we should
> - either port this feature (patch 3/3) to EmbeddedPkg/ResetRuntimeDxe,
> - or else rebase all platforms that consume EmbeddedPkg/ResetRuntimeDxe
> to MdeModulePkg/Universal/ResetSystemRuntimeDxe, and delete
> EmbeddedPkg/ResetRuntimeDxe from the tree.
>
> What do you guys think?
>

I would happily get rid of EmbeddedPkg/ResetRuntimeDxe, given that I
can't really tell why it is there in the first place. Anyone have a
clue?

> Other producers of gEfiResetArchProtocolGuid could be affected as well
> (just from a quick grep):
> - DuetPkg/AcpiResetDxe
> - EmulatorPkg/ResetRuntimeDxe
> - Nt32Pkg/ResetRuntimeDxe
>
> Thanks
> Laszlo


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

* Re: [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-07-01 21:04 ` [PATCH 0/3] " Laszlo Ersek
  2017-07-03 11:49   ` Ard Biesheuvel
@ 2017-07-03 12:09   ` Leif Lindholm
  2017-07-03 17:30     ` Laszlo Ersek
  1 sibling, 1 reply; 14+ messages in thread
From: Leif Lindholm @ 2017-07-03 12:09 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Ard Biesheuvel, Ruiyu Ni, edk2-devel, Hao Wu,
	Jordan Justen (Intel address), Andrew Fish

On Sat, Jul 01, 2017 at 11:04:08PM +0200, Laszlo Ersek wrote:
> Ard, Leif,
> 
> On 06/29/17 10:32, Ruiyu Ni wrote:
> > Ruiyu Ni (3):
> >   MdePkg: Add ResetNotification protocol definition
> >   MdeModulePkg/ResetSystem: Remove unnecessary global variable
> >   MdeModulePkg/ResetSystem: Implement ResetNotification protocol
> > 
> >  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 146 +++++++++++++++++++--
> >  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 ++-
> >  .../ResetSystemRuntimeDxe.inf                      |   5 +-
> >  MdePkg/Include/Protocol/ResetNotification.h        |  86 ++++++++++++
> >  MdePkg/MdePkg.dec                                  |   3 +
> >  5 files changed, 247 insertions(+), 14 deletions(-)
> >  create mode 100644 MdePkg/Include/Protocol/ResetNotification.h
> > 
> 
> I think we should
> - either port this feature (patch 3/3) to EmbeddedPkg/ResetRuntimeDxe,
> - or else rebase all platforms that consume EmbeddedPkg/ResetRuntimeDxe
> to MdeModulePkg/Universal/ResetSystemRuntimeDxe, and delete
> EmbeddedPkg/ResetRuntimeDxe from the tree.
> 
> What do you guys think?

I think deleting the EmbeddedPkg one, and making the current consumers
implement ResetSystemLib instead of EfiResetSystemLib would be an
improvement.

At a quick skim, the only functionality I can see added in
EmbeddedPkg/ResetRuntimeDxe is the LibInitializeResetSystem
function. The only (ARM) platform I can see doing anything useful
there is the Armada ... and that code could move.

/
    Leif

> Other producers of gEfiResetArchProtocolGuid could be affected as well
> (just from a quick grep):
> - DuetPkg/AcpiResetDxe
> - EmulatorPkg/ResetRuntimeDxe
> - Nt32Pkg/ResetRuntimeDxe
> 
> Thanks
> Laszlo


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

* Re: [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-07-03 12:09   ` Leif Lindholm
@ 2017-07-03 17:30     ` Laszlo Ersek
  2017-07-03 17:31       ` Ard Biesheuvel
  0 siblings, 1 reply; 14+ messages in thread
From: Laszlo Ersek @ 2017-07-03 17:30 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: Ard Biesheuvel, Ruiyu Ni, edk2-devel, Hao Wu,
	Jordan Justen (Intel address), Andrew Fish

On 07/03/17 14:09, Leif Lindholm wrote:
> On Sat, Jul 01, 2017 at 11:04:08PM +0200, Laszlo Ersek wrote:
>> Ard, Leif,
>>
>> On 06/29/17 10:32, Ruiyu Ni wrote:
>>> Ruiyu Ni (3):
>>>   MdePkg: Add ResetNotification protocol definition
>>>   MdeModulePkg/ResetSystem: Remove unnecessary global variable
>>>   MdeModulePkg/ResetSystem: Implement ResetNotification protocol
>>>
>>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 146 +++++++++++++++++++--
>>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 ++-
>>>  .../ResetSystemRuntimeDxe.inf                      |   5 +-
>>>  MdePkg/Include/Protocol/ResetNotification.h        |  86 ++++++++++++
>>>  MdePkg/MdePkg.dec                                  |   3 +
>>>  5 files changed, 247 insertions(+), 14 deletions(-)
>>>  create mode 100644 MdePkg/Include/Protocol/ResetNotification.h
>>>
>>
>> I think we should
>> - either port this feature (patch 3/3) to EmbeddedPkg/ResetRuntimeDxe,
>> - or else rebase all platforms that consume EmbeddedPkg/ResetRuntimeDxe
>> to MdeModulePkg/Universal/ResetSystemRuntimeDxe, and delete
>> EmbeddedPkg/ResetRuntimeDxe from the tree.
>>
>> What do you guys think?
> 
> I think deleting the EmbeddedPkg one, and making the current consumers
> implement ResetSystemLib instead of EfiResetSystemLib would be an
> improvement.

Looks like you and Ard agree this is the best way forward. (I also
agree, I just wasn't sure if it would be your shared preference, due to
the conversion of dependent platforms possibly needing a lot of work.)

Ard, do you want me to file a BZ for the ArmVirtPkg conversion? (I can't
volunteer to actually do the conversion right now; my plate is full.)

Thanks,
Laszlo


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

* Re: [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-07-03 17:30     ` Laszlo Ersek
@ 2017-07-03 17:31       ` Ard Biesheuvel
  2017-07-03 17:36         ` Laszlo Ersek
  0 siblings, 1 reply; 14+ messages in thread
From: Ard Biesheuvel @ 2017-07-03 17:31 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Leif Lindholm, Ruiyu Ni, edk2-devel@lists.01.org, Hao Wu,
	Jordan Justen (Intel address), Andrew Fish

On 3 July 2017 at 18:30, Laszlo Ersek <lersek@redhat.com> wrote:
> On 07/03/17 14:09, Leif Lindholm wrote:
>> On Sat, Jul 01, 2017 at 11:04:08PM +0200, Laszlo Ersek wrote:
>>> Ard, Leif,
>>>
>>> On 06/29/17 10:32, Ruiyu Ni wrote:
>>>> Ruiyu Ni (3):
>>>>   MdePkg: Add ResetNotification protocol definition
>>>>   MdeModulePkg/ResetSystem: Remove unnecessary global variable
>>>>   MdeModulePkg/ResetSystem: Implement ResetNotification protocol
>>>>
>>>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 146 +++++++++++++++++++--
>>>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 ++-
>>>>  .../ResetSystemRuntimeDxe.inf                      |   5 +-
>>>>  MdePkg/Include/Protocol/ResetNotification.h        |  86 ++++++++++++
>>>>  MdePkg/MdePkg.dec                                  |   3 +
>>>>  5 files changed, 247 insertions(+), 14 deletions(-)
>>>>  create mode 100644 MdePkg/Include/Protocol/ResetNotification.h
>>>>
>>>
>>> I think we should
>>> - either port this feature (patch 3/3) to EmbeddedPkg/ResetRuntimeDxe,
>>> - or else rebase all platforms that consume EmbeddedPkg/ResetRuntimeDxe
>>> to MdeModulePkg/Universal/ResetSystemRuntimeDxe, and delete
>>> EmbeddedPkg/ResetRuntimeDxe from the tree.
>>>
>>> What do you guys think?
>>
>> I think deleting the EmbeddedPkg one, and making the current consumers
>> implement ResetSystemLib instead of EfiResetSystemLib would be an
>> improvement.
>
> Looks like you and Ard agree this is the best way forward. (I also
> agree, I just wasn't sure if it would be your shared preference, due to
> the conversion of dependent platforms possibly needing a lot of work.)
>
> Ard, do you want me to file a BZ for the ArmVirtPkg conversion? (I can't
> volunteer to actually do the conversion right now; my plate is full.)
>

I already sent the patch a couple of hours ago, but if we need a BZ
entry as well [for documentation purposes], please go ahead and file
one.


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

* Re: [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol
  2017-07-03 17:31       ` Ard Biesheuvel
@ 2017-07-03 17:36         ` Laszlo Ersek
  0 siblings, 0 replies; 14+ messages in thread
From: Laszlo Ersek @ 2017-07-03 17:36 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Leif Lindholm, Ruiyu Ni, edk2-devel@lists.01.org, Hao Wu,
	Jordan Justen (Intel address), Andrew Fish

On 07/03/17 19:31, Ard Biesheuvel wrote:
> On 3 July 2017 at 18:30, Laszlo Ersek <lersek@redhat.com> wrote:
>> On 07/03/17 14:09, Leif Lindholm wrote:
>>> On Sat, Jul 01, 2017 at 11:04:08PM +0200, Laszlo Ersek wrote:
>>>> Ard, Leif,
>>>>
>>>> On 06/29/17 10:32, Ruiyu Ni wrote:
>>>>> Ruiyu Ni (3):
>>>>>   MdePkg: Add ResetNotification protocol definition
>>>>>   MdeModulePkg/ResetSystem: Remove unnecessary global variable
>>>>>   MdeModulePkg/ResetSystem: Implement ResetNotification protocol
>>>>>
>>>>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 146 +++++++++++++++++++--
>>>>>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |  21 ++-
>>>>>  .../ResetSystemRuntimeDxe.inf                      |   5 +-
>>>>>  MdePkg/Include/Protocol/ResetNotification.h        |  86 ++++++++++++
>>>>>  MdePkg/MdePkg.dec                                  |   3 +
>>>>>  5 files changed, 247 insertions(+), 14 deletions(-)
>>>>>  create mode 100644 MdePkg/Include/Protocol/ResetNotification.h
>>>>>
>>>>
>>>> I think we should
>>>> - either port this feature (patch 3/3) to EmbeddedPkg/ResetRuntimeDxe,
>>>> - or else rebase all platforms that consume EmbeddedPkg/ResetRuntimeDxe
>>>> to MdeModulePkg/Universal/ResetSystemRuntimeDxe, and delete
>>>> EmbeddedPkg/ResetRuntimeDxe from the tree.
>>>>
>>>> What do you guys think?
>>>
>>> I think deleting the EmbeddedPkg one, and making the current consumers
>>> implement ResetSystemLib instead of EfiResetSystemLib would be an
>>> improvement.
>>
>> Looks like you and Ard agree this is the best way forward. (I also
>> agree, I just wasn't sure if it would be your shared preference, due to
>> the conversion of dependent platforms possibly needing a lot of work.)
>>
>> Ard, do you want me to file a BZ for the ArmVirtPkg conversion? (I can't
>> volunteer to actually do the conversion right now; my plate is full.)
>>
> 
> I already sent the patch a couple of hours ago,

Yup, looking at it right now, thanks!

> but if we need a BZ
> entry as well [for documentation purposes], please go ahead and file
> one.

Nah I'm just in the middle of my usual post-PTO email crisis.

Laszlo


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

end of thread, other threads:[~2017-07-03 17:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-29  8:32 [PATCH 0/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
2017-06-29  8:32 ` [PATCH 1/3] MdePkg: Add ResetNotification protocol definition Ruiyu Ni
2017-06-29 14:10   ` Zeng, Star
2017-06-29  8:32 ` [PATCH 2/3] MdeModulePkg/ResetSystem: Remove unnecessary global variable Ruiyu Ni
2017-06-29 14:11   ` Zeng, Star
2017-06-29  8:32 ` [PATCH 3/3] MdeModulePkg/ResetSystem: Implement ResetNotification protocol Ruiyu Ni
2017-06-29 14:30   ` Zeng, Star
2017-06-30  1:27     ` Ni, Ruiyu
2017-07-01 21:04 ` [PATCH 0/3] " Laszlo Ersek
2017-07-03 11:49   ` Ard Biesheuvel
2017-07-03 12:09   ` Leif Lindholm
2017-07-03 17:30     ` Laszlo Ersek
2017-07-03 17:31       ` Ard Biesheuvel
2017-07-03 17:36         ` Laszlo Ersek

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