UINTN mReservedTopOfApStack;\r
volatile UINT32 mNumberToFinish = 0;\r
\r
+//\r
+// Begin wakeup buffer allocation below 0x88000\r
+//\r
+STATIC EFI_PHYSICAL_ADDRESS mSevEsDxeWakeupBuffer = 0x88000;\r
+\r
/**\r
Enable Debug Agent to support source debugging on AP function.\r
\r
// LagacyBios driver depends on CPU Arch protocol which guarantees below\r
// allocation runs earlier than LegacyBios driver.\r
//\r
- StartAddress = 0x88000;\r
+ if (PcdGetBool (PcdSevEsIsEnabled)) {\r
+ //\r
+ // SEV-ES Wakeup buffer should be under 0x88000 and under any previous one\r
+ //\r
+ StartAddress = mSevEsDxeWakeupBuffer;\r
+ } else {\r
+ StartAddress = 0x88000;\r
+ }\r
Status = gBS->AllocatePages (\r
AllocateMaxAddress,\r
MemoryType,\r
ASSERT_EFI_ERROR (Status);\r
if (EFI_ERROR (Status)) {\r
StartAddress = (EFI_PHYSICAL_ADDRESS) -1;\r
+ } else if (PcdGetBool (PcdSevEsIsEnabled)) {\r
+ //\r
+ // Next SEV-ES wakeup buffer allocation must be below this allocation\r
+ //\r
+ mSevEsDxeWakeupBuffer = StartAddress;\r
}\r
\r
DEBUG ((DEBUG_INFO, "WakeupBufferStart = %x, WakeupBufferSize = %x\n",\r