]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFspPkg/FspSecCore add AsmGetFspBaseAddressNoStack and AsmGetFspInfoHeaderNoStack
authorYao, Jiewen <Jiewen.Yao@intel.com>
Fri, 22 May 2015 07:49:34 +0000 (07:49 +0000)
committerjyao1 <jyao1@Edk2>
Fri, 22 May 2015 07:49:34 +0000 (07:49 +0000)
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

IntelFspPkg/FspSecCore/Ia32/FspApiEntry.asm
IntelFspPkg/FspSecCore/Ia32/FspApiEntry.s
IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
IntelFspPkg/FspSecCore/Ia32/FspHelper.s

index a0c9b1ed7351a5911310283cc9e0560472a733ba..d0e56b2360b9e21013e0790511b27e3021ca8070 100644 (file)
@@ -143,8 +143,8 @@ check_main_header:
    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
@@ -569,7 +569,7 @@ FspApiCommon   PROC C PUBLIC
   ;\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
index 8f4093ca1940a7adad50ba5b895950ec0ea51fb5..d9cfcc3390dec9412248a032fd95a619d188cb4e 100644 (file)
@@ -297,8 +297,8 @@ CheckMainHeader:
    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
@@ -784,7 +784,7 @@ FspApiCommonL2:
   #\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
index 8efea01aae8780acc554af00d0228c1c5febb078..b991386c77c68217631feac8742ea86f2d54c5b3 100644 (file)
     .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
@@ -22,6 +26,11 @@ FspInfoHeaderRelativeOff    PROC      NEAR    PUBLIC
    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
@@ -30,10 +39,35 @@ AsmGetFspBaseAddress        PROC      NEAR    PUBLIC
    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
index a6cf36259d69a4511a459e6f7862e6cb76122a55..55d8ae75c0df50d13a9d33984c021cf9e879b1b6 100644 (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
@@ -22,17 +26,46 @@ ASM_PFX(FspInfoHeaderRelativeOff):
    #\r
    .long    0x012345678\r
 \r
    #\r
    .long    0x012345678\r
 \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
    ret\r
    ret\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