return ;\r
}\r
\r
+/**\r
+\r
+ Firmware volume inherits authentication status from the FV image file and section(in another firmware volume)\r
+ where it came from.\r
+\r
+ @param FvDevice A pointer to the FvDevice.\r
+\r
+**/\r
+VOID\r
+FwVolInheritAuthenticationStatus (\r
+ IN FV_DEVICE *FvDevice\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_FIRMWARE_VOLUME_HEADER *CachedFvHeader;\r
+ EFI_FIRMWARE_VOLUME_EXT_HEADER *CachedFvExtHeader;\r
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *ParentFvProtocol;\r
+ UINTN Key;\r
+ EFI_GUID FileNameGuid;\r
+ EFI_FV_FILETYPE FileType;\r
+ EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
+ UINTN FileSize;\r
+ EFI_SECTION_TYPE SectionType;\r
+ UINT32 AuthenticationStatus;\r
+ EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
+ EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader;\r
+ UINTN BufferSize;\r
+\r
+ CachedFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FvDevice->CachedFv;\r
+\r
+ if (FvDevice->Fv.ParentHandle != NULL) {\r
+ //\r
+ // By Parent Handle, find out the FV image file and section(in another firmware volume) where the firmware volume came from \r
+ //\r
+ Status = gBS->HandleProtocol (FvDevice->Fv.ParentHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **) &ParentFvProtocol);\r
+ if (!EFI_ERROR (Status) && (ParentFvProtocol != NULL)) {\r
+ Key = 0;\r
+ do {\r
+ FileType = EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE;\r
+ Status = ParentFvProtocol->GetNextFile (\r
+ ParentFvProtocol,\r
+ &Key,\r
+ &FileType,\r
+ &FileNameGuid,\r
+ &FileAttributes,\r
+ &FileSize\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return;\r
+ }\r
+\r
+ SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;\r
+ FvHeader = NULL;\r
+ BufferSize = 0;\r
+ Status = ParentFvProtocol->ReadSection (\r
+ ParentFvProtocol,\r
+ &FileNameGuid,\r
+ SectionType,\r
+ 0,\r
+ (VOID **) &FvHeader,\r
+ &BufferSize,\r
+ &AuthenticationStatus\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ if ((FvHeader->FvLength == CachedFvHeader->FvLength) &&\r
+ (FvHeader->ExtHeaderOffset == CachedFvHeader->ExtHeaderOffset)) {\r
+ if (FvHeader->ExtHeaderOffset !=0) {\r
+ //\r
+ // Both FVs contain extension header, then compare their FV Name GUID\r
+ //\r
+ FvExtHeader = (EFI_FIRMWARE_VOLUME_EXT_HEADER *) ((UINTN) FvHeader + FvHeader->ExtHeaderOffset);\r
+ CachedFvExtHeader = (EFI_FIRMWARE_VOLUME_EXT_HEADER *) ((UINTN) CachedFvHeader + CachedFvHeader->ExtHeaderOffset);\r
+ if (CompareGuid (&FvExtHeader->FvName, &CachedFvExtHeader->FvName)) {\r
+ //\r
+ // Found the FV image section where the firmware volume came from,\r
+ // and then inherit authentication status from it.\r
+ //\r
+ FvDevice->AuthenticationStatus = AuthenticationStatus;\r
+ FreePool ((VOID *) FvHeader);\r
+ return;\r
+ }\r
+ } else {\r
+ //\r
+ // Both FVs don't contain extension header, then compare their whole FV Image.\r
+ //\r
+ if (CompareMem ((VOID *) FvHeader, (VOID *) CachedFvHeader, FvHeader->FvLength) == 0) {\r
+ //\r
+ // Found the FV image section where the firmware volume came from\r
+ // and then inherit authentication status from it.\r
+ //\r
+ FvDevice->AuthenticationStatus = AuthenticationStatus;\r
+ FreePool ((VOID *) FvHeader);\r
+ return;\r
+ }\r
+ }\r
+ }\r
+ FreePool ((VOID *) FvHeader);\r
+ }\r
+ } while (TRUE);\r
+ }\r
+ }\r
+}\r
+\r
/**\r
Check if an FV is consistent and allocate cache for it.\r
\r
FvDevice->Fv.KeySize = KEYSIZE;\r
FvDevice->Fv.GetInfo = FvGetVolumeInfo;\r
FvDevice->Fv.SetInfo = FvSetVolumeInfo;\r
+ FvDevice->Fv.ParentHandle = Fvb->ParentHandle;\r
\r
Status = FvCheck (FvDevice);\r
if (EFI_ERROR (Status)) {\r
continue;\r
}\r
\r
+ FwVolInheritAuthenticationStatus (FvDevice);\r
+\r
if (Reinstall) {\r
//\r
// Reinstall an New FV protocol\r
/** @file\r
Common defines and definitions for a FwVolDxe driver.\r
\r
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
\r
FFS_FILE_LIST_ENTRY *CurrentFfsFile;\r
BOOLEAN IsFfs3Fv;\r
+ UINT32 AuthenticationStatus;\r
} FV_DEVICE;\r
\r
#define FV_DEVICE_FROM_THIS(a) CR (a, FV_DEVICE, Fv, FV_DEVICE_SIGNATURE)\r
/** @file\r
Implements functions to read firmware file.\r
\r
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
)\r
{\r
EFI_STATUS Status;\r
+ FV_DEVICE *FvDevice;\r
EFI_FV_ATTRIBUTES FvAttributes;\r
EFI_FV_FILETYPE FileType;\r
EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ FvDevice = FV_DEVICE_FROM_THIS (This);\r
+\r
Status = This->GetVolumeAttributes (This, &FvAttributes);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
AuthenticationStatus\r
);\r
}\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Inherit the authentication status.\r
+ //\r
+ *AuthenticationStatus |= FvDevice->AuthenticationStatus;\r
+ }\r
+\r
//\r
// Handle AuthenticationStatus if necessary\r
//\r
Depex - Dependency Expresion.\r
SOR - Schedule On Request - Don't schedule if this bit is set.\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
(EFI_PHYSICAL_ADDRESS) (UINTN) AlignedBuffer,\r
(UINT64)BufferSize,\r
FvHandle,\r
+ AuthenticationStatus,\r
NULL\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
NULL,\r
NULL,\r
{ NULL, NULL },\r
+ 0,\r
+ FALSE,\r
0\r
};\r
\r
FvDevice->Fvb = Fvb;\r
FvDevice->Handle = Handle;\r
FvDevice->FwVolHeader = FwVolHeader;\r
- FvDevice->Fv.ParentHandle = Fvb->ParentHandle;\r
FvDevice->IsFfs3Fv = CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid);\r
+ FvDevice->Fv.ParentHandle = Fvb->ParentHandle;\r
+\r
+ if (Fvb->ParentHandle != NULL) {\r
+ //\r
+ // Inherit the authentication status from FVB.\r
+ //\r
+ FvDevice->AuthenticationStatus = GetFvbAuthenticationStatus (Fvb);\r
+ }\r
\r
if (!EFI_ERROR (FvCheck (FvDevice))) {\r
//\r
\r
UINT8 ErasePolarity;\r
BOOLEAN IsFfs3Fv;\r
+ UINT32 AuthenticationStatus;\r
} FV_DEVICE;\r
\r
#define FV_DEVICE_FROM_THIS(a) CR(a, FV_DEVICE, Fv, FV2_DEVICE_SIGNATURE)\r
/** @file\r
Implements functions to read firmware file\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
FvDevice->IsFfs3Fv\r
);\r
\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Inherit the authentication status.\r
+ //\r
+ *AuthenticationStatus |= FvDevice->AuthenticationStatus;\r
+ }\r
+\r
//\r
// Close of stream defered to close of FfsHeader list to allow SEP to cache data\r
//\r
It consumes FV HOBs and creates read-only Firmare Volume Block protocol\r
instances for each of them.\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
0,\r
NULL,\r
0,\r
+ 0,\r
0\r
};\r
\r
return EFI_SUCCESS;\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
+ EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;\r
+ UINT32 AuthenticationStatus;\r
+\r
+ AuthenticationStatus = 0;\r
+ FvbDevice = BASE_CR (FvbProtocol, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance);\r
+ if (FvbDevice->Signature == FVB_DEVICE_SIGNATURE) {\r
+ AuthenticationStatus = FvbDevice->AuthenticationStatus;\r
+ }\r
+\r
+ return AuthenticationStatus;\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
FvbDev->BaseAddress = BaseAddress;\r
FvbDev->FvbAttributes = FwVolHeader->Attributes;\r
FvbDev->FwVolBlockInstance.ParentHandle = ParentHandle;\r
+ if (ParentHandle != NULL) {\r
+ FvbDev->AuthenticationStatus = AuthenticationStatus;\r
+ }\r
\r
//\r
// Init the block caching fields of the device\r
//\r
// Produce an FVB protocol for it\r
//\r
- ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, NULL);\r
+ ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, 0, NULL);\r
FvHob.Raw = GET_NEXT_HOB (FvHob);\r
}\r
\r
(EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader,\r
(UINT64)Size,\r
NULL,\r
+ 0,\r
FVProtocolHandle\r
);\r
//\r
Firmware Volume Block protocol functions.\r
Consumes FV hobs and creates appropriate block protocols.\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
LBA_CACHE *LbaCache;\r
UINT32 FvbAttributes;\r
EFI_PHYSICAL_ADDRESS BaseAddress;\r
+ UINT32 AuthenticationStatus;\r
} EFI_FW_VOL_BLOCK_DEVICE;\r
\r
\r