From cb77b48ad9ee73acfb78c1d800ace7417fb7a24e Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Wed, 12 Mar 2014 17:23:33 +0000 Subject: ArmPlatformPkg/BootMonFs: Added support for new revision of the NOR Flash file system Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15324 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h | 4 ++++ ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c | 14 +++++++++----- ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h index 3ebb5ba54a..c1bef755ae 100644 --- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h +++ b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsHw.h @@ -19,9 +19,13 @@ #define HW_IMAGE_FOOTER_SIGNATURE_1 0x464C5348 #define HW_IMAGE_FOOTER_SIGNATURE_2 0x464F4F54 + #define HW_IMAGE_FOOTER_VERSION 1 #define HW_IMAGE_FOOTER_OFFSET 92 +#define HW_IMAGE_FOOTER_VERSION2 2 +#define HW_IMAGE_FOOTER_OFFSET2 96 + typedef struct { CHAR8 Filename[MAX_NAME_LENGTH]; UINT32 Offset; diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c index 7d3e901903..aadc0c7f93 100644 --- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c +++ b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsImages.c @@ -109,11 +109,15 @@ BootMonFsImageInThisBlock ( return FALSE; } - if (Ptr->Version != HW_IMAGE_FOOTER_VERSION) { - return FALSE; - } - - if (Ptr->Offset != HW_IMAGE_FOOTER_OFFSET) { + if (Ptr->Version == HW_IMAGE_FOOTER_VERSION) { + if (Ptr->Offset != HW_IMAGE_FOOTER_OFFSET) { + return FALSE; + } + } else if (Ptr->Version == HW_IMAGE_FOOTER_VERSION2) { + if (Ptr->Offset != HW_IMAGE_FOOTER_OFFSET2) { + return FALSE; + } + } else { return FALSE; } diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c index 908393fa53..778af389a0 100644 --- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c +++ b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsOpenClose.c @@ -100,8 +100,13 @@ FlushAppendRegion ( Description->BlockEnd = Description->BlockStart + (NewFileSize / BlockSize); Description->Footer.FooterSignature1 = HW_IMAGE_FOOTER_SIGNATURE_1; Description->Footer.FooterSignature2 = HW_IMAGE_FOOTER_SIGNATURE_2; +#ifdef MDE_CPU_ARM Description->Footer.Version = HW_IMAGE_FOOTER_VERSION; Description->Footer.Offset = HW_IMAGE_FOOTER_OFFSET; +#else + Description->Footer.Version = HW_IMAGE_FOOTER_VERSION2; + Description->Footer.Offset = HW_IMAGE_FOOTER_OFFSET2; +#endif Description->RegionCount = 1; Description->Region[0].Checksum = 0; Description->Region[0].Offset = Description->BlockStart * BlockSize; -- cgit v1.2.3