VirtualBox

Ignore:
Timestamp:
Mar 31, 2025 11:31:09 AM (5 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:
3 edited

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c

    r105670 r108794  
    44  notify to call FspSiliconInit API.
    55
    6   Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>
     6  Copyright (c) 2014 - 2024, Intel Corporation. All rights reserved.<BR>
    77  SPDX-License-Identifier: BSD-2-Clause-Patent
    88
     
    3939#include <FspGlobalData.h>
    4040#include <Library/FspCommonLib.h>
     41#include <Guid/MigratedFvInfo.h>
    4142
    4243extern EFI_GUID  gFspHobGuid;
     
    125126
    126127  //
    127   // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
    128   //
    129   if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
    130     DEBUG ((DEBUG_INFO, "FspMemoryInitApi requested reset %r\n", Status));
    131     CallFspWrapperResetSystem (Status);
    132   }
    133 
    134   if ((Status != FSP_STATUS_VARIABLE_REQUEST) && EFI_ERROR (Status)) {
    135     DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspMemoryInitApi(), Status = %r\n", Status));
    136     ASSERT_EFI_ERROR (Status);
    137   }
    138 
    139   DEBUG ((DEBUG_INFO, "FspMemoryInit status: %r\n", Status));
    140   if (Status == FSP_STATUS_VARIABLE_REQUEST) {
    141     //
    142     // call to Variable request handler
    143     //
    144     FspWrapperVariableRequestHandler (&FspHobListPtr, FspMultiPhaseMemInitApiIndex);
    145   }
    146 
    147   //
    148   // See if MultiPhase process is required or not
    149   //
    150   FspWrapperMultiPhaseHandler (&FspHobListPtr, FspMultiPhaseMemInitApiIndex);    // FspM MultiPhase
    151 
    152   //
    153   // Create hobs after memory initialization and not in temp RAM. Hence passing the recorded timestamp here
    154   //
    155   PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, TimeStampCounterStart, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
    156   PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
    157   DEBUG ((DEBUG_INFO, "Total time spent executing FspMemoryInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));
    158 
    159   Status = TestFspMemoryInitApiOutput (FspmUpdDataPtr, &FspHobListPtr);
    160   if (EFI_ERROR (Status)) {
    161     DEBUG ((DEBUG_ERROR, "ERROR - TestFspMemoryInitApiOutput () fail, Status = %r\n", Status));
    162   }
    163 
    164   DEBUG ((DEBUG_INFO, "  FspHobListPtr (returned) - 0x%x\n", FspHobListPtr));
    165   ASSERT (FspHobListPtr != NULL);
    166 
    167   PostFspmHobProcess (FspHobListPtr);
    168 
    169   //
    170128  // FspHobList is not complete at this moment.
    171129  // Save FspHobList pointer to hob, so that it can be got later
     
    177135  ASSERT (HobData != NULL);
    178136  CopyMem (HobData, &FspHobListPtr, sizeof (FspHobListPtr));
     137
     138  //
     139  // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
     140  //
     141  if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
     142    DEBUG ((DEBUG_INFO, "FspMemoryInitApi requested reset %r\n", Status));
     143    CallFspWrapperResetSystem (Status);
     144  }
     145
     146  if ((Status != FSP_STATUS_VARIABLE_REQUEST) && EFI_ERROR (Status)) {
     147    DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspMemoryInitApi(), Status = %r\n", Status));
     148    ASSERT_EFI_ERROR (Status);
     149  }
     150
     151  DEBUG ((DEBUG_INFO, "FspMemoryInit status: %r\n", Status));
     152  if (Status == FSP_STATUS_VARIABLE_REQUEST) {
     153    //
     154    // call to Variable request handler
     155    //
     156    FspWrapperVariableRequestHandler (&FspHobListPtr, FspMultiPhaseMemInitApiIndex);
     157  }
     158
     159  //
     160  // See if MultiPhase process is required or not
     161  //
     162  FspWrapperMultiPhaseHandler (&FspHobListPtr, FspMultiPhaseMemInitApiIndex);    // FspM MultiPhase
     163
     164  //
     165  // Create hobs after memory initialization and not in temp RAM. Hence passing the recorded timestamp here
     166  //
     167  PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, TimeStampCounterStart, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
     168  PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
     169  DEBUG ((DEBUG_INFO, "Total time spent executing FspMemoryInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));
     170
     171  Status = TestFspMemoryInitApiOutput (FspmUpdDataPtr, &FspHobListPtr);
     172  if (EFI_ERROR (Status)) {
     173    DEBUG ((DEBUG_ERROR, "ERROR - TestFspMemoryInitApiOutput () fail, Status = %r\n", Status));
     174  }
     175
     176  DEBUG ((DEBUG_INFO, "  FspHobListPtr (returned) - 0x%x\n", FspHobListPtr));
     177  ASSERT (FspHobListPtr != NULL);
     178
     179  PostFspmHobProcess (FspHobListPtr);
    179180
    180181  return Status;
     
    279280  )
    280281{
    281   UINT32  FspMeasureMask;
     282  UINT32                  FspMeasureMask;
     283  EFI_PHYSICAL_ADDRESS    FsptBaseAddress;
     284  EFI_PHYSICAL_ADDRESS    FspmBaseAddress;
     285  EDKII_MIGRATED_FV_INFO  *MigratedFvInfo;
     286  EFI_PEI_HOB_POINTERS    Hob;
    282287
    283288  DEBUG ((DEBUG_INFO, "TcgPpiNotify FSPM\n"));
    284289
    285   FspMeasureMask = PcdGet32 (PcdFspMeasurementConfig);
     290  FspMeasureMask  = PcdGet32 (PcdFspMeasurementConfig);
     291  FsptBaseAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFsptBaseAddress);
     292  FspmBaseAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFspmBaseAddress);
     293  Hob.Raw         = GetFirstGuidHob (&gEdkiiMigratedFvInfoGuid);
     294  while (Hob.Raw != NULL) {
     295    MigratedFvInfo = GET_GUID_HOB_DATA (Hob);
     296    if ((MigratedFvInfo->FvOrgBase == PcdGet32 (PcdFsptBaseAddress)) && (MigratedFvInfo->FvDataBase != 0)) {
     297      //
     298      // Found the migrated FspT raw data
     299      //
     300      FsptBaseAddress = MigratedFvInfo->FvDataBase;
     301    }
     302
     303    if ((MigratedFvInfo->FvOrgBase == PcdGet32 (PcdFspmBaseAddress)) && (MigratedFvInfo->FvDataBase != 0)) {
     304      FspmBaseAddress = MigratedFvInfo->FvDataBase;
     305    }
     306
     307    Hob.Raw = GET_NEXT_HOB (Hob);
     308    Hob.Raw = GetNextGuidHob (&gEdkiiMigratedFvInfoGuid, Hob.Raw);
     309  }
    286310
    287311  if ((FspMeasureMask & FSP_MEASURE_FSPT) != 0) {
     
    289313      0,
    290314      "FSPT",
    291       PcdGet32 (PcdFsptBaseAddress),
    292       (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFsptBaseAddress))->FvLength
     315      FsptBaseAddress,
     316      (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)FsptBaseAddress)->FvLength
    293317      );
    294318  }
     
    298322      0,
    299323      "FSPM",
    300       PcdGet32 (PcdFspmBaseAddress),
    301       (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength
     324      FspmBaseAddress,
     325      (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)FspmBaseAddress)->FvLength
    302326      );
    303327  }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf

    r101291 r108794  
    77# notify to call FspSiliconInit API.
    88#
    9 #  Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
     9#  Copyright (c) 2014 - 2024, Intel Corporation. All rights reserved.<BR>
    1010#
    1111#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    7070  gFspHobGuid                           ## PRODUCES ## HOB
    7171  gFspApiPerformanceGuid                ## SOMETIMES_CONSUMES ## GUID
     72  gEdkiiMigratedFvInfoGuid              ## SOMETIMES_CONSUMES ## HOB
    7273
    7374[Ppis]
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