+\r
+ //\r
+ // If PMREGMISC/PMIOSE is set, assume the ACPI PMBA has been configured (for\r
+ // example by Xen) and skip the setup here. This matches the logic in\r
+ // AcpiTimerLibConstructor ().\r
+ //\r
+ if ((PciRead8 (PCI_LIB_ADDRESS (0, 1, 3, 0x80)) & 0x01) == 0) {\r
+ //\r
+ // The PEI phase should be exited with fully accessibe PIIX4 IO space:\r
+ // 1. set PMBA\r
+ //\r
+ PciAndThenOr32 (\r
+ PCI_LIB_ADDRESS (0, 1, 3, 0x40),\r
+ (UINT32) ~0xFFC0,\r
+ PcdGet16 (PcdAcpiPmBaseAddress)\r
+ );\r
+\r
+ //\r
+ // 2. set PCICMD/IOSE\r
+ //\r
+ PciOr8 (\r
+ PCI_LIB_ADDRESS (0, 1, 3, PCI_COMMAND_OFFSET),\r
+ EFI_PCI_COMMAND_IO_SPACE\r
+ );\r
+\r
+ //\r
+ // 3. set PMREGMISC/PMIOSE\r
+ //\r
+ PciOr8 (PCI_LIB_ADDRESS (0, 1, 3, 0x80), 0x01);\r
+ }\r
+}\r
+\r
+\r
+VOID\r
+BootModeInitialization (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ if (CmosRead8 (0xF) == 0xFE) {\r
+ mBootMode = BOOT_ON_S3_RESUME;\r
+ }\r
+\r
+ Status = PeiServicesSetBootMode (mBootMode);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ Status = PeiServicesInstallPpi (mPpiBootMode);\r
+ ASSERT_EFI_ERROR (Status);\r