Fix GCC issue on FspInfoHeaderRelativeOff.
Clean up comments for platform ID matching on Microcode and PcdFspBootFirmwareVolumeBase
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <Jiewen.Yao@intel.com>
Reviewed-by: "Rangarajan, Ravi P" <ravi.p.rangarajan@intel.com>
Reviewed-by: "Mudusuru, Giri P" <giri.p.mudusuru@intel.com>
Reviewed-by: "Ma, Maurice" <maurice.ma@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17496
6f19259b-4bc3-4df7-8a09-
765794883524
mov ecx, MSR_IA32_PLATFORM_ID\r
rdmsr\r
mov ecx, edx\r
mov ecx, MSR_IA32_PLATFORM_ID\r
rdmsr\r
mov ecx, edx\r
- shr ecx, 50-32\r
- and ecx, 7h\r
+ shr ecx, 50-32 ; shift (50d-32d=18d=0x12) bits\r
+ and ecx, 7h ; platform id at bit[52..50]\r
mov edx, 1\r
shl edx, cl\r
\r
mov edx, 1\r
shl edx, cl\r
\r
;\r
; Pass BFV into the PEI Core\r
; It uses relative address to calucate the actual boot FV base\r
;\r
; Pass BFV into the PEI Core\r
; It uses relative address to calucate the actual boot FV base\r
- ; For FSP impleantion with single FV, PcdFlashFvRecoveryBase and\r
+ ; For FSP implementation with single FV, PcdFspBootFirmwareVolumeBase and\r
; PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,\r
; they are different. The code below can handle both cases.\r
;\r
; PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,\r
; they are different. The code below can handle both cases.\r
;\r
movl $MSR_IA32_PLATFORM_ID, %ecx\r
rdmsr\r
movl %edx, %ecx\r
movl $MSR_IA32_PLATFORM_ID, %ecx\r
rdmsr\r
movl %edx, %ecx\r
- shrl $0x12, %ecx #($50-$32)\r
- andl $0x07, %ecx\r
+ shrl $0x12, %ecx # shift (50d-32d=18d=0x12) bits\r
+ andl $0x07, %ecx # platform id at bit[52..50]\r
movl $0x01, %edx\r
shll %cl,%edx\r
\r
movl $0x01, %edx\r
shll %cl,%edx\r
\r
#\r
# Pass BFV into the PEI Core\r
# It uses relative address to calucate the actual boot FV base\r
#\r
# Pass BFV into the PEI Core\r
# It uses relative address to calucate the actual boot FV base\r
- # For FSP impleantion with single FV, PcdFlashFvRecoveryBase and\r
+ # For FSP implementation with single FV, PcdFspBootFirmwareVolumeBase and\r
# PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,\r
# they are different. The code below can handle both cases.\r
#\r
# PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,\r
# they are different. The code below can handle both cases.\r
#\r
.model flat,C\r
.code\r
\r
.model flat,C\r
.code\r
\r
+;\r
+; FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress \r
+; from the FSP Info header. \r
+;\r
FspInfoHeaderRelativeOff PROC NEAR PUBLIC\r
;\r
; This value will be pached by the build script\r
FspInfoHeaderRelativeOff PROC NEAR PUBLIC\r
;\r
; This value will be pached by the build script\r
DD 012345678h\r
FspInfoHeaderRelativeOff ENDP\r
\r
DD 012345678h\r
FspInfoHeaderRelativeOff ENDP\r
\r
+;\r
+; Returns FSP Base Address. \r
+;\r
+; This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure\r
+;\r
AsmGetFspBaseAddress PROC NEAR PUBLIC\r
mov eax, AsmGetFspBaseAddress\r
sub eax, dword ptr [FspInfoHeaderRelativeOff]\r
AsmGetFspBaseAddress PROC NEAR PUBLIC\r
mov eax, AsmGetFspBaseAddress\r
sub eax, dword ptr [FspInfoHeaderRelativeOff]\r
ret\r
AsmGetFspBaseAddress ENDP\r
\r
ret\r
AsmGetFspBaseAddress ENDP\r
\r
+;\r
+; No stack counter part of AsmGetFspBaseAddress. Return address is in edi.\r
+;\r
+AsmGetFspBaseAddressNoStack PROC NEAR PUBLIC\r
+ mov eax, AsmGetFspBaseAddress\r
+ sub eax, dword ptr [FspInfoHeaderRelativeOff]\r
+ add eax, 01Ch \r
+ mov eax, dword ptr [eax]\r
+ jmp edi\r
+AsmGetFspBaseAddressNoStack ENDP\r
+\r
+;\r
+; Returns FSP Info Header. \r
+;\r
+; This function gets the FSP Info Header using relative addressing and returns it\r
+;\r
AsmGetFspInfoHeader PROC NEAR PUBLIC\r
mov eax, AsmGetFspBaseAddress\r
sub eax, dword ptr [FspInfoHeaderRelativeOff]\r
ret\r
AsmGetFspInfoHeader ENDP\r
\r
AsmGetFspInfoHeader PROC NEAR PUBLIC\r
mov eax, AsmGetFspBaseAddress\r
sub eax, dword ptr [FspInfoHeaderRelativeOff]\r
ret\r
AsmGetFspInfoHeader ENDP\r
\r
+;\r
+; No stack counter part of AsmGetFspInfoHeader. Return address is in edi.\r
+;\r
+AsmGetFspInfoHeaderNoStack PROC NEAR PUBLIC\r
+ mov eax, AsmGetFspBaseAddress\r
+ sub eax, dword ptr [FspInfoHeaderRelativeOff]\r
+ jmp edi\r
+AsmGetFspInfoHeaderNoStack ENDP\r
+\r
END
\ No newline at end of file
END
\ No newline at end of file
#\r
#------------------------------------------------------------------------------\r
\r
#\r
#------------------------------------------------------------------------------\r
\r
+#\r
+# FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress \r
+# from the FSP Info header. \r
+#\r
ASM_GLOBAL ASM_PFX(FspInfoHeaderRelativeOff)\r
ASM_PFX(FspInfoHeaderRelativeOff):\r
#\r
ASM_GLOBAL ASM_PFX(FspInfoHeaderRelativeOff)\r
ASM_PFX(FspInfoHeaderRelativeOff):\r
#\r
#\r
.long 0x012345678\r
\r
#\r
.long 0x012345678\r
\r
+#\r
+# Returns FSP Base Address. \r
+#\r
+# This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure\r
+#\r
ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddress)\r
ASM_PFX(AsmGetFspBaseAddress):\r
mov $AsmGetFspBaseAddress, %eax\r
ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddress)\r
ASM_PFX(AsmGetFspBaseAddress):\r
mov $AsmGetFspBaseAddress, %eax\r
- sub $FspInfoHeaderRelativeOff, %eax\r
+ sub FspInfoHeaderRelativeOff, %eax\r
add $0x01C, %eax\r
mov (%eax), %eax\r
ret\r
\r
add $0x01C, %eax\r
mov (%eax), %eax\r
ret\r
\r
+#\r
+# No stack counter part of AsmGetFspBaseAddress. Return address is in edi.\r
+#\r
+ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddressNoStack)\r
+ASM_PFX(AsmGetFspBaseAddressNoStack):\r
+ mov $AsmGetFspBaseAddress, %eax\r
+ sub FspInfoHeaderRelativeOff, %eax\r
+ add $0x01C, %eax \r
+ mov (%eax), %eax\r
+ jmp *%edi\r
+\r
+#\r
+# Returns FSP Info Header. \r
+#\r
+# This function gets the FSP Info Header using relative addressing and returns it\r
+#\r
ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeader)\r
ASM_PFX(AsmGetFspInfoHeader):\r
mov $AsmGetFspBaseAddress, %eax\r
ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeader)\r
ASM_PFX(AsmGetFspInfoHeader):\r
mov $AsmGetFspBaseAddress, %eax\r
- sub $FspInfoHeaderRelativeOff, %eax\r
+ sub FspInfoHeaderRelativeOff, %eax\r
+ \r
+#\r
+# No stack counter part of AsmGetFspInfoHeader. Return address is in edi.\r
+#\r
+ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeaderNoStack)\r
+ASM_PFX(AsmGetFspInfoHeaderNoStack):\r
+ mov $AsmGetFspBaseAddress, %eax\r
+ sub FspInfoHeaderRelativeOff, %eax\r
+ jmp *%edi\r