IntelFsp2Pkg: Fsp T new ARCH UPD Support

Changes to support spec changes

1. Remove usage of Pcd.
2. Change code to validate the Temporary Ram size input.
3. Consume the input saved in YMM Register

Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Chiu Chasel <chasel.chiu@intel.com>
Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com>
Cc: Ni Ray <ray.ni@intel.com>

Signed-off-by: Duggapu Chinni B <chinni.b.duggapu@intel.com>
Reviewed-by: Chiu Chasel <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
This commit is contained in:
Duggapu Chinni B
2024-04-05 09:30:48 +05:30
committed by mergify[bot]
parent 932db9df0c
commit 543add1d41
14 changed files with 212 additions and 28 deletions

View File

@@ -11,7 +11,6 @@
; Following are fixed PCDs
;
extern ASM_PFX(PcdGet32(PcdTemporaryRamBase))
extern ASM_PFX(PcdGet32(PcdTemporaryRamSize))
extern ASM_PFX(PcdGet32(PcdFspTemporaryRamSize))
extern ASM_PFX(PcdGet8 (PcdFspHeapSizePercentage))

View File

@@ -11,7 +11,6 @@
; Following are fixed PCDs
;
extern ASM_PFX(PcdGet32(PcdTemporaryRamBase))
extern ASM_PFX(PcdGet32(PcdTemporaryRamSize))
extern ASM_PFX(PcdGet32(PcdFspTemporaryRamSize))
extern ASM_PFX(PcdGet8 (PcdFspHeapSizePercentage))

View File

@@ -109,7 +109,8 @@ struc LoadMicrocodeParamsFsp24
.FsptArchReserved: resb 3
.FsptArchLength: resd 1
.FspDebugHandler resq 1
.FsptArchUpd: resd 4
.FspTemporaryRamSize: resd 1 ; Supported only if ArchRevison is >= 3
.FsptArchUpd: resd 3
; }
; FSPT_CORE_UPD {
.MicrocodeCodeAddr: resq 1
@@ -267,7 +268,7 @@ ASM_PFX(LoadMicrocodeDefault):
cmp byte [esp + LoadMicrocodeParamsFsp22.FspUpdHeaderRevision], 2
jb Fsp20UpdHeader
cmp byte [esp + LoadMicrocodeParamsFsp22.FsptArchRevision], 2
je Fsp24UpdHeader
jae Fsp24UpdHeader
jmp Fsp22UpdHeader
Fsp20UpdHeader:
@@ -405,7 +406,7 @@ CheckAddress:
cmp byte [esp + LoadMicrocodeParamsFsp22.FspUpdHeaderRevision], 2
jb Fsp20UpdHeader1
cmp byte [esp + LoadMicrocodeParamsFsp22.FsptArchRevision], 2
je Fsp24UpdHeader1;
jae Fsp24UpdHeader1;
jmp Fsp22UpdHeader1
Fsp20UpdHeader1:
@@ -497,7 +498,8 @@ ASM_PFX(EstablishStackFsp):
; Enable FSP STACK
;
mov esp, DWORD [ASM_PFX(PcdGet32 (PcdTemporaryRamBase))]
add esp, DWORD [ASM_PFX(PcdGet32 (PcdTemporaryRamSize))]
LOAD_TEMPORARY_RAM_SIZE ecx
add esp, ecx
push DATA_LEN_OF_MCUD ; Size of the data region
push 4455434Dh ; Signature of the data region 'MCUD'
@@ -506,7 +508,7 @@ ASM_PFX(EstablishStackFsp):
cmp byte [edx + LoadMicrocodeParamsFsp22.FspUpdHeaderRevision], 2
jb Fsp20UpdHeader2
cmp byte [esp + LoadMicrocodeParamsFsp22.FsptArchRevision], 2
je Fsp24UpdHeader2
jae Fsp24UpdHeader2
jmp Fsp22UpdHeader2
Fsp20UpdHeader2:
@@ -554,12 +556,13 @@ ContinueAfterUpdPush:
;
; Set ECX/EDX to the BootLoader temporary memory range
;
mov ecx, [ASM_PFX(PcdGet32 (PcdTemporaryRamBase))]
mov edx, ecx
add edx, [ASM_PFX(PcdGet32 (PcdTemporaryRamSize))]
mov edx, [ASM_PFX(PcdGet32 (PcdTemporaryRamBase))]
LOAD_TEMPORARY_RAM_SIZE ecx
add edx, ecx
sub edx, [ASM_PFX(PcdGet32 (PcdFspReservedBufferSize))]
mov ecx, [ASM_PFX(PcdGet32 (PcdTemporaryRamBase))]
cmp ecx, edx ;If PcdFspReservedBufferSize >= PcdTemporaryRamSize, then error.
cmp ecx, edx ;If PcdFspReservedBufferSize >= TemporaryRamSize, then error.
jb EstablishStackFspSuccess
mov eax, 80000003h ;EFI_UNSUPPORTED
jmp EstablishStackFspExit
@@ -599,6 +602,45 @@ ASM_PFX(TempRamInitApi):
CALL_EBP ASM_PFX(LoadUpdPointerToECX) ; ECX for UPD param
SAVE_ECX ; save UPD param to slot 3 in xmm6
mov edx, ASM_PFX(PcdGet32 (PcdTemporaryRamSize))
mov edx, DWORD [edx]
;
; Read Fsp Arch2 revision
;
cmp byte [ecx + LoadMicrocodeParamsFsp24.FsptArchRevision], 3
jb UseTemporaryRamSizePcd
;
; Read ARCH2 UPD input value.
;
mov ebx, DWORD [ecx + LoadMicrocodeParamsFsp24.FspTemporaryRamSize]
;
; As per spec, if Bootloader pass zero, use Fsp defined Size
;
cmp ebx, 0
jz UseTemporaryRamSizePcd
xor eax, eax
mov ax, WORD [esi + 020h] ; Read ImageAttribute
test ax, 16 ; check if Bit4 is set
jnz ConsumeInputConfiguration
;
; Sometimes user may change input value even if it is not supported
; return error if input is Non-Zero and not same as PcdTemporaryRamSize.
;
cmp ebx, edx
je UseTemporaryRamSizePcd
mov eax, 080000002h ; RETURN_INVALID_PARAMETER
jmp TempRamInitExit
ConsumeInputConfiguration:
;
; Read ARCH2 UPD value and Save.
;
SAVE_TEMPORARY_RAM_SIZE ebx
jmp GotTemporaryRamSize
UseTemporaryRamSizePcd:
SAVE_TEMPORARY_RAM_SIZE edx
GotTemporaryRamSize:
LOAD_ECX
;
; Sec Platform Init
;

View File

@@ -128,6 +128,17 @@
SXMMN xmm5, 1, eax
%endmacro
;
; XMM5 slot 2 for TemporaryRamSize
;
%macro LOAD_TEMPORARY_RAM_SIZE 1
LXMMN xmm5, %1, 2
%endmacro
%macro SAVE_TEMPORARY_RAM_SIZE 1
SXMMN xmm5, 2, %1
%endmacro
%macro ENABLE_SSE 0
;
; Initialize floating point units