Add doxygen style comments for functions in DxeIpl.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5174 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2008-05-07 06:58:06 +00:00
parent 6d3f77236c
commit 91d92e2564
10 changed files with 383 additions and 105 deletions

View File

@ -55,6 +55,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
extern BOOLEAN gInMemory;
/**
Loads and relocates a PE/COFF image into memory.
@param FileHandle The image file handle
@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
@return EFI_SUCCESS The file was loaded and relocated
@return EFI_OUT_OF_RESOURCES There was not enough memory to load and relocate the PE/COFF file
**/
EFI_STATUS
PeiLoadFile (
IN EFI_PEI_FILE_HANDLE FileHandle,
@ -64,18 +79,54 @@ PeiLoadFile (
)
;
/**
Find DxeCore driver from all First Volumes.
@param FileHandle Pointer to FFS file to search.
@return EFI_SUCESS Success to find the FFS in specificed FV
@return others Fail to find the FFS in specificed FV
**/
EFI_STATUS
DxeIplFindDxeCore (
OUT EFI_PEI_FILE_HANDLE *FileHandle
)
;
/**
This function simply retrieves the function pointer of ImageRead in
ImageContext structure.
@param ImageContext A pointer to the structure of
PE_COFF_LOADER_IMAGE_CONTEXT
@retval EFI_SUCCESS This function always return EFI_SUCCESS.
**/
EFI_STATUS
GetImageReadFunction (
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
;
/**
Main entry point to last PEIM
@param This Entry point for DXE IPL PPI
@param PeiServices General purpose services available to every PEIM.
@param HobList Address to the Pei HOB list
@return EFI_SUCCESS DXE core was successfully loaded.
@return EFI_OUT_OF_RESOURCES There are not enough resources to load DXE core.
**/
EFI_STATUS
EFIAPI
DxeLoadCore (
@ -84,6 +135,20 @@ DxeLoadCore (
IN EFI_PEI_HOB_POINTERS HobList
);
/**
Transfers control to DxeCore.
This function performs a CPU architecture specific operations to execute
the entry point of DxeCore with the parameters of HobList.
It also intalls EFI_END_OF_PEI_PPI to signal the end of PEI phase.
@param DxeCoreEntryPoint The entrypoint of DxeCore.
@param HobList The start of HobList passed to DxeCore.
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
**/
VOID
HandOffToDxeCore (
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
@ -91,12 +156,35 @@ HandOffToDxeCore (
IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
);
/**
Updates the Stack HOB passed to DXE phase.
This function traverses the whole HOB list and update the stack HOB to
reflect the real stack that is used by DXE core.
@param BaseAddress The lower address of stack used by DxeCore.
@param Length The length of stack used by DxeCore.
**/
VOID
UpdateStackHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
);
/**
Initializes the Dxe Ipl PPI
@param FfsHandle The handle of FFS file.
@param PeiServices General purpose services available to
every PEIM.
@return EFI_SUCESS
**/
EFI_STATUS
EFIAPI
PeimInitializeDxeIpl (

View File

@ -101,6 +101,7 @@
[FixedPcd.common]
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeiHandoffToDxe
[Depex]
gEfiPeiMemoryDiscoveredPpiGuid

View File

@ -16,21 +16,97 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeIpl.h"
#include <Ppi/GuidedSectionExtraction.h>
/**
The ExtractSection() function processes the input section and
returns a pointer to the section contents. If the section being
extracted does not require processing (if the section
GuidedSectionHeader.Attributes has the
EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then
OutputBuffer is just updated to point to the start of the
section's contents. Otherwise, *Buffer must be allocated
from PEI permanent memory.
@param This Indicates the
EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI instance.
Buffer containing the input GUIDed section to be
processed. OutputBuffer OutputBuffer is
allocated from PEI permanent memory and contains
the new section stream.
@param CompressionSection A pointer to the input buffer, which contains
the input section to be processed.
@param OutputBuffer A pointer to a caller-allocated buffer, whose
size is specified by the contents of OutputSize.
@param OutputSize A pointer to a caller-allocated
UINTN in which the size of *OutputBuffer
allocation is stored. If the function
returns anything other than EFI_SUCCESS,
the value of OutputSize is undefined.
@param AuthenticationStatus A pointer to a caller-allocated
UINT32 that indicates the
authentication status of the
output buffer. If the input
section's GuidedSectionHeader.
Attributes field has the
EFI_GUIDED_SECTION_AUTH_STATUS_VALID
bit as clear,
AuthenticationStatus must return
zero. These bits reflect the
status of the extraction
operation. If the function
returns anything other than
EFI_SUCCESS, the value of
AuthenticationStatus is
undefined.
@retval EFI_SUCCESS The InputSection was
successfully processed and the
section contents were returned.
@retval EFI_OUT_OF_RESOURCES The system has insufficient
resources to process the request.
@reteval EFI_INVALID_PARAMETER The GUID in InputSection does
not match this instance of the
GUIDed Section Extraction PPI.
**/
EFI_STATUS
CustomGuidedSectionExtract (
IN CONST EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *This,
IN CONST VOID *InputSection,
IN CONST VOID *CompressionSection,
OUT VOID **OutputBuffer,
OUT UINTN *OutputSize,
OUT UINT32 *AuthenticationStatus
);
STATIC
/**
Decompresses a section to the output buffer.
This function lookes up the compression type field in the input section and
applies the appropriate compression algorithm to compress the section to a
callee allocated buffer.
@param This Points to this instance of the
EFI_PEI_DECOMPRESS_PEI PPI.
@param CompressionSection Points to the compressed section.
@param OutputBuffer Holds the returned pointer to the decompressed
sections.
@param OutputSize Holds the returned size of the decompress
section streams.
@retval EFI_SUCCESS The section was decompressed successfully.
OutputBuffer contains the resulting data and
OutputSize contains the resulting size.
**/
EFI_STATUS
EFIAPI
Decompress (
IN CONST EFI_PEI_DECOMPRESS_PPI *This,
IN CONST EFI_COMPRESSION_SECTION *InputSection,
IN CONST EFI_COMPRESSION_SECTION *CompressionSection,
OUT VOID **OutputBuffer,
OUT UINTN *OutputSize
);
@ -80,7 +156,8 @@ static EFI_PEI_PPI_DESCRIPTOR mPpiSignal = {
@param PeiServices General purpose services available to
every PEIM.
@return EFI_SUCESS
*/
**/
EFI_STATUS
EFIAPI
PeimInitializeDxeIpl (
@ -151,6 +228,7 @@ PeimInitializeDxeIpl (
@return EFI_SUCCESS DXE core was successfully loaded.
@return EFI_OUT_OF_RESOURCES There are not enough resources to load DXE core.
**/
EFI_STATUS
EFIAPI
@ -183,7 +261,7 @@ DxeLoadCore (
} else if (BootMode == BOOT_IN_RECOVERY_MODE) {
Status = PeiRecoverFirmware ();
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Load Recovery Capsule Failed.(Status = %r)\n", Status));
DEBUG ((DEBUG_ERROR, "Load Recovery Capsule Failed.(Status = %r)\n", Status));
CpuDeadLoop ();
}
@ -266,12 +344,12 @@ DxeLoadCore (
PtrPeImage.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) ((UINTN) DxeCoreAddress + ((EFI_IMAGE_DOS_HEADER *) (UINTN) DxeCoreAddress)->e_lfanew);
if (PtrPeImage.Pe32->FileHeader.Machine != IMAGE_FILE_MACHINE_IA64) {
DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading DXE CORE at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)DxeCoreAddress, (VOID *)(UINTN)DxeCoreEntryPoint));
DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Loading DXE CORE at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)DxeCoreAddress, (VOID *)(UINTN)DxeCoreEntryPoint));
} else {
//
// For IPF Image, the real entry point should be print.
//
DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading DXE CORE at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)DxeCoreAddress, (VOID *)(UINTN)(*(UINT64 *)(UINTN)DxeCoreEntryPoint)));
DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Loading DXE CORE at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)DxeCoreAddress, (VOID *)(UINTN)(*(UINT64 *)(UINTN)DxeCoreEntryPoint)));
}
DEBUG_CODE_END ();
@ -290,6 +368,9 @@ DxeLoadCore (
return EFI_OUT_OF_RESOURCES;
}
/**
Find DxeCore driver from all First Volumes.
@ -297,7 +378,8 @@ DxeLoadCore (
@return EFI_SUCESS Success to find the FFS in specificed FV
@return others Fail to find the FFS in specificed FV
*/
**/
EFI_STATUS
DxeIplFindDxeCore (
OUT EFI_PEI_FILE_HANDLE *FileHandle
@ -324,6 +406,9 @@ DxeIplFindDxeCore (
return EFI_NOT_FOUND;
}
/**
Loads and relocates a PE/COFF image into memory.
@ -334,6 +419,7 @@ DxeIplFindDxeCore (
@return EFI_SUCCESS The file was loaded and relocated
@return EFI_OUT_OF_RESOURCES There was not enough memory to load and relocate the PE/COFF file
**/
EFI_STATUS
PeiLoadFile (
@ -406,6 +492,9 @@ PeiLoadFile (
return EFI_SUCCESS;
}
/**
The ExtractSection() function processes the input section and
returns a pointer to the section contents. If the section being
@ -422,13 +511,15 @@ PeiLoadFile (
processed. OutputBuffer OutputBuffer is
allocated from PEI permanent memory and contains
the new section stream.
@param InputSection A pointer to the input buffer, which contains
the input section to be processed.
@param OutputBuffer A pointer to a caller-allocated buffer, whose
size is specified by the contents of OutputSize.
@param OutputSize A pointer to a caller-allocated
UINTN in which the size of *OutputBuffer
allocation is stored. If the function
returns anything other than EFI_SUCCESS,
the value of OutputSize is undefined.
@param AuthenticationStatus A pointer to a caller-allocated
UINT32 that indicates the
authentication status of the
@ -456,6 +547,7 @@ PeiLoadFile (
@reteval EFI_INVALID_PARAMETER The GUID in InputSection does
not match this instance of the
GUIDed Section Extraction PPI.
**/
EFI_STATUS
CustomGuidedSectionExtract (
@ -488,7 +580,7 @@ CustomGuidedSectionExtract (
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "GetInfo from guided section Failed - %r\n", Status));
DEBUG ((DEBUG_ERROR, "GetInfo from guided section Failed - %r\n", Status));
return Status;
}
@ -510,7 +602,7 @@ CustomGuidedSectionExtract (
if (*OutputBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
DEBUG ((EFI_D_INFO, "Customed Guided section Memory Size required is 0x%x and address is 0x%p\n", OutputBufferSize, *OutputBuffer));
DEBUG ((DEBUG_INFO, "Customed Guided section Memory Size required is 0x%x and address is 0x%p\n", OutputBufferSize, *OutputBuffer));
//
// *OutputBuffer still is one section. Adjust *OutputBuffer offset,
// skip EFI section header to make section data at page alignment.
@ -529,7 +621,7 @@ CustomGuidedSectionExtract (
//
// Decode failed
//
DEBUG ((EFI_D_ERROR, "Extract guided section Failed - %r\n", Status));
DEBUG ((DEBUG_ERROR, "Extract guided section Failed - %r\n", Status));
return Status;
}
@ -538,7 +630,28 @@ CustomGuidedSectionExtract (
return EFI_SUCCESS;
}
STATIC
/**
Decompresses a section to the output buffer.
This function lookes up the compression type field in the input section and
applies the appropriate compression algorithm to compress the section to a
callee allocated buffer.
@param This Points to this instance of the
EFI_PEI_DECOMPRESS_PEI PPI.
@param CompressionSection Points to the compressed section.
@param OutputBuffer Holds the returned pointer to the decompressed
sections.
@param OutputSize Holds the returned size of the decompress
section streams.
@retval EFI_SUCCESS The section was decompressed successfully.
OutputBuffer contains the resulting data and
OutputSize contains the resulting size.
**/
EFI_STATUS
EFIAPI
Decompress (
@ -583,7 +696,7 @@ Decompress (
//
// GetInfo failed
//
DEBUG ((EFI_D_ERROR, "Decompress GetInfo Failed - %r\n", Status));
DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));
return EFI_NOT_FOUND;
}
//
@ -617,7 +730,7 @@ Decompress (
//
// Decompress failed
//
DEBUG ((EFI_D_ERROR, "Decompress Failed - %r\n", Status));
DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));
return EFI_NOT_FOUND;
}
break;
@ -656,6 +769,19 @@ Decompress (
return EFI_SUCCESS;
}
/**
Updates the Stack HOB passed to DXE phase.
This function traverses the whole HOB list and update the stack HOB to
reflect the real stack that is used by DXE core.
@param BaseAddress The lower address of stack used by DxeCore.
@param Length The length of stack used by DxeCore.
**/
VOID
UpdateStackHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,

