Fix function comment to follows doxygen format.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5499 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,6 +1,11 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
This module provide function for ascertaining and updating the boot mode:
|
||||||
Copyright (c) 2006, Intel Corporation
|
GetBootMode()
|
||||||
|
SetBootMode()
|
||||||
|
See PI Speicifcation volume I, chapter 9 Boot Paths for addtional information
|
||||||
|
on the boot mode.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -9,47 +14,28 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
BootMode.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
EFI PEI Core Boot Mode services
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
This service enables PEIMs to ascertain the present value of the boot mode.
|
||||||
|
|
||||||
|
@param PeiServices The PEI core services table.
|
||||||
|
@param BootMode A pointer to contain the value of the boot mode.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The boot mode was returned successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER BootMode is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiGetBootMode (
|
PeiGetBootMode (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||||
OUT EFI_BOOT_MODE *BootMode
|
OUT EFI_BOOT_MODE *BootMode
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This service enables PEIMs to ascertain the present value of the boot mode.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
BootMode - A pointer to contain the value of the boot mode.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The boot mode was returned successfully.
|
|
||||||
EFI_INVALID_PARAMETER - BootMode is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
||||||
|
|
||||||
|
|
||||||
@ -68,28 +54,22 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
This service enables PEIMs to update the boot mode variable.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param BootMode - The value of the boot mode to set.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS - The value was successfully updated
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiSetBootMode (
|
PeiSetBootMode (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||||
IN EFI_BOOT_MODE BootMode
|
IN EFI_BOOT_MODE BootMode
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This service enables PEIMs to update the boot mode variable.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
BootMode - The value of the boot mode to set.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The value was successfully updated
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
PEI Dispatcher Dependency Evaluator
|
||||||
|
|
||||||
|
This routine evaluates a dependency expression (DEPENDENCY_EXPRESSION) to determine
|
||||||
|
if a driver can be scheduled for execution. The criteria for
|
||||||
|
schedulability is that the dependency expression is satisfied.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
@ -9,47 +14,30 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
dependency.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
PEI Dispatcher Dependency Evaluator
|
|
||||||
|
|
||||||
This routine evaluates a dependency expression (DEPENDENCY_EXPRESSION) to determine
|
|
||||||
if a driver can be scheduled for execution. The criteria for
|
|
||||||
schedulability is that the dependency expression is satisfied.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
#include "dependency.h"
|
#include "dependency.h"
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
BOOLEAN
|
|
||||||
IsPpiInstalled (
|
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
|
||||||
IN EVAL_STACK_ENTRY *Stack
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This routine determines if a PPI has been installed.
|
This routine determines if a PPI has been installed.
|
||||||
The truth value of a GUID is determined by if the PPI has
|
The truth value of a GUID is determined by if the PPI has
|
||||||
been published and can be queried from the PPI database.
|
been published and can be queried from the PPI database.
|
||||||
|
|
||||||
Arguments:
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
Stack - Reference to EVAL_STACK_ENTRY that contains PPI GUID to check
|
|
||||||
|
|
||||||
Returns:
|
@param PeiServices The PEI core services table.
|
||||||
|
@param Stack Reference to EVAL_STACK_ENTRY that contains PPI GUID to check
|
||||||
|
|
||||||
True if the PPI is already installed.
|
@retval TRUE if the PPI is already installed.
|
||||||
False if the PPI has yet to be installed.
|
@retval FALSE if the PPI has yet to be installed.
|
||||||
|
|
||||||
--*/
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsPpiInstalled (
|
||||||
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
|
IN EVAL_STACK_ENTRY *Stack
|
||||||
|
)
|
||||||
{
|
{
|
||||||
VOID *PeiInstance;
|
VOID *PeiInstance;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -86,15 +74,7 @@ Returns:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
BOOLEAN
|
|
||||||
PeimDispatchReadiness (
|
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
|
||||||
IN VOID *DependencyExpression
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This is the POSTFIX version of the dependency evaluator. When a
|
This is the POSTFIX version of the dependency evaluator. When a
|
||||||
PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
|
PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
|
||||||
@ -103,22 +83,22 @@ Routine Description:
|
|||||||
some time savings as not all PPIs must be checked for certain
|
some time savings as not all PPIs must be checked for certain
|
||||||
operation types (AND, OR).
|
operation types (AND, OR).
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - Calling context.
|
@param PeiServices Calling context.
|
||||||
|
@param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
|
||||||
|
the BNF described above and is stored in postfix notation.
|
||||||
|
|
||||||
DependencyExpression - Pointer to a dependency expression. The Grammar adheres to
|
@retval TRUE if it is a well-formed Grammar
|
||||||
the BNF described above and is stored in postfix notation.
|
@retval FALSE if the dependency expression overflows the evaluation stack
|
||||||
Returns:
|
if the dependency expression underflows the evaluation stack
|
||||||
|
if the dependency expression is not a well-formed Grammar.
|
||||||
|
|
||||||
Status = EFI_SUCCESS if it is a well-formed Grammar
|
**/
|
||||||
EFI_INVALID_PARAMETER if the dependency expression overflows
|
BOOLEAN
|
||||||
the evaluation stack
|
PeimDispatchReadiness (
|
||||||
EFI_INVALID_PARAMETER if the dependency expression underflows
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
the evaluation stack
|
IN VOID *DependencyExpression
|
||||||
EFI_INVALID_PARAMETER if the dependency expression is not a
|
)
|
||||||
well-formed Grammar.
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
DEPENDENCY_EXPRESSION_OPERAND *Iterator;
|
DEPENDENCY_EXPRESSION_OPERAND *Iterator;
|
||||||
EVAL_STACK_ENTRY *StackPtr;
|
EVAL_STACK_ENTRY *StackPtr;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
This module contains data specific to dependency expressions
|
||||||
Copyright (c) 2006, Intel Corporation
|
and local function prototypes.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -9,15 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
dependency.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
This module contains data specific to dependency expressions
|
|
||||||
and local function prototypes.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _PEI_DEPENDENCY_H_
|
#ifndef _PEI_DEPENDENCY_H_
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
EFI PEI Core dispatch services
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,23 +10,13 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Dispatcher.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
EFI PEI Core dispatch services
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
//
|
///
|
||||||
//CAR is filled with this initial value during SEC phase
|
/// CAR is filled with this initial value during SEC phase
|
||||||
//
|
///
|
||||||
#define INIT_CAR_VALUE 0x5AA55AA5
|
#define INIT_CAR_VALUE 0x5AA55AA5
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -33,27 +24,21 @@ typedef struct {
|
|||||||
EFI_HANDLE Handle;
|
EFI_HANDLE Handle;
|
||||||
} PEIM_FILE_HANDLE_EXTENDED_DATA;
|
} PEIM_FILE_HANDLE_EXTENDED_DATA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Discover all Peims and optional Apriori file in one FV. There is at most one
|
||||||
|
Apriori file in one FV.
|
||||||
|
|
||||||
|
|
||||||
|
@param Private - Pointer to the private data passed in from caller
|
||||||
|
@param VolumeHandle - Fv handle.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
DiscoverPeimsAndOrderWithApriori (
|
DiscoverPeimsAndOrderWithApriori (
|
||||||
IN PEI_CORE_INSTANCE *Private,
|
IN PEI_CORE_INSTANCE *Private,
|
||||||
IN EFI_PEI_FV_HANDLE VolumeHandle
|
IN EFI_PEI_FV_HANDLE VolumeHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Discover all Peims and optional Apriori file in one FV. There is at most one
|
|
||||||
Apriori file in one FV.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Private - Pointer to the private data passed in from caller
|
|
||||||
VolumeHandle - Fv handle.
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
NONE
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PEI_FV_HANDLE FileHandle;
|
EFI_PEI_FV_HANDLE FileHandle;
|
||||||
@ -187,6 +172,13 @@ Returns:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shadow PeiCore module from flash to installed memory.
|
||||||
|
|
||||||
|
@param PeiServices Pointer to PeiService table
|
||||||
|
@param PrivateInMem PeiCore's private data structure
|
||||||
|
|
||||||
|
**/
|
||||||
VOID*
|
VOID*
|
||||||
ShadowPeiCore(
|
ShadowPeiCore(
|
||||||
EFI_PEI_SERVICES **PeiServices,
|
EFI_PEI_SERVICES **PeiServices,
|
||||||
@ -226,32 +218,23 @@ ShadowPeiCore(
|
|||||||
return (VOID*) ((UINTN) EntryPoint + (UINTN) PeiCore - (UINTN) _ModuleEntryPoint);
|
return (VOID*) ((UINTN) EntryPoint + (UINTN) PeiCore - (UINTN) _ModuleEntryPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Conduct PEIM dispatch.
|
||||||
|
|
||||||
|
@param SecCoreData Points to a data structure containing information about the PEI core's operating
|
||||||
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
|
@param Private Pointer to the private data passed in from caller
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS - Successfully dispatched PEIM.
|
||||||
|
@retval EFI_NOT_FOUND - The dispatch failed.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
PeiDispatcher (
|
PeiDispatcher (
|
||||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN PEI_CORE_INSTANCE *Private
|
IN PEI_CORE_INSTANCE *Private
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Conduct PEIM dispatch.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
|
||||||
environment, such as the size and location of temporary RAM, the stack location and
|
|
||||||
the BFV location.
|
|
||||||
PrivateData - Pointer to the private data passed in from caller
|
|
||||||
DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Successfully dispatched PEIM.
|
|
||||||
EFI_NOT_FOUND - The dispatch failed.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 Index1;
|
UINT32 Index1;
|
||||||
@ -674,32 +657,25 @@ Returns:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize the Dispatcher's data members
|
||||||
|
|
||||||
|
@param PrivateData PeiCore's private data structure
|
||||||
|
@param OldCoreData Old data from SecCore
|
||||||
|
NULL if being run in non-permament memory mode.
|
||||||
|
@param SecCoreData Points to a data structure containing information about the PEI core's operating
|
||||||
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
|
|
||||||
|
@return None.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializeDispatcherData (
|
InitializeDispatcherData (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData,
|
IN PEI_CORE_INSTANCE *OldCoreData,
|
||||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Initialize the Dispatcher's data members
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
OldCoreData - Pointer to old core data (before switching stack).
|
|
||||||
NULL if being run in non-permament memory mode.
|
|
||||||
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
|
||||||
environment, such as the size and location of temporary RAM, the stack location and
|
|
||||||
the BFV location.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
None.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (OldCoreData == NULL) {
|
if (OldCoreData == NULL) {
|
||||||
PeiInitializeFv (PrivateData, SecCoreData);
|
PeiInitializeFv (PrivateData, SecCoreData);
|
||||||
@ -708,29 +684,25 @@ Returns:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This routine parses the Dependency Expression, if available, and
|
||||||
|
decides if the module can be executed.
|
||||||
|
|
||||||
|
|
||||||
|
@param Private PeiCore's private data structure
|
||||||
|
@param FileHandle PEIM's file handle
|
||||||
|
@param PeimCount Peim count in all dispatched PEIMs.
|
||||||
|
|
||||||
|
@retval TRUE Can be dispatched
|
||||||
|
@retval FALSE Cannot be dispatched
|
||||||
|
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DepexSatisfied (
|
DepexSatisfied (
|
||||||
IN PEI_CORE_INSTANCE *Private,
|
IN PEI_CORE_INSTANCE *Private,
|
||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
IN UINTN PeimCount
|
IN UINTN PeimCount
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This routine parses the Dependency Expression, if available, and
|
|
||||||
decides if the module can be executed.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
PeiServices - The PEI Service Table
|
|
||||||
CurrentPeimAddress - Address of the PEIM Firmware File under investigation
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
TRUE - Can be dispatched
|
|
||||||
FALSE - Cannot be dispatched
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
VOID *DepexData;
|
VOID *DepexData;
|
||||||
@ -768,11 +740,11 @@ Returns:
|
|||||||
This routine enable a PEIM to register itself to shadow when PEI Foundation
|
This routine enable a PEIM to register itself to shadow when PEI Foundation
|
||||||
discovery permanent memory.
|
discovery permanent memory.
|
||||||
|
|
||||||
@param FileHandle File handle of a PEIM.
|
@param FileHandle File handle of a PEIM.
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
|
@retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
|
||||||
@retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
|
@retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
|
||||||
@retval EFI_SUCCESS Successfully to register itself.
|
@retval EFI_SUCCESS Successfully to register itself.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -803,18 +775,16 @@ PeiRegisterForShadow (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
|
Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
|
||||||
|
|
||||||
@param PeiServices Pointer to the PEI Core Services Table.
|
@param PeiServices Pointer to the PEI Core Services Table.
|
||||||
@param FileHandle File handle of a Fv type file.
|
@param FvFileHandle File handle of a Fv type file.
|
||||||
@param AuthenticationState Pointer to attestation authentication state of image.
|
@param AuthenticationState Pointer to attestation authentication state of image.
|
||||||
|
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND FV image can't be found.
|
@retval EFI_NOT_FOUND FV image can't be found.
|
||||||
@retval EFI_SUCCESS Successfully to process it.
|
@retval EFI_SUCCESS Successfully to process it.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Pei Core Firmware File System service routines.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -15,7 +16,7 @@ Module Name:
|
|||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
Pei Core Firmware File System service routines.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -31,28 +32,22 @@ STATIC EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnFvInfoList = {
|
|||||||
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
|
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
|
||||||
(ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
|
(ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
Returns the highest bit set of the State field
|
||||||
|
|
||||||
|
|
||||||
|
@param ErasePolarity Erase Polarity as defined by EFI_FVB2_ERASE_POLARITY
|
||||||
|
in the Attributes field.
|
||||||
|
@param FfsHeader Pointer to FFS File Header.
|
||||||
|
|
||||||
|
@return Returns the highest bit in the State field
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_FFS_FILE_STATE
|
EFI_FFS_FILE_STATE
|
||||||
GetFileState(
|
GetFileState(
|
||||||
IN UINT8 ErasePolarity,
|
IN UINT8 ErasePolarity,
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader
|
IN EFI_FFS_FILE_HEADER *FfsHeader
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Returns the highest bit set of the State field
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
ErasePolarity - Erase Polarity as defined by EFI_FVB2_ERASE_POLARITY
|
|
||||||
in the Attributes field.
|
|
||||||
FfsHeader - Pointer to FFS File Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Returns the highest bit in the State field
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_FFS_FILE_STATE FileState;
|
EFI_FFS_FILE_STATE FileState;
|
||||||
EFI_FFS_FILE_STATE HighestBit;
|
EFI_FFS_FILE_STATE HighestBit;
|
||||||
@ -71,48 +66,37 @@ Returns:
|
|||||||
return HighestBit;
|
return HighestBit;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
Calculates the checksum of the header of a file.
|
||||||
|
|
||||||
|
@param FileHeader Pointer to FFS File Header.
|
||||||
|
|
||||||
|
@return Checksum of the header.
|
||||||
|
The header is zero byte checksum.
|
||||||
|
Zero means the header is good.
|
||||||
|
Non-zero means the header is bad.
|
||||||
|
**/
|
||||||
UINT8
|
UINT8
|
||||||
CalculateHeaderChecksum (
|
CalculateHeaderChecksum (
|
||||||
IN EFI_FFS_FILE_HEADER *FileHeader
|
IN EFI_FFS_FILE_HEADER *FileHeader
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Calculates the checksum of the header of a file.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
FileHeader - Pointer to FFS File Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Checksum of the header.
|
|
||||||
|
|
||||||
The header is zero byte checksum.
|
|
||||||
- Zero means the header is good.
|
|
||||||
- Non-zero means the header is bad.
|
|
||||||
|
|
||||||
|
|
||||||
Bugbug: For PEI performance reason, we comments this code at this time.
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINT8 *ptr;
|
UINT8 *Ptr;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINT8 Sum;
|
UINT8 Sum;
|
||||||
|
|
||||||
Sum = 0;
|
Sum = 0;
|
||||||
ptr = (UINT8 *)FileHeader;
|
Ptr = (UINT8 *)FileHeader;
|
||||||
|
|
||||||
for (Index = 0; Index < sizeof(EFI_FFS_FILE_HEADER) - 3; Index += 4) {
|
for (Index = 0; Index < sizeof(EFI_FFS_FILE_HEADER) - 3; Index += 4) {
|
||||||
Sum = (UINT8)(Sum + ptr[Index]);
|
Sum = (UINT8)(Sum + Ptr[Index]);
|
||||||
Sum = (UINT8)(Sum + ptr[Index+1]);
|
Sum = (UINT8)(Sum + Ptr[Index+1]);
|
||||||
Sum = (UINT8)(Sum + ptr[Index+2]);
|
Sum = (UINT8)(Sum + Ptr[Index+2]);
|
||||||
Sum = (UINT8)(Sum + ptr[Index+3]);
|
Sum = (UINT8)(Sum + Ptr[Index+3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; Index < sizeof(EFI_FFS_FILE_HEADER); Index++) {
|
for (; Index < sizeof(EFI_FFS_FILE_HEADER); Index++) {
|
||||||
Sum = (UINT8)(Sum + ptr[Index]);
|
Sum = (UINT8)(Sum + Ptr[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -127,7 +111,15 @@ Bugbug: For PEI performance reason, we comments this code at this time.
|
|||||||
return Sum;
|
return Sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
Find FV handler according some FileHandle in that FV.
|
||||||
|
|
||||||
|
@param FileHandle Handle of file image
|
||||||
|
@param VolumeHandle Handle of FV
|
||||||
|
|
||||||
|
@return EDES_TODO: Add description for return value
|
||||||
|
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiFileHandleToVolume (
|
PeiFileHandleToVolume (
|
||||||
@ -151,7 +143,23 @@ PeiFileHandleToVolume (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Given the input file pointer, search for the next matching file in the
|
||||||
|
FFS volume as defined by SearchType. The search starts from FileHeader inside
|
||||||
|
the Firmware Volume defined by FwVolHeader.
|
||||||
|
|
||||||
|
|
||||||
|
@param FvHandle Pointer to the FV header of the volume to search
|
||||||
|
@param FileName File name
|
||||||
|
@param SearchType Filter to find only files of this type.
|
||||||
|
Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
|
||||||
|
@param FileHandle This parameter must point to a valid FFS volume.
|
||||||
|
@param AprioriFile Pointer to AprioriFile image in this FV if has
|
||||||
|
|
||||||
|
@return EFI_NOT_FOUND No files matching the search criteria were found
|
||||||
|
@retval EFI_SUCCESS Success to search given file
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiFindFileEx (
|
PeiFindFileEx (
|
||||||
IN CONST EFI_PEI_FV_HANDLE FvHandle,
|
IN CONST EFI_PEI_FV_HANDLE FvHandle,
|
||||||
@ -160,28 +168,6 @@ PeiFindFileEx (
|
|||||||
IN OUT EFI_PEI_FILE_HANDLE *FileHandle,
|
IN OUT EFI_PEI_FILE_HANDLE *FileHandle,
|
||||||
IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL
|
IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Given the input file pointer, search for the next matching file in the
|
|
||||||
FFS volume as defined by SearchType. The search starts from FileHeader inside
|
|
||||||
the Firmware Volume defined by FwVolHeader.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
PeiServices - Pointer to the PEI Core Services Table.
|
|
||||||
SearchType - Filter to find only files of this type.
|
|
||||||
Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
|
|
||||||
FwVolHeader - Pointer to the FV header of the volume to search.
|
|
||||||
This parameter must point to a valid FFS volume.
|
|
||||||
FileHeader - Pointer to the current file from which to begin searching.
|
|
||||||
This pointer will be updated upon return to reflect the file found.
|
|
||||||
Flag - Indicator for if this is for PEI Dispath search
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_NOT_FOUND - No files matching the search criteria were found
|
|
||||||
EFI_SUCCESS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||||
EFI_FFS_FILE_HEADER **FileHeader;
|
EFI_FFS_FILE_HEADER **FileHeader;
|
||||||
@ -297,25 +283,22 @@ Returns:
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Initialize PeiCore Fv List.
|
||||||
|
|
||||||
|
|
||||||
|
@param PrivateData - Pointer to PEI_CORE_INSTANCE.
|
||||||
|
@param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
|
||||||
|
|
||||||
|
@return NONE
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
PeiInitializeFv (
|
PeiInitializeFv (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Initialize PeiCore Fv List.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
PrivateData - Pointer to PEI_CORE_INSTANCE.
|
|
||||||
SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
NONE
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
//
|
//
|
||||||
@ -340,6 +323,17 @@ Returns:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Process Firmware Volum Information once FvInfoPPI install.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - General purpose services available to every PEIM.
|
||||||
|
@param NotifyDescriptor EDES_TODO: Add parameter description
|
||||||
|
@param Ppi EDES_TODO: Add parameter description
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS if the interface could be successfully installed
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
FirmwareVolmeInfoPpiNotifyCallback (
|
FirmwareVolmeInfoPpiNotifyCallback (
|
||||||
@ -347,22 +341,6 @@ FirmwareVolmeInfoPpiNotifyCallback (
|
|||||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
|
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
|
||||||
IN VOID *Ppi
|
IN VOID *Ppi
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Process Firmware Volum Information once FvInfoPPI install.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - General purpose services available to every PEIM.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS if the interface could be successfully
|
|
||||||
installed
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINT8 FvCount;
|
UINT8 FvCount;
|
||||||
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *Fv;
|
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *Fv;
|
||||||
@ -434,6 +412,22 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Go through the file to search SectionType section,
|
||||||
|
when meeting an encapsuled section.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - General purpose services available to every PEIM.
|
||||||
|
SearchType - Filter to find only section of this type.
|
||||||
|
@param SectionType EDES_TODO: Add parameter description
|
||||||
|
@param Section - From where to search.
|
||||||
|
@param SectionSize - The file size to search.
|
||||||
|
@param OutputBuffer - Pointer to the section to search.
|
||||||
|
|
||||||
|
@return EFI_STATUS
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiFfsProcessSection (
|
PeiFfsProcessSection (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||||
@ -442,24 +436,6 @@ PeiFfsProcessSection (
|
|||||||
IN UINTN SectionSize,
|
IN UINTN SectionSize,
|
||||||
OUT VOID **OutputBuffer
|
OUT VOID **OutputBuffer
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Go through the file to search SectionType section,
|
|
||||||
when meeting an encapsuled section.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
PeiServices - General purpose services available to every PEIM.
|
|
||||||
SearchType - Filter to find only section of this type.
|
|
||||||
Section - From where to search.
|
|
||||||
SectionSize - The file size to search.
|
|
||||||
OutputBuffer - Pointer to the section to search.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 SectionLength;
|
UINT32 SectionLength;
|
||||||
@ -571,6 +547,21 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Given the input file pointer, search for the next matching section in the
|
||||||
|
FFS volume.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices Pointer to the PEI Core Services Table.
|
||||||
|
@param SectionType Filter to find only sections of this type.
|
||||||
|
@param FileHandle Pointer to the current file to search.
|
||||||
|
@param SectionData Pointer to the Section matching SectionType in FfsFileHeader.
|
||||||
|
NULL if section not found
|
||||||
|
|
||||||
|
@retval EFI_NOT_FOUND No files matching the search criteria were found
|
||||||
|
@retval EFI_SUCCESS Success to find section data in given file
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiFfsFindSectionData (
|
PeiFfsFindSectionData (
|
||||||
@ -579,24 +570,6 @@ PeiFfsFindSectionData (
|
|||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
IN OUT VOID **SectionData
|
IN OUT VOID **SectionData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Given the input file pointer, search for the next matching section in the
|
|
||||||
FFS volume.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
PeiServices - Pointer to the PEI Core Services Table.
|
|
||||||
SearchType - Filter to find only sections of this type.
|
|
||||||
FfsFileHeader - Pointer to the current file to search.
|
|
||||||
SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
|
|
||||||
- NULL if section not found
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_NOT_FOUND - No files matching the search criteria were found
|
|
||||||
EFI_SUCCESS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_FFS_FILE_HEADER *FfsFileHeader;
|
EFI_FFS_FILE_HEADER *FfsFileHeader;
|
||||||
UINT32 FileSize;
|
UINT32 FileSize;
|
||||||
@ -622,7 +595,22 @@ Returns:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Given the input file pointer, search for the next matching file in the
|
||||||
|
FFS volume as defined by SearchType. The search starts from FileHeader inside
|
||||||
|
the Firmware Volume defined by FwVolHeader.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices Pointer to the PEI Core Services Table.
|
||||||
|
@param SearchType Filter to find only files of this type.
|
||||||
|
Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
|
||||||
|
@param VolumeHandle Pointer to the FV header of the volume to search.
|
||||||
|
@param FileHandle Pointer to the current file from which to begin searching.
|
||||||
|
This pointer will be updated upon return to reflect the file found.
|
||||||
|
@retval EFI_NOT_FOUND No files matching the search criteria were found
|
||||||
|
@retval EFI_SUCCESS Success to find next file in given volume
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiFfsFindNextFile (
|
PeiFfsFindNextFile (
|
||||||
@ -631,35 +619,22 @@ PeiFfsFindNextFile (
|
|||||||
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
||||||
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
|
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Given the input file pointer, search for the next matching file in the
|
|
||||||
FFS volume as defined by SearchType. The search starts from FileHeader inside
|
|
||||||
the Firmware Volume defined by FwVolHeader.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
PeiServices - Pointer to the PEI Core Services Table.
|
|
||||||
|
|
||||||
SearchType - Filter to find only files of this type.
|
|
||||||
Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
|
|
||||||
|
|
||||||
FwVolHeader - Pointer to the FV header of the volume to search.
|
|
||||||
This parameter must point to a valid FFS volume.
|
|
||||||
|
|
||||||
FileHeader - Pointer to the current file from which to begin searching.
|
|
||||||
This pointer will be updated upon return to reflect the file found.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_NOT_FOUND - No files matching the search criteria were found
|
|
||||||
EFI_SUCCESS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
return PeiFindFileEx (VolumeHandle, NULL, SearchType, FileHandle, NULL);
|
return PeiFindFileEx (VolumeHandle, NULL, SearchType, FileHandle, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
search the firmware volumes by index
|
||||||
|
|
||||||
|
@param PeiServices The PEI core services table.
|
||||||
|
@param Instance Instance of FV to find
|
||||||
|
@param VolumeHandle Pointer to found Volume.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER FwVolHeader is NULL
|
||||||
|
@retval EFI_SUCCESS Firmware volume instance successfully found.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiFvFindNextVolume (
|
PeiFvFindNextVolume (
|
||||||
@ -667,30 +642,6 @@ PeiFvFindNextVolume (
|
|||||||
IN UINTN Instance,
|
IN UINTN Instance,
|
||||||
IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
|
IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Return the firmware volumes.
|
|
||||||
|
|
||||||
BugBug -- Move this to the location of this code to where the
|
|
||||||
other FV and FFS support code lives.
|
|
||||||
Also, update to use FindFV for instances #'s >= 1.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
Instance - Instance of FV to find
|
|
||||||
FwVolHeader - Pointer to contain the data to return
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Pointer to the Firmware Volume instance requested
|
|
||||||
|
|
||||||
EFI_INVALID_PARAMETER - FwVolHeader is NULL
|
|
||||||
|
|
||||||
EFI_SUCCESS - Firmware volume instance successfully found.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *Private;
|
PEI_CORE_INSTANCE *Private;
|
||||||
|
|
||||||
@ -709,6 +660,19 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Given the input VolumeHandle, search for the next matching name file.
|
||||||
|
|
||||||
|
|
||||||
|
@param FileName - File name to search.
|
||||||
|
@param VolumeHandle - The current FV to search.
|
||||||
|
@param FileHandle - Pointer to the file matching name in VolumeHandle.
|
||||||
|
- NULL if file not found
|
||||||
|
|
||||||
|
@return EFI_STATUS
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiFfsFindFileByName (
|
PeiFfsFindFileByName (
|
||||||
@ -716,22 +680,6 @@ PeiFfsFindFileByName (
|
|||||||
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
||||||
OUT EFI_PEI_FILE_HANDLE *FileHandle
|
OUT EFI_PEI_FILE_HANDLE *FileHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Given the input VolumeHandle, search for the next matching name file.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
FileName - File name to search.
|
|
||||||
VolumeHandle - The current FV to search.
|
|
||||||
FileHandle - Pointer to the file matching name in VolumeHandle.
|
|
||||||
- NULL if file not found
|
|
||||||
Returns:
|
|
||||||
EFI_STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
if ((VolumeHandle == NULL) || (FileName == NULL) || (FileHandle == NULL)) {
|
if ((VolumeHandle == NULL) || (FileName == NULL) || (FileHandle == NULL)) {
|
||||||
@ -744,26 +692,24 @@ Returns:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns information about a specific file.
|
||||||
|
|
||||||
|
|
||||||
|
@param FileHandle - The handle to file.
|
||||||
|
@param FileInfo - Pointer to the file information.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Invalid FileHandle or FileInfo.
|
||||||
|
@retval EFI_SUCCESS Success to collect file info.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiFfsGetFileInfo (
|
PeiFfsGetFileInfo (
|
||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
OUT EFI_FV_FILE_INFO *FileInfo
|
OUT EFI_FV_FILE_INFO *FileInfo
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Collect information of given file.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
FileHandle - The handle to file.
|
|
||||||
FileInfo - Pointer to the file information.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINT8 FileState;
|
UINT8 FileState;
|
||||||
UINT8 ErasePolarity;
|
UINT8 ErasePolarity;
|
||||||
@ -811,26 +757,22 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Collect information of given Fv Volume.
|
||||||
|
|
||||||
|
@param VolumeHandle - The handle to Fv Volume.
|
||||||
|
@param VolumeInfo - The pointer to volume information.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER VolumeInfo is NULL
|
||||||
|
@retval EFI_SUCCESS Success to collect fv info.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiFfsGetVolumeInfo (
|
PeiFfsGetVolumeInfo (
|
||||||
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
||||||
OUT EFI_FV_INFO *VolumeInfo
|
OUT EFI_FV_INFO *VolumeInfo
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Collect information of given Fv Volume.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
VolumeHandle - The handle to Fv Volume.
|
|
||||||
VolumeInfo - The pointer to volume information.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_FIRMWARE_VOLUME_HEADER FwVolHeader;
|
EFI_FIRMWARE_VOLUME_HEADER FwVolHeader;
|
||||||
EFI_FIRMWARE_VOLUME_EXT_HEADER *FwVolExHeaderInfo;
|
EFI_FIRMWARE_VOLUME_EXT_HEADER *FwVolExHeaderInfo;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
This module provide Hand-Off Block manupulation.
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,42 +10,29 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Hob.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
EFI PEI Core HOB services
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Gets the pointer to the HOB List.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices The PEI core services table.
|
||||||
|
@param HobList Pointer to the HOB List.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Get the pointer of HOB List
|
||||||
|
@retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
|
||||||
|
@retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiGetHobList (
|
PeiGetHobList (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||||
IN OUT VOID **HobList
|
IN OUT VOID **HobList
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Gets the pointer to the HOB List.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
HobList - Pointer to the HOB List.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Get the pointer of HOB List
|
|
||||||
EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
|
|
||||||
EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
|
|
||||||
@ -68,6 +56,20 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Add a new HOB to the HOB List.
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param Type - Type of the new HOB.
|
||||||
|
@param Length - Length of the new HOB to allocate.
|
||||||
|
@param Hob - Pointer to the new HOB.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Success to create hob.
|
||||||
|
@retval EFI_INVALID_PARAMETER if Hob is NULL
|
||||||
|
@retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiCreateHob (
|
PeiCreateHob (
|
||||||
@ -76,27 +78,6 @@ PeiCreateHob (
|
|||||||
IN UINT16 Length,
|
IN UINT16 Length,
|
||||||
IN OUT VOID **Hob
|
IN OUT VOID **Hob
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Add a new HOB to the HOB List.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
Type - Type of the new HOB.
|
|
||||||
Length - Length of the new HOB to allocate.
|
|
||||||
Hob - Pointer to the new HOB.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS
|
|
||||||
- EFI_INVALID_PARAMETER if Hob is NULL
|
|
||||||
- EFI_NOT_AVAILABLE_YET if HobList is still not available.
|
|
||||||
- EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
|
||||||
@ -142,29 +123,23 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Builds a Handoff Information Table HOB
|
||||||
|
|
||||||
|
@param BootMode - Current Bootmode
|
||||||
|
@param MemoryBegin - Start Memory Address.
|
||||||
|
@param MemoryLength - Length of Memory.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Always success to initialize HOB.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiCoreBuildHobHandoffInfoTable (
|
PeiCoreBuildHobHandoffInfoTable (
|
||||||
IN EFI_BOOT_MODE BootMode,
|
IN EFI_BOOT_MODE BootMode,
|
||||||
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
|
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
|
||||||
IN UINT64 MemoryLength
|
IN UINT64 MemoryLength
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Builds a Handoff Information Table HOB
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
BootMode - Current Bootmode
|
|
||||||
MemoryBegin - Start Memory Address.
|
|
||||||
MemoryLength - Length of Memory.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_HOB_HANDOFF_INFO_TABLE *Hob;
|
EFI_HOB_HANDOFF_INFO_TABLE *Hob;
|
||||||
EFI_HOB_GENERIC_HEADER *HobEnd;
|
EFI_HOB_GENERIC_HEADER *HobEnd;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Pei Core Load Image Support
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,37 +10,25 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Image.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Pei Core Load Image Support
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
/*++
|
/**
|
||||||
|
Routine for loading file image.
|
||||||
|
|
||||||
Routine Description:
|
@param PeiServices The PEI core services table.
|
||||||
|
@param FileHandle Pointer to the FFS file header of the image.
|
||||||
|
@param ImageAddressArg Pointer to PE/TE image.
|
||||||
|
@param ImageSizeArg Size of PE/TE image.
|
||||||
|
@param EntryPoint Pointer to entry point of specified image file for output.
|
||||||
|
@param AuthenticationState - Pointer to attestation authentication state of image.
|
||||||
|
|
||||||
Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
|
@retval EFI_SUCCESS - Image is successfully loaded.
|
||||||
|
@retval EFI_NOT_FOUND - Fail to locate necessary PPI
|
||||||
Arguments:
|
@retval Others - Fail to load file.
|
||||||
|
|
||||||
FileHandle - The handle to the PE/COFF file
|
|
||||||
FileOffset - The offset, in bytes, into the file to read
|
|
||||||
ReadSize - The number of bytes to read from the file starting at FileOffset
|
|
||||||
Buffer - A pointer to the buffer to read the data into.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiLoadImageLoadImage (
|
PeiLoadImageLoadImage (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
@ -49,30 +38,21 @@ PeiLoadImageLoadImage (
|
|||||||
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
||||||
OUT UINT32 *AuthenticationState
|
OUT UINT32 *AuthenticationState
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Routine for loading file image.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
FileHandle - Pointer to the FFS file header of the image.
|
|
||||||
ImageAddressArg - Pointer to PE/TE image.
|
|
||||||
ImageSizeArg - Size of PE/TE image.
|
|
||||||
EntryPoint - Pointer to entry point of specified image file for output.
|
|
||||||
AuthenticationState - Pointer to attestation authentication state of image.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS - Image is successfully loaded.
|
|
||||||
EFI_NOT_FOUND - Fail to locate necessary PPI
|
|
||||||
Others - Fail to load file.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The wrapper function of PeiLoadImageLoadImage().
|
||||||
|
|
||||||
|
@param This - Pointer to EFI_PEI_LOAD_FILE_PPI.
|
||||||
|
@param FileHandle - Pointer to the FFS file header of the image.
|
||||||
|
@param ImageAddressArg - Pointer to PE/TE image.
|
||||||
|
@param ImageSizeArg - Size of PE/TE image.
|
||||||
|
@param EntryPoint - Pointer to entry point of specified image file for output.
|
||||||
|
@param AuthenticationState - Pointer to attestation authentication state of image.
|
||||||
|
|
||||||
|
@return Status of PeiLoadImageLoadImage().
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiLoadImageLoadImageWrapper (
|
PeiLoadImageLoadImageWrapper (
|
||||||
@ -83,27 +63,6 @@ PeiLoadImageLoadImageWrapper (
|
|||||||
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
||||||
OUT UINT32 *AuthenticationState
|
OUT UINT32 *AuthenticationState
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
The wrapper function of PeiLoadImageLoadImage().
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Pointer to EFI_PEI_LOAD_FILE_PPI.
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
FileHandle - Pointer to the FFS file header of the image.
|
|
||||||
ImageAddressArg - Pointer to PE/TE image.
|
|
||||||
ImageSizeArg - Size of PE/TE image.
|
|
||||||
EntryPoint - Pointer to entry point of specified image file for output.
|
|
||||||
AuthenticationState - Pointer to attestation authentication state of image.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_STATUS.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
;
|
||||||
|
|
||||||
STATIC EFI_PEI_LOAD_FILE_PPI mPeiLoadImagePpi = {
|
STATIC EFI_PEI_LOAD_FILE_PPI mPeiLoadImagePpi = {
|
||||||
@ -117,6 +76,19 @@ STATIC EFI_PEI_PPI_DESCRIPTOR gPpiLoadFilePpiList = {
|
|||||||
&mPeiLoadImagePpi
|
&mPeiLoadImagePpi
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
|
||||||
|
|
||||||
|
|
||||||
|
@param FileHandle - The handle to the PE/COFF file
|
||||||
|
@param FileOffset - The offset, in bytes, into the file to read
|
||||||
|
@param ReadSize - The number of bytes to read from the file starting at FileOffset
|
||||||
|
@param Buffer - A pointer to the buffer to read the data into.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiImageRead (
|
PeiImageRead (
|
||||||
@ -125,24 +97,6 @@ PeiImageRead (
|
|||||||
IN OUT UINTN *ReadSize,
|
IN OUT UINTN *ReadSize,
|
||||||
OUT VOID *Buffer
|
OUT VOID *Buffer
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
FileHandle - The handle to the PE/COFF file
|
|
||||||
FileOffset - The offset, in bytes, into the file to read
|
|
||||||
ReadSize - The number of bytes to read from the file starting at FileOffset
|
|
||||||
Buffer - A pointer to the buffer to read the data into.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
CHAR8 *Destination8;
|
CHAR8 *Destination8;
|
||||||
CHAR8 *Source8;
|
CHAR8 *Source8;
|
||||||
@ -158,27 +112,19 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Support routine to return the Image Read.
|
||||||
|
|
||||||
|
@param ImageContext - The context of the image being loaded
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS - If Image function location is found
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetImageReadFunction (
|
GetImageReadFunction (
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Support routine to return the Image Read
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - PEI Services Table
|
|
||||||
|
|
||||||
ImageContext - The context of the image being loaded
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - If Image function location is found
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
VOID* MemoryBuffer;
|
VOID* MemoryBuffer;
|
||||||
|
|
||||||
@ -192,7 +138,20 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
|
||||||
|
Loads and relocates a PE/COFF image into memory.
|
||||||
|
|
||||||
|
|
||||||
|
@param Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated
|
||||||
|
@param ImageAddress - The base address of the relocated PE/COFF image
|
||||||
|
@param ImageSize - The size of the relocated PE/COFF image
|
||||||
|
@param EntryPoint - The entry point of the relocated PE/COFF image
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The file was loaded and relocated
|
||||||
|
@retval EFI_OUT_OF_RESOURCES There was not enough memory to load and relocate the PE/COFF file
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
LoadAndRelocatePeCoffImage (
|
LoadAndRelocatePeCoffImage (
|
||||||
IN VOID *Pe32Data,
|
IN VOID *Pe32Data,
|
||||||
@ -200,29 +159,6 @@ LoadAndRelocatePeCoffImage (
|
|||||||
OUT UINT64 *ImageSize,
|
OUT UINT64 *ImageSize,
|
||||||
OUT EFI_PHYSICAL_ADDRESS *EntryPoint
|
OUT EFI_PHYSICAL_ADDRESS *EntryPoint
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Loads and relocates a PE/COFF image into memory.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated
|
|
||||||
|
|
||||||
ImageAddress - The base address of the relocated PE/COFF image
|
|
||||||
|
|
||||||
ImageSize - The size of the relocated PE/COFF image
|
|
||||||
|
|
||||||
EntryPoint - The entry point of the relocated PE/COFF image
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The file was loaded and relocated
|
|
||||||
|
|
||||||
EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
|
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
|
||||||
@ -286,6 +222,21 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Routine for loading file image.
|
||||||
|
|
||||||
|
@param PeiServices The PEI core services table.
|
||||||
|
@param FileHandle Pointer to the FFS file header of the image.
|
||||||
|
@param ImageAddressArg Pointer to PE/TE image.
|
||||||
|
@param ImageSizeArg Size of PE/TE image.
|
||||||
|
@param EntryPoint Pointer to entry point of specified image file for output.
|
||||||
|
@param AuthenticationState - Pointer to attestation authentication state of image.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS - Image is successfully loaded.
|
||||||
|
@retval EFI_NOT_FOUND - Fail to locate necessary PPI
|
||||||
|
@retval Others - Fail to load file.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiLoadImageLoadImage (
|
PeiLoadImageLoadImage (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
@ -295,28 +246,6 @@ PeiLoadImageLoadImage (
|
|||||||
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
||||||
OUT UINT32 *AuthenticationState
|
OUT UINT32 *AuthenticationState
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Routine for loading file image.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
FileHandle - Pointer to the FFS file header of the image.
|
|
||||||
ImageAddressArg - Pointer to PE/TE image.
|
|
||||||
ImageSizeArg - Size of PE/TE image.
|
|
||||||
EntryPoint - Pointer to entry point of specified image file for output.
|
|
||||||
AuthenticationState - Pointer to attestation authentication state of image.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS - Image is successfully loaded.
|
|
||||||
EFI_NOT_FOUND - Fail to locate necessary PPI
|
|
||||||
Others - Fail to load file.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
VOID *Pe32Data;
|
VOID *Pe32Data;
|
||||||
@ -464,6 +393,19 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
The wrapper function of PeiLoadImageLoadImage().
|
||||||
|
|
||||||
|
@param This - Pointer to EFI_PEI_LOAD_FILE_PPI.
|
||||||
|
@param FileHandle - Pointer to the FFS file header of the image.
|
||||||
|
@param ImageAddressArg - Pointer to PE/TE image.
|
||||||
|
@param ImageSizeArg - Size of PE/TE image.
|
||||||
|
@param EntryPoint - Pointer to entry point of specified image file for output.
|
||||||
|
@param AuthenticationState - Pointer to attestation authentication state of image.
|
||||||
|
|
||||||
|
@return Status of PeiLoadImageLoadImage().
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiLoadImageLoadImageWrapper (
|
PeiLoadImageLoadImageWrapper (
|
||||||
@ -474,27 +416,6 @@ PeiLoadImageLoadImageWrapper (
|
|||||||
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
||||||
OUT UINT32 *AuthenticationState
|
OUT UINT32 *AuthenticationState
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
The wrapper function of PeiLoadImageLoadImage().
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Pointer to EFI_PEI_LOAD_FILE_PPI.
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
FileHandle - Pointer to the FFS file header of the image.
|
|
||||||
ImageAddressArg - Pointer to PE/TE image.
|
|
||||||
ImageSizeArg - Size of PE/TE image.
|
|
||||||
EntryPoint - Pointer to entry point of specified image file for output.
|
|
||||||
AuthenticationState - Pointer to attestation authentication state of image.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_STATUS.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
return PeiLoadImageLoadImage (
|
return PeiLoadImageLoadImage (
|
||||||
GetPeiServicesTablePointer (),
|
GetPeiServicesTablePointer (),
|
||||||
@ -506,6 +427,21 @@ Returns:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Routine for load image file.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param FileHandle - Pointer to the FFS file header of the image.
|
||||||
|
@param EntryPoint - Pointer to entry point of specified image file for output.
|
||||||
|
@param AuthenticationState - Pointer to attestation authentication state of image.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS - Image is successfully loaded.
|
||||||
|
@retval EFI_NOT_FOUND - Fail to locate necessary PPI
|
||||||
|
@retval Others - Fail to load file.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PeiLoadImage (
|
PeiLoadImage (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
@ -513,26 +449,6 @@ PeiLoadImage (
|
|||||||
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
|
||||||
OUT UINT32 *AuthenticationState
|
OUT UINT32 *AuthenticationState
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Routine for load image file.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
FileHandle - Pointer to the FFS file header of the image.
|
|
||||||
EntryPoint - Pointer to entry point of specified image file for output.
|
|
||||||
AuthenticationState - Pointer to attestation authentication state of image.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS - Image is successfully loaded.
|
|
||||||
EFI_NOT_FOUND - Fail to locate necessary PPI
|
|
||||||
Others - Fail to load file.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS PpiStatus;
|
EFI_STATUS PpiStatus;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -585,27 +501,20 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Install Pei Load File PPI.
|
||||||
|
|
||||||
|
|
||||||
|
@param PrivateData - Pointer to PEI_CORE_INSTANCE.
|
||||||
|
@param OldCoreData - Pointer to PEI_CORE_INSTANCE.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializeImageServices (
|
InitializeImageServices (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData
|
IN PEI_CORE_INSTANCE *OldCoreData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Install Pei Load File PPI.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PrivateData - Pointer to PEI_CORE_INSTANCE.
|
|
||||||
OldCoreData - Pointer to PEI_CORE_INSTANCE.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
NONE.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (OldCoreData == NULL) {
|
if (OldCoreData == NULL) {
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
EFI PEI Core memory services
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,45 +10,29 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
MemoryServices.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
EFI PEI Core memory services
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Initialize the memory services.
|
||||||
|
|
||||||
|
|
||||||
|
@param PrivateData Add parameter description
|
||||||
|
@param SecCoreData Points to a data structure containing information about the PEI core's operating
|
||||||
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
|
@param OldCoreData Pointer to the PEI Core data.
|
||||||
|
NULL if being run in non-permament memory mode.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializeMemoryServices (
|
InitializeMemoryServices (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData
|
IN PEI_CORE_INSTANCE *OldCoreData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Initialize the memory services.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
|
||||||
environment, such as the size and location of temporary RAM, the stack location and
|
|
||||||
the BFV location.
|
|
||||||
|
|
||||||
OldCoreData - Pointer to the PEI Core data.
|
|
||||||
NULL if being run in non-permament memory mode.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
|
|
||||||
PrivateData->SwitchStackSignal = FALSE;
|
PrivateData->SwitchStackSignal = FALSE;
|
||||||
@ -85,6 +70,18 @@ Returns:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Install the permanent memory is now available.
|
||||||
|
Creates HOB (PHIT and Stack).
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param MemoryBegin - Start of memory address.
|
||||||
|
@param MemoryLength - Length of memory.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Always success.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiInstallPeiMemory (
|
PeiInstallPeiMemory (
|
||||||
@ -92,24 +89,6 @@ PeiInstallPeiMemory (
|
|||||||
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
|
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
|
||||||
IN UINT64 MemoryLength
|
IN UINT64 MemoryLength
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Install the permanent memory is now available.
|
|
||||||
Creates HOB (PHIT and Stack).
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
MemoryBegin - Start of memory address.
|
|
||||||
MemoryLength - Length of memory.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
|
|
||||||
@ -125,6 +104,24 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Memory allocation service on permanent memory,
|
||||||
|
not usable prior to the memory installation.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param MemoryType - Type of memory to allocate.
|
||||||
|
@param Pages - Number of pages to allocate.
|
||||||
|
@param Memory - Pointer of memory allocated.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The allocation was successful
|
||||||
|
@retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
|
||||||
|
@retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
|
||||||
|
@retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
|
||||||
|
to allocate the number of pages.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiAllocatePages (
|
PeiAllocatePages (
|
||||||
@ -133,29 +130,6 @@ PeiAllocatePages (
|
|||||||
IN UINTN Pages,
|
IN UINTN Pages,
|
||||||
OUT EFI_PHYSICAL_ADDRESS *Memory
|
OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Memory allocation service on permanent memory,
|
|
||||||
not usable prior to the memory installation.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
MemoryType - Type of memory to allocate.
|
|
||||||
Pages - Number of pages to allocate.
|
|
||||||
Memory - Pointer of memory allocated.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS The allocation was successful
|
|
||||||
EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
|
|
||||||
EFI_NOT_AVAILABLE_YET Called with permanent memory not available
|
|
||||||
EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
|
|
||||||
to allocate the number of pages.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
EFI_PEI_HOB_POINTERS Hob;
|
EFI_PEI_HOB_POINTERS Hob;
|
||||||
@ -232,7 +206,20 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Memory allocation service on the CAR.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param Size - Amount of memory required
|
||||||
|
@param Buffer - Address of pointer to the buffer
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The allocation was successful
|
||||||
|
@retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
|
||||||
|
to allocate the requested size.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiAllocatePool (
|
PeiAllocatePool (
|
||||||
@ -240,27 +227,6 @@ PeiAllocatePool (
|
|||||||
IN UINTN Size,
|
IN UINTN Size,
|
||||||
OUT VOID **Buffer
|
OUT VOID **Buffer
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Memory allocation service on the CAR.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
|
|
||||||
Size - Amount of memory required
|
|
||||||
|
|
||||||
Buffer - Address of pointer to the buffer
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS The allocation was successful
|
|
||||||
EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
|
|
||||||
to allocate the requested size.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HOB_MEMORY_POOL *Hob;
|
EFI_HOB_MEMORY_POOL *Hob;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Pei Core Main Entry Point
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,21 +10,11 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
PeiMain.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Pei Core Main Entry Point
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
static EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {
|
STATIC EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {
|
||||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
&gEfiPeiMemoryDiscoveredPpiGuid,
|
&gEfiPeiMemoryDiscoveredPpiGuid,
|
||||||
NULL
|
NULL
|
||||||
@ -33,7 +24,7 @@ static EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {
|
|||||||
// Pei Core Module Variables
|
// Pei Core Module Variables
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
static EFI_PEI_SERVICES mPS = {
|
STATIC EFI_PEI_SERVICES gPs = {
|
||||||
{
|
{
|
||||||
PEI_SERVICES_SIGNATURE,
|
PEI_SERVICES_SIGNATURE,
|
||||||
PEI_SERVICES_REVISION,
|
PEI_SERVICES_REVISION,
|
||||||
@ -74,6 +65,28 @@ static EFI_PEI_SERVICES mPS = {
|
|||||||
PeiRegisterForShadow
|
PeiRegisterForShadow
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
The entry routine to Pei Core, invoked by PeiMain during transition
|
||||||
|
from SEC to PEI. After switching stack in the PEI core, it will restart
|
||||||
|
with the old core data.
|
||||||
|
|
||||||
|
|
||||||
|
@param SecCoreData Points to a data structure containing information about the PEI core's operating
|
||||||
|
environment, such as the size and location of temporary RAM, the stack location and
|
||||||
|
the BFV location.
|
||||||
|
@param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
|
||||||
|
An empty PPI list consists of a single descriptor with the end-tag
|
||||||
|
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
|
||||||
|
phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
|
||||||
|
that both the PEI Foundation and any modules can leverage the associated service
|
||||||
|
calls and/or code in these early PPIs
|
||||||
|
@param Data Pointer to old core data that is used to initialize the
|
||||||
|
core's data areas.
|
||||||
|
|
||||||
|
@retval EFI_NOT_FOUND Never reach
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiCore (
|
PeiCore (
|
||||||
@ -81,34 +94,6 @@ PeiCore (
|
|||||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,
|
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,
|
||||||
IN VOID *Data
|
IN VOID *Data
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
The entry routine to Pei Core, invoked by PeiMain during transition
|
|
||||||
from SEC to PEI. After switching stack in the PEI core, it will restart
|
|
||||||
with the old core data.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
SecCoreData - Points to a data structure containing information about the PEI core's operating
|
|
||||||
environment, such as the size and location of temporary RAM, the stack location and
|
|
||||||
the BFV location.
|
|
||||||
PpiList - Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
|
|
||||||
An empty PPI list consists of a single descriptor with the end-tag
|
|
||||||
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
|
|
||||||
phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
|
|
||||||
that both the PEI Foundation and any modules can leverage the associated service
|
|
||||||
calls and/or code in these early PPIs
|
|
||||||
Data - Pointer to old core data that is used to initialize the
|
|
||||||
core's data areas.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
This function never returns
|
|
||||||
EFI_NOT_FOUND - Never reach
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE PrivateData;
|
PEI_CORE_INSTANCE PrivateData;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -144,14 +129,14 @@ Returns:
|
|||||||
CpuIo = (VOID*)PrivateData.ServiceTableShadow.CpuIo;
|
CpuIo = (VOID*)PrivateData.ServiceTableShadow.CpuIo;
|
||||||
PciCfg = (VOID*)PrivateData.ServiceTableShadow.PciCfg;
|
PciCfg = (VOID*)PrivateData.ServiceTableShadow.PciCfg;
|
||||||
|
|
||||||
CopyMem (&PrivateData.ServiceTableShadow, &mPS, sizeof (mPS));
|
CopyMem (&PrivateData.ServiceTableShadow, &gPs, sizeof (gPs));
|
||||||
|
|
||||||
PrivateData.ServiceTableShadow.CpuIo = CpuIo;
|
PrivateData.ServiceTableShadow.CpuIo = CpuIo;
|
||||||
PrivateData.ServiceTableShadow.PciCfg = PciCfg;
|
PrivateData.ServiceTableShadow.PciCfg = PciCfg;
|
||||||
} else {
|
} else {
|
||||||
ZeroMem (&PrivateData, sizeof (PEI_CORE_INSTANCE));
|
ZeroMem (&PrivateData, sizeof (PEI_CORE_INSTANCE));
|
||||||
PrivateData.Signature = PEI_CORE_HANDLE_SIGNATURE;
|
PrivateData.Signature = PEI_CORE_HANDLE_SIGNATURE;
|
||||||
CopyMem (&PrivateData.ServiceTableShadow, &mPS, sizeof (mPS));
|
CopyMem (&PrivateData.ServiceTableShadow, &gPs, sizeof (gPs));
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateData.PS = &PrivateData.ServiceTableShadow;
|
PrivateData.PS = &PrivateData.ServiceTableShadow;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
EFI PEI Core PPI services
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,51 +10,43 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Ppi.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
EFI PEI Core PPI services
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Initialize PPI services.
|
||||||
|
|
||||||
|
|
||||||
|
@param PrivateData Pointer to the PEI Core data.
|
||||||
|
@param OldCoreData Pointer to old PEI Core data.
|
||||||
|
NULL if being run in non-permament memory mode.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializePpiServices (
|
InitializePpiServices (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData
|
IN PEI_CORE_INSTANCE *OldCoreData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Initialize PPI services.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
OldCoreData - Pointer to the PEI Core data.
|
|
||||||
NULL if being run in non-permament memory mode.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Nothing
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (OldCoreData == NULL) {
|
if (OldCoreData == NULL) {
|
||||||
PrivateData->PpiData.NotifyListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;
|
PrivateData->PpiData.NotifyListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;
|
||||||
PrivateData->PpiData.DispatchListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;
|
PrivateData->PpiData.DispatchListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;
|
||||||
PrivateData->PpiData.LastDispatchedNotify = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;
|
PrivateData->PpiData.LastDispatchedNotify = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Migrate the Hob list from the CAR stack to PEI installed memory.
|
||||||
|
|
||||||
|
@param PeiServices The PEI core services table.
|
||||||
|
@param OldCheckingBottom The old checking bottom.
|
||||||
|
@param OldCheckingTop The old checking top.
|
||||||
|
@param NewHandOffHob The new handoff HOB list.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
ConvertPpiPointers (
|
ConvertPpiPointers (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||||
@ -61,22 +54,6 @@ ConvertPpiPointers (
|
|||||||
IN UINTN OldCheckingTop,
|
IN UINTN OldCheckingTop,
|
||||||
IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob
|
IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Migrate the Hob list from the CAR stack to PEI installed memory.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
OldCheckingBottom - The old checking bottom.
|
|
||||||
OldCheckingTop - The old checking top.
|
|
||||||
NewHandOffHob - The new handoff HOB list.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
UINT8 Index;
|
UINT8 Index;
|
||||||
@ -132,33 +109,25 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Install PPI services.
|
||||||
|
|
||||||
|
@param PeiServices - Pointer to the PEI Service Table
|
||||||
|
@param PpiList - Pointer to a list of PEI PPI Descriptors.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
|
||||||
|
@retval EFI_INVALID_PARAMETER - if PpiList is NULL pointer
|
||||||
|
@retval EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
|
||||||
|
@retval EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiInstallPpi (
|
PeiInstallPpi (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
|
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Install PPI services.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - Pointer to the PEI Service Table
|
|
||||||
PpiList - Pointer to a list of PEI PPI Descriptors.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
|
|
||||||
EFI_INVALID_PARAMETER - if PpiList is NULL pointer
|
|
||||||
EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
|
|
||||||
EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
INTN Index;
|
INTN Index;
|
||||||
@ -230,7 +199,20 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Re-Install PPI services.
|
||||||
|
|
||||||
|
@param PeiServices - Pointer to the PEI Service Table
|
||||||
|
@param OldPpi - Pointer to the old PEI PPI Descriptors.
|
||||||
|
@param NewPpi - Pointer to the new PEI PPI Descriptors.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS - if the operation was successful
|
||||||
|
@retval EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
|
||||||
|
@retval EFI_INVALID_PARAMETER - if NewPpi is not valid
|
||||||
|
@retval EFI_NOT_FOUND - if the PPI was not in the database
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiReInstallPpi (
|
PeiReInstallPpi (
|
||||||
@ -238,26 +220,6 @@ PeiReInstallPpi (
|
|||||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
|
IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
|
||||||
IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
|
IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Re-Install PPI services.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - Pointer to the PEI Service Table
|
|
||||||
OldPpi - Pointer to the old PEI PPI Descriptors.
|
|
||||||
NewPpi - Pointer to the new PEI PPI Descriptors.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - if the operation was successful
|
|
||||||
EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
|
|
||||||
EFI_INVALID_PARAMETER - if NewPpi is not valid
|
|
||||||
EFI_NOT_FOUND - if the PPI was not in the database
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
INTN Index;
|
INTN Index;
|
||||||
@ -308,7 +270,22 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Locate a given named PPI.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - Pointer to the PEI Service Table
|
||||||
|
@param Guid - Pointer to GUID of the PPI.
|
||||||
|
@param Instance - Instance Number to discover.
|
||||||
|
@param PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
|
||||||
|
returns a pointer to the descriptor (includes flags, etc)
|
||||||
|
@param Ppi - Pointer to reference the found PPI
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS if the PPI is in the database
|
||||||
|
@retval EFI_NOT_FOUND if the PPI is not in the database
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiLocatePpi (
|
PeiLocatePpi (
|
||||||
@ -318,26 +295,6 @@ PeiLocatePpi (
|
|||||||
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
|
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
|
||||||
IN OUT VOID **Ppi
|
IN OUT VOID **Ppi
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Locate a given named PPI.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - Pointer to the PEI Service Table
|
|
||||||
Guid - Pointer to GUID of the PPI.
|
|
||||||
Instance - Instance Number to discover.
|
|
||||||
PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
|
|
||||||
returns a pointer to the descriptor (includes flags, etc)
|
|
||||||
Ppi - Pointer to reference the found PPI
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS if the PPI is in the database
|
|
||||||
EFI_NOT_FOUND if the PPI is not in the database
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
INTN Index;
|
INTN Index;
|
||||||
@ -383,31 +340,25 @@ Returns:
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Install a notification for a given PPI.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - Pointer to the PEI Service Table
|
||||||
|
@param NotifyList - Pointer to list of Descriptors to notify upon.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS if successful
|
||||||
|
@retval EFI_OUT_OF_RESOURCES if no space in the database
|
||||||
|
@retval EFI_INVALID_PARAMETER if not a good decriptor
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiNotifyPpi (
|
PeiNotifyPpi (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||||
IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
|
IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Install a notification for a given PPI.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - Pointer to the PEI Service Table
|
|
||||||
NotifyList - Pointer to list of Descriptors to notify upon.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS if successful
|
|
||||||
EFI_OUT_OF_RESOURCES if no space in the database
|
|
||||||
EFI_INVALID_PARAMETER if not a good decriptor
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
INTN Index;
|
INTN Index;
|
||||||
@ -507,24 +458,17 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Process the Notify List at dispatch level.
|
||||||
|
|
||||||
|
@param PrivateData PeiCore's private data structure.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
ProcessNotifyList (
|
ProcessNotifyList (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData
|
IN PEI_CORE_INSTANCE *PrivateData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Process the Notify List at dispatch level.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - Pointer to the PEI Service Table
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
{
|
{
|
||||||
INTN TempValue;
|
INTN TempValue;
|
||||||
|
|
||||||
@ -577,6 +521,18 @@ Returns:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Dispatch notifications.
|
||||||
|
|
||||||
|
@param PrivateData PeiCore's private data structure
|
||||||
|
@param NotifyType Type of notify to fire.
|
||||||
|
@param InstallStartIndex Install Beginning index.
|
||||||
|
@param InstallStopIndex Install Ending index.
|
||||||
|
@param NotifyStartIndex Notify Beginning index.
|
||||||
|
@param NotifyStopIndex Notify Ending index.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
DispatchNotify (
|
DispatchNotify (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
@ -586,25 +542,6 @@ DispatchNotify (
|
|||||||
IN INTN NotifyStartIndex,
|
IN INTN NotifyStartIndex,
|
||||||
IN INTN NotifyStopIndex
|
IN INTN NotifyStopIndex
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Dispatch notifications.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - Pointer to the PEI Service Table
|
|
||||||
NotifyType - Type of notify to fire.
|
|
||||||
InstallStartIndex - Install Beginning index.
|
|
||||||
InstallStopIndex - Install Ending index.
|
|
||||||
NotifyStartIndex - Notify Beginning index.
|
|
||||||
NotifyStopIndex - Notify Ending index.
|
|
||||||
|
|
||||||
Returns: None
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
{
|
{
|
||||||
INTN Index1;
|
INTN Index1;
|
||||||
INTN Index2;
|
INTN Index2;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Pei Core Reset System Support
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,43 +10,27 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Reset.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Pei Core Reset System Support
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Core version of the Reset System
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
|
||||||
|
@retval EFI_NOT_AVAILABLE_YET PPI not available yet.
|
||||||
|
@retval EFI_DEVICE_ERROR Did not reset system.
|
||||||
|
Otherwise, resets the system.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiResetSystem (
|
PeiResetSystem (
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Core version of the Reset System
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
|
|
||||||
- EFI_DEVICE_ERROR. Did not reset system.
|
|
||||||
|
|
||||||
Otherwise, resets the system.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PEI_RESET_PPI *ResetPpi;
|
EFI_PEI_RESET_PPI *ResetPpi;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
EFI PEI Core Security services
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,19 +10,21 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Security.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
EFI PEI Core Security services
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
|
||||||
|
Provide a callback for when the security PPI is installed.
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param NotifyDescriptor - The descriptor for the notification event.
|
||||||
|
@param Ppi - Pointer to the PPI in question.
|
||||||
|
|
||||||
|
@return Always success
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecurityPpiNotifyCallback (
|
SecurityPpiNotifyCallback (
|
||||||
@ -30,33 +33,27 @@ SecurityPpiNotifyCallback (
|
|||||||
IN VOID *Ppi
|
IN VOID *Ppi
|
||||||
);
|
);
|
||||||
|
|
||||||
static EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
|
STATIC EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
|
||||||
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
|
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
|
||||||
&gEfiPeiSecurity2PpiGuid,
|
&gEfiPeiSecurity2PpiGuid,
|
||||||
SecurityPpiNotifyCallback
|
SecurityPpiNotifyCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Initialize the security services.
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param OldCoreData - Pointer to the old core data.
|
||||||
|
NULL if being run in non-permament memory mode.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializeSecurityServices (
|
InitializeSecurityServices (
|
||||||
IN EFI_PEI_SERVICES **PeiServices,
|
IN EFI_PEI_SERVICES **PeiServices,
|
||||||
IN PEI_CORE_INSTANCE *OldCoreData
|
IN PEI_CORE_INSTANCE *OldCoreData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Initialize the security services.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
OldCoreData - Pointer to the old core data.
|
|
||||||
NULL if being run in non-permament memory mode.
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (OldCoreData == NULL) {
|
if (OldCoreData == NULL) {
|
||||||
PeiServicesNotifyPpi (&mNotifyList);
|
PeiServicesNotifyPpi (&mNotifyList);
|
||||||
@ -64,7 +61,17 @@ Returns:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
|
||||||
|
Provide a callback for when the security PPI is installed.
|
||||||
|
|
||||||
|
@param PeiServices - The PEI core services table.
|
||||||
|
@param NotifyDescriptor - The descriptor for the notification event.
|
||||||
|
@param Ppi - Pointer to the PPI in question.
|
||||||
|
|
||||||
|
@return Always success
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecurityPpiNotifyCallback (
|
SecurityPpiNotifyCallback (
|
||||||
@ -72,23 +79,6 @@ SecurityPpiNotifyCallback (
|
|||||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
|
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
|
||||||
IN VOID *Ppi
|
IN VOID *Ppi
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Provide a callback for when the security PPI is installed.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
NotifyDescriptor - The descriptor for the notification event.
|
|
||||||
Ppi - Pointer to the PPI in question.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The function is successfully processed.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
PEI_CORE_INSTANCE *PrivateData;
|
PEI_CORE_INSTANCE *PrivateData;
|
||||||
|
|
||||||
@ -106,29 +96,25 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Provide a callout to the security verification service.
|
||||||
|
|
||||||
|
|
||||||
|
@param PrivateData PeiCore's private data structure
|
||||||
|
@param VolumeHandle Handle of FV
|
||||||
|
@param FileHandle Handle of PEIM's ffs
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Image is OK
|
||||||
|
@retval EFI_SECURITY_VIOLATION Image is illegal
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
VerifyPeim (
|
VerifyPeim (
|
||||||
IN PEI_CORE_INSTANCE *PrivateData,
|
IN PEI_CORE_INSTANCE *PrivateData,
|
||||||
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
IN EFI_PEI_FV_HANDLE VolumeHandle,
|
||||||
IN EFI_PEI_FILE_HANDLE FileHandle
|
IN EFI_PEI_FILE_HANDLE FileHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Provide a callout to the security verification service.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
CurrentPeimAddress - Pointer to the Firmware File under investigation.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Image is OK
|
|
||||||
EFI_SECURITY_VIOLATION - Image is illegal
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 AuthenticationStatus;
|
UINT32 AuthenticationStatus;
|
||||||
@ -161,26 +147,19 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Verify a Firmware volume.
|
||||||
|
|
||||||
|
@param CurrentFvAddress - Pointer to the current Firmware Volume under consideration
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS - Firmware Volume is legal
|
||||||
|
@retval EFI_SECURITY_VIOLATION - Firmware Volume fails integrity test
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
VerifyFv (
|
VerifyFv (
|
||||||
IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress
|
IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Verify a Firmware volume
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
CurrentFvAddress - Pointer to the current Firmware Volume under consideration
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Firmware Volume is legal
|
|
||||||
EFI_SECURITY_VIOLATION - Firmware Volume fails integrity test
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Right now just pass the test. Future can authenticate and/or check the
|
// Right now just pass the test. Future can authenticate and/or check the
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
Pei Core Status Code Support
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,20 +10,26 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
StatusCode.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Pei Core Status Code Support
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PeiMain.h>
|
#include <PeiMain.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Core version of the Status Code reporter
|
||||||
|
|
||||||
|
|
||||||
|
@param PeiServices The PEI core services table.
|
||||||
|
@param CodeType Type of Status Code.
|
||||||
|
@param Value Value to output for Status Code.
|
||||||
|
@param Instance Instance Number of this status code.
|
||||||
|
@param CallerId ID of the caller of this status code.
|
||||||
|
@param Data Optional data associated with this status code.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS if status code is successfully reported
|
||||||
|
@retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiReportStatusCode (
|
PeiReportStatusCode (
|
||||||
@ -33,32 +40,6 @@ PeiReportStatusCode (
|
|||||||
IN CONST EFI_GUID *CallerId,
|
IN CONST EFI_GUID *CallerId,
|
||||||
IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
|
IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Core version of the Status Code reporter
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
PeiServices - The PEI core services table.
|
|
||||||
|
|
||||||
CodeType - Type of Status Code.
|
|
||||||
|
|
||||||
Value - Value to output for Status Code.
|
|
||||||
|
|
||||||
Instance - Instance Number of this status code.
|
|
||||||
|
|
||||||
CallerId - ID of the caller of this status code.
|
|
||||||
|
|
||||||
Data - Optional data associated with this status code.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status - EFI_SUCCESS if status code is successfully reported
|
|
||||||
- EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PEI_PROGRESS_CODE_PPI *StatusCodePpi;
|
EFI_PEI_PROGRESS_CODE_PPI *StatusCodePpi;
|
||||||
@ -87,7 +68,6 @@ Returns:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user