]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/DecomprScratchEnd.fdf.inc
OvmfPkg/SmmCpuFeaturesLib: SEV: encrypt+free pages of init. save state map
[mirror_edk2.git] / OvmfPkg / DecomprScratchEnd.fdf.inc
CommitLineData
9beac0d8
LE
1## @file\r
2# This FDF include file computes the end of the scratch buffer used in\r
3# DecompressMemFvs() [OvmfPkg/Sec/SecMain.c]. It is based on the decompressed\r
4# (ie. original) size of the LZMA-compressed section of the one FFS file in\r
5# the FVMAIN_COMPACT firmware volume.\r
6#\r
7# Copyright (C) 2015, Red Hat, Inc.\r
8#\r
9# This program and the accompanying materials are licensed and made available\r
10# under the terms and conditions of the BSD License which accompanies this\r
11# distribution. The full text of the license may be found at\r
12# http://opensource.org/licenses/bsd-license.php\r
13#\r
14# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR\r
16# IMPLIED.\r
17##\r
18\r
19# The GUID EE4E5898-3914-4259-9D6E-DC7BD79403CF means "LzmaCustomDecompress".\r
20# The decompressed output will have the following structure (see the file\r
21# "9E21FD93-9C72-4c15-8C4B-E77F1DB2D792SEC1.guided.dummy" in the\r
22# Build/Ovmf*/*/FV/Ffs/9E21FD93-9C72-4c15-8C4B-E77F1DB2D792/ directory):\r
23#\r
24# Size Contents\r
25# ------------------- --------------------------------------------------------\r
26# 4 EFI_COMMON_SECTION_HEADER, stating size 124 (0x7C) and\r
27# type 0x19 (EFI_SECTION_RAW). The purpose of this section\r
28# is to pad the start of PEIFV to 128 bytes.\r
29# 120 Zero bytes (padding).\r
30#\r
31# 4 EFI_COMMON_SECTION_HEADER, stating size\r
32# (PcdOvmfPeiMemFvSize + 4), and type 0x17\r
33# (EFI_SECTION_FIRMWARE_VOLUME_IMAGE).\r
34# PcdOvmfPeiMemFvSize PEIFV. Note that the above sizes pad the offset of this\r
35# object to 128 bytes. See also the "guided.dummy.txt"\r
36# file in the same directory.\r
37#\r
38# 4 EFI_COMMON_SECTION_HEADER, stating size 12 (0xC) and\r
39# type 0x19 (EFI_SECTION_RAW). The purpose of this section\r
40# is to pad the start of DXEFV to 16 bytes.\r
41# 8 Zero bytes (padding).\r
42#\r
43# 4 EFI_COMMON_SECTION_HEADER, stating size\r
44# (PcdOvmfDxeMemFvSize + 4), and type 0x17\r
45# (EFI_SECTION_FIRMWARE_VOLUME_IMAGE).\r
46# PcdOvmfDxeMemFvSize DXEFV. Note that the above sizes pad the offset of this\r
47# object to 16 bytes. See also the "guided.dummy.txt" file\r
48# in the same directory.\r
49#\r
50# The total size after decompression is (128 + PcdOvmfPeiMemFvSize + 16 +\r
51# PcdOvmfDxeMemFvSize).\r
52\r
53DEFINE OUTPUT_SIZE = (128 + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize + 16 + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize)\r
54\r
55# LzmaCustomDecompressLib uses a constant scratch buffer size of 64KB; see\r
56# SCRATCH_BUFFER_REQUEST_SIZE in\r
57# "MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c".\r
58\r
59DEFINE DECOMP_SCRATCH_SIZE = 0x00010000\r
60\r
61# Note: when we use PcdOvmfDxeMemFvBase in this context, BaseTools have not yet\r
62# offset it with MEMFD's base address. For that reason we have to do it manually.\r
63#\r
64# The calculation below mirrors DecompressMemFvs() [OvmfPkg/Sec/SecMain.c].\r
65\r
66DEFINE OUTPUT_BASE = ($(MEMFD_BASE_ADDRESS) + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase + 0x00100000)\r
67DEFINE DECOMP_SCRATCH_BASE_UNALIGNED = ($(OUTPUT_BASE) + $(OUTPUT_SIZE))\r
68DEFINE DECOMP_SCRATCH_BASE_ALIGNMENT = 0x000FFFFF\r
69DEFINE DECOMP_SCRATCH_BASE_MASK = 0xFFF00000\r
70DEFINE DECOMP_SCRATCH_BASE = (($(DECOMP_SCRATCH_BASE_UNALIGNED) + $(DECOMP_SCRATCH_BASE_ALIGNMENT)) & $(DECOMP_SCRATCH_BASE_MASK))\r
71\r
72SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd = $(DECOMP_SCRATCH_BASE) + $(DECOMP_SCRATCH_SIZE)\r