summaryrefslogtreecommitdiff
path: root/UnixPkg
diff options
context:
space:
mode:
Diffstat (limited to 'UnixPkg')
-rw-r--r--UnixPkg/Include/Library/SecDispatchTableLib.h38
-rw-r--r--UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c36
-rw-r--r--UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf42
-rw-r--r--UnixPkg/Sec/SecMain.c9
-rw-r--r--UnixPkg/Sec/SecMain.h2
-rw-r--r--UnixPkg/Sec/SecMain.inf1
-rw-r--r--UnixPkg/UnixPkg.dsc1
-rw-r--r--UnixPkg/UnixPkgX64.dsc1
8 files changed, 129 insertions, 1 deletions
diff --git a/UnixPkg/Include/Library/SecDispatchTableLib.h b/UnixPkg/Include/Library/SecDispatchTableLib.h
new file mode 100644
index 0000000000..6cebb58b9b
--- /dev/null
+++ b/UnixPkg/Include/Library/SecDispatchTableLib.h
@@ -0,0 +1,38 @@
+/** @file
+ Allows an override of the SEC SEC PPI Dispatch Table. This allows
+ customized PPIs to be passed into the PEI Core.
+
+Copyright (c) 2008 - 2010, Apple Inc. 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
+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 __SEC_DISPATCH_TABLE_LIB_H__
+#define __SEC_DISPATCH_TABLE_LIB_H__
+
+/**
+ Allow an override of the Sec PPI Dispatch Table. This table contains PPIs passed
+ up from SEC to PEI. This function is responcible for allocating space for the
+ overridden table.
+
+
+ @param OriginalTable SECs default PPI dispatch table
+
+ @return OriginalTable or override of the table
+
+**/
+EFI_PEI_PPI_DESCRIPTOR *
+EFIAPI
+OverrideDispatchTable (
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable
+ );
+
+
+#endif
diff --git a/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c b/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c
new file mode 100644
index 0000000000..da3d182f1e
--- /dev/null
+++ b/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c
@@ -0,0 +1,36 @@
+/** @file
+ Allows an override of the SEC SEC PPI Dispatch Table. This allows
+ customized PPIs to be passed into the PEI Core.
+
+Copyright (c) 2008 - 2010, Apple Inc. 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
+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.
+
+--*/
+
+#include <PiPei.h>
+
+/**
+ Allow an override of the Sec PPI Dispatch Table. This table contains PPIs passed
+ up from SEC to PEI. This function is responcible for allocating space for the
+ overridden table.
+
+
+ @param OriginalTable SECs default PPI dispatch table
+
+ @return OriginalTable or override of the table
+
+**/
+EFI_PEI_PPI_DESCRIPTOR *
+EFIAPI
+OverrideDispatchTable (
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable
+ )
+{
+ return (EFI_PEI_PPI_DESCRIPTOR *)OriginalTable;
+}
diff --git a/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf b/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
new file mode 100644
index 0000000000..858a14012d
--- /dev/null
+++ b/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
@@ -0,0 +1,42 @@
+## @file
+# A library to produce the global variable 'gUnix'
+#
+# This library contains a single global variable 'gUnix' along with a constructor to initialize that global.
+# Copyright (c) 2006 - 2010, 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
+# 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.
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = NullSecDispatchTableLib
+ FILE_GUID = D9F3D6F5-97C4-469A-848B-03F742FCCEA3
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = SecDispatchTableLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources]
+ SecDispatchTableLib.c
+
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UnixPkg/UnixPkg.dec
+
+[LibraryClasses]
+ BaseLib
+
+
diff --git a/UnixPkg/Sec/SecMain.c b/UnixPkg/Sec/SecMain.c
index 76ac58e636..b2046b6a75 100644
--- a/UnixPkg/Sec/SecMain.c
+++ b/UnixPkg/Sec/SecMain.c
@@ -543,6 +543,7 @@ Returns:
EFI_PHYSICAL_ADDRESS PeiImageAddress;
EFI_SEC_PEI_HAND_OFF *SecCoreData;
UINTN PeiStackSize;
+ EFI_PEI_PPI_DESCRIPTOR *DispatchTable;
//
// Compute Top Of Memory for Stack and PEI Core Allocations
@@ -597,12 +598,18 @@ Returns:
}
//
+ // Allow an override for extra PPIs to be passed up to PEI
+ // This is an easy way to enable OS specific customizations
+ //
+ DispatchTable = OverrideDispatchTable (&gPrivateDispatchTable[0]);
+
+ //
// Transfer control to the PEI Core
//
PeiSwitchStacks (
(SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,
SecCoreData,
- (VOID *) (UINTN) ((EFI_PEI_PPI_DESCRIPTOR *) &gPrivateDispatchTable),
+ (VOID *)DispatchTable,
NULL,
TopOfStack
);
diff --git a/UnixPkg/Sec/SecMain.h b/UnixPkg/Sec/SecMain.h
index 9d34787fc4..408a761965 100644
--- a/UnixPkg/Sec/SecMain.h
+++ b/UnixPkg/Sec/SecMain.h
@@ -30,6 +30,8 @@ Abstract:
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
#include <Library/ReportStatusCodeLib.h>
+#include <Library/SecDispatchTableLib.h>
+
#define STACK_SIZE 0x20000
diff --git a/UnixPkg/Sec/SecMain.inf b/UnixPkg/Sec/SecMain.inf
index 890c2ea7ab..da09d07f30 100644
--- a/UnixPkg/Sec/SecMain.inf
+++ b/UnixPkg/Sec/SecMain.inf
@@ -62,6 +62,7 @@
BaseLib
PeCoffLib
ReportStatusCodeLib
+ SecDispatchTableLib
[Ppis]
diff --git a/UnixPkg/UnixPkg.dsc b/UnixPkg/UnixPkg.dsc
index 9867c48564..50a95942a1 100644
--- a/UnixPkg/UnixPkg.dsc
+++ b/UnixPkg/UnixPkg.dsc
@@ -104,6 +104,7 @@
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
+ SecDispatchTableLib|UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
[LibraryClasses.common.USER_DEFINED]
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
diff --git a/UnixPkg/UnixPkgX64.dsc b/UnixPkg/UnixPkgX64.dsc
index e843d09863..c4470cc27a 100644
--- a/UnixPkg/UnixPkgX64.dsc
+++ b/UnixPkg/UnixPkgX64.dsc
@@ -104,6 +104,7 @@
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
+ SecDispatchTableLib|UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
[LibraryClasses.common.USER_DEFINED]
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf