summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-10 09:26:52 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-10 09:26:52 +0000
commit84266565f5957184483515157987168e2c930a60 (patch)
treed149051e14e4b0435af428f82d822a2d7bb3802f /MdeModulePkg/Core
parentf0480ecf804ff9e0e5c12d21ba563f73212028e8 (diff)
downloadedk2-84266565f5957184483515157987168e2c930a60.zip
edk2-84266565f5957184483515157987168e2c930a60.tar.gz
edk2-84266565f5957184483515157987168e2c930a60.tar.bz2
Update DxeCore to deal PIWG FV device path case if FV contains extension header.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7850 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r--MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c85
-rw-r--r--MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h12
2 files changed, 71 insertions, 26 deletions
diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
index 2584af5..02b8914 100644
--- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
+++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
@@ -18,34 +18,57 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeMain.h"
#include "FwVolBlock.h"
-
-EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
- FVB_DEVICE_SIGNATURE,
- NULL,
+FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate = {
{
{
+ HARDWARE_DEVICE_PATH,
+ HW_MEMMAP_DP,
{
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- {
- (UINT8)(sizeof (MEMMAP_DEVICE_PATH)),
- (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8)
- }
- },
- EfiMemoryMappedIO,
- (EFI_PHYSICAL_ADDRESS) 0,
- (EFI_PHYSICAL_ADDRESS) 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_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
+ }
+};
+
+FV_PIWG_DEVICE_PATH mFvPIWGDevicePathTemplate = {
+ {
+ {
+ MEDIA_DEVICE_PATH,
+ MEDIA_PIWG_FW_VOL_DP,
{
- END_DEVICE_PATH_LENGTH,
- 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 mFwVolBlock = {
+ FVB_DEVICE_SIGNATURE,
+ NULL,
+ NULL,
+ {
FwVolBlockGetAttributes,
(EFI_FVB_SET_ATTRIBUTES)FwVolBlockSetAttributes,
FwVolBlockGetPhysicalAddress,
@@ -466,6 +489,7 @@ ProduceFVBProtocolOnBuffer (
CoreFreePool (FvbDev);
return EFI_OUT_OF_RESOURCES;
}
+
//
// Last, fill in the cache with the linear address of the blocks
//
@@ -482,11 +506,26 @@ ProduceFVBProtocolOnBuffer (
}
//
- // Set up the devicepath
+ // Judget whether FV name guid is produced in Fv extension header
//
- FvbDev->DevicePath.MemMapDevPath.StartingAddress = BaseAddress;
- FvbDev->DevicePath.MemMapDevPath.EndingAddress = BaseAddress + FwVolHeader->FvLength - 1;
-
+ if (FwVolHeader->ExtHeaderOffset == 0) {
+ //
+ // FV does not contains extension header, then produce MEMMAP_DEVICE_PATH
+ //
+ FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate);
+ ((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.StartingAddress = BaseAddress;
+ ((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.EndingAddress = BaseAddress + FwVolHeader->FvLength - 1;
+ } else {
+ //
+ // FV contains extension header, then produce MEDIA_FW_VOL_DEVICE_PATH
+ //
+ FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);
+ CopyGuid (
+ &((FV_PIWG_DEVICE_PATH *)FvbDev->DevicePath)->FvDevPath.FvName,
+ (GUID *)(UINTN)(BaseAddress + FwVolHeader->ExtHeaderOffset)
+ );
+ }
+
//
//
// Attach FvVolBlock Protocol to new handle
@@ -494,7 +533,7 @@ ProduceFVBProtocolOnBuffer (
Status = CoreInstallMultipleProtocolInterfaces (
&FvbDev->Handle,
&gEfiFirmwareVolumeBlockProtocolGuid, &FvbDev->FwVolBlockInstance,
- &gEfiDevicePathProtocolGuid, &FvbDev->DevicePath,
+ &gEfiDevicePathProtocolGuid, FvbDev->DevicePath,
NULL
);
diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h
index d06beb0..e287937 100644
--- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h
+++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h
@@ -25,17 +25,23 @@ typedef struct {
UINTN Length;
} LBA_CACHE;
-
typedef struct {
MEMMAP_DEVICE_PATH MemMapDevPath;
EFI_DEVICE_PATH_PROTOCOL EndDevPath;
-} FV_DEVICE_PATH;
+} FV_MEMMAP_DEVICE_PATH;
+//
+// UEFI Specification define FV device path format if FV provide name guid in extension header
+//
+typedef struct {
+ MEDIA_FW_VOL_DEVICE_PATH FvDevPath;
+ EFI_DEVICE_PATH_PROTOCOL EndDevPath;
+} FV_PIWG_DEVICE_PATH;
typedef struct {
UINTN Signature;
EFI_HANDLE Handle;
- FV_DEVICE_PATH DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
UINTN NumBlocks;
LBA_CACHE *LbaCache;