public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] Handle notification PPI from SEC
@ 2017-07-28  9:12 Star Zeng
  2017-07-28  9:12 ` [PATCH 1/2] MdePkg PiPeiCis.h: Add description for " Star Zeng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Star Zeng @ 2017-07-28  9:12 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng

This patch series is to follow latest (>= 1.5) PI spec to
handle notification PPI from SEC.

Star Zeng (2):
  MdePkg PiPeiCis.h: Add description for notification PPI from SEC
  MdeModulePkg PeiCore: Handle notification PPI from SEC

 MdeModulePkg/Core/Pei/PeiMain.h         |  14 ++++
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c |   7 +-
 MdeModulePkg/Core/Pei/Ppi/Ppi.c         | 140 ++++++++++++++++++++++++++++----
 MdePkg/Include/Pi/PiPeiCis.h            |  17 ++--
 4 files changed, 151 insertions(+), 27 deletions(-)

-- 
2.7.0.windows.1



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

* [PATCH 1/2] MdePkg PiPeiCis.h: Add description for notification PPI from SEC
  2017-07-28  9:12 [PATCH 0/2] Handle notification PPI from SEC Star Zeng
@ 2017-07-28  9:12 ` Star Zeng
  2017-07-28  9:12 ` [PATCH 2/2] MdeModulePkg PeiCore: Handle " Star Zeng
  2017-07-31  3:01 ` [PATCH 0/2] " Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Star Zeng @ 2017-07-28  9:12 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Liming Gao

This patch is to follow latest (>= 1.5) PI spec to add description
for notification PPI from SEC

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdePkg/Include/Pi/PiPeiCis.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/MdePkg/Include/Pi/PiPeiCis.h b/MdePkg/Include/Pi/PiPeiCis.h
index 92d6f0641ede..eda814a8701a 100644
--- a/MdePkg/Include/Pi/PiPeiCis.h
+++ b/MdePkg/Include/Pi/PiPeiCis.h
@@ -230,7 +230,7 @@ EFI_STATUS
 
   @retval EFI_SUCCESS           The interface was successfully installed.
   @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL, or any of the PEI PPI descriptors in the 
-                                list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
+                                list do not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
   @retval EFI_OUT_OF_RESOURCES  There is no additional space in the PPI database.
 
 **/
