]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Added SecDispatchTable library to allow custom PPIs to be passed up to into PEI Core...
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 16 Sep 2010 20:23:33 +0000 (20:23 +0000)
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 16 Sep 2010 20:23:33 +0000 (20:23 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10882 6f19259b-4bc3-4df7-8a09-765794883524

UnixPkg/Include/Library/SecDispatchTableLib.h [new file with mode: 0644]
UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.c [new file with mode: 0644]
UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf [new file with mode: 0644]
UnixPkg/Sec/SecMain.c
UnixPkg/Sec/SecMain.h
UnixPkg/Sec/SecMain.inf
UnixPkg/UnixPkg.dsc
UnixPkg/UnixPkgX64.dsc

diff --git a/UnixPkg/Include/Library/SecDispatchTableLib.h b/UnixPkg/Include/Library/SecDispatchTableLib.h
new file mode 100644 (file)
index 0000000..6cebb58
--- /dev/null
@@ -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 (file)
index 0000000..da3d182
--- /dev/null
@@ -0,0 +1,36 @@
+/** @file\r
+  Allows an override of the SEC SEC PPI Dispatch Table. This allows \r
+  customized PPIs to be passed into the PEI Core.\r
+\r
+Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
+This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+--*/\r
+\r
+#include <PiPei.h>\r
+\r
+/**\r
+  Allow an override of the Sec PPI Dispatch Table. This table contains PPIs passed\r
+  up from SEC to PEI. This function is responcible for allocating space for the \r
+  overridden table.\r
+\r
+\r
+  @param  OriginalTable  SECs default PPI dispatch table\r
+\r
+  @return OriginalTable or override of the table\r
+\r
+**/\r
+EFI_PEI_PPI_DESCRIPTOR *\r
+EFIAPI\r
+OverrideDispatchTable (\r
+  IN CONST EFI_PEI_PPI_DESCRIPTOR          *OriginalTable\r
+  )\r
+{\r
+  return (EFI_PEI_PPI_DESCRIPTOR *)OriginalTable;\r
+}\r
diff --git a/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf b/UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf
new file mode 100644 (file)
index 0000000..858a140
--- /dev/null
@@ -0,0 +1,42 @@
+## @file\r
+# A library to produce the global variable 'gUnix'\r
+#\r
+# This library contains a single global variable 'gUnix' along with a constructor to initialize that global.\r
+# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = NullSecDispatchTableLib\r
+  FILE_GUID                      = D9F3D6F5-97C4-469A-848B-03F742FCCEA3\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = SecDispatchTableLib \r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  SecDispatchTableLib.c\r
+\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  UnixPkg/UnixPkg.dec\r
+\r
+[LibraryClasses]\r
+  BaseLib\r
+\r
+\r
index 76ac58e63687dddcef89e61a600424fe6a8b661d..b2046b6a756d5c13c8936e210d39fdc075824ba6 100644 (file)
@@ -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
@@ -596,13 +597,19 @@ Returns:
     return ;
   }
   
+  //
+  // 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
     );
index 9d34787fc44684cbe910810c9ea4c420059ddb00..408a761965a4e092328650eeeb17ebc37ac04597 100644 (file)
@@ -30,6 +30,8 @@ Abstract:
 #include <Library/PcdLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
+#include <Library/SecDispatchTableLib.h>\r
+\r
 \r
 #define STACK_SIZE                0x20000      \r
 \r
index 890c2ea7ab5dc6e562cfca74d5145a54e1932a0c..da09d07f300c5cd8c7105f833b068f2ccafa8272 100644 (file)
@@ -62,6 +62,7 @@
   BaseLib\r
   PeCoffLib\r
   ReportStatusCodeLib\r
+  SecDispatchTableLib\r
 \r
 \r
 [Ppis]\r
index 9867c48564d852a74ed9772d98466ee72979d9ef..50a95942a1ceef1883055659484242c407b1adcd 100644 (file)
   DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf\r
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
+  SecDispatchTableLib|UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf\r
 \r
 [LibraryClasses.common.USER_DEFINED]\r
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf\r
index e843d09863ad262183f4c10cc0c7893f14eaeeef..c4470cc27aa987be805f94e1ec0910c87acbc213 100644 (file)
   DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf\r
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
+  SecDispatchTableLib|UnixPkg/Library/SecDispatchTableLib/SecDispatchTableLib.inf\r
 \r
 [LibraryClasses.common.USER_DEFINED]\r
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf\r