VirtualBox

Ignore:
Timestamp:
Mar 31, 2025 11:31:09 AM (2 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168237
Message:

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c

    r105670 r108794  
    1616#pragma pack(1)
    1717
    18 //
    19 //   API Parameter                +0x34
    20 //   API return address           +0x30
    21 //
    22 //   push    FspInfoHeader        +0x2C
    23 //   pushfd                       +0x28
    24 //   cli
    25 //   pushad                       +0x24
    26 //   sub     esp, 8               +0x00
    27 //   sidt    fword ptr [esp]
    28 //
    2918typedef struct {
    3019  UINT16    IdtrLimit;
    3120  UINT32    IdtrBase;
    3221  UINT16    Reserved;
     22  UINT32    Cr0;
     23  UINT32    Cr3;
     24  UINT32    Cr4;
     25  UINT32    Efer;           // lower 32-bit of EFER since only NXE bit (BIT11) need to be restored.
    3326  UINT32    Registers[8];   // General Purpose Registers: Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx and Eax
    3427  UINT16    Flags[2];
     
    3831} CONTEXT_STACK;
    3932
    40 //
    41 //   API return address           +0xB8
    42 //   Reserved                     +0xB0
    43 //   push    API Parameter2       +0xA8
    44 //   push    API Parameter1       +0xA0
    45 //   push    FspInfoHeader        +0x98
    46 //   pushfq                       +0x90
    47 //   cli
    48 //   PUSHA_64                     +0x10
    49 //   sub     rsp, 16              +0x00
    50 //   sidt    [rsp]
    51 //
    5233typedef struct {
    5334  UINT64    Idtr[2];        // IDTR Limit - bit0:bi15, IDTR Base - bit16:bit79
     35  UINT64    Cr0;
     36  UINT64    Cr3;
     37  UINT64    Cr4;
     38  UINT64    Efer;
    5439  UINT64    Registers[16];  // General Purpose Registers: RDI, RSI, RBP, RSP, RBX, RDX, RCX, RAX, and R15 to R8
    5540  UINT32    Flags[2];
     
    9075  )
    9176{
    92   FSP_GLOBAL_DATA  *FspData;
    93 
    94   FspData = *(FSP_GLOBAL_DATA  **)(UINTN)PcdGet32 (PcdGlobalDataPointerAddress);
    95   return FspData;
     77  UINT32  FspDataAddress;
     78
     79  FspDataAddress = *(UINT32 *)(UINTN)PcdGet32 (PcdGlobalDataPointerAddress);
     80  return (FSP_GLOBAL_DATA *)(UINTN)FspDataAddress;
    9681}
    9782
     
    567552  FspData->StatusCode = StatusCode;
    568553}
    569 
    570 /**
    571   This function updates the return status of the FSP API with requested reset type and returns to Boot Loader.
    572 
    573   @param[in] FspResetType     Reset type that needs to returned as API return status
    574 
    575 **/
    576 VOID
    577 EFIAPI
    578 FspApiReturnStatusReset (
    579   IN EFI_STATUS  FspResetType
    580   )
    581 {
    582   volatile BOOLEAN  LoopUntilReset;
    583 
    584   LoopUntilReset = TRUE;
    585   DEBUG ((DEBUG_INFO, "FSP returning control to Bootloader with reset required return status %x\n", FspResetType));
    586   if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {
    587     ///
    588     /// Below code is not an infinite loop.The control will go back to API calling function in BootLoader each time BootLoader
    589     /// calls the FSP API without honoring the reset request by FSP
    590     ///
    591     do {
    592       SetFspApiReturnStatus (FspResetType);
    593       Pei2LoaderSwitchStack ();
    594       DEBUG ((DEBUG_ERROR, "!!!ERROR: FSP has requested BootLoader for reset. But BootLoader has not honored the reset\n"));
    595       DEBUG ((DEBUG_ERROR, "!!!ERROR: Please add support in BootLoader to honor the reset request from FSP\n"));
    596     } while (LoopUntilReset);
    597   }
    598 }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette