public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Bret Barkelew <brbarkel@microsoft.com>,
	Liming Gao <liming.gao@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Star Zeng <star.zeng@intel.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: [PATCH v2 10/10] MdeModulePkg/ResetSystemPei: Add reset notifications in PEI
Date: Fri,  9 Feb 2018 12:16:35 +0800	[thread overview]
Message-ID: <20180209041635.320856-11-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20180209041635.320856-1-ruiyu.ni@intel.com>

From: Bret Barkelew <brbarkel@microsoft.com>

The Reset Notification protocol is added in UEFI spec to support
reset notification mechanism in the DXE phase.
This patch adds similar EDKII specific Reset Notification PPI to PEI
phase to provide the same support.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
 .../Include/Ppi/PlatformSpecificResetFilter.h      |  4 +--
 .../Include/Ppi/PlatformSpecificResetHandler.h     |  4 +--
 .../Ppi/PlatformSpecificResetNotification.h        | 32 ++++++++++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                      |  7 +++--
 MdeModulePkg/MdeModulePkg.uni                      |  5 ++--
 .../Universal/ResetSystemPei/ResetSystem.c         | 16 +++++++++++
 .../Universal/ResetSystemPei/ResetSystem.h         |  1 +
 .../Universal/ResetSystemPei/ResetSystemPei.inf    |  7 +++--
 8 files changed, 65 insertions(+), 11 deletions(-)
 create mode 100644 MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h

diff --git a/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h b/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h
index 0f1432f5f8..1f728387b7 100644
--- a/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h
+++ b/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h
@@ -3,9 +3,9 @@
   for ResetSystem().  A reset filter evaluates the parameters passed to
   ResetSystem() and converts a ResetType of EfiResetPlatformSpecific to a
   non-platform specific reset type.  The registered filters are processed before
-  EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI handlers.
+  EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI handlers.
 
-  Copyright (c) 2017 Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2018 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
diff --git a/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h b/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h
index d5f1350c69..8d938abb02 100644
--- a/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h
+++ b/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h
@@ -1,9 +1,9 @@
 /** @file
   This PPI provides services to register a platform specific handler for
   ResetSystem().  The registered handlers are processed after
-  EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI notifications.
+  EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI notifications.
 
-  Copyright (c) 2017 Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2018 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
diff --git a/MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h b/MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h
new file mode 100644
index 0000000000..cf6d1f18a6
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h
@@ -0,0 +1,32 @@
+/** @file
+  This PPI provides services to register a platform specific notification callback for
+  ResetSystem().  The registered handlers are processed after
+  EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI notifications and before
+  EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI notifications.
+
+  Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 Microsoft 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.
+
+**/
+
+#ifndef _PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_H_
+#define _PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_H_
+
+#include <Protocol/ResetNotification.h>
+
+#define EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_GUID \
+  { 0xe09f355d, 0xdae8, 0x4910, { 0xb1, 0x4a, 0x92, 0x78, 0x0f, 0xdc, 0xf7, 0xcb } }
+
+typedef EFI_RESET_NOTIFICATION_PROTOCOL  EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI;
+
+extern EFI_GUID gEdkiiPlatformSpecificResetNotificationPpiGuid;
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 484ad3fb4d..0695ce607e 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -447,6 +447,9 @@ [Ppis]
   ## Include/Ppi/PlatformSpecificResetFilter.h
   gEdkiiPlatformSpecificResetFilterPpiGuid = { 0x8c9f4de3, 0x7b90, 0x47ef, { 0x93, 0x8, 0x28, 0x7c, 0xec, 0xd6, 0x6d, 0xe8 } }
 
+  ## Include/Ppi/PlatformSpecificResetNotification.h
+  gEdkiiPlatformSpecificResetNotificationPpiGuid = { 0xe09f355d, 0xdae8, 0x4910, { 0xb1, 0x4a, 0x92, 0x78, 0xf, 0xdc, 0xf7, 0xcb } }
+
   ## Include/Ppi/PlatformSpecificResetHandler.h
   gEdkiiPlatformSpecificResetHandlerPpiGuid = { 0x75cf14ae, 0x3441, 0x49dc, { 0xaa, 0x10, 0xbb, 0x35, 0xa7, 0xba, 0x8b, 0xab } }
 
@@ -1422,8 +1425,8 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   # @Prompt CapsuleMax value in capsule report variable.
   gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleMax|0xFFFF|UINT16|0x00000107
 
