diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-03-10 09:27:59 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-03-10 09:27:59 +0000 |
commit | eb9203646f2f05dff08a2852fe3a862d1c4fc5bd (patch) | |
tree | 3e63580afce68806bcfb21c6dfa26da0cb6382d2 /Nt32Pkg | |
parent | 84266565f5957184483515157987168e2c930a60 (diff) | |
download | edk2-platforms-eb9203646f2f05dff08a2852fe3a862d1c4fc5bd.tar.xz |
Add FvNameGuid for FV extension header.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7851 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg')
-rw-r--r-- | Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c | 96 | ||||
-rw-r--r-- | Nt32Pkg/FvbServicesRuntimeDxe/FwBlockService.h | 11 | ||||
-rw-r--r-- | Nt32Pkg/Nt32Pkg.fdf | 1 |
3 files changed, 77 insertions, 31 deletions
diff --git a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c index 9ab295a242..8d1b7e3c28 100644 --- a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c +++ b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c @@ -52,31 +52,55 @@ Revision History ESAL_FWB_GLOBAL *mFvbModuleGlobal;
-EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate = {
- FVB_DEVICE_SIGNATURE,
+FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate = {
{
{
+ HARDWARE_DEVICE_PATH,
+ HW_MEMMAP_DP,
{
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- {
- sizeof (MEMMAP_DEVICE_PATH),
- 0
- }
- },
- EfiMemoryMappedIO,
- 0,
- 0,
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH)),
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8)
+ }
},
+ EfiMemoryMappedIO,
+ (EFI_PHYSICAL_ADDRESS) 0,
+ (EFI_PHYSICAL_ADDRESS) 0,
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
+ }
+};
+
+FV_PIWG_DEVICE_PATH mFvPIWGDevicePathTemplate = {
+ {
{
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ MEDIA_DEVICE_PATH,
+ MEDIA_PIWG_FW_VOL_DP,
{
- sizeof (EFI_DEVICE_PATH_PROTOCOL),
- 0
+ (UINT8)(sizeof (MEDIA_FW_VOL_DEVICE_PATH)),
+ (UINT8)(sizeof (MEDIA_FW_VOL_DEVICE_PATH) >> 8)
}
- }
+ },
+ { 0 }
},
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
+ }
+};
+
+EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate = {
+ FVB_DEVICE_SIGNATURE,
+ NULL,
0,
{
FvbProtocolGetAttributes,
@@ -1097,6 +1121,7 @@ Returns: ) {
return EFI_NOT_FOUND;
}
+
//
// Verify the header checksum
//
@@ -1113,6 +1138,13 @@ Returns: return EFI_NOT_FOUND;
}
+ //
+ // PI specification defines the name guid of FV exists in extension header.
+ //
+ if (FwVolHeader->ExtHeaderOffset == 0) {
+ return EFI_NOT_FOUND;
+ }
+
return EFI_SUCCESS;
}
@@ -1143,8 +1175,6 @@ Returns: EFI_HANDLE FwbHandle;
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *OldFwbInterface;
- EFI_DEVICE_PATH_PROTOCOL *TempFwbDevicePath;
- FV_DEVICE_PATH TempFvbDevicePathData;
UINT32 MaxLbaSize;
EFI_PHYSICAL_ADDRESS BaseAddress;
UINT64 Length;
@@ -1262,7 +1292,7 @@ Returns: FwVolHeader->HeaderLength
);
}
-
+
FwhInstance->FvBase[FVB_PHYSICAL] = (UINTN) BaseAddress;
FwhInstance->FvBase[FVB_VIRTUAL] = (UINTN) BaseAddress;
@@ -1297,19 +1327,29 @@ Returns: FvbDevice->Instance = mFvbModuleGlobal->NumFv;
mFvbModuleGlobal->NumFv++;
-
+
+
//
// Set up the devicepath
//
- FvbDevice->DevicePath.MemMapDevPath.StartingAddress = BaseAddress;
- FvbDevice->DevicePath.MemMapDevPath.EndingAddress = BaseAddress + (FwVolHeader->FvLength - 1);
-
+ if (FwVolHeader->ExtHeaderOffset == 0) {
+ //
+ // FV does not contains extension header, then produce MEMMAP_DEVICE_PATH
+ //
+ FvbDevice->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate);
+ ((FV_MEMMAP_DEVICE_PATH *) FvbDevice->DevicePath)->MemMapDevPath.StartingAddress = BaseAddress;
+ ((FV_MEMMAP_DEVICE_PATH *) FvbDevice->DevicePath)->MemMapDevPath.EndingAddress = BaseAddress + FwVolHeader->FvLength - 1;
+ } else {
+ FvbDevice->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);
+ CopyGuid (
+ &((FV_PIWG_DEVICE_PATH *)FvbDevice->DevicePath)->FvDevPath.FvName,
+ (GUID *)(UINTN)(BaseAddress + FwVolHeader->ExtHeaderOffset)
+ );
+ }
//
// Find a handle with a matching device path that has supports FW Block protocol
//
- TempFwbDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &TempFvbDevicePathData;
- CopyMem (TempFwbDevicePath, &FvbDevice->DevicePath, sizeof (FV_DEVICE_PATH));
- Status = gBS->LocateDevicePath (&gEfiFirmwareVolumeBlockProtocolGuid, &TempFwbDevicePath, &FwbHandle);
+ Status = gBS->LocateDevicePath (&gEfiFirmwareVolumeBlockProtocolGuid, &FvbDevice->DevicePath, &FwbHandle);
if (EFI_ERROR (Status)) {
//
// LocateDevicePath fails so install a new interface and device path
@@ -1324,7 +1364,7 @@ Returns: NULL
);
ASSERT_EFI_ERROR (Status);
- } else if (IsDevicePathEnd (TempFwbDevicePath)) {
+ } else if (IsDevicePathEnd (FvbDevice->DevicePath)) {
//
// Device allready exists, so reinstall the FVB protocol
//
diff --git a/Nt32Pkg/FvbServicesRuntimeDxe/FwBlockService.h b/Nt32Pkg/FvbServicesRuntimeDxe/FwBlockService.h index b9ebfded32..51332a4ad1 100644 --- a/Nt32Pkg/FvbServicesRuntimeDxe/FwBlockService.h +++ b/Nt32Pkg/FvbServicesRuntimeDxe/FwBlockService.h @@ -49,13 +49,18 @@ typedef struct { #define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'N')
typedef struct {
- MEMMAP_DEVICE_PATH MemMapDevPath;
+ MEDIA_FW_VOL_DEVICE_PATH FvDevPath;
EFI_DEVICE_PATH_PROTOCOL EndDevPath;
-} FV_DEVICE_PATH;
+} FV_PIWG_DEVICE_PATH;
+
+typedef struct {
+ MEMMAP_DEVICE_PATH MemMapDevPath;
+ EFI_DEVICE_PATH_PROTOCOL EndDevPath;
+} FV_MEMMAP_DEVICE_PATH;
typedef struct {
UINTN Signature;
- FV_DEVICE_PATH DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN Instance;
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
} EFI_FW_VOL_BLOCK_DEVICE;
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf index e08c3c889a..f4fe784d52 100644 --- a/Nt32Pkg/Nt32Pkg.fdf +++ b/Nt32Pkg/Nt32Pkg.fdf @@ -133,6 +133,7 @@ READ_ENABLED_CAP = TRUE READ_STATUS = TRUE
READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
+FvNameGuid = 6D99E806-3D38-42c2-A095-5F4300BFD7DC
################################################################################
#
|