/** @file\r
Source file for FSP notify phase PEI module\r
\r
- Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.\r
+ Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
**/\r
\r
@retval EFI_OUT_OF_RESOURCES Insufficient resources to create database\r
**/\r
EFI_STATUS\r
+EFIAPI\r
FspNotifyPhasePeimEntryPoint (\r
IN EFI_PEI_FILE_HANDLE FileHandle,\r
IN CONST EFI_PEI_SERVICES **PeiServices\r
;; @file\r
; Provide read ESP function\r
;\r
-; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;;\r
;------------------------------------------------------------------------------\r
SECTION .text\r
\r
;------------------------------------------------------------------------------\r
-; UINT32\r
+; UINTN\r
; EFIAPI\r
-; AsmReadEsp (\r
+; AsmReadStackPointer (\r
; VOID\r
; );\r
;------------------------------------------------------------------------------\r
-global ASM_PFX(AsmReadEsp)\r
-ASM_PFX(AsmReadEsp):\r
+global ASM_PFX(AsmReadStackPointer)\r
+ASM_PFX(AsmReadStackPointer):\r
mov eax, esp\r
ret\r
\r
;------------------------------------------------------------------------------\r
;\r
-; Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;\r
; Abstract:\r
;\r
;------------------------------------------------------------------------------\r
\r
-SECTION .text\r
+ SECTION .text\r
\r
;------------------------------------------------------------------------------\r
; VOID\r
; EFIAPI\r
; SecSwitchStack (\r
; UINT32 TemporaryMemoryBase,\r
-; UINT32 PermenentMemoryBase\r
+; UINT32 PermanentMemoryBase\r
; );\r
;------------------------------------------------------------------------------\r
global ASM_PFX(SecSwitchStack)\r
ASM_PFX(SecSwitchStack):\r
;\r
- ; Save three register: eax, ebx, ecx\r
+ ; Save four register: eax, ebx, ecx, edx\r
;\r
push eax\r
push ebx\r
mov dword [eax + 12], edx\r
mov edx, dword [esp + 16] ; Update this function's return address into permanent memory\r
mov dword [eax + 16], edx\r
- mov esp, eax ; From now, esp is pointed to permanent memory\r
+ mov esp, eax ; From now, esp is pointed to permanent memory\r
\r
;\r
; Fixup the ebp point to permanent memory\r
mov eax, ebp\r
sub eax, ebx\r
add eax, ecx\r
- mov ebp, eax ; From now, ebp is pointed to permanent memory\r
+ mov ebp, eax ; From now, ebp is pointed to permanent memory\r
\r
pop edx\r
pop ecx\r
/** @file\r
\r
- Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
IA32_IDT_GATE_DESCRIPTOR *IdtGateDescriptor;\r
FSP_INFO_HEADER *FspInfoHeader;\r
\r
- FspInfoHeader = (FSP_INFO_HEADER *)AsmGetFspInfoHeader ();\r
+ FspInfoHeader = (FSP_INFO_HEADER *)(UINTN)AsmGetFspInfoHeader ();\r
ExceptionHandler = IdtEntryTemplate;\r
IdtGateDescriptor = (IA32_IDT_GATE_DESCRIPTOR *)&ExceptionHandler;\r
Entry = (IdtGateDescriptor->Bits.OffsetHigh << 16) | IdtGateDescriptor->Bits.OffsetLow;\r
VOID\r
FspGlobalDataInit (\r
IN OUT FSP_GLOBAL_DATA *PeiFspData,\r
- IN UINT32 BootLoaderStack,\r
+ IN UINTN BootLoaderStack,\r
IN UINT8 ApiIdx\r
)\r
{\r
// Get FSP Header offset\r
// It may have multiple FVs, so look into the last one for FSP header\r
//\r
- PeiFspData->FspInfoHeader = (FSP_INFO_HEADER *)AsmGetFspInfoHeader ();\r
+ PeiFspData->FspInfoHeader = (FSP_INFO_HEADER *)(UINTN)AsmGetFspInfoHeader ();\r
SecGetPlatformData (PeiFspData);\r
\r
//\r
//\r
FspmUpdDataPtr = (VOID *)GetFspApiParameter ();\r
if (FspmUpdDataPtr == NULL) {\r
- FspmUpdDataPtr = (VOID *)(PeiFspData->FspInfoHeader->ImageBase + PeiFspData->FspInfoHeader->CfgRegionOffset);\r
+ FspmUpdDataPtr = (VOID *)(UINTN)(PeiFspData->FspInfoHeader->ImageBase + PeiFspData->FspInfoHeader->CfgRegionOffset);\r
}\r
\r
SetFspUpdDataPointer (FspmUpdDataPtr);\r
/** @file\r
\r
- Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
VOID\r
FspGlobalDataInit (\r
IN OUT FSP_GLOBAL_DATA *PeiFspData,\r
- IN UINT32 BootLoaderStack,\r
+ IN UINTN BootLoaderStack,\r
IN UINT8 ApiIdx\r
);\r
\r
/** @file\r
\r
- Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
//\r
// NotifyPhase check\r
//\r
- if ((FspData == NULL) || ((UINT32)FspData == 0xFFFFFFFF)) {\r
+ if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) {\r
Status = EFI_UNSUPPORTED;\r
} else {\r
if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {\r
//\r
// FspMemoryInit check\r
//\r
- if ((UINT32)FspData != 0xFFFFFFFF) {\r
+ if (((UINTN)FspData != MAX_ADDRESS) && ((UINTN)FspData != MAX_UINT32)) {\r
Status = EFI_UNSUPPORTED;\r
} else if (EFI_ERROR (FspUpdSignatureCheck (ApiIdx, ApiParam))) {\r
Status = EFI_INVALID_PARAMETER;\r
//\r
// TempRamExit check\r
//\r
- if ((FspData == NULL) || ((UINT32)FspData == 0xFFFFFFFF)) {\r
+ if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) {\r
Status = EFI_UNSUPPORTED;\r
} else {\r
if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {\r
//\r
// FspSiliconInit check\r
//\r
- if ((FspData == NULL) || ((UINT32)FspData == 0xFFFFFFFF)) {\r
+ if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) {\r
Status = EFI_UNSUPPORTED;\r
} else {\r
if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {\r
/** @file\r
\r
- Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
IN UINT32 TempRamBase,\r
IN VOID *BootFirmwareVolume,\r
IN PEI_CORE_ENTRY PeiCore,\r
- IN UINT32 BootLoaderStack,\r
+ IN UINTN BootLoaderStack,\r
IN UINT32 ApiIdx\r
)\r
{\r
GetFspGlobalDataPointer ()->OnSeparateStack = 1;\r
\r
if (PcdGet8 (PcdFspHeapSizePercentage) == 0) {\r
- CurrentStack = AsmReadEsp ();\r
+ CurrentStack = AsmReadStackPointer ();\r
FspStackBase = (UINTN)GetFspEntryStack ();\r
\r
StackSize = FspStackBase - CurrentStack;\r
// permanent memory.\r
//\r
SecSwitchStack (\r
- (UINT32)(UINTN)OldStack,\r
- (UINT32)(UINTN)NewStack\r
+ (UINTN)OldStack,\r
+ (UINTN)NewStack\r
);\r
\r
return EFI_SUCCESS;\r
/** @file\r
\r
- Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
#include <Library/UefiCpuLib.h>\r
#include <FspEas.h>\r
\r
-typedef VOID (*PEI_CORE_ENTRY) ( \\r
- IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \\r
- IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \\r
+typedef\r
+VOID\r
+(EFIAPI *PEI_CORE_ENTRY) (\r
+ IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
);\r
\r
typedef struct _SEC_IDT_TABLE {\r
VOID\r
EFIAPI\r
SecSwitchStack (\r
- IN UINT32 TemporaryMemoryBase,\r
- IN UINT32 PermenentMemoryBase\r
+ IN UINTN TemporaryMemoryBase,\r
+ IN UINTN PermenentMemoryBase\r
);\r
\r
/**\r
IN UINT32 TempRamBase,\r
IN VOID *BootFirmwareVolume,\r
IN PEI_CORE_ENTRY PeiCore,\r
- IN UINT32 BootLoaderStack,\r
+ IN UINTN BootLoaderStack,\r
IN UINT32 ApiIdx\r
);\r
\r
@return value of esp.\r
\r
**/\r
-UINT32\r
+UINTN\r
EFIAPI\r
-AsmReadEsp (\r
+AsmReadStackPointer (\r
VOID\r
);\r
\r
/** @file\r
\r
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
**/\r
UINTN\r
+EFIAPI\r
SwapStack (\r
IN UINTN NewStack\r
)\r
; This is the code that goes from real-mode to protected mode.\r
; It consumes the reset vector, configures the stack.\r
;\r
-; Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.<BR>\r
; SPDX-License-Identifier: BSD-2-Clause-Patent\r
;;\r
\r
\r
%macro RET_ESI 0\r
\r
- movd esi, mm7 ; restore ESP from MM7\r
+ movd esi, mm7 ; restore EIP from MM7\r
jmp esi\r
\r
%endmacro\r