audk/MdeModulePkg
Star Zeng c03beb762a MdeModulePkg PiSmmCore: Remove a hidden assumption of SMRAM reservation
that assumes the SMRAM reserved range is only at the end of the SMRAM descriptor.

          //
          // This range has reserved area, calculate the left free size
          //
          gSmmCorePrivate->SmramRanges[Index].PhysicalSize = SmramResRegion->SmramReservedStart - gSmmCorePrivate->SmramRanges[Index].CpuStart;

Imagine the following scenario where we just reserve the first page of the SMRAM range:

SMRAM Descriptor:
  Start: 0x80000000
  Size: 0x02000000

Reserved Range:
  Start: 0x80000000
  Size: 0x00001000

In this case the adjustment to the SMRAM range size yields zero: ReservedStart - SMRAM Start is 0x80000000 - 0x80000000 = 0.
So even though most of the range is still free the IPL code decides its unusable.

The problem comes from the email thread: [edk2] PiSmmIpl SMRAM Reservation Logic.
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/15268

Also to follow the idea in the email thread, the patch is to
1. Keep only one copy of full SMRAM ranges in gSmmCorePrivate->SmramRanges,
split record for SmmConfiguration->SmramReservedRegions and SMM Core that
will be marked to be EFI_ALLOCATED in gSmmCorePrivate->SmramRanges.
2. Handle SmmConfiguration->SmramReservedRegions at beginning of, at end of,
in the middle of, or cross multiple SmramRanges.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18031 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 07:38:12 +00:00
..
Application MdeModulePkg: Refine code to use Strn**S safe functions instead of Str**S ones in some cases. 2015-07-08 01:08:09 +00:00
Bus MdeModulePkg/XhciPei: Error handling enhancement for XhcPeiExecTransfer 2015-07-08 05:54:44 +00:00
Core MdeModulePkg PiSmmCore: Remove a hidden assumption of SMRAM reservation 2015-07-26 07:38:12 +00:00
Include MdeModulePkg: Remove Ip4ConfigDxe and related guid definition 2015-07-10 05:49:48 +00:00
Library MdeModulePkg PiSmmCore: Remove a hidden assumption of SMRAM reservation 2015-07-26 07:38:12 +00:00
Logo MdeModulePkg: Convert non DOS format files to DOS format and remove unused module UNI files. 2014-09-03 08:39:12 +00:00
Universal MdeModulePkg/TerminalDxe: Some improvements 2015-07-16 08:50:43 +00:00
Contributions.txt */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
License.txt Update copyright format 2012-04-24 06:49:39 +00:00
MdeModulePkg.dec MdeModulePkg: Correct PcdConOutColumn help string. 2015-07-16 05:44:16 +00:00
MdeModulePkg.dsc MdeModulePkg: Remove Ip4ConfigDxe and related guid definition 2015-07-10 05:49:48 +00:00
MdeModulePkg.uni MdeModulePkg: Correct PcdConOutColumn help string. 2015-07-16 05:44:16 +00:00
MdeModulePkgExtra.uni MdeModulePkg: INF/DEC file updates to EDK II packages 2014-08-28 06:55:48 +00:00