Finish spliting SecDispatchTableLib into two functions so it can be a BaseLib

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10895 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
andrewfish
2010-09-20 21:04:07 +00:00
parent 7effcbff29
commit 69cf40e09a
6 changed files with 80 additions and 26 deletions

View File

@ -17,21 +17,40 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __SEC_DISPATCH_TABLE_LIB_H__ #ifndef __SEC_DISPATCH_TABLE_LIB_H__
#define __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 Return the number of bytes that OverrideDispatchTable() will append to
up from SEC to PEI. This function is responcible for allocating space for the the dispatch table.
overridden table.
@return Size of table in bytes OverrideDispatchTable() will return
@param OriginalTable SECs default PPI dispatch table
@return OriginalTable or override of the table
**/ **/
EFI_PEI_PPI_DESCRIPTOR * UINTN
EFIAPI
OverrideDispatchTableExtraSize (
VOID
);
/**
Allow an override of the Sec PPI Dispatch Table. This table contains PPIs passed
up from SEC to PEI.
@param OriginalTable SECs default PPI dispatch table
@param OriginalTableSize Size of SECs default PPI dispatch table
@param NewTable New dispatch table
@param NewTableSize Size of of the NewTable in bytes
@return EFI_SUCCESS table was copied
**/
EFI_STATUS
EFIAPI EFIAPI
OverrideDispatchTable ( OverrideDispatchTable (
IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable,
IN UINTN OriginalTableSize,
IN OUT EFI_PEI_PPI_DESCRIPTOR *NewTable,
IN UINTN NewTableSize
); );

View File

@ -373,13 +373,13 @@ typedef struct _EFI_UNIX_THUNK_PROTOCOL {
UnixGetTimeZone GetTimeZone; UnixGetTimeZone GetTimeZone;
UnixGetDayLight GetDayLight; UnixGetDayLight GetDayLight;
UnixPoll Poll; UnixPoll Poll;
UnixRead Read; UnixRead Read;
UnixWrite Write; UnixWrite Write;
UnixGetenv Getenv; UnixGetenv Getenv;
UnixOpen Open; UnixOpen Open;
UnixSeek Lseek; UnixSeek Lseek;
UnixFtruncate FTruncate; UnixFtruncate FTruncate;
UnixClose Close; UnixClose Close;
UnixMkdir MkDir; UnixMkdir MkDir;
UnixRmDir RmDir; UnixRmDir RmDir;
UnixUnLink UnLink; UnixUnLink UnLink;

View File

@ -14,23 +14,48 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
--*/ --*/
#include <PiPei.h> #include <PiPei.h>
#include <Library/BaseMemoryLib.h>
#include <Library/SecDispatchTableLib.h>
/**
Return the number of bytes that OverrideDispatchTable() will append to
the dispatch table.
@return Size of table in bytes OverrideDispatchTable() will return
**/
UINTN
EFIAPI
OverrideDispatchTableExtraSize (
)
{
return 0;
}
/** /**
Allow an override of the Sec PPI Dispatch Table. This table contains PPIs passed 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 up from SEC to PEI.
overridden table.
@param OriginalTable SECs default PPI dispatch table
@param OriginalTableSize Size of SECs default PPI dispatch table
@param NewTable New dispatch table
@param NewTableSize Size of of the NewTable in bytes
@param OriginalTable SECs default PPI dispatch table @return EFI_SUCCESS table was copied
@return OriginalTable or override of the table
**/ **/
EFI_PEI_PPI_DESCRIPTOR * EFI_STATUS
EFIAPI EFIAPI
OverrideDispatchTable ( OverrideDispatchTable (
IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable IN CONST EFI_PEI_PPI_DESCRIPTOR *OriginalTable,
IN UINTN OriginalTableSize,
IN OUT EFI_PEI_PPI_DESCRIPTOR *NewTable,
IN UINTN NewTableSize
) )
{ {
return (EFI_PEI_PPI_DESCRIPTOR *)OriginalTable; CopyMem (NewTable, OriginalTable, OriginalTableSize);
return EFI_SUCCESS;
} }

View File

@ -38,5 +38,6 @@
[LibraryClasses] [LibraryClasses]
BaseLib BaseLib
BaseMemoryLib

View File

@ -544,6 +544,7 @@ Returns:
EFI_SEC_PEI_HAND_OFF *SecCoreData; EFI_SEC_PEI_HAND_OFF *SecCoreData;
UINTN PeiStackSize; UINTN PeiStackSize;
EFI_PEI_PPI_DESCRIPTOR *DispatchTable; EFI_PEI_PPI_DESCRIPTOR *DispatchTable;
UINTN DispatchTableSize;
// //
// Compute Top Of Memory for Stack and PEI Core Allocations // Compute Top Of Memory for Stack and PEI Core Allocations
@ -597,11 +598,19 @@ Returns:
return ; return ;
} }
DispatchTableSize = sizeof (gPrivateDispatchTable);
DispatchTableSize += OverrideDispatchTableExtraSize ();
DispatchTable = malloc (DispatchTableSize);
if (DispatchTable == NULL) {
return;
}
// //
// Allow an override for extra PPIs to be passed up to PEI // Allow an override for extra PPIs to be passed up to PEI
// This is an easy way to enable OS specific customizations // This is an easy way to enable OS specific customizations
// //
DispatchTable = OverrideDispatchTable (&gPrivateDispatchTable[0]); OverrideDispatchTable (&gPrivateDispatchTable[0], sizeof (gPrivateDispatchTable), DispatchTable, DispatchTableSize);
// //
// Transfer control to the PEI Core // Transfer control to the PEI Core

View File

@ -223,7 +223,7 @@
# generated for it, but the binary will not be put into any firmware volume. # generated for it, but the binary will not be put into any firmware volume.
# #
################################################################################################### ###################################################################################################
[Components.common] [Components]
## ##
# SEC Phase modules # SEC Phase modules
## ##