View File

@ -44,6 +44,22 @@ GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR gLidtDescriptor = {
0
};
/**
Transfers control to DxeCore.
This function performs a CPU architecture specific operations to execute
the entry point of DxeCore with the parameters of HobList.
It also intalls EFI_END_OF_PEI_PPI to signal the end of PEI phase.
@param DxeCoreEntryPoint The entrypoint of DxeCore.
@param HobList The start of HobList passed to DxeCore.
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
**/
VOID
HandOffToDxeCore (
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,

View File

@ -14,6 +14,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeIpl.h"
/**
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.
@retval EFI_SUCCESS ReadSize bytes of data were read into Buffer from the
PE/COFF file starting at FileOffset
**/
EFI_STATUS
EFIAPI
PeiImageRead (
@ -22,27 +39,6 @@ PeiImageRead (
IN OUT UINTN *ReadSize,
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
--*/
{
UINT8 *Destination32;
UINT8 *Source32;
@ -66,24 +62,24 @@ Returns:
return EFI_SUCCESS;
}
/**
This function simply retrieves the function pointer of ImageRead in
ImageContext structure.
@param ImageContext A pointer to the structure of
PE_COFF_LOADER_IMAGE_CONTEXT
@retval EFI_SUCCESS This function always return EFI_SUCCESS.
**/
EFI_STATUS
GetImageReadFunction (
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
/*++
Routine Description:
Support routine to return the PE32 Image Reader.
If the PeiImageRead() function is less than a page
in legnth. If the function is more than a page the DXE IPL will crash!!!!
Arguments:
ImageContext - The context of the image being loaded
Returns:
EFI_SUCCESS - If Image function location is found
--*/
{
VOID *MemoryBuffer;

View File

@ -30,28 +30,26 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "VirtualMemory.h"
/**
Allocates and fills in the Page Directory and Page Table Entries to
establish a 1:1 Virtual to Physical mapping.
@param NumberOfProcessorPhysicalAddressBits Number of processor address bits
to use. Limits the number of page
table entries to the physical
address space.
@return EFI_SUCCESS The 1:1 Virtual to Physical identity mapping was created
**/
UINTN
CreateIdentityMappingPageTables (
VOID
)
/*++
Routine Description:
Allocates and fills in the Page Directory and Page Table Entries to
establish a 1:1 Virtual to Physical mapping.
Arguments:
NumberOfProcessorPhysicalAddressBits - Number of processor address bits to use.
Limits the number of page table entries
to the physical address space.
Returns:
EFI_SUCCESS The 1:1 Virtual to Physical identity mapping was created
--*/
{
UINT8 PhysicalAddressBits;
EFI_PHYSICAL_ADDRESS PageAddress;
@ -159,6 +157,6 @@ Returns:
);
}
return (UINTN)PageMap; // FIXME
return (UINTN)PageMap;
}

View File

@ -99,6 +99,20 @@ typedef union {
#pragma pack()
/**
Allocates and fills in the Page Directory and Page Table Entries to
establish a 1:1 Virtual to Physical mapping.
@param NumberOfProcessorPhysicalAddressBits Number of processor address bits
to use. Limits the number of page
table entries to the physical
address space.
@return EFI_SUCCESS The 1:1 Virtual to Physical identity mapping was created
**/
UINTN
CreateIdentityMappingPageTables (
VOID
@ -106,6 +120,9 @@ CreateIdentityMappingPageTables (
;
/**
Fix up the vector number in the vector code.
@ -123,6 +140,9 @@ AsmVectorFixup (
);
/**
Get the information of vector template.

View File

@ -14,6 +14,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeIpl.h"
/**
Transfers control to DxeCore.
This function performs a CPU architecture specific operations to execute
the entry point of DxeCore with the parameters of HobList.
It also intalls EFI_END_OF_PEI_PPI to signal the end of PEI phase.
@param DxeCoreEntryPoint The entrypoint of DxeCore.
@param HobList The start of HobList passed to DxeCore.
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
**/
VOID
HandOffToDxeCore (
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,

View File

@ -14,6 +14,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeIpl.h"
/**
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.
@retval EFI_SUCCESS ReadSize bytes of data were read into Buffer from the
PE/COFF file starting at FileOffset
**/
EFI_STATUS
PeiImageRead (
IN VOID *FileHandle,
@ -21,27 +36,6 @@ PeiImageRead (
IN OUT UINTN *ReadSize,
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 *Source8;
@ -55,6 +49,17 @@ Returns:
return EFI_SUCCESS;
}
/**
This function simply retrieves the function pointer of ImageRead in
ImageContext structure.
@param ImageContext A pointer to the structure of
PE_COFF_LOADER_IMAGE_CONTEXT
@retval EFI_SUCCESS This function always return EFI_SUCCESS.
**/
EFI_STATUS
GetImageReadFunction (
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext

View File

@ -1,5 +1,5 @@
/** @file
Ia32-specifc functionality for DxeLoad.
x64-specifc functionality for DxeLoad.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@ -14,6 +14,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeIpl.h"
/**
Transfers control to DxeCore.
This function performs a CPU architecture specific operations to execute
the entry point of DxeCore with the parameters of HobList.
It also intalls EFI_END_OF_PEI_PPI to signal the end of PEI phase.
@param DxeCoreEntryPoint The entrypoint of DxeCore.
@param HobList The start of HobList passed to DxeCore.
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
**/
VOID
HandOffToDxeCore (
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,