@@ -1004,13 +1004,14 @@ typedef struct _EFI_SEC_PEI_HAND_OFF {
   allows the SEC phase to pass information about the stack,
   temporary RAM and the Boot Firmware Volume. In addition, it also
   allows the SEC phase to pass services and data forward for use
-  during the PEI phase in the form of one or more PPIs. There is
-  no limit to the number of additional PPIs that can be passed
-  from SEC into the PEI Foundation. As part of its initialization
-  phase, the PEI Foundation will add these SEC-hosted PPIs to its
-  PPI database such that both the PEI Foundation and any modules
-  can leverage the associated service calls and/or code in these
-  early PPIs.
+  during the PEI phase in the form of one or more PPIs. These PPI's
+  will be installed and/or immediately signaled if they are
+  notification type. There is no limit to the number of additional
+  PPIs that can be passed from SEC into the PEI Foundation. As part
+  of its initialization phase, the PEI Foundation will add these
+  SEC-hosted PPIs to its PPI database such that both the PEI
+  Foundation and any modules can leverage the associated service
+  calls and/or code in these early PPIs.
 
   @param SecCoreData    Points to a data structure containing
                         information about the PEI core's
-- 
2.7.0.windows.1



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

* [PATCH 2/2] MdeModulePkg PeiCore: Handle notification PPI from SEC
  2017-07-28  9:12 [PATCH 0/2] Handle notification PPI from SEC Star Zeng
  2017-07-28  9:12 ` [PATCH 1/2] MdePkg PiPeiCis.h: Add description for " Star Zeng
@ 2017-07-28  9:12 ` Star Zeng
  2017-07-31  3:01 ` [PATCH 0/2] " Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Star Zeng @ 2017-07-28  9:12 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Liming Gao

InstallPpi() will be used for normal PPI in PPI list from SEC,
and NotifyPpi() will be used for notification PPI in PPI list from SEC.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Core/Pei/PeiMain.h         |  14 ++++
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c |   7 +-
 MdeModulePkg/Core/Pei/Ppi/Ppi.c         | 140 ++++++++++++++++++++++++++++----
 3 files changed, 142 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index 8b58916e65b3..e95b1c3d8cd7 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -557,6 +557,20 @@ DispatchNotify (
   IN INTN                NotifyStopIndex
   );
 
+/**
+  Process PpiList from SEC phase.
+
+  @param PeiServices    An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+  @param PpiList        Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
+                        These PPI's will be installed and/or immediately signaled if they are notification type.
+
+**/
+VOID
+ProcessPpiListFromSec (
+  IN CONST EFI_PEI_SERVICES         **PeiServices,
+  IN CONST EFI_PEI_PPI_DESCRIPTOR   *PpiList
+  );
+
 //
 // Boot mode support functions
 //
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index 27484bafc575..556c40a3035c 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -1,7 +1,7 @@
 /** @file
   Pei Core Main Entry Point
   
-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
 which accompanies this distribution.  The full text of the license may be found at
@@ -380,11 +380,10 @@ PeiCore (
       );
       
     //
-    // If SEC provided any PPI services to PEI, install them.
+    // If SEC provided the PpiList, process it.
     //
     if (PpiList != NULL) {
-      Status = PeiServicesInstallPpi (PpiList);
-      ASSERT_EFI_ERROR (Status);
+      ProcessPpiListFromSec (&PrivateData.Ps, PpiList);
     }
   } else {
     //
diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
index db6eded6d6ed..b2ab3fbd2086 100644
--- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
+++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
@@ -1,7 +1,7 @@
 /** @file
   EFI PEI Core PPI services
   
-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
 which accompanies this distribution.  The full text of the license may be found at
@@ -171,6 +171,9 @@ ConvertPpiPointers (
 
   @param PeiServices                An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
   @param PpiList                    Pointer to a list of PEI PPI Descriptors.
+  @param Single                     TRUE if only single entry in the PpiList.
+                                    FALSE if the PpiList is ended with an entry which has the
+                                    EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST flag set in its Flags field.
 
   @retval EFI_SUCCESS              if all PPIs in PpiList are successfully installed.
   @retval EFI_INVALID_PARAMETER    if PpiList is NULL pointer
@@ -179,10 +182,10 @@ ConvertPpiPointers (
 
 **/
 EFI_STATUS
-EFIAPI
-PeiInstallPpi (
+InternalPeiInstallPpi (
   IN CONST EFI_PEI_SERVICES        **PeiServices,
-  IN CONST EFI_PEI_PPI_DESCRIPTOR  *PpiList
+  IN CONST EFI_PEI_PPI_DESCRIPTOR  *PpiList,
+  IN BOOLEAN                       Single
   )
 {
   PEI_CORE_INSTANCE *PrivateData;
@@ -229,11 +232,16 @@ PeiInstallPpi (
     PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR*) PpiList;
     PrivateData->PpiData.PpiListEnd++;
 
-    //
-    // Continue until the end of the PPI List.
-    //
-    if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
-        EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
+    if (Single) {
+      //
+      // Only single entry in the PpiList.
+      //
+      break;
+    } else if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
+               EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
+      //
+      // Continue until the end of the PPI List.
+      //
       break;
     }
     PpiList++;
@@ -258,6 +266,31 @@ PeiInstallPpi (
 
 /**
 
+  This function installs an interface in the PEI PPI database by GUID. 
+  The purpose of the service is to publish an interface that other parties
+  can use to call additional PEIMs.
+
+  @param PeiServices                An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+  @param PpiList                    Pointer to a list of PEI PPI Descriptors.
+
+  @retval EFI_SUCCESS              if all PPIs in PpiList are successfully installed.
+  @retval EFI_INVALID_PARAMETER    if PpiList is NULL pointer
+                                   if any PPI in PpiList is not valid
+  @retval EFI_OUT_OF_RESOURCES     if there is no more memory resource to install PPI
+
+**/
+EFI_STATUS
+EFIAPI
+PeiInstallPpi (
+  IN CONST EFI_PEI_SERVICES        **PeiServices,
+  IN CONST EFI_PEI_PPI_DESCRIPTOR  *PpiList
+  )
+{
+  return InternalPeiInstallPpi (PeiServices, PpiList, FALSE);
+}
+
+/**
+
   This function reinstalls an interface in the PEI PPI database by GUID. 
   The purpose of the service is to publish an interface that other parties can 
   use to replace an interface of the same name in the protocol database with a 
@@ -409,17 +442,20 @@ PeiLocatePpi (
 
   @param PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
   @param NotifyList         Pointer to list of Descriptors to notify upon.
+  @param Single             TRUE if only single entry in the NotifyList.
+                            FALSE if the NotifyList is ended with an entry which has the
+                            EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST flag set in its Flags field.
 
   @retval EFI_SUCCESS           if successful
   @retval EFI_OUT_OF_RESOURCES  if no space in the database
-  @retval EFI_INVALID_PARAMETER if not a good decriptor
+  @retval EFI_INVALID_PARAMETER if not a good descriptor
 
 **/
 EFI_STATUS
-EFIAPI
-PeiNotifyPpi (
+InternalPeiNotifyPpi (
   IN CONST EFI_PEI_SERVICES           **PeiServices,
-  IN CONST EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyList
+  IN CONST EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyList,
+  IN BOOLEAN                          Single
   )
 {
   PEI_CORE_INSTANCE                *PrivateData;
@@ -474,8 +510,16 @@ PeiNotifyPpi (
 
     PrivateData->PpiData.NotifyListEnd--;
     DEBUG((EFI_D_INFO, "Register PPI Notify: %g\n", NotifyList->Guid));
-    if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
-        EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
+    if (Single) {
+      //
+      // Only single entry in the NotifyList.
+      //
+      break;
+    } else if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
+               EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
+      //
+      // Continue until the end of the Notify List.
+      //
       break;
     }
     //
@@ -519,6 +563,30 @@ PeiNotifyPpi (
   return  EFI_SUCCESS;
 }
 
+/**
+
+  This function installs a notification service to be called back when a given 
+  interface is installed or reinstalled. The purpose of the service is to publish 
+  an interface that other parties can use to call additional PPIs that may materialize later.
+
+  @param PeiServices        An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+  @param NotifyList         Pointer to list of Descriptors to notify upon.
+
+  @retval EFI_SUCCESS           if successful
+  @retval EFI_OUT_OF_RESOURCES  if no space in the database
+  @retval EFI_INVALID_PARAMETER if not a good descriptor
+
+**/
+EFI_STATUS
+EFIAPI
+PeiNotifyPpi (
+  IN CONST EFI_PEI_SERVICES           **PeiServices,
+  IN CONST EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyList
+  )
+{
+  return InternalPeiNotifyPpi (PeiServices, NotifyList, FALSE);
+}
+
 
 /**
 
@@ -644,3 +712,45 @@ DispatchNotify (
   }
 }
 
+/**
+  Process PpiList from SEC phase.
+
+  @param PeiServices    An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+  @param PpiList        Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
+                        These PPI's will be installed and/or immediately signaled if they are notification type.
+
+**/
+VOID
+ProcessPpiListFromSec (
+  IN CONST EFI_PEI_SERVICES         **PeiServices,
+  IN CONST EFI_PEI_PPI_DESCRIPTOR   *PpiList
+  )
+{
+  EFI_STATUS    Status;
+
+  for (;;) {
+    if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) != 0) {
+      //
+      // It is a notification PPI.
+      //
+      Status = InternalPeiNotifyPpi (PeiServices, (CONST EFI_PEI_NOTIFY_DESCRIPTOR *) PpiList, TRUE);
+      ASSERT_EFI_ERROR (Status);
+    } else {
+      //
+      // It is a normal PPI.
+      //
+      Status = InternalPeiInstallPpi (PeiServices, PpiList, TRUE);
+      ASSERT_EFI_ERROR (Status);
+    }
+
+    if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) == EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
+      //
+      // Continue until the end of the PPI List.
+      //
+      break;
+    }
+
+    PpiList++;
+  }
+}
+
-- 
2.7.0.windows.1



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

* Re: [PATCH 0/2] Handle notification PPI from SEC
  2017-07-28  9:12 [PATCH 0/2] Handle notification PPI from SEC Star Zeng
  2017-07-28  9:12 ` [PATCH 1/2] MdePkg PiPeiCis.h: Add description for " Star Zeng
  2017-07-28  9:12 ` [PATCH 2/2] MdeModulePkg PeiCore: Handle " Star Zeng
@ 2017-07-31  3:01 ` Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Gao, Liming @ 2017-07-31  3:01 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Zeng, Star

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Star
>Zeng
>Sent: Friday, July 28, 2017 5:12 PM
>To: edk2-devel@lists.01.org
>Cc: Zeng, Star <star.zeng@intel.com>
>Subject: [edk2] [PATCH 0/2] Handle notification PPI from SEC
>
>This patch series is to follow latest (>= 1.5) PI spec to
>handle notification PPI from SEC.
>
>Star Zeng (2):
>  MdePkg PiPeiCis.h: Add description for notification PPI from SEC
>  MdeModulePkg PeiCore: Handle notification PPI from SEC
>
> MdeModulePkg/Core/Pei/PeiMain.h         |  14 ++++
> MdeModulePkg/Core/Pei/PeiMain/PeiMain.c |   7 +-
> MdeModulePkg/Core/Pei/Ppi/Ppi.c         | 140
>++++++++++++++++++++++++++++----
> MdePkg/Include/Pi/PiPeiCis.h            |  17 ++--
> 4 files changed, 151 insertions(+), 27 deletions(-)
>
>--
>2.7.0.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2017-07-31  2:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-28  9:12 [PATCH 0/2] Handle notification PPI from SEC Star Zeng
2017-07-28  9:12 ` [PATCH 1/2] MdePkg PiPeiCis.h: Add description for " Star Zeng
2017-07-28  9:12 ` [PATCH 2/2] MdeModulePkg PeiCore: Handle " Star Zeng
2017-07-31  3:01 ` [PATCH 0/2] " Gao, Liming

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