OvmfPkg: Carve 128KB out of MAINFV in MEMFD

In an effort to consolidate fixed memory used by OVMF,
we'll move 2 SEC/PEI phase RAM users to 8MB.
* X64 page tables (24KB)   0x80000 => 0x800000
* PEI temporary RAM (64KB) 0x70000 => 0x810000

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15144 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg/Sec/SecMain.c: Convert to CRLF (dos) text

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15145 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg X64 ResetVector: Move page tables from 512KB to 8MB

To help consolidate OVMF fixed memory uses, we declare this
range in MEMFD and thereby move it to 8MB.

We also now declare the table range in the FDF to set
PCDs. This allows us to ASSERT that CR3 is set as expected
in OVMF SEC.

OvmfPkgIa32.fdf and OvmfPkgIa32X64.fdf are updated simply
for consistency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15146 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: Move SEC/PEI Temporary RAM from 0x70000 to 0x810000

Note: The Temporary RAM memory size is being reduced from
      64KB to 32KB. This still appears to be more than
      adequate for OVMF's early PEI phase. We will be adding
      another 32KB range of RAM just above this range for
      use on S3 resume.

The range is declared as part of MEMFD, so it is easier
to identify the memory range.

We also now assign PCDs to the memory range.

The PCDs are used to set the initial SEC/PEI stack in
SEC's assembly code.

The PCDs are also used in the SEC C code to setup
the Temporary RAM PPI.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15147 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg/Sec: Cleanup debug messages

Remove some not-so-useful messages (during FV scanning).

Convert ERROR to INFO and vise versa where appropriate.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15148 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg/Sec: Remove EFIAPI from functions that don't require it

These are all internal functions that don't interface with
assembly code or other drivers. Therefore EFIAPI is not
required.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15149 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg/Sec: Add FindFfsSectionInstance

This allow you to search for an 'instance' of a section
within a series of FFS sections.

For example, we will split the MAINFV into a PEI and DXE
FV, and then compress those two FV's together within a
FFS FV file. The DXE FV will appear as the second section
of the file, and therefore we will search for it using
an Instance=1 value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15150 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: Split MAINFV into a separate PEI and DXE FVs

By splitting the PEI and DXE phases into separate FVs,
we can only reserve the PEI FV for ACPI S3 support.
This should save about 7MB.

Unfortunately, this all has to happen in a single commit.

DEC:
* Remove PcdOvmfMemFv(Base|Size)
* Add PcdOvmfPeiMemFv(Base|Size)
* Add PcdOvmfDxeMemFv(Base|Size)

FDF:
* Add new PEIFV. Move PEI modules here.
* Remove MAINFV
* Add PEIFV and DXEFV into FVMAIN_COMPACT
   - They are added as 2 sections of a file, and compressed
     together so they should retain good compression
* PcdOvmf(Pei|Dxe)MemFv(Base|Size) are set

SEC:
* Find both the PEI and DXE FVs after decompression.
   - Copy them separately to their memory locations.

Platform PEI driver:
* Fv.c: Publish both FVs as appropriate
* MemDetect.c: PcdOvmfMemFv(Base|Size) =>
                PcdOvmfDxeMemFv(Base|Size)

OVMF.fd before:

  Non-volatile data storage
  FVMAIN_COMPACT                    uncompressed
    FV FFS file                     LZMA compressed
      MAINFV                        uncompressed
        individual PEI modules      uncompressed
        FV FFS file                 compressed with PI_NONE
          DXEFV                     uncompressed
            individual DXE modules  uncompressed
  SECFV                             uncompressed

OVMF.fd after:

  Non-volatile data storage
  FVMAIN_COMPACT                    uncompressed
    FV FFS file                     LZMA compressed
      PEIFV                         uncompressed
        individual PEI modules      uncompressed
      DXEFV                         uncompressed
        individual DXE modules      uncompressed
  SECFV                             uncompressed

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15151 6f19259b-4bc3-4df7-8a09-765794883524