summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm6
-rw-r--r--IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s6
-rw-r--r--IntelFspPkg/FspSecCore/Ia32/FspHelper.asm34
-rw-r--r--IntelFspPkg/FspSecCore/Ia32/FspHelper.s39
4 files changed, 76 insertions, 9 deletions
diff --git a/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm b/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm
index a0c9b1ed73..d0e56b2360 100644
--- a/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm
+++ b/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm
@@ -143,8 +143,8 @@ check_main_header:
mov ecx, MSR_IA32_PLATFORM_ID
rdmsr
mov ecx, edx
- shr ecx, 50-32
- and ecx, 7h
+ shr ecx, 50-32 ; shift (50d-32d=18d=0x12) bits
+ and ecx, 7h ; platform id at bit[52..50]
mov edx, 1
shl edx, cl
@@ -569,7 +569,7 @@ FspApiCommon PROC C PUBLIC
;
; Pass BFV into the PEI Core
; It uses relative address to calucate the actual boot FV base
- ; For FSP impleantion with single FV, PcdFlashFvRecoveryBase and
+ ; For FSP implementation with single FV, PcdFspBootFirmwareVolumeBase and
; PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,
; they are different. The code below can handle both cases.
;
diff --git a/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s b/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s
index 8f4093ca19..d9cfcc3390 100644
--- a/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s
+++ b/IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s
@@ -297,8 +297,8 @@ CheckMainHeader:
movl $MSR_IA32_PLATFORM_ID, %ecx
rdmsr
movl %edx, %ecx
- shrl $0x12, %ecx #($50-$32)
- andl $0x07, %ecx
+ shrl $0x12, %ecx # shift (50d-32d=18d=0x12) bits
+ andl $0x07, %ecx # platform id at bit[52..50]
movl $0x01, %edx
shll %cl,%edx
@@ -784,7 +784,7 @@ FspApiCommonL2:
#
# Pass BFV into the PEI Core
# It uses relative address to calucate the actual boot FV base
- # For FSP impleantion with single FV, PcdFlashFvRecoveryBase and
+ # For FSP implementation with single FV, PcdFspBootFirmwareVolumeBase and
# PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,
# they are different. The code below can handle both cases.
#
diff --git a/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm b/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
index 8efea01aae..b991386c77 100644
--- a/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
+++ b/IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
@@ -15,6 +15,10 @@
.model flat,C
.code
+;
+; FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
+; from the FSP Info header.
+;
FspInfoHeaderRelativeOff PROC NEAR PUBLIC
;
; This value will be pached by the build script
@@ -22,6 +26,11 @@ FspInfoHeaderRelativeOff PROC NEAR PUBLIC
DD 012345678h
FspInfoHeaderRelativeOff ENDP
+;
+; Returns FSP Base Address.
+;
+; This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
+;
AsmGetFspBaseAddress PROC NEAR PUBLIC
mov eax, AsmGetFspBaseAddress
sub eax, dword ptr [FspInfoHeaderRelativeOff]
@@ -30,10 +39,35 @@ AsmGetFspBaseAddress PROC NEAR PUBLIC
ret
AsmGetFspBaseAddress ENDP
+;
+; No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
+;
+AsmGetFspBaseAddressNoStack PROC NEAR PUBLIC
+ mov eax, AsmGetFspBaseAddress
+ sub eax, dword ptr [FspInfoHeaderRelativeOff]
+ add eax, 01Ch
+ mov eax, dword ptr [eax]
+ jmp edi
+AsmGetFspBaseAddressNoStack ENDP
+
+;
+; Returns FSP Info Header.
+;
+; This function gets the FSP Info Header using relative addressing and returns it
+;
AsmGetFspInfoHeader PROC NEAR PUBLIC
mov eax, AsmGetFspBaseAddress
sub eax, dword ptr [FspInfoHeaderRelativeOff]
ret
AsmGetFspInfoHeader ENDP
+;
+; No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
+;
+AsmGetFspInfoHeaderNoStack PROC NEAR PUBLIC
+ mov eax, AsmGetFspBaseAddress
+ sub eax, dword ptr [FspInfoHeaderRelativeOff]
+ jmp edi
+AsmGetFspInfoHeaderNoStack ENDP
+
END \ No newline at end of file
diff --git a/IntelFspPkg/FspSecCore/Ia32/FspHelper.s b/IntelFspPkg/FspSecCore/Ia32/FspHelper.s
index a6cf36259d..55d8ae75c0 100644
--- a/IntelFspPkg/FspSecCore/Ia32/FspHelper.s
+++ b/IntelFspPkg/FspSecCore/Ia32/FspHelper.s
@@ -15,6 +15,10 @@
#
#------------------------------------------------------------------------------
+#
+# FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
+# from the FSP Info header.
+#
ASM_GLOBAL ASM_PFX(FspInfoHeaderRelativeOff)
ASM_PFX(FspInfoHeaderRelativeOff):
#
@@ -22,17 +26,46 @@ ASM_PFX(FspInfoHeaderRelativeOff):
#
.long 0x012345678
-
+#
+# Returns FSP Base Address.
+#
+# This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
+#
ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddress)
ASM_PFX(AsmGetFspBaseAddress):
mov $AsmGetFspBaseAddress, %eax
- sub $FspInfoHeaderRelativeOff, %eax
+ sub FspInfoHeaderRelativeOff, %eax
add $0x01C, %eax
mov (%eax), %eax
ret
+#
+# No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
+#
+ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddressNoStack)
+ASM_PFX(AsmGetFspBaseAddressNoStack):
+ mov $AsmGetFspBaseAddress, %eax
+ sub FspInfoHeaderRelativeOff, %eax
+ add $0x01C, %eax
+ mov (%eax), %eax
+ jmp *%edi
+
+#
+# Returns FSP Info Header.
+#
+# This function gets the FSP Info Header using relative addressing and returns it
+#
ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeader)
ASM_PFX(AsmGetFspInfoHeader):
mov $AsmGetFspBaseAddress, %eax
- sub $FspInfoHeaderRelativeOff, %eax
+ sub FspInfoHeaderRelativeOff, %eax
ret
+
+#
+# No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
+#
+ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeaderNoStack)
+ASM_PFX(AsmGetFspInfoHeaderNoStack):
+ mov $AsmGetFspBaseAddress, %eax
+ sub FspInfoHeaderRelativeOff, %eax
+ jmp *%edi