4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2011, Andrei Warkentin <andreiw@motorola.com>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
12 // The package level header files this module uses
17 // The Library classes this module consumes
19 #include <Library/BaseLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/HobLib.h>
22 #include <Library/IoLib.h>
23 #include <Library/MemoryAllocationLib.h>
24 #include <Library/PcdLib.h>
25 #include <Library/PciLib.h>
26 #include <Library/PeimEntryPoint.h>
27 #include <Library/PeiServicesLib.h>
28 #include <Library/QemuFwCfgLib.h>
29 #include <Library/QemuFwCfgS3Lib.h>
30 #include <Library/QemuFwCfgSimpleParserLib.h>
31 #include <Library/ResourcePublicationLib.h>
32 #include <Ppi/MasterBootMode.h>
33 #include <IndustryStandard/I440FxPiix4.h>
34 #include <IndustryStandard/Pci22.h>
35 #include <IndustryStandard/Q35MchIch9.h>
36 #include <IndustryStandard/QemuCpuHotplug.h>
37 #include <OvmfPlatforms.h>
42 EFI_PEI_PPI_DESCRIPTOR mPpiBootMode
[] = {
44 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
45 &gEfiPeiMasterBootModePpiGuid
,
51 UINT16 mHostBridgeDevId
;
53 EFI_BOOT_MODE mBootMode
= BOOT_WITH_FULL_CONFIGURATION
;
55 BOOLEAN mS3Supported
= FALSE
;
60 AddIoMemoryBaseSizeHob (
61 EFI_PHYSICAL_ADDRESS MemoryBase
,
65 BuildResourceDescriptorHob (
66 EFI_RESOURCE_MEMORY_MAPPED_IO
,
67 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
68 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
|
69 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
|
70 EFI_RESOURCE_ATTRIBUTE_TESTED
,
77 AddReservedMemoryBaseSizeHob (
78 EFI_PHYSICAL_ADDRESS MemoryBase
,
83 BuildResourceDescriptorHob (
84 EFI_RESOURCE_MEMORY_RESERVED
,
85 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
86 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
|
87 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
|
89 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE
|
90 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE
|
91 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
:
94 EFI_RESOURCE_ATTRIBUTE_TESTED
,
101 AddIoMemoryRangeHob (
102 EFI_PHYSICAL_ADDRESS MemoryBase
,
103 EFI_PHYSICAL_ADDRESS MemoryLimit
106 AddIoMemoryBaseSizeHob (MemoryBase
, (UINT64
)(MemoryLimit
- MemoryBase
));
111 AddMemoryBaseSizeHob (
112 EFI_PHYSICAL_ADDRESS MemoryBase
,
116 BuildResourceDescriptorHob (
117 EFI_RESOURCE_SYSTEM_MEMORY
,
118 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
119 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
|
120 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
|
121 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE
|
122 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE
|
123 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
|
124 EFI_RESOURCE_ATTRIBUTE_TESTED
,
133 EFI_PHYSICAL_ADDRESS MemoryBase
,
134 EFI_PHYSICAL_ADDRESS MemoryLimit
137 AddMemoryBaseSizeHob (MemoryBase
, (UINT64
)(MemoryLimit
- MemoryBase
));
142 MemMapInitialization (
148 RETURN_STATUS PcdStatus
;
158 // Video memory + Legacy BIOS region
160 AddIoMemoryRangeHob (0x0A0000, BASE_1MB
);
162 if (mHostBridgeDevId
== 0xffff /* microvm */) {
163 AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB
); /* ioapic #1 */
164 AddIoMemoryBaseSizeHob (0xFEC10000, SIZE_4KB
); /* ioapic #2 */
168 TopOfLowRam
= GetSystemMemorySizeBelow4gb ();
170 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
172 // The MMCONFIG area is expected to fall between the top of low RAM and
173 // the base of the 32-bit PCI host aperture.
175 PciExBarBase
= FixedPcdGet64 (PcdPciExpressBaseAddress
);
176 ASSERT (TopOfLowRam
<= PciExBarBase
);
177 ASSERT (PciExBarBase
<= MAX_UINT32
- SIZE_256MB
);
178 PciBase
= (UINT32
)(PciExBarBase
+ SIZE_256MB
);
180 ASSERT (TopOfLowRam
<= mQemuUc32Base
);
181 PciBase
= mQemuUc32Base
;
185 // address purpose size
186 // ------------ -------- -------------------------
187 // max(top, 2g) PCI MMIO 0xFC000000 - max(top, 2g)
188 // 0xFC000000 gap 44 MB
189 // 0xFEC00000 IO-APIC 4 KB
190 // 0xFEC01000 gap 1020 KB
191 // 0xFED00000 HPET 1 KB
192 // 0xFED00400 gap 111 KB
193 // 0xFED1C000 gap (PIIX4) / RCRB (ICH9) 16 KB
194 // 0xFED20000 gap 896 KB
195 // 0xFEE00000 LAPIC 1 MB
197 PciSize
= 0xFC000000 - PciBase
;
198 AddIoMemoryBaseSizeHob (PciBase
, PciSize
);
199 PcdStatus
= PcdSet64S (PcdPciMmio32Base
, PciBase
);
200 ASSERT_RETURN_ERROR (PcdStatus
);
201 PcdStatus
= PcdSet64S (PcdPciMmio32Size
, PciSize
);
202 ASSERT_RETURN_ERROR (PcdStatus
);
204 AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB
);
205 AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB
);
206 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
207 AddIoMemoryBaseSizeHob (ICH9_ROOT_COMPLEX_BASE
, SIZE_16KB
);
209 // Note: there should be an
211 // AddIoMemoryBaseSizeHob (PciExBarBase, SIZE_256MB);
213 // call below, just like the one above for RCBA. However, Linux insists
214 // that the MMCONFIG area be marked in the E820 or UEFI memory map as
215 // "reserved memory" -- Linux does not content itself with a simple gap
216 // in the memory map wherever the MCFG ACPI table points to.
218 // This appears to be a safety measure. The PCI Firmware Specification
219 // (rev 3.1) says in 4.1.2. "MCFG Table Description": "The resources can
220 // *optionally* be returned in [...] EFIGetMemoryMap as reserved memory
221 // [...]". (Emphasis added here.)
223 // Normally we add memory resource descriptor HOBs in
224 // QemuInitializeRam(), and pre-allocate from those with memory
225 // allocation HOBs in InitializeRamRegions(). However, the MMCONFIG area
226 // is most definitely not RAM; so, as an exception, cover it with
227 // uncacheable reserved memory right here.
229 AddReservedMemoryBaseSizeHob (PciExBarBase
, SIZE_256MB
, FALSE
);
230 BuildMemoryAllocationHob (PciExBarBase
, SIZE_256MB
,
231 EfiReservedMemoryType
);
233 AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress
), SIZE_1MB
);
236 // On Q35, the IO Port space is available for PCI resource allocations from
239 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
242 ASSERT ((ICH9_PMBASE_VALUE
& 0xF000) < PciIoBase
);
246 // Add PCI IO Port space available for PCI resource allocations.
248 BuildResourceDescriptorHob (
250 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
251 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
,
255 PcdStatus
= PcdSet64S (PcdPciIoBase
, PciIoBase
);
256 ASSERT_RETURN_ERROR (PcdStatus
);
257 PcdStatus
= PcdSet64S (PcdPciIoSize
, PciIoSize
);
258 ASSERT_RETURN_ERROR (PcdStatus
);
261 #define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName) \
264 RETURN_STATUS PcdStatus; \
266 if (!RETURN_ERROR (QemuFwCfgParseBool ( \
267 "opt/ovmf/" #TokenName, &Setting))) { \
268 PcdStatus = PcdSetBoolS (TokenName, Setting); \
269 ASSERT_RETURN_ERROR (PcdStatus); \
274 NoexecDxeInitialization (
278 UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdSetNxForStack
);
282 PciExBarInitialization (
292 // We only support the 256MB size for the MMCONFIG area:
293 // 256 buses * 32 devices * 8 functions * 4096 bytes config space.
295 // The masks used below enforce the Q35 requirements that the MMCONFIG area
296 // be (a) correctly aligned -- here at 256 MB --, (b) located under 64 GB.
298 // Note that (b) also ensures that the minimum address width we have
299 // determined in AddressWidthInitialization(), i.e., 36 bits, will suffice
300 // for DXE's page tables to cover the MMCONFIG area.
302 PciExBarBase
.Uint64
= FixedPcdGet64 (PcdPciExpressBaseAddress
);
303 ASSERT ((PciExBarBase
.Uint32
[1] & MCH_PCIEXBAR_HIGHMASK
) == 0);
304 ASSERT ((PciExBarBase
.Uint32
[0] & MCH_PCIEXBAR_LOWMASK
) == 0);
307 // Clear the PCIEXBAREN bit first, before programming the high register.
309 PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW
), 0);
312 // Program the high register. Then program the low register, setting the
313 // MMCONFIG area size and enabling decoding at once.
315 PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_HIGH
), PciExBarBase
.Uint32
[1]);
317 DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW
),
318 PciExBarBase
.Uint32
[0] | MCH_PCIEXBAR_BUS_FF
| MCH_PCIEXBAR_EN
333 RETURN_STATUS PcdStatus
;
341 // Build the CPU HOB with guest RAM size dependent address width and 16-bits
342 // of IO space. (Side note: unlike other HOBs, the CPU HOB is needed during
343 // S3 resume as well, so we build it unconditionally.)
345 BuildCpuHob (mPhysMemAddressWidth
, 16);
348 // Determine platform type and save Host Bridge DID to PCD
350 switch (mHostBridgeDevId
) {
351 case INTEL_82441_DEVICE_ID
:
352 PmCmd
= POWER_MGMT_REGISTER_PIIX4 (PCI_COMMAND_OFFSET
);
353 Pmba
= POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA
);
354 PmbaAndVal
= ~(UINT32
)PIIX4_PMBA_MASK
;
355 PmbaOrVal
= PIIX4_PMBA_VALUE
;
356 AcpiCtlReg
= POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMREGMISC
);
357 AcpiEnBit
= PIIX4_PMREGMISC_PMIOSE
;
359 case INTEL_Q35_MCH_DEVICE_ID
:
360 PmCmd
= POWER_MGMT_REGISTER_Q35 (PCI_COMMAND_OFFSET
);
361 Pmba
= POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE
);
362 PmbaAndVal
= ~(UINT32
)ICH9_PMBASE_MASK
;
363 PmbaOrVal
= ICH9_PMBASE_VALUE
;
364 AcpiCtlReg
= POWER_MGMT_REGISTER_Q35 (ICH9_ACPI_CNTL
);
365 AcpiEnBit
= ICH9_ACPI_CNTL_ACPI_EN
;
368 DEBUG ((DEBUG_ERROR
, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
369 __FUNCTION__
, mHostBridgeDevId
));
373 PcdStatus
= PcdSet16S (PcdOvmfHostBridgePciDevId
, mHostBridgeDevId
);
374 ASSERT_RETURN_ERROR (PcdStatus
);
377 // If the appropriate IOspace enable bit is set, assume the ACPI PMBA has
378 // been configured and skip the setup here. This matches the logic in
379 // AcpiTimerLibConstructor ().
381 if ((PciRead8 (AcpiCtlReg
) & AcpiEnBit
) == 0) {
383 // The PEI phase should be exited with fully accessibe ACPI PM IO space:
386 PciAndThenOr32 (Pmba
, PmbaAndVal
, PmbaOrVal
);
389 // 2. set PCICMD/IOSE
391 PciOr8 (PmCmd
, EFI_PCI_COMMAND_IO_SPACE
);
394 // 3. set ACPI PM IO enable bit (PMREGMISC:PMIOSE or ACPI_CNTL:ACPI_EN)
396 PciOr8 (AcpiCtlReg
, AcpiEnBit
);
399 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
401 // Set Root Complex Register Block BAR
404 POWER_MGMT_REGISTER_Q35 (ICH9_RCBA
),
405 ICH9_ROOT_COMPLEX_BASE
| ICH9_RCBA_EN
409 // Set PCI Express Register Range Base Address
411 PciExBarInitialization ();
417 BootModeInitialization (
423 if (CmosRead8 (0xF) == 0xFE) {
424 mBootMode
= BOOT_ON_S3_RESUME
;
426 CmosWrite8 (0xF, 0x00);
428 Status
= PeiServicesSetBootMode (mBootMode
);
429 ASSERT_EFI_ERROR (Status
);
431 Status
= PeiServicesInstallPpi (mPpiBootMode
);
432 ASSERT_EFI_ERROR (Status
);
437 ReserveEmuVariableNvStore (
440 EFI_PHYSICAL_ADDRESS VariableStore
;
441 RETURN_STATUS PcdStatus
;
444 // Allocate storage for NV variables early on so it will be
445 // at a consistent address. Since VM memory is preserved
446 // across reboots, this allows the NV variable storage to survive
450 (EFI_PHYSICAL_ADDRESS
)(UINTN
)
451 AllocateRuntimePages (
452 EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize
))
455 "Reserved variable store memory: 0x%lX; size: %dkb\n",
457 (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize
)) / 1024
459 PcdStatus
= PcdSet64S (PcdEmuVariableNvStoreReserved
, VariableStore
);
460 ASSERT_RETURN_ERROR (PcdStatus
);
471 DEBUG ((DEBUG_INFO
, "CMOS:\n"));
473 for (Loop
= 0; Loop
< 0x80; Loop
++) {
474 if ((Loop
% 0x10) == 0) {
475 DEBUG ((DEBUG_INFO
, "%02x:", Loop
));
477 DEBUG ((DEBUG_INFO
, " %02x", CmosRead8 (Loop
)));
478 if ((Loop
% 0x10) == 0xf) {
479 DEBUG ((DEBUG_INFO
, "\n"));
490 #if defined (MDE_CPU_X64)
491 if (FeaturePcdGet (PcdSmmSmramRequire
) && mS3Supported
) {
493 "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n", __FUNCTION__
));
495 "%a: Please disable S3 on the QEMU command line (see the README),\n",
498 "%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n", __FUNCTION__
));
507 Q35BoardVerification (
511 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
517 "%a: no TSEG (SMRAM) on host bridge DID=0x%04x; "
518 "only DID=0x%04x (Q35) is supported\n",
521 INTEL_Q35_MCH_DEVICE_ID
529 Fetch the boot CPU count and the possible CPU count from QEMU, and expose
530 them to UefiCpuPkg modules. Set the mMaxCpuCount variable.
533 MaxCpuCountInitialization (
538 RETURN_STATUS PcdStatus
;
541 // Try to fetch the boot CPU count.
543 QemuFwCfgSelectItem (QemuFwCfgItemSmpCpuCount
);
544 BootCpuCount
= QemuFwCfgRead16 ();
545 if (BootCpuCount
== 0) {
547 // QEMU doesn't report the boot CPU count. (BootCpuCount == 0) will let
548 // MpInitLib count APs up to (PcdCpuMaxLogicalProcessorNumber - 1), or
549 // until PcdCpuApInitTimeOutInMicroSeconds elapses (whichever is reached
552 DEBUG ((DEBUG_WARN
, "%a: boot CPU count unavailable\n", __FUNCTION__
));
553 mMaxCpuCount
= PcdGet32 (PcdCpuMaxLogicalProcessorNumber
);
556 // We will expose BootCpuCount to MpInitLib. MpInitLib will count APs up to
557 // (BootCpuCount - 1) precisely, regardless of timeout.
559 // Now try to fetch the possible CPU count.
564 CpuHpBase
= ((mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) ?
565 ICH9_CPU_HOTPLUG_BASE
: PIIX4_CPU_HOTPLUG_BASE
);
568 // If only legacy mode is available in the CPU hotplug register block, or
569 // the register block is completely missing, then the writes below are
572 // 1. Switch the hotplug register block to modern mode.
574 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, 0);
576 // 2. Select a valid CPU for deterministic reading of
577 // QEMU_CPUHP_R_CMD_DATA2.
579 // CPU#0 is always valid; it is the always present and non-removable
582 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, 0);
584 // 3. Send a command after which QEMU_CPUHP_R_CMD_DATA2 is specified to
585 // read as zero, and which does not invalidate the selector. (The
586 // selector may change, but it must not become invalid.)
588 // Send QEMU_CPUHP_CMD_GET_PENDING, as it will prove useful later.
590 IoWrite8 (CpuHpBase
+ QEMU_CPUHP_W_CMD
, QEMU_CPUHP_CMD_GET_PENDING
);
592 // 4. Read QEMU_CPUHP_R_CMD_DATA2.
594 // If the register block is entirely missing, then this is an unassigned
595 // IO read, returning all-bits-one.
597 // If only legacy mode is available, then bit#0 stands for CPU#0 in the
598 // "CPU present bitmap". CPU#0 is always present.
600 // Otherwise, QEMU_CPUHP_R_CMD_DATA2 is either still reserved (returning
601 // all-bits-zero), or it is specified to read as zero after the above
602 // steps. Both cases confirm modern mode.
604 CmdData2
= IoRead32 (CpuHpBase
+ QEMU_CPUHP_R_CMD_DATA2
);
605 DEBUG ((DEBUG_VERBOSE
, "%a: CmdData2=0x%x\n", __FUNCTION__
, CmdData2
));
608 // QEMU doesn't support the modern CPU hotplug interface. Assume that the
609 // possible CPU count equals the boot CPU count (precluding hotplug).
611 DEBUG ((DEBUG_WARN
, "%a: modern CPU hotplug interface unavailable\n",
613 mMaxCpuCount
= BootCpuCount
;
616 // Grab the possible CPU count from the modern CPU hotplug interface.
618 UINT32 Present
, Possible
, Selected
;
624 // We've sent QEMU_CPUHP_CMD_GET_PENDING last; this ensures
625 // QEMU_CPUHP_RW_CMD_DATA can now be read usefully. However,
626 // QEMU_CPUHP_CMD_GET_PENDING may have selected a CPU with actual pending
627 // hotplug events; therefore, select CPU#0 forcibly.
629 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, Possible
);
635 // Read the status of the currently selected CPU. This will help with a
636 // sanity check against "BootCpuCount".
638 CpuStatus
= IoRead8 (CpuHpBase
+ QEMU_CPUHP_R_CPU_STAT
);
639 if ((CpuStatus
& QEMU_CPUHP_STAT_ENABLED
) != 0) {
643 // Attempt to select the next CPU.
646 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, Possible
);
648 // If the selection is successful, then the following read will return
649 // the selector (which we know is positive at this point). Otherwise,
650 // the read will return 0.
652 Selected
= IoRead32 (CpuHpBase
+ QEMU_CPUHP_RW_CMD_DATA
);
653 ASSERT (Selected
== Possible
|| Selected
== 0);
654 } while (Selected
> 0);
657 // Sanity check: fw_cfg and the modern CPU hotplug interface should
658 // return the same boot CPU count.
660 if (BootCpuCount
!= Present
) {
661 DEBUG ((DEBUG_WARN
, "%a: QEMU v2.7 reset bug: BootCpuCount=%d "
662 "Present=%u\n", __FUNCTION__
, BootCpuCount
, Present
));
664 // The handling of QemuFwCfgItemSmpCpuCount, across CPU hotplug plus
665 // platform reset (including S3), was corrected in QEMU commit
666 // e3cadac073a9 ("pc: fix FW_CFG_NB_CPUS to account for -device added
667 // CPUs", 2016-11-16), part of release v2.8.0.
669 BootCpuCount
= (UINT16
)Present
;
672 mMaxCpuCount
= Possible
;
676 DEBUG ((DEBUG_INFO
, "%a: BootCpuCount=%d mMaxCpuCount=%u\n", __FUNCTION__
,
677 BootCpuCount
, mMaxCpuCount
));
678 ASSERT (BootCpuCount
<= mMaxCpuCount
);
680 PcdStatus
= PcdSet32S (PcdCpuBootLogicalProcessorNumber
, BootCpuCount
);
681 ASSERT_RETURN_ERROR (PcdStatus
);
682 PcdStatus
= PcdSet32S (PcdCpuMaxLogicalProcessorNumber
, mMaxCpuCount
);
683 ASSERT_RETURN_ERROR (PcdStatus
);
688 Perform Platform PEI initialization.
690 @param FileHandle Handle of the file being invoked.
691 @param PeiServices Describes the list of possible PEI Services.
693 @return EFI_SUCCESS The PEIM initialized successfully.
699 IN EFI_PEI_FILE_HANDLE FileHandle
,
700 IN CONST EFI_PEI_SERVICES
**PeiServices
705 DEBUG ((DEBUG_INFO
, "Platform PEIM Loaded\n"));
709 if (QemuFwCfgS3Enabled ()) {
710 DEBUG ((DEBUG_INFO
, "S3 support was detected on QEMU\n"));
712 Status
= PcdSetBoolS (PcdAcpiS3Enable
, TRUE
);
713 ASSERT_EFI_ERROR (Status
);
717 BootModeInitialization ();
718 AddressWidthInitialization ();
721 // Query Host Bridge DID
723 mHostBridgeDevId
= PciRead16 (OVMF_HOSTBRIDGE_DID
);
725 MaxCpuCountInitialization ();
727 if (FeaturePcdGet (PcdSmmSmramRequire
)) {
728 Q35BoardVerification ();
729 Q35TsegMbytesInitialization ();
730 Q35SmramAtDefaultSmbaseInitialization ();
735 QemuUc32BaseInitialization ();
737 InitializeRamRegions ();
739 if (mBootMode
!= BOOT_ON_S3_RESUME
) {
740 if (!FeaturePcdGet (PcdSmmSmramRequire
)) {
741 ReserveEmuVariableNvStore ();
743 PeiFvInitialization ();
744 MemTypeInfoInitialization ();
745 MemMapInitialization ();
746 NoexecDxeInitialization ();
749 InstallClearCacheCallback ();
751 MiscInitialization ();
752 InstallFeatureControlCallback ();