Added SecDispatchTable library to allow custom PPIs to be passed up to into PEI Core. This will allow platform specific libraries to do thinks like map hardware devices directly into the emulator.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10882 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
andrewfish 2010-09-16 20:23:33 +00:00
parent 45059fab2a
commit 249383cf15
8 changed files with 129 additions and 1 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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

View 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
);

View File

@ -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

View File

@ -62,6 +62,7 @@
BaseLib
PeCoffLib
ReportStatusCodeLib
SecDispatchTableLib
[Ppis]

View File

@ -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

View File

@ -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