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/Microvm.h>
35 #include <IndustryStandard/Pci22.h>
36 #include <IndustryStandard/Q35MchIch9.h>
37 #include <IndustryStandard/QemuCpuHotplug.h>
38 #include <OvmfPlatforms.h>
43 EFI_PEI_PPI_DESCRIPTOR mPpiBootMode
[] = {
45 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
46 &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
));
110 AddMemoryBaseSizeHob (
111 EFI_PHYSICAL_ADDRESS MemoryBase
,
115 BuildResourceDescriptorHob (
116 EFI_RESOURCE_SYSTEM_MEMORY
,
117 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
118 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
|
119 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
|
120 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE
|
121 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE
|
122 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
|
123 EFI_RESOURCE_ATTRIBUTE_TESTED
,
131 EFI_PHYSICAL_ADDRESS MemoryBase
,
132 EFI_PHYSICAL_ADDRESS MemoryLimit
135 AddMemoryBaseSizeHob (MemoryBase
, (UINT64
)(MemoryLimit
- MemoryBase
));
139 MemMapInitialization (
145 RETURN_STATUS PcdStatus
;
155 // Video memory + Legacy BIOS region
157 AddIoMemoryRangeHob (0x0A0000, BASE_1MB
);
159 if (mHostBridgeDevId
== 0xffff /* microvm */) {
160 AddIoMemoryBaseSizeHob (MICROVM_GED_MMIO_BASE
, SIZE_4KB
);
161 AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB
); /* ioapic #1 */
162 AddIoMemoryBaseSizeHob (0xFEC10000, SIZE_4KB
); /* ioapic #2 */
166 TopOfLowRam
= GetSystemMemorySizeBelow4gb ();
168 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
170 // The MMCONFIG area is expected to fall between the top of low RAM and
171 // the base of the 32-bit PCI host aperture.
173 PciExBarBase
= FixedPcdGet64 (PcdPciExpressBaseAddress
);
174 ASSERT (TopOfLowRam
<= PciExBarBase
);
175 ASSERT (PciExBarBase
<= MAX_UINT32
- SIZE_256MB
);
176 PciBase
= (UINT32
)(PciExBarBase
+ SIZE_256MB
);
178 ASSERT (TopOfLowRam
<= mQemuUc32Base
);
179 PciBase
= mQemuUc32Base
;
183 // address purpose size
184 // ------------ -------- -------------------------
185 // max(top, 2g) PCI MMIO 0xFC000000 - max(top, 2g)
186 // 0xFC000000 gap 44 MB
187 // 0xFEC00000 IO-APIC 4 KB
188 // 0xFEC01000 gap 1020 KB
189 // 0xFED00000 HPET 1 KB
190 // 0xFED00400 gap 111 KB
191 // 0xFED1C000 gap (PIIX4) / RCRB (ICH9) 16 KB
192 // 0xFED20000 gap 896 KB
193 // 0xFEE00000 LAPIC 1 MB
195 PciSize
= 0xFC000000 - PciBase
;
196 AddIoMemoryBaseSizeHob (PciBase
, PciSize
);
197 PcdStatus
= PcdSet64S (PcdPciMmio32Base
, PciBase
);
198 ASSERT_RETURN_ERROR (PcdStatus
);
199 PcdStatus
= PcdSet64S (PcdPciMmio32Size
, PciSize
);
200 ASSERT_RETURN_ERROR (PcdStatus
);
202 AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB
);
203 AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB
);
204 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
205 AddIoMemoryBaseSizeHob (ICH9_ROOT_COMPLEX_BASE
, SIZE_16KB
);
207 // Note: there should be an
209 // AddIoMemoryBaseSizeHob (PciExBarBase, SIZE_256MB);
211 // call below, just like the one above for RCBA. However, Linux insists
212 // that the MMCONFIG area be marked in the E820 or UEFI memory map as
213 // "reserved memory" -- Linux does not content itself with a simple gap
214 // in the memory map wherever the MCFG ACPI table points to.
216 // This appears to be a safety measure. The PCI Firmware Specification
217 // (rev 3.1) says in 4.1.2. "MCFG Table Description": "The resources can
218 // *optionally* be returned in [...] EFIGetMemoryMap as reserved memory
219 // [...]". (Emphasis added here.)
221 // Normally we add memory resource descriptor HOBs in
222 // QemuInitializeRam(), and pre-allocate from those with memory
223 // allocation HOBs in InitializeRamRegions(). However, the MMCONFIG area
224 // is most definitely not RAM; so, as an exception, cover it with
225 // uncacheable reserved memory right here.
227 AddReservedMemoryBaseSizeHob (PciExBarBase
, SIZE_256MB
, FALSE
);
228 BuildMemoryAllocationHob (
231 EfiReservedMemoryType
235 AddIoMemoryBaseSizeHob (PcdGet32 (PcdCpuLocalApicBaseAddress
), SIZE_1MB
);
238 // On Q35, the IO Port space is available for PCI resource allocations from
241 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
244 ASSERT ((ICH9_PMBASE_VALUE
& 0xF000) < PciIoBase
);
248 // Add PCI IO Port space available for PCI resource allocations.
250 BuildResourceDescriptorHob (
252 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
253 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
,
257 PcdStatus
= PcdSet64S (PcdPciIoBase
, PciIoBase
);
258 ASSERT_RETURN_ERROR (PcdStatus
);
259 PcdStatus
= PcdSet64S (PcdPciIoSize
, PciIoSize
);
260 ASSERT_RETURN_ERROR (PcdStatus
);
263 #define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName) \
266 RETURN_STATUS PcdStatus; \
268 if (!RETURN_ERROR (QemuFwCfgParseBool ( \
269 "opt/ovmf/" #TokenName, &Setting))) { \
270 PcdStatus = PcdSetBoolS (TokenName, Setting); \
271 ASSERT_RETURN_ERROR (PcdStatus); \
276 NoexecDxeInitialization (
280 UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdSetNxForStack
);
284 PciExBarInitialization (
294 // We only support the 256MB size for the MMCONFIG area:
295 // 256 buses * 32 devices * 8 functions * 4096 bytes config space.
297 // The masks used below enforce the Q35 requirements that the MMCONFIG area
298 // be (a) correctly aligned -- here at 256 MB --, (b) located under 64 GB.
300 // Note that (b) also ensures that the minimum address width we have
301 // determined in AddressWidthInitialization(), i.e., 36 bits, will suffice
302 // for DXE's page tables to cover the MMCONFIG area.
304 PciExBarBase
.Uint64
= FixedPcdGet64 (PcdPciExpressBaseAddress
);
305 ASSERT ((PciExBarBase
.Uint32
[1] & MCH_PCIEXBAR_HIGHMASK
) == 0);
306 ASSERT ((PciExBarBase
.Uint32
[0] & MCH_PCIEXBAR_LOWMASK
) == 0);
309 // Clear the PCIEXBAREN bit first, before programming the high register.
311 PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW
), 0);
314 // Program the high register. Then program the low register, setting the
315 // MMCONFIG area size and enabling decoding at once.
317 PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_HIGH
), PciExBarBase
.Uint32
[1]);
319 DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW
),
320 PciExBarBase
.Uint32
[0] | MCH_PCIEXBAR_BUS_FF
| MCH_PCIEXBAR_EN
335 RETURN_STATUS PcdStatus
;
343 // Build the CPU HOB with guest RAM size dependent address width and 16-bits
344 // of IO space. (Side note: unlike other HOBs, the CPU HOB is needed during
345 // S3 resume as well, so we build it unconditionally.)
347 BuildCpuHob (mPhysMemAddressWidth
, 16);
350 // Determine platform type and save Host Bridge DID to PCD
352 switch (mHostBridgeDevId
) {
353 case INTEL_82441_DEVICE_ID
:
354 PmCmd
= POWER_MGMT_REGISTER_PIIX4 (PCI_COMMAND_OFFSET
);
355 Pmba
= POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA
);
356 PmbaAndVal
= ~(UINT32
)PIIX4_PMBA_MASK
;
357 PmbaOrVal
= PIIX4_PMBA_VALUE
;
358 AcpiCtlReg
= POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMREGMISC
);
359 AcpiEnBit
= PIIX4_PMREGMISC_PMIOSE
;
361 case INTEL_Q35_MCH_DEVICE_ID
:
362 PmCmd
= POWER_MGMT_REGISTER_Q35 (PCI_COMMAND_OFFSET
);
363 Pmba
= POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE
);
364 PmbaAndVal
= ~(UINT32
)ICH9_PMBASE_MASK
;
365 PmbaOrVal
= ICH9_PMBASE_VALUE
;
366 AcpiCtlReg
= POWER_MGMT_REGISTER_Q35 (ICH9_ACPI_CNTL
);
367 AcpiEnBit
= ICH9_ACPI_CNTL_ACPI_EN
;
369 case 0xffff: /* microvm */
370 DEBUG ((DEBUG_INFO
, "%a: microvm\n", __FUNCTION__
));
371 PcdStatus
= PcdSet16S (
372 PcdOvmfHostBridgePciDevId
,
373 MICROVM_PSEUDO_DEVICE_ID
375 ASSERT_RETURN_ERROR (PcdStatus
);
380 "%a: Unknown Host Bridge Device ID: 0x%04x\n",
388 PcdStatus
= PcdSet16S (PcdOvmfHostBridgePciDevId
, mHostBridgeDevId
);
389 ASSERT_RETURN_ERROR (PcdStatus
);
392 // If the appropriate IOspace enable bit is set, assume the ACPI PMBA has
393 // been configured and skip the setup here. This matches the logic in
394 // AcpiTimerLibConstructor ().
396 if ((PciRead8 (AcpiCtlReg
) & AcpiEnBit
) == 0) {
398 // The PEI phase should be exited with fully accessibe ACPI PM IO space:
401 PciAndThenOr32 (Pmba
, PmbaAndVal
, PmbaOrVal
);
404 // 2. set PCICMD/IOSE
406 PciOr8 (PmCmd
, EFI_PCI_COMMAND_IO_SPACE
);
409 // 3. set ACPI PM IO enable bit (PMREGMISC:PMIOSE or ACPI_CNTL:ACPI_EN)
411 PciOr8 (AcpiCtlReg
, AcpiEnBit
);
414 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
416 // Set Root Complex Register Block BAR
419 POWER_MGMT_REGISTER_Q35 (ICH9_RCBA
),
420 ICH9_ROOT_COMPLEX_BASE
| ICH9_RCBA_EN
424 // Set PCI Express Register Range Base Address
426 PciExBarInitialization ();
431 BootModeInitialization (
437 if (CmosRead8 (0xF) == 0xFE) {
438 mBootMode
= BOOT_ON_S3_RESUME
;
441 CmosWrite8 (0xF, 0x00);
443 Status
= PeiServicesSetBootMode (mBootMode
);
444 ASSERT_EFI_ERROR (Status
);
446 Status
= PeiServicesInstallPpi (mPpiBootMode
);
447 ASSERT_EFI_ERROR (Status
);
451 ReserveEmuVariableNvStore (
454 EFI_PHYSICAL_ADDRESS VariableStore
;
455 RETURN_STATUS PcdStatus
;
458 // Allocate storage for NV variables early on so it will be
459 // at a consistent address. Since VM memory is preserved
460 // across reboots, this allows the NV variable storage to survive
464 (EFI_PHYSICAL_ADDRESS
)(UINTN
)
465 AllocateRuntimePages (
466 EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize
))
470 "Reserved variable store memory: 0x%lX; size: %dkb\n",
472 (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize
)) / 1024
474 PcdStatus
= PcdSet64S (PcdEmuVariableNvStoreReserved
, VariableStore
);
475 ASSERT_RETURN_ERROR (PcdStatus
);
485 DEBUG ((DEBUG_INFO
, "CMOS:\n"));
487 for (Loop
= 0; Loop
< 0x80; Loop
++) {
488 if ((Loop
% 0x10) == 0) {
489 DEBUG ((DEBUG_INFO
, "%02x:", Loop
));
492 DEBUG ((DEBUG_INFO
, " %02x", CmosRead8 (Loop
)));
493 if ((Loop
% 0x10) == 0xf) {
494 DEBUG ((DEBUG_INFO
, "\n"));
504 #if defined (MDE_CPU_X64)
505 if (FeaturePcdGet (PcdSmmSmramRequire
) && mS3Supported
) {
508 "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n",
513 "%a: Please disable S3 on the QEMU command line (see the README),\n",
518 "%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n",
529 Q35BoardVerification (
533 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
539 "%a: no TSEG (SMRAM) on host bridge DID=0x%04x; "
540 "only DID=0x%04x (Q35) is supported\n",
543 INTEL_Q35_MCH_DEVICE_ID
550 Fetch the boot CPU count and the possible CPU count from QEMU, and expose
551 them to UefiCpuPkg modules. Set the mMaxCpuCount variable.
554 MaxCpuCountInitialization (
559 RETURN_STATUS PcdStatus
;
562 // Try to fetch the boot CPU count.
564 QemuFwCfgSelectItem (QemuFwCfgItemSmpCpuCount
);
565 BootCpuCount
= QemuFwCfgRead16 ();
566 if (BootCpuCount
== 0) {
568 // QEMU doesn't report the boot CPU count. (BootCpuCount == 0) will let
569 // MpInitLib count APs up to (PcdCpuMaxLogicalProcessorNumber - 1), or
570 // until PcdCpuApInitTimeOutInMicroSeconds elapses (whichever is reached
573 DEBUG ((DEBUG_WARN
, "%a: boot CPU count unavailable\n", __FUNCTION__
));
574 mMaxCpuCount
= PcdGet32 (PcdCpuMaxLogicalProcessorNumber
);
577 // We will expose BootCpuCount to MpInitLib. MpInitLib will count APs up to
578 // (BootCpuCount - 1) precisely, regardless of timeout.
580 // Now try to fetch the possible CPU count.
585 CpuHpBase
= ((mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) ?
586 ICH9_CPU_HOTPLUG_BASE
: PIIX4_CPU_HOTPLUG_BASE
);
589 // If only legacy mode is available in the CPU hotplug register block, or
590 // the register block is completely missing, then the writes below are
593 // 1. Switch the hotplug register block to modern mode.
595 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, 0);
597 // 2. Select a valid CPU for deterministic reading of
598 // QEMU_CPUHP_R_CMD_DATA2.
600 // CPU#0 is always valid; it is the always present and non-removable
603 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, 0);
605 // 3. Send a command after which QEMU_CPUHP_R_CMD_DATA2 is specified to
606 // read as zero, and which does not invalidate the selector. (The
607 // selector may change, but it must not become invalid.)
609 // Send QEMU_CPUHP_CMD_GET_PENDING, as it will prove useful later.
611 IoWrite8 (CpuHpBase
+ QEMU_CPUHP_W_CMD
, QEMU_CPUHP_CMD_GET_PENDING
);
613 // 4. Read QEMU_CPUHP_R_CMD_DATA2.
615 // If the register block is entirely missing, then this is an unassigned
616 // IO read, returning all-bits-one.
618 // If only legacy mode is available, then bit#0 stands for CPU#0 in the
619 // "CPU present bitmap". CPU#0 is always present.
621 // Otherwise, QEMU_CPUHP_R_CMD_DATA2 is either still reserved (returning
622 // all-bits-zero), or it is specified to read as zero after the above
623 // steps. Both cases confirm modern mode.
625 CmdData2
= IoRead32 (CpuHpBase
+ QEMU_CPUHP_R_CMD_DATA2
);
626 DEBUG ((DEBUG_VERBOSE
, "%a: CmdData2=0x%x\n", __FUNCTION__
, CmdData2
));
629 // QEMU doesn't support the modern CPU hotplug interface. Assume that the
630 // possible CPU count equals the boot CPU count (precluding hotplug).
634 "%a: modern CPU hotplug interface unavailable\n",
637 mMaxCpuCount
= BootCpuCount
;
640 // Grab the possible CPU count from the modern CPU hotplug interface.
642 UINT32 Present
, Possible
, Selected
;
648 // We've sent QEMU_CPUHP_CMD_GET_PENDING last; this ensures
649 // QEMU_CPUHP_RW_CMD_DATA can now be read usefully. However,
650 // QEMU_CPUHP_CMD_GET_PENDING may have selected a CPU with actual pending
651 // hotplug events; therefore, select CPU#0 forcibly.
653 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, Possible
);
659 // Read the status of the currently selected CPU. This will help with a
660 // sanity check against "BootCpuCount".
662 CpuStatus
= IoRead8 (CpuHpBase
+ QEMU_CPUHP_R_CPU_STAT
);
663 if ((CpuStatus
& QEMU_CPUHP_STAT_ENABLED
) != 0) {
668 // Attempt to select the next CPU.
671 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, Possible
);
673 // If the selection is successful, then the following read will return
674 // the selector (which we know is positive at this point). Otherwise,
675 // the read will return 0.
677 Selected
= IoRead32 (CpuHpBase
+ QEMU_CPUHP_RW_CMD_DATA
);
678 ASSERT (Selected
== Possible
|| Selected
== 0);
679 } while (Selected
> 0);
682 // Sanity check: fw_cfg and the modern CPU hotplug interface should
683 // return the same boot CPU count.
685 if (BootCpuCount
!= Present
) {
688 "%a: QEMU v2.7 reset bug: BootCpuCount=%d "
695 // The handling of QemuFwCfgItemSmpCpuCount, across CPU hotplug plus
696 // platform reset (including S3), was corrected in QEMU commit
697 // e3cadac073a9 ("pc: fix FW_CFG_NB_CPUS to account for -device added
698 // CPUs", 2016-11-16), part of release v2.8.0.
700 BootCpuCount
= (UINT16
)Present
;
703 mMaxCpuCount
= Possible
;
709 "%a: BootCpuCount=%d mMaxCpuCount=%u\n",
714 ASSERT (BootCpuCount
<= mMaxCpuCount
);
716 PcdStatus
= PcdSet32S (PcdCpuBootLogicalProcessorNumber
, BootCpuCount
);
717 ASSERT_RETURN_ERROR (PcdStatus
);
718 PcdStatus
= PcdSet32S (PcdCpuMaxLogicalProcessorNumber
, mMaxCpuCount
);
719 ASSERT_RETURN_ERROR (PcdStatus
);
723 Perform Platform PEI initialization.
725 @param FileHandle Handle of the file being invoked.
726 @param PeiServices Describes the list of possible PEI Services.
728 @return EFI_SUCCESS The PEIM initialized successfully.
734 IN EFI_PEI_FILE_HANDLE FileHandle
,
735 IN CONST EFI_PEI_SERVICES
**PeiServices
740 DEBUG ((DEBUG_INFO
, "Platform PEIM Loaded\n"));
744 if (QemuFwCfgS3Enabled ()) {
745 DEBUG ((DEBUG_INFO
, "S3 support was detected on QEMU\n"));
747 Status
= PcdSetBoolS (PcdAcpiS3Enable
, TRUE
);
748 ASSERT_EFI_ERROR (Status
);
752 BootModeInitialization ();
753 AddressWidthInitialization ();
756 // Query Host Bridge DID
758 mHostBridgeDevId
= PciRead16 (OVMF_HOSTBRIDGE_DID
);
760 MaxCpuCountInitialization ();
762 if (FeaturePcdGet (PcdSmmSmramRequire
)) {
763 Q35BoardVerification ();
764 Q35TsegMbytesInitialization ();
765 Q35SmramAtDefaultSmbaseInitialization ();
770 QemuUc32BaseInitialization ();
772 InitializeRamRegions ();
774 if (mBootMode
!= BOOT_ON_S3_RESUME
) {
775 if (!FeaturePcdGet (PcdSmmSmramRequire
)) {
776 ReserveEmuVariableNvStore ();
779 PeiFvInitialization ();
780 MemTypeInfoInitialization ();
781 MemMapInitialization ();
782 NoexecDxeInitialization ();
785 InstallClearCacheCallback ();
787 MiscInitialization ();
788 InstallFeatureControlCallback ();