The internal header file includes the common header files, defines\r
internal structure and functions used by DxeCore module.\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
#include <Protocol/Decompress.h>\r
#include <Protocol/LoadPe32Image.h>\r
#include <Protocol/Security.h>\r
+#include <Protocol/Security2.h>\r
#include <Protocol/Ebc.h>\r
#include <Protocol/Reset.h>\r
#include <Protocol/Cpu.h>\r
#include <Protocol/FirmwareVolumeBlock.h>\r
#include <Protocol/Capsule.h>\r
#include <Protocol/BusSpecificDriverOverride.h>\r
+#include <Protocol/DriverFamilyOverride.h>\r
#include <Protocol/TcgService.h>\r
#include <Protocol/HiiPackageList.h>\r
+#include <Protocol/SmmBase2.h>\r
#include <Guid/MemoryTypeInformation.h>\r
#include <Guid/FirmwareFileSystem2.h>\r
+#include <Guid/FirmwareFileSystem3.h>\r
#include <Guid/HobList.h>\r
#include <Guid/DebugImageInfoTable.h>\r
#include <Guid/FileInfo.h>\r
#include <Guid/MemoryAllocationHob.h>\r
#include <Guid/EventLegacyBios.h>\r
#include <Guid/EventGroup.h>\r
-\r
+#include <Guid/EventExitBootServiceFailed.h>\r
+#include <Guid/LoadModuleAtFixedAddress.h>\r
+#include <Guid/IdleLoopEvent.h>\r
+#include <Guid/VectorHandoffTable.h>\r
+#include <Ppi/VectorHandoffInfo.h>\r
\r
#include <Library/DxeCoreEntryPoint.h>\r
#include <Library/DebugLib.h>\r
#include <Library/CacheMaintenanceLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/PeCoffLib.h>\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PeCoffExtraActionLib.h>\r
#include <Library/PcdLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/DevicePathLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/ReportStatusCodeLib.h>\r
#include <Library/TimerLib.h>\r
+#include <Library/DxeServicesLib.h>\r
+#include <Library/DebugAgentLib.h>\r
+#include <Library/CpuExceptionHandlerLib.h>\r
+\r
\r
//\r
// attributes for reserved memory before it is promoted to system memory\r
EFI_EVENT Event;\r
VOID *Registration;\r
BOOLEAN Present;\r
-} ARCHITECTURAL_PROTOCOL_ENTRY;\r
+} EFI_CORE_PROTOCOL_NOTIFY_ENTRY;\r
\r
//\r
// DXE Dispatcher Data structures\r
UINTN Signature;\r
LIST_ENTRY Link; // mFvHandleList\r
EFI_HANDLE Handle;\r
+ EFI_GUID FvNameGuid;\r
} KNOWN_HANDLE;\r
\r
\r
BOOLEAN DepexProtocolError;\r
\r
EFI_HANDLE ImageHandle;\r
+ BOOLEAN IsFvImage;\r
\r
} EFI_CORE_DRIVER_ENTRY;\r
\r
extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome;\r
extern EFI_TIMER_ARCH_PROTOCOL *gTimer;\r
extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity;\r
+extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2;\r
extern EFI_BDS_ARCH_PROTOCOL *gBds;\r
+extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2;\r
\r
extern EFI_TPL gEfiCurrentTpl;\r
\r
extern BOOLEAN gDispatcherRunning;\r
extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;\r
\r
+extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable;\r
+extern BOOLEAN gLoadFixedAddressCodeMemoryReady;\r
//\r
// Service Initialization Functions\r
//\r
\r
**/\r
VOID\r
-CoreNotifyOnArchProtocolInstallation (\r
+CoreNotifyOnProtocolInstallation (\r
VOID\r
);\r
\r
arguments to InstallProtocolInterface(). All the\r
protocols are added to Handle.\r
\r
+ @retval EFI_SUCCESS All the protocol interface was installed.\r
+ @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
+ @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r
+ the handle database.\r
@retval EFI_INVALID_PARAMETER Handle is NULL.\r
- @retval EFI_SUCCESS Protocol interfaces successfully installed.\r
+ @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.\r
\r
**/\r
EFI_STATUS\r
/**\r
Connects one or more drivers to a controller.\r
\r
- @param ControllerHandle Handle of the controller to be\r
- connected.\r
- @param DriverImageHandle DriverImageHandle A pointer to an\r
- ordered list of driver image\r
- handles.\r
- @param RemainingDevicePath RemainingDevicePath A pointer to\r
- the device path that specifies a\r
- child of the controller specified\r
- by ControllerHandle.\r
- @param Recursive Whether the function would be\r
- called recursively or not.\r
+ @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
+ @param DriverImageHandle A pointer to an ordered list handles that support the\r
+ EFI_DRIVER_BINDING_PROTOCOL.\r
+ @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
+ controller specified by ControllerHandle.\r
+ @param Recursive If TRUE, then ConnectController() is called recursively\r
+ until the entire tree of controllers below the controller specified\r
+ by ControllerHandle have been created. If FALSE, then\r
+ the tree of controllers is only expanded one level.\r
\r
- @return Status code.\r
+ @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
+ 2) No drivers were connected to ControllerHandle, but\r
+ RemainingDevicePath is not NULL, and it is an End Device\r
+ Path Node.\r
+ @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
+ @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
+ present in the system.\r
+ 2) No drivers were connected to ControllerHandle.\r
+ @retval EFI_SECURITY_VIOLATION \r
+ The user has no permission to start UEFI device drivers on the device path \r
+ associated with the ControllerHandle or specified by the RemainingDevicePath.\r
\r
**/\r
EFI_STATUS\r
@retval EFI_SUCCESS DriverImageHandle is not NULL,\r
and on entry DriverImageHandle is\r
not managing ControllerHandle.\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid\r
- EFI_HANDLE.\r
+ @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
@retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,\r
and it is not a valid EFI_HANDLE.\r
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it\r
@param Buffer The address to return a pointer to the allocated\r
pool\r
\r
- @retval EFI_INVALID_PARAMETER PoolType not valid\r
+ @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
@retval EFI_SUCCESS Pool successfully allocated.\r
\r
protocol for loading the file.\r
@retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
resources.\r
+ @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
+ understood.\r
+ @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
+ @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the \r
+ image from being loaded. NULL is returned in *ImageHandle.\r
+ @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a \r
+ valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
+ platform policy specifies that the image should not be started.\r
\r
**/\r
EFI_STATUS\r
@param ImageHandle Handle of image to be started.\r
@param ExitDataSize Pointer of the size to ExitData\r
@param ExitData Pointer to a pointer to a data buffer that\r
- includes a Null-terminated Unicode string,\r
+ includes a Null-terminated string,\r
optionally followed by additional binary data.\r
The string is a description that the caller may\r
use to further indicate the reason for the\r
\r
@retval EFI_INVALID_PARAMETER Invalid parameter\r
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
+ @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.\r
@retval EFI_SUCCESS Successfully transfer control to the image's\r
entry point.\r
\r
\r
\r
/**\r
- Creates a general-purpose event structure.\r
+ Creates an event.\r
\r
@param Type The type of event to create and its mode and\r
attributes\r
\r
\r
/**\r
- Creates a general-purpose event structure\r
+ Creates an event in a group.\r
\r
@param Type The type of event to create and its mode and\r
attributes\r
OUT EFI_EVENT *Event\r
);\r
\r
+/**\r
+ Creates a general-purpose event structure\r
+\r
+ @param Type The type of event to create and its mode and\r
+ attributes\r
+ @param NotifyTpl The task priority level of event notifications\r
+ @param NotifyFunction Pointer to the events notification function\r
+ @param NotifyContext Pointer to the notification functions context;\r
+ corresponds to parameter "Context" in the\r
+ notification function\r
+ @param EventGroup GUID for EventGroup if NULL act the same as\r
+ gBS->CreateEvent().\r
+ @param Event Pointer to the newly created event if the call\r
+ succeeds; undefined otherwise\r
+\r
+ @retval EFI_SUCCESS The event structure was created\r
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
+ @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreCreateEventInternal (\r
+ IN UINT32 Type,\r
+ IN EFI_TPL NotifyTpl,\r
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
+ IN CONST VOID *NotifyContext, OPTIONAL\r
+ IN CONST EFI_GUID *EventGroup, OPTIONAL\r
+ OUT EFI_EVENT *Event\r
+ );\r
\r
/**\r
Sets the type of timer and the trigger time for a timer event.\r
@param Length Specified length\r
@param Attributes Specified attributes\r
\r
- @retval EFI_SUCCESS Successfully set attribute of a segment of\r
- memory space.\r
+ @retval EFI_SUCCESS The attributes were set for the memory region.\r
+ @retval EFI_INVALID_PARAMETER Length is zero. \r
+ @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory\r
+ resource range specified by BaseAddress and Length.\r
+ @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource\r
+ range specified by BaseAddress and Length.\r
+ @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by\r
+ BaseAddress and Length cannot be modified.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of\r
+ the memory resource range.\r
+ @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
+ not available yet.\r
\r
**/\r
EFI_STATUS\r
function returns anything other than\r
EFI_SUCCESS, the value of *AuthenticationStatus\r
is undefined.\r
+ @param IsFfs3Fv Indicates the FV format.\r
\r
@retval EFI_SUCCESS Section was retrieved successfully\r
@retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r
IN UINTN SectionInstance,\r
IN VOID **Buffer,\r
IN OUT UINTN *BufferSize,\r
- OUT UINT32 *AuthenticationStatus\r
+ OUT UINT32 *AuthenticationStatus,\r
+ IN BOOLEAN IsFfs3Fv\r
);\r
\r
\r
SEP member function. Deletes an existing section stream\r
\r
@param StreamHandleToClose Indicates the stream to close\r
+ @param FreeStreamBuffer TRUE - Need to free stream buffer;\r
+ FALSE - No need to free stream buffer.\r
\r
@retval EFI_SUCCESS The section stream is closed sucessfully.\r
@retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
EFI_STATUS\r
EFIAPI\r
CloseSectionStream (\r
- IN UINTN StreamHandleToClose\r
+ IN UINTN StreamHandleToClose,\r
+ IN BOOLEAN FreeStreamBuffer\r
);\r
\r
/**\r
IN EFI_SYSTEM_TABLE *SystemTable\r
);\r
\r
+/**\r
+\r
+ Get FVB authentication status\r
+\r
+ @param FvbProtocol FVB protocol.\r
+\r
+ @return Authentication status.\r
+\r
+**/\r
+UINT32\r
+GetFvbAuthenticationStatus (\r
+ IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol\r
+ );\r
\r
/**\r
This routine produces a firmware volume block protocol on a given\r
@param BaseAddress base address of the firmware volume image\r
@param Length length of the firmware volume image\r
@param ParentHandle handle of parent firmware volume, if this image\r
- came from an FV image file in another firmware\r
+ came from an FV image file and section in another firmware\r
volume (ala capsules)\r
+ @param AuthenticationStatus Authentication status inherited, if this image\r
+ came from an FV image file and section in another firmware volume.\r
@param FvProtocol Firmware volume block protocol produced.\r
\r
@retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
IN UINT64 Length,\r
IN EFI_HANDLE ParentHandle,\r
+ IN UINT32 AuthenticationStatus,\r
OUT EFI_HANDLE *FvProtocol OPTIONAL\r
);\r
\r
IN EFI_LOCK *Lock\r
);\r
\r
+\r
+/**\r
+ An empty function to pass error checking of CreateEventEx ().\r
+\r
+ @param Event Event whose notification function is being invoked.\r
+ @param Context Pointer to the notification function's context,\r
+ which is implementation-dependent.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CoreEmptyCallbackFunction (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ Read data from Firmware Block by FVB protocol Read. \r
+ The data may cross the multi block ranges.\r
+\r
+ @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r
+ @param StartLba Pointer to StartLba.\r
+ On input, the start logical block index from which to read.\r
+ On output,the end logical block index after reading.\r
+ @param Offset Pointer to Offset\r
+ On input, offset into the block at which to begin reading.\r
+ On output, offset into the end block after reading.\r
+ @param DataSize Size of data to be read.\r
+ @param Data Pointer to Buffer that the data will be read into.\r
+\r
+ @retval EFI_SUCCESS Successfully read data from firmware block.\r
+ @retval others\r
+**/\r
+EFI_STATUS\r
+ReadFvbData (\r
+ IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
+ IN OUT EFI_LBA *StartLba,\r
+ IN OUT UINTN *Offset,\r
+ IN UINTN DataSize,\r
+ OUT UINT8 *Data\r
+ );\r
+\r
+/**\r
+ Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
+ copy the real length volume header into it.\r
+\r
+ @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to\r
+ read the volume header\r
+ @param FwVolHeader Pointer to pointer to allocated buffer in which\r
+ the volume header is returned.\r
+\r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.\r
+ @retval EFI_SUCCESS Successfully read volume header to the allocated\r
+ buffer.\r
+ @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or\r
+ the file system could not be understood.\r
+\r
+**/\r
+EFI_STATUS\r
+GetFwVolHeader (\r
+ IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
+ OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
+ );\r
+\r
+/**\r
+ Verify checksum of the firmware volume header.\r
+\r
+ @param FvHeader Points to the firmware volume header to be checked\r
+\r
+ @retval TRUE Checksum verification passed\r
+ @retval FALSE Checksum verification failed\r
+\r
+**/\r
+BOOLEAN\r
+VerifyFvHeaderChecksum (\r
+ IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
+ );\r
+\r
#endif\r