From ddbf479f531a7a847ac00114c053608b33a50a8e Mon Sep 17 00:00:00 2001 From: Maurice Ma Date: Fri, 17 May 2019 12:14:13 -0700 Subject: [PATCH] Add warning if component is in CSME mapped flash region On APL the last 256KB flash address space (4GB-256KB to 4GB) is remapped to CSME SRAM read-only region. During stitching due to space limitation, if a component gets pushed into this region, then direct memory mapped access might not work since it will be decoded by CSME. To access components within this region, SPI command based interfaces has to be used instead of memory mapped interface. This patch added warning message when this condition is detected in the stitching process. Signed-off-by: Maurice Ma --- Platform/ApollolakeBoardPkg/Script/StitchLoader.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Platform/ApollolakeBoardPkg/Script/StitchLoader.py b/Platform/ApollolakeBoardPkg/Script/StitchLoader.py index 9cf88901..2f951f18 100755 --- a/Platform/ApollolakeBoardPkg/Script/StitchLoader.py +++ b/Platform/ApollolakeBoardPkg/Script/StitchLoader.py @@ -458,6 +458,16 @@ def PatchFlashMap (ImageData, PlatformData = 0xffffffff): if (Bp1.Offset + Bp1.Length - 0x1000) <= (Desc.Offset + Desc.Size) <= (Bp1.Offset + Bp1.Length): raise Exception("Component '%s' offset is in bootloader reserved region, please try to reduce compoent size !" % CompBpdtDict[Desc.Sig]) + Limit = Bp1.Offset + Bp1.Length - Bp0.Offset - 0x40000 + for Idx in range (EntryNum): + Desc = FlashMapDesc.from_buffer (OutputImageData, Stage1AOffset + FlaMapOff + sizeof(FlashMap) + Idx * sizeof(FlashMapDesc)) + if Desc.Sig == 'RSVD': + continue + # Last 256K flash space (4GB - 256KB to 4GB) is remapped to CSME read-only SRAM on APL + # Directly access is not available. + if Desc.Offset >= Limit or Desc.Offset + Desc.Size > Limit: + print "WARNING: Component '%s' in BP%d is located inside CSME memory mapped region, direct access might fail." % (Desc.Sig, Part) + print ("Flash map was patched successfully!") return 0 @@ -829,7 +839,6 @@ def CreateIfwiImage (IfwiIn, IfwiOut, BiosOut, PlatformData, NonRedundant, Stitc ('EPLD' , 'EPLD'), ('UVAR' , 'UVAR'), ('PLD' , 'PLD'), - ] if RedundantPayload: