mirror of https://github.com/acidanthera/audk.git
Update DxeCore handle FV Image file with Depex section per PI spec.
Signed-off-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12763 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b316eabf7c
commit
d359254990
|
@ -168,6 +168,7 @@ CoreFvToDevicePath (
|
||||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||||
read out of the FV at a later time.
|
read out of the FV at a later time.
|
||||||
@param DriverName Name of driver to add to mDiscoveredList.
|
@param DriverName Name of driver to add to mDiscoveredList.
|
||||||
|
@param Type Fv File Type of file to add to mDiscoveredList.
|
||||||
|
|
||||||
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
||||||
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
||||||
|
@ -179,7 +180,8 @@ EFI_STATUS
|
||||||
CoreAddToDriverList (
|
CoreAddToDriverList (
|
||||||
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
|
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
|
||||||
IN EFI_HANDLE FvHandle,
|
IN EFI_HANDLE FvHandle,
|
||||||
IN EFI_GUID *DriverName
|
IN EFI_GUID *DriverName,
|
||||||
|
IN EFI_FV_FILETYPE Type
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -477,7 +479,7 @@ CoreDispatcher (
|
||||||
// Untrused to Scheduled it would have already been loaded so we may need to
|
// Untrused to Scheduled it would have already been loaded so we may need to
|
||||||
// skip the LoadImage
|
// skip the LoadImage
|
||||||
//
|
//
|
||||||
if (DriverEntry->ImageHandle == NULL) {
|
if (DriverEntry->ImageHandle == NULL && !DriverEntry->IsFvImage) {
|
||||||
DEBUG ((DEBUG_INFO, "Loading driver %g\n", &DriverEntry->FileName));
|
DEBUG ((DEBUG_INFO, "Loading driver %g\n", &DriverEntry->FileName));
|
||||||
Status = CoreLoadImage (
|
Status = CoreLoadImage (
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -530,6 +532,12 @@ CoreDispatcher (
|
||||||
CoreReleaseDispatcherLock ();
|
CoreReleaseDispatcherLock ();
|
||||||
|
|
||||||
|
|
||||||
|
if (DriverEntry->IsFvImage) {
|
||||||
|
//
|
||||||
|
// Produce a firmware volume block protocol for FvImage so it gets dispatched from.
|
||||||
|
//
|
||||||
|
Status = CoreProcessFvImageFile (DriverEntry->Fv, DriverEntry->FvHandle, &DriverEntry->FileName);
|
||||||
|
} else {
|
||||||
REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
|
REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
|
||||||
EFI_PROGRESS_CODE,
|
EFI_PROGRESS_CODE,
|
||||||
(EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN),
|
(EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN),
|
||||||
|
@ -545,6 +553,7 @@ CoreDispatcher (
|
||||||
&DriverEntry->ImageHandle,
|
&DriverEntry->ImageHandle,
|
||||||
sizeof (DriverEntry->ImageHandle)
|
sizeof (DriverEntry->ImageHandle)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnStatus = EFI_SUCCESS;
|
ReturnStatus = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -784,6 +793,7 @@ CoreFvToDevicePath (
|
||||||
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
EFI_CORE_DRIVER_ENTRY so that the PE image can be
|
||||||
read out of the FV at a later time.
|
read out of the FV at a later time.
|
||||||
@param DriverName Name of driver to add to mDiscoveredList.
|
@param DriverName Name of driver to add to mDiscoveredList.
|
||||||
|
@param Type Fv File Type of file to add to mDiscoveredList.
|
||||||
|
|
||||||
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
@retval EFI_SUCCESS If driver was added to the mDiscoveredList.
|
||||||
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
@retval EFI_ALREADY_STARTED The driver has already been started. Only one
|
||||||
|
@ -795,7 +805,8 @@ EFI_STATUS
|
||||||
CoreAddToDriverList (
|
CoreAddToDriverList (
|
||||||
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
|
IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv,
|
||||||
IN EFI_HANDLE FvHandle,
|
IN EFI_HANDLE FvHandle,
|
||||||
IN EFI_GUID *DriverName
|
IN EFI_GUID *DriverName,
|
||||||
|
IN EFI_FV_FILETYPE Type
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_CORE_DRIVER_ENTRY *DriverEntry;
|
EFI_CORE_DRIVER_ENTRY *DriverEntry;
|
||||||
|
@ -807,6 +818,9 @@ CoreAddToDriverList (
|
||||||
//
|
//
|
||||||
DriverEntry = AllocateZeroPool (sizeof (EFI_CORE_DRIVER_ENTRY));
|
DriverEntry = AllocateZeroPool (sizeof (EFI_CORE_DRIVER_ENTRY));
|
||||||
ASSERT (DriverEntry != NULL);
|
ASSERT (DriverEntry != NULL);
|
||||||
|
if (Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
|
||||||
|
DriverEntry->IsFvImage = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;
|
DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;
|
||||||
CopyGuid (&DriverEntry->FileName, DriverName);
|
CopyGuid (&DriverEntry->FileName, DriverName);
|
||||||
|
@ -1006,7 +1020,7 @@ CoreFwVolEventProtocolNotify (
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
UINT32 AuthenticationStatus;
|
UINT32 AuthenticationStatus;
|
||||||
UINTN SizeOfBuffer;
|
UINTN SizeOfBuffer;
|
||||||
|
VOID *DepexBuffer;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
BufferSize = sizeof (EFI_HANDLE);
|
BufferSize = sizeof (EFI_HANDLE);
|
||||||
|
@ -1120,17 +1134,84 @@ CoreFwVolEventProtocolNotify (
|
||||||
if (FvFoundInHobFv2 (FvHandle, &NameGuid)) {
|
if (FvFoundInHobFv2 (FvHandle, &NameGuid)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Found a firmware volume image. Produce a firmware volume block
|
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has PEI depex section.
|
||||||
// protocol for it so it gets dispatched from. This is usually a
|
//
|
||||||
// capsule.
|
DepexBuffer = NULL;
|
||||||
|
SizeOfBuffer = 0;
|
||||||
|
Status = Fv->ReadSection (
|
||||||
|
Fv,
|
||||||
|
&NameGuid,
|
||||||
|
EFI_SECTION_PEI_DEPEX,
|
||||||
|
0,
|
||||||
|
&DepexBuffer,
|
||||||
|
&SizeOfBuffer,
|
||||||
|
&AuthenticationStatus
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// If PEI depex section is found, this FV image will be ignored in DXE phase.
|
||||||
|
// Now, DxeCore doesn't support FV image with more one type DEPEX section.
|
||||||
|
//
|
||||||
|
FreePool (DepexBuffer);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has SMM depex section.
|
||||||
|
//
|
||||||
|
DepexBuffer = NULL;
|
||||||
|
SizeOfBuffer = 0;
|
||||||
|
Status = Fv->ReadSection (
|
||||||
|
Fv,
|
||||||
|
&NameGuid,
|
||||||
|
EFI_SECTION_SMM_DEPEX,
|
||||||
|
0,
|
||||||
|
&DepexBuffer,
|
||||||
|
&SizeOfBuffer,
|
||||||
|
&AuthenticationStatus
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// If SMM depex section is found, this FV image will be ignored in DXE phase.
|
||||||
|
// Now, DxeCore doesn't support FV image with more one type DEPEX section.
|
||||||
|
//
|
||||||
|
FreePool (DepexBuffer);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has DXE depex section.
|
||||||
|
//
|
||||||
|
DepexBuffer = NULL;
|
||||||
|
SizeOfBuffer = 0;
|
||||||
|
Status = Fv->ReadSection (
|
||||||
|
Fv,
|
||||||
|
&NameGuid,
|
||||||
|
EFI_SECTION_DXE_DEPEX,
|
||||||
|
0,
|
||||||
|
&DepexBuffer,
|
||||||
|
&SizeOfBuffer,
|
||||||
|
&AuthenticationStatus
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// If no depex section, produce a firmware volume block protocol for it so it gets dispatched from.
|
||||||
//
|
//
|
||||||
CoreProcessFvImageFile (Fv, FvHandle, &NameGuid);
|
CoreProcessFvImageFile (Fv, FvHandle, &NameGuid);
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// If depex section is found, this FV image will be dispatched until its depex is evaluated to TRUE.
|
||||||
|
//
|
||||||
|
FreePool (DepexBuffer);
|
||||||
|
CoreAddToDriverList (Fv, FvHandle, &NameGuid, Type);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Transition driver from Undiscovered to Discovered state
|
// Transition driver from Undiscovered to Discovered state
|
||||||
//
|
//
|
||||||
CoreAddToDriverList (Fv, FvHandle, &NameGuid);
|
CoreAddToDriverList (Fv, FvHandle, &NameGuid, Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!EFI_ERROR (GetNextFileStatus));
|
} while (!EFI_ERROR (GetNextFileStatus));
|
||||||
|
|
|
@ -164,6 +164,7 @@ typedef struct {
|
||||||
BOOLEAN DepexProtocolError;
|
BOOLEAN DepexProtocolError;
|
||||||
|
|
||||||
EFI_HANDLE ImageHandle;
|
EFI_HANDLE ImageHandle;
|
||||||
|
BOOLEAN IsFvImage;
|
||||||
|
|
||||||
} EFI_CORE_DRIVER_ENTRY;
|
} EFI_CORE_DRIVER_ENTRY;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue