]>
Commit | Line | Data |
---|---|---|
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 | |
b26f0cf9 | 9 | # SPDX-License-Identifier: BSD-2-Clause-Patent\r |
9beac0d8 LE |
10 | ##\r |
11 | \r | |
12 | # The GUID EE4E5898-3914-4259-9D6E-DC7BD79403CF means "LzmaCustomDecompress".\r | |
13 | # The decompressed output will have the following structure (see the file\r | |
14 | # "9E21FD93-9C72-4c15-8C4B-E77F1DB2D792SEC1.guided.dummy" in the\r | |
15 | # Build/Ovmf*/*/FV/Ffs/9E21FD93-9C72-4c15-8C4B-E77F1DB2D792/ directory):\r | |
16 | #\r | |
17 | # Size Contents\r | |
18 | # ------------------- --------------------------------------------------------\r | |
19 | # 4 EFI_COMMON_SECTION_HEADER, stating size 124 (0x7C) and\r | |
20 | # type 0x19 (EFI_SECTION_RAW). The purpose of this section\r | |
21 | # is to pad the start of PEIFV to 128 bytes.\r | |
22 | # 120 Zero bytes (padding).\r | |
23 | #\r | |
24 | # 4 EFI_COMMON_SECTION_HEADER, stating size\r | |
25 | # (PcdOvmfPeiMemFvSize + 4), and type 0x17\r | |
26 | # (EFI_SECTION_FIRMWARE_VOLUME_IMAGE).\r | |
27 | # PcdOvmfPeiMemFvSize PEIFV. Note that the above sizes pad the offset of this\r | |
28 | # object to 128 bytes. See also the "guided.dummy.txt"\r | |
29 | # file in the same directory.\r | |
30 | #\r | |
31 | # 4 EFI_COMMON_SECTION_HEADER, stating size 12 (0xC) and\r | |
32 | # type 0x19 (EFI_SECTION_RAW). The purpose of this section\r | |
33 | # is to pad the start of DXEFV to 16 bytes.\r | |
34 | # 8 Zero bytes (padding).\r | |
35 | #\r | |
36 | # 4 EFI_COMMON_SECTION_HEADER, stating size\r | |
37 | # (PcdOvmfDxeMemFvSize + 4), and type 0x17\r | |
38 | # (EFI_SECTION_FIRMWARE_VOLUME_IMAGE).\r | |
39 | # PcdOvmfDxeMemFvSize DXEFV. Note that the above sizes pad the offset of this\r | |
40 | # object to 16 bytes. See also the "guided.dummy.txt" file\r | |
41 | # in the same directory.\r | |
42 | #\r | |
43 | # The total size after decompression is (128 + PcdOvmfPeiMemFvSize + 16 +\r | |
44 | # PcdOvmfDxeMemFvSize).\r | |
45 | \r | |
46 | DEFINE OUTPUT_SIZE = (128 + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize + 16 + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize)\r | |
47 | \r | |
48 | # LzmaCustomDecompressLib uses a constant scratch buffer size of 64KB; see\r | |
49 | # SCRATCH_BUFFER_REQUEST_SIZE in\r | |
50 | # "MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c".\r | |
51 | \r | |
52 | DEFINE DECOMP_SCRATCH_SIZE = 0x00010000\r | |
53 | \r | |
54 | # Note: when we use PcdOvmfDxeMemFvBase in this context, BaseTools have not yet\r | |
55 | # offset it with MEMFD's base address. For that reason we have to do it manually.\r | |
56 | #\r | |
57 | # The calculation below mirrors DecompressMemFvs() [OvmfPkg/Sec/SecMain.c].\r | |
58 | \r | |
59 | DEFINE OUTPUT_BASE = ($(MEMFD_BASE_ADDRESS) + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase + 0x00100000)\r | |
60 | DEFINE DECOMP_SCRATCH_BASE_UNALIGNED = ($(OUTPUT_BASE) + $(OUTPUT_SIZE))\r | |
61 | DEFINE DECOMP_SCRATCH_BASE_ALIGNMENT = 0x000FFFFF\r | |
62 | DEFINE DECOMP_SCRATCH_BASE_MASK = 0xFFF00000\r | |
63 | DEFINE DECOMP_SCRATCH_BASE = (($(DECOMP_SCRATCH_BASE_UNALIGNED) + $(DECOMP_SCRATCH_BASE_ALIGNMENT)) & $(DECOMP_SCRATCH_BASE_MASK))\r | |
64 | \r | |
65 | SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd = $(DECOMP_SCRATCH_BASE) + $(DECOMP_SCRATCH_SIZE)\r |