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
;
154 // Video memory + Legacy BIOS region
156 AddIoMemoryRangeHob (0x0A0000, BASE_1MB
);
164 TopOfLowRam
= GetSystemMemorySizeBelow4gb ();
166 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
168 // The MMCONFIG area is expected to fall between the top of low RAM and
169 // the base of the 32-bit PCI host aperture.
171 PciExBarBase
= FixedPcdGet64 (PcdPciExpressBaseAddress
);
172 ASSERT (TopOfLowRam
<= PciExBarBase
);
173 ASSERT (PciExBarBase
<= MAX_UINT32
- SIZE_256MB
);
174 PciBase
= (UINT32
)(PciExBarBase
+ SIZE_256MB
);
176 ASSERT (TopOfLowRam
<= mQemuUc32Base
);
177 PciBase
= mQemuUc32Base
;
181 // address purpose size
182 // ------------ -------- -------------------------
183 // max(top, 2g) PCI MMIO 0xFC000000 - max(top, 2g)
184 // 0xFC000000 gap 44 MB
185 // 0xFEC00000 IO-APIC 4 KB
186 // 0xFEC01000 gap 1020 KB
187 // 0xFED00000 HPET 1 KB
188 // 0xFED00400 gap 111 KB
189 // 0xFED1C000 gap (PIIX4) / RCRB (ICH9) 16 KB
190 // 0xFED20000 gap 896 KB
191 // 0xFEE00000 LAPIC 1 MB
193 PciSize
= 0xFC000000 - PciBase
;
194 AddIoMemoryBaseSizeHob (PciBase
, PciSize
);
195 PcdStatus
= PcdSet64S (PcdPciMmio32Base
, PciBase
);
196 ASSERT_RETURN_ERROR (PcdStatus
);
197 PcdStatus
= PcdSet64S (PcdPciMmio32Size
, PciSize
);
198 ASSERT_RETURN_ERROR (PcdStatus
);
200 AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB
);
201 AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB
);
202 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
203 AddIoMemoryBaseSizeHob (ICH9_ROOT_COMPLEX_BASE
, SIZE_16KB
);
205 // Note: there should be an
207 // AddIoMemoryBaseSizeHob (PciExBarBase, SIZE_256MB);
209 // call below, just like the one above for RCBA. However, Linux insists
210 // that the MMCONFIG area be marked in the E820 or UEFI memory map as
211 // "reserved memory" -- Linux does not content itself with a simple gap
212 // in the memory map wherever the MCFG ACPI table points to.
214 // This appears to be a safety measure. The PCI Firmware Specification
215 // (rev 3.1) says in 4.1.2. "MCFG Table Description": "The resources can
216 // *optionally* be returned in [...] EFIGetMemoryMap as reserved memory
217 // [...]". (Emphasis added here.)
219 // Normally we add memory resource descriptor HOBs in
220 // QemuInitializeRam(), and pre-allocate from those with memory
221 // allocation HOBs in InitializeRamRegions(). However, the MMCONFIG area
222 // is most definitely not RAM; so, as an exception, cover it with
223 // uncacheable reserved memory right here.
225 AddReservedMemoryBaseSizeHob (PciExBarBase
, SIZE_256MB
, FALSE
);
226 BuildMemoryAllocationHob (PciExBarBase
, SIZE_256MB
,
227 EfiReservedMemoryType
);
229 AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress
), SIZE_1MB
);
232 // On Q35, the IO Port space is available for PCI resource allocations from
235 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
238 ASSERT ((ICH9_PMBASE_VALUE
& 0xF000) < PciIoBase
);
243 // Add PCI IO Port space available for PCI resource allocations.
245 BuildResourceDescriptorHob (
247 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
248 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
,
252 PcdStatus
= PcdSet64S (PcdPciIoBase
, PciIoBase
);
253 ASSERT_RETURN_ERROR (PcdStatus
);
254 PcdStatus
= PcdSet64S (PcdPciIoSize
, PciIoSize
);
255 ASSERT_RETURN_ERROR (PcdStatus
);
258 #define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName) \
261 RETURN_STATUS PcdStatus; \
263 if (!RETURN_ERROR (QemuFwCfgParseBool ( \
264 "opt/ovmf/" #TokenName, &Setting))) { \
265 PcdStatus = PcdSetBoolS (TokenName, Setting); \
266 ASSERT_RETURN_ERROR (PcdStatus); \
271 NoexecDxeInitialization (
275 UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdSetNxForStack
);
279 PciExBarInitialization (
289 // We only support the 256MB size for the MMCONFIG area:
290 // 256 buses * 32 devices * 8 functions * 4096 bytes config space.
292 // The masks used below enforce the Q35 requirements that the MMCONFIG area
293 // be (a) correctly aligned -- here at 256 MB --, (b) located under 64 GB.
295 // Note that (b) also ensures that the minimum address width we have
296 // determined in AddressWidthInitialization(), i.e., 36 bits, will suffice
297 // for DXE's page tables to cover the MMCONFIG area.
299 PciExBarBase
.Uint64
= FixedPcdGet64 (PcdPciExpressBaseAddress
);
300 ASSERT ((PciExBarBase
.Uint32
[1] & MCH_PCIEXBAR_HIGHMASK
) == 0);
301 ASSERT ((PciExBarBase
.Uint32
[0] & MCH_PCIEXBAR_LOWMASK
) == 0);
304 // Clear the PCIEXBAREN bit first, before programming the high register.
306 PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW
), 0);
309 // Program the high register. Then program the low register, setting the
310 // MMCONFIG area size and enabling decoding at once.
312 PciWrite32 (DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_HIGH
), PciExBarBase
.Uint32
[1]);
314 DRAMC_REGISTER_Q35 (MCH_PCIEXBAR_LOW
),
315 PciExBarBase
.Uint32
[0] | MCH_PCIEXBAR_BUS_FF
| MCH_PCIEXBAR_EN
330 RETURN_STATUS PcdStatus
;
338 // Build the CPU HOB with guest RAM size dependent address width and 16-bits
339 // of IO space. (Side note: unlike other HOBs, the CPU HOB is needed during
340 // S3 resume as well, so we build it unconditionally.)
342 BuildCpuHob (mPhysMemAddressWidth
, 16);
345 // Determine platform type and save Host Bridge DID to PCD
347 switch (mHostBridgeDevId
) {
348 case INTEL_82441_DEVICE_ID
:
349 PmCmd
= POWER_MGMT_REGISTER_PIIX4 (PCI_COMMAND_OFFSET
);
350 Pmba
= POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA
);
351 PmbaAndVal
= ~(UINT32
)PIIX4_PMBA_MASK
;
352 PmbaOrVal
= PIIX4_PMBA_VALUE
;
353 AcpiCtlReg
= POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMREGMISC
);
354 AcpiEnBit
= PIIX4_PMREGMISC_PMIOSE
;
356 case INTEL_Q35_MCH_DEVICE_ID
:
357 PmCmd
= POWER_MGMT_REGISTER_Q35 (PCI_COMMAND_OFFSET
);
358 Pmba
= POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE
);
359 PmbaAndVal
= ~(UINT32
)ICH9_PMBASE_MASK
;
360 PmbaOrVal
= ICH9_PMBASE_VALUE
;
361 AcpiCtlReg
= POWER_MGMT_REGISTER_Q35 (ICH9_ACPI_CNTL
);
362 AcpiEnBit
= ICH9_ACPI_CNTL_ACPI_EN
;
365 DEBUG ((EFI_D_ERROR
, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
366 __FUNCTION__
, mHostBridgeDevId
));
370 PcdStatus
= PcdSet16S (PcdOvmfHostBridgePciDevId
, mHostBridgeDevId
);
371 ASSERT_RETURN_ERROR (PcdStatus
);
374 // If the appropriate IOspace enable bit is set, assume the ACPI PMBA
375 // has been configured (e.g., by Xen) and skip the setup here.
376 // This matches the logic in AcpiTimerLibConstructor ().
378 if ((PciRead8 (AcpiCtlReg
) & AcpiEnBit
) == 0) {
380 // The PEI phase should be exited with fully accessibe ACPI PM IO space:
383 PciAndThenOr32 (Pmba
, PmbaAndVal
, PmbaOrVal
);
386 // 2. set PCICMD/IOSE
388 PciOr8 (PmCmd
, EFI_PCI_COMMAND_IO_SPACE
);
391 // 3. set ACPI PM IO enable bit (PMREGMISC:PMIOSE or ACPI_CNTL:ACPI_EN)
393 PciOr8 (AcpiCtlReg
, AcpiEnBit
);
396 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
398 // Set Root Complex Register Block BAR
401 POWER_MGMT_REGISTER_Q35 (ICH9_RCBA
),
402 ICH9_ROOT_COMPLEX_BASE
| ICH9_RCBA_EN
406 // Set PCI Express Register Range Base Address
408 PciExBarInitialization ();
414 BootModeInitialization (
420 if (CmosRead8 (0xF) == 0xFE) {
421 mBootMode
= BOOT_ON_S3_RESUME
;
423 CmosWrite8 (0xF, 0x00);
425 Status
= PeiServicesSetBootMode (mBootMode
);
426 ASSERT_EFI_ERROR (Status
);
428 Status
= PeiServicesInstallPpi (mPpiBootMode
);
429 ASSERT_EFI_ERROR (Status
);
434 ReserveEmuVariableNvStore (
437 EFI_PHYSICAL_ADDRESS VariableStore
;
438 RETURN_STATUS PcdStatus
;
441 // Allocate storage for NV variables early on so it will be
442 // at a consistent address. Since VM memory is preserved
443 // across reboots, this allows the NV variable storage to survive
447 (EFI_PHYSICAL_ADDRESS
)(UINTN
)
448 AllocateRuntimePages (
449 EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize
))
452 "Reserved variable store memory: 0x%lX; size: %dkb\n",
454 (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize
)) / 1024
456 PcdStatus
= PcdSet64S (PcdEmuVariableNvStoreReserved
, VariableStore
);
457 ASSERT_RETURN_ERROR (PcdStatus
);
468 DEBUG ((EFI_D_INFO
, "CMOS:\n"));
470 for (Loop
= 0; Loop
< 0x80; Loop
++) {
471 if ((Loop
% 0x10) == 0) {
472 DEBUG ((EFI_D_INFO
, "%02x:", Loop
));
474 DEBUG ((EFI_D_INFO
, " %02x", CmosRead8 (Loop
)));
475 if ((Loop
% 0x10) == 0xf) {
476 DEBUG ((EFI_D_INFO
, "\n"));
487 #if defined (MDE_CPU_X64)
488 if (FeaturePcdGet (PcdSmmSmramRequire
) && mS3Supported
) {
490 "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n", __FUNCTION__
));
492 "%a: Please disable S3 on the QEMU command line (see the README),\n",
495 "%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n", __FUNCTION__
));
504 Q35BoardVerification (
508 if (mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) {
514 "%a: no TSEG (SMRAM) on host bridge DID=0x%04x; "
515 "only DID=0x%04x (Q35) is supported\n",
518 INTEL_Q35_MCH_DEVICE_ID
526 Fetch the boot CPU count and the possible CPU count from QEMU, and expose
527 them to UefiCpuPkg modules. Set the mMaxCpuCount variable.
530 MaxCpuCountInitialization (
535 RETURN_STATUS PcdStatus
;
538 // Try to fetch the boot CPU count.
540 QemuFwCfgSelectItem (QemuFwCfgItemSmpCpuCount
);
541 BootCpuCount
= QemuFwCfgRead16 ();
542 if (BootCpuCount
== 0) {
544 // QEMU doesn't report the boot CPU count. (BootCpuCount == 0) will let
545 // MpInitLib count APs up to (PcdCpuMaxLogicalProcessorNumber - 1), or
546 // until PcdCpuApInitTimeOutInMicroSeconds elapses (whichever is reached
549 DEBUG ((DEBUG_WARN
, "%a: boot CPU count unavailable\n", __FUNCTION__
));
550 mMaxCpuCount
= PcdGet32 (PcdCpuMaxLogicalProcessorNumber
);
553 // We will expose BootCpuCount to MpInitLib. MpInitLib will count APs up to
554 // (BootCpuCount - 1) precisely, regardless of timeout.
556 // Now try to fetch the possible CPU count.
561 CpuHpBase
= ((mHostBridgeDevId
== INTEL_Q35_MCH_DEVICE_ID
) ?
562 ICH9_CPU_HOTPLUG_BASE
: PIIX4_CPU_HOTPLUG_BASE
);
565 // If only legacy mode is available in the CPU hotplug register block, or
566 // the register block is completely missing, then the writes below are
569 // 1. Switch the hotplug register block to modern mode.
571 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, 0);
573 // 2. Select a valid CPU for deterministic reading of
574 // QEMU_CPUHP_R_CMD_DATA2.
576 // CPU#0 is always valid; it is the always present and non-removable
579 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, 0);
581 // 3. Send a command after which QEMU_CPUHP_R_CMD_DATA2 is specified to
582 // read as zero, and which does not invalidate the selector. (The
583 // selector may change, but it must not become invalid.)
585 // Send QEMU_CPUHP_CMD_GET_PENDING, as it will prove useful later.
587 IoWrite8 (CpuHpBase
+ QEMU_CPUHP_W_CMD
, QEMU_CPUHP_CMD_GET_PENDING
);
589 // 4. Read QEMU_CPUHP_R_CMD_DATA2.
591 // If the register block is entirely missing, then this is an unassigned
592 // IO read, returning all-bits-one.
594 // If only legacy mode is available, then bit#0 stands for CPU#0 in the
595 // "CPU present bitmap". CPU#0 is always present.
597 // Otherwise, QEMU_CPUHP_R_CMD_DATA2 is either still reserved (returning
598 // all-bits-zero), or it is specified to read as zero after the above
599 // steps. Both cases confirm modern mode.
601 CmdData2
= IoRead32 (CpuHpBase
+ QEMU_CPUHP_R_CMD_DATA2
);
602 DEBUG ((DEBUG_VERBOSE
, "%a: CmdData2=0x%x\n", __FUNCTION__
, CmdData2
));
605 // QEMU doesn't support the modern CPU hotplug interface. Assume that the
606 // possible CPU count equals the boot CPU count (precluding hotplug).
608 DEBUG ((DEBUG_WARN
, "%a: modern CPU hotplug interface unavailable\n",
610 mMaxCpuCount
= BootCpuCount
;
613 // Grab the possible CPU count from the modern CPU hotplug interface.
615 UINT32 Present
, Possible
, Selected
;
621 // We've sent QEMU_CPUHP_CMD_GET_PENDING last; this ensures
622 // QEMU_CPUHP_RW_CMD_DATA can now be read usefully. However,
623 // QEMU_CPUHP_CMD_GET_PENDING may have selected a CPU with actual pending
624 // hotplug events; therefore, select CPU#0 forcibly.
626 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, Possible
);
632 // Read the status of the currently selected CPU. This will help with a
633 // sanity check against "BootCpuCount".
635 CpuStatus
= IoRead8 (CpuHpBase
+ QEMU_CPUHP_R_CPU_STAT
);
636 if ((CpuStatus
& QEMU_CPUHP_STAT_ENABLED
) != 0) {
640 // Attempt to select the next CPU.
643 IoWrite32 (CpuHpBase
+ QEMU_CPUHP_W_CPU_SEL
, Possible
);
645 // If the selection is successful, then the following read will return
646 // the selector (which we know is positive at this point). Otherwise,
647 // the read will return 0.
649 Selected
= IoRead32 (CpuHpBase
+ QEMU_CPUHP_RW_CMD_DATA
);
650 ASSERT (Selected
== Possible
|| Selected
== 0);
651 } while (Selected
> 0);
654 // Sanity check: fw_cfg and the modern CPU hotplug interface should
655 // return the same boot CPU count.
657 if (BootCpuCount
!= Present
) {
658 DEBUG ((DEBUG_WARN
, "%a: QEMU v2.7 reset bug: BootCpuCount=%d "
659 "Present=%u\n", __FUNCTION__
, BootCpuCount
, Present
));
661 // The handling of QemuFwCfgItemSmpCpuCount, across CPU hotplug plus
662 // platform reset (including S3), was corrected in QEMU commit
663 // e3cadac073a9 ("pc: fix FW_CFG_NB_CPUS to account for -device added
664 // CPUs", 2016-11-16), part of release v2.8.0.
666 BootCpuCount
= (UINT16
)Present
;
669 mMaxCpuCount
= Possible
;
673 DEBUG ((DEBUG_INFO
, "%a: BootCpuCount=%d mMaxCpuCount=%u\n", __FUNCTION__
,
674 BootCpuCount
, mMaxCpuCount
));
675 ASSERT (BootCpuCount
<= mMaxCpuCount
);
677 PcdStatus
= PcdSet32S (PcdCpuBootLogicalProcessorNumber
, BootCpuCount
);
678 ASSERT_RETURN_ERROR (PcdStatus
);
679 PcdStatus
= PcdSet32S (PcdCpuMaxLogicalProcessorNumber
, mMaxCpuCount
);
680 ASSERT_RETURN_ERROR (PcdStatus
);
685 Perform Platform PEI initialization.
687 @param FileHandle Handle of the file being invoked.
688 @param PeiServices Describes the list of possible PEI Services.
690 @return EFI_SUCCESS The PEIM initialized successfully.
696 IN EFI_PEI_FILE_HANDLE FileHandle
,
697 IN CONST EFI_PEI_SERVICES
**PeiServices
702 DEBUG ((DEBUG_INFO
, "Platform PEIM Loaded\n"));
708 if (QemuFwCfgS3Enabled ()) {
709 DEBUG ((EFI_D_INFO
, "S3 support was detected on QEMU\n"));
711 Status
= PcdSetBoolS (PcdAcpiS3Enable
, TRUE
);
712 ASSERT_EFI_ERROR (Status
);
716 BootModeInitialization ();
717 AddressWidthInitialization ();
720 // Query Host Bridge DID
722 mHostBridgeDevId
= PciRead16 (OVMF_HOSTBRIDGE_DID
);
724 MaxCpuCountInitialization ();
726 if (FeaturePcdGet (PcdSmmSmramRequire
)) {
727 Q35BoardVerification ();
728 Q35TsegMbytesInitialization ();
729 Q35SmramAtDefaultSmbaseInitialization ();
734 QemuUc32BaseInitialization ();
736 InitializeRamRegions ();
739 DEBUG ((EFI_D_INFO
, "Xen was detected\n"));
743 if (mBootMode
!= BOOT_ON_S3_RESUME
) {
744 if (!FeaturePcdGet (PcdSmmSmramRequire
)) {
745 ReserveEmuVariableNvStore ();
747 PeiFvInitialization ();
748 MemTypeInfoInitialization ();
749 MemMapInitialization ();
750 NoexecDxeInitialization ();
753 InstallClearCacheCallback ();
755 MiscInitialization ();
756 InstallFeatureControlCallback ();