summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-14 07:23:10 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-14 07:23:10 +0000
commite9867606178f943f5b5370f6d84a2f2fdb0bf25c (patch)
tree52fa797eff889decb699073238a9c14eca006e4a
parent18207db786dad25cd67ea862ed8a18354e9ce43d (diff)
downloadedk2-platforms-e9867606178f943f5b5370f6d84a2f2fdb0bf25c.tar.xz
Ensure there is only one instance of Status Code PPI in system.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9747 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.c b/MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.c
index eb5b490d1b..8f5a3a0ceb 100644
--- a/MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.c
+++ b/MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.c
@@ -1,7 +1,7 @@
/** @file
Report Status Code Router PEIM which produces Report Stataus Code Handler PPI and Status Code PPI.
- Copyright (c) 2009, Intel Corporation
+ Copyright (c) 2009 - 2010, Intel Corporation
All rights reserved. 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
@@ -23,12 +23,15 @@ EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {
ReportDispatcher
};
-EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiList[] = {
+EFI_PEI_PPI_DESCRIPTOR mRscHandlerPpiList[] = {
{
- EFI_PEI_PPI_DESCRIPTOR_PPI,
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gEfiPeiRscHandlerPpiGuid,
&mRscHandlerPpi
- },
+ }
+};
+
+EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiList[] = {
{
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gEfiPeiStatusCodePpiGuid,
@@ -257,11 +260,35 @@ GenericStatusCodePeiEntry (
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *OldDescriptor;
+ EFI_PEI_PROGRESS_CODE_PPI *OldStatusCodePpi;
CreateRscHandlerCallbackPacket ();
- Status = PeiServicesInstallPpi (mStatusCodePpiList);
+ //
+ // Install Report Status Code Handler PPI
+ //
+ Status = PeiServicesInstallPpi (mRscHandlerPpiList);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Install Status Code PPI. PI spec specifies that there can be only one instance
+ // of this PPI in system. So first check if other instance already exists.
+ // If no other instance exists, then just install the PPI.
+ // If other instance already exists, then reinstall it.
+ //
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiStatusCodePpiGuid,
+ 0,
+ &OldDescriptor,
+ (VOID **) &OldStatusCodePpi
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = PeiServicesReInstallPpi (OldDescriptor, mStatusCodePpiList);
+ } else {
+ Status = PeiServicesInstallPpi (mStatusCodePpiList);
+ }
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;