-  ## Indicates the allowable maximum number of Reset Filters or Reset Handlers in PEI phase.
-  # @Prompt Maximum Number of PEI Reset Filters or Reset Handlers.
+  ## Indicates the allowable maximum number of Reset Filters, Reset Notifications or Reset Handlers in PEI phase.
+  # @Prompt Maximum Number of PEI Reset Filters, Reset Notifications or Reset Handlers.
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaximumPeiResetNotifies|0x10|UINT32|0x00000109
 
 [PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index a63d4764a3..d8cc7416c5 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1059,9 +1059,10 @@
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdCapsuleMax_HELP  #language en-US "CapsuleMax value in capsule report variable."
 
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaximumPeiResetNotifies_PROMPT  #language en-US "Maximum Number of PEI Reset Filters or Reset Handlers."
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaximumPeiResetNotifies_PROMPT  #language en-US "Maximum Number of PEI Reset Filters, Reset Notifications or Reset Handlers."
 
-#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaximumPeiResetNotifies_HELP  #language en-US "Indicates the allowable maximum number of Reset Filters or Reset Handlers in PEI phase."
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaximumPeiResetNotifies_HELP  #language en-US "Indicates the allowable maximum number of Reset Filters, <BR>\n"
+                                                                                            "Reset Notifications or Reset Handlers in PEI phase."
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdRecoveryFileName_PROMPT  #language en-US "Recover file name in PEI phase"
 
diff --git a/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.c b/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.c
index 8d9bd4884a..c2ee592d56 100644
--- a/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.c
+++ b/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.c
@@ -25,6 +25,7 @@ EFI_PEI_RESET2_PPI mPpiReset2 = {
 
 EFI_GUID                *mProcessingOrder[] = {
   &gEdkiiPlatformSpecificResetFilterPpiGuid,
+  &gEdkiiPlatformSpecificResetNotificationPpiGuid,
   &gEdkiiPlatformSpecificResetHandlerPpiGuid
 };
 
@@ -36,6 +37,14 @@ RESET_FILTER_INSTANCE   mResetFilter = {
   &gEdkiiPlatformSpecificResetFilterPpiGuid
 };
 
+RESET_FILTER_INSTANCE   mResetNotification = {
+  {
+    RegisterResetNotify,
+    UnregisterResetNotify
+  },
+  &gEdkiiPlatformSpecificResetNotificationPpiGuid
+};
+
 RESET_FILTER_INSTANCE   mResetHandler = {
   {
     RegisterResetNotify,
@@ -55,6 +64,11 @@ EFI_PEI_PPI_DESCRIPTOR mPpiListReset[] = {
     &gEdkiiPlatformSpecificResetFilterPpiGuid,
     &mResetFilter.ResetFilter
   },
+  {
+    EFI_PEI_PPI_DESCRIPTOR_PPI,
+    &gEdkiiPlatformSpecificResetNotificationPpiGuid,
+    &mResetNotification.ResetFilter
+  },
   {
     EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
     &gEdkiiPlatformSpecificResetHandlerPpiGuid,
@@ -101,6 +115,7 @@ RegisterResetNotify (
 
   ResetFilter = (RESET_FILTER_INSTANCE *) This;
   ASSERT (CompareGuid (ResetFilter->Guid, &gEdkiiPlatformSpecificResetFilterPpiGuid) ||
+          CompareGuid (ResetFilter->Guid, &gEdkiiPlatformSpecificResetNotificationPpiGuid) ||
           CompareGuid (ResetFilter->Guid, &gEdkiiPlatformSpecificResetHandlerPpiGuid)
           );
 
@@ -187,6 +202,7 @@ UnregisterResetNotify (
 
   ResetFilter = (RESET_FILTER_INSTANCE *)This;
   ASSERT (CompareGuid (ResetFilter->Guid, &gEdkiiPlatformSpecificResetFilterPpiGuid) ||
+    CompareGuid (ResetFilter->Guid, &gEdkiiPlatformSpecificResetNotificationPpiGuid) ||
     CompareGuid (ResetFilter->Guid, &gEdkiiPlatformSpecificResetHandlerPpiGuid)
   );
 
diff --git a/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.h b/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.h
index f06d39bef5..8e9f872056 100644
--- a/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.h
+++ b/MdeModulePkg/Universal/ResetSystemPei/ResetSystem.h
@@ -21,6 +21,7 @@
 
 #include <Ppi/Reset2.h>
 #include <Ppi/PlatformSpecificResetFilter.h>
+#include <Ppi/PlatformSpecificResetNotification.h>
 #include <Ppi/PlatformSpecificResetHandler.h>
 
 #include <Library/BaseLib.h>
diff --git a/MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf b/MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
index 38fdd16ceb..a88e2018b7 100644
--- a/MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
+++ b/MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
@@ -48,9 +48,10 @@ [LibraryClasses]
   ReportStatusCodeLib
 
 [Ppis]
-  gEfiPeiReset2PpiGuid                       ## PRODUCES
-  gEdkiiPlatformSpecificResetFilterPpiGuid   ## PRODUCES
-  gEdkiiPlatformSpecificResetHandlerPpiGuid  ## PRODUCES
+  gEfiPeiReset2PpiGuid                           ## PRODUCES
+  gEdkiiPlatformSpecificResetFilterPpiGuid       ## PRODUCES
+  gEdkiiPlatformSpecificResetHandlerPpiGuid      ## PRODUCES
+  gEdkiiPlatformSpecificResetNotificationPpiGuid ## PRODUCES
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaximumPeiResetNotifies
-- 
2.16.1.windows.1



  parent reply	other threads:[~2018-02-09  4:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09  4:16 [PATCH v2 00/10] Formalize the reset system core design Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 01/10] MdePkg/PeiServicesLib: Add PeiServicesResetSystem2() Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 02/10] MdeModulePkg/PeiMain: Always attempt to use Reset2 PPI first Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 03/10] MdeModulePkg/PeiMain: Cleanup whitespace in Reset.c Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 04/10] MdeModulePkg/ResetSystemRuntimeDxe: Add platform filter and handler Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 05/10] MdeModulePkg/ResetSystemRuntimeDxe: Add more debug message Ruiyu Ni
2018-02-19 18:59   ` Ard Biesheuvel
2018-02-19 19:23     ` Laszlo Ersek
2018-02-19 23:30       ` Andrew Fish
2018-02-20  8:53         ` Laszlo Ersek
2018-02-09  4:16 ` [PATCH v2 06/10] MdeModulePkg: Add ResetSystemLib instances that call core services Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 07/10] MdeModulePkg: Add ResetUtility librray class and BASE instance Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 08/10] MdePkg/UefiRuntimeLib: Support more module types Ruiyu Ni
2018-02-09  4:16 ` [PATCH v2 09/10] MdeModulePkg: Add ResetSystemPei PEIM Ruiyu Ni
2018-02-09  4:16 ` Ruiyu Ni [this message]
2018-02-09  4:55 ` [PATCH v2 00/10] Formalize the reset system core design Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180209041635.320856-11-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox