VirtualBox

Changeset 85951 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Aug 31, 2020 11:41:01 AM (4 years ago)
Author:
vboxsync
Message:

Devices/EFI/Firmware/UefiCpuPkg/MpInitLib: Force x2APIC mode when the VM config indicates it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/UefiCpuPkg/Library/MpInitLib/MpLib.c

    r85718 r85951  
    1010
    1111#include "MpLib.h"
     12#ifdef VBOX
     13# include <Library/IoLib.h>
     14# include "../../../../DevEFI.h"
     15#endif
    1216
    1317EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;
     
    476480}
    477481
     482#ifdef VBOX
     483/*
     484 *   @todo move this function to the library.
     485 */
     486UINT32 VBoxGetVmVariable(UINT32 Variable, CHAR8* Buffer, UINT32 Size)
     487{
     488    UINT32 VarLen, i;
     489
     490    IoWrite32(EFI_INFO_PORT, Variable);
     491    VarLen = IoRead32(EFI_INFO_PORT);
     492
     493    for (i = 0; i < VarLen && i < Size; i++)
     494        Buffer[i] = IoRead8(EFI_INFO_PORT);
     495
     496    return VarLen;
     497}
     498#endif
     499
    478500/**
    479501  This function will get CPU count in the system.
     
    491513  CPU_INFO_IN_HOB        *CpuInfoInHob;
    492514  BOOLEAN                X2Apic;
     515#ifdef VBOX
     516  CHAR8                  u8ApicMode;
     517#endif
    493518
    494519  //
     
    527552    }
    528553  }
     554#ifdef VBOX
     555  /* Force x2APIC mode if the VM config forces it. */
     556  VBoxGetVmVariable(EFI_INFO_INDEX_APIC_MODE, &u8ApicMode, sizeof(u8ApicMode));
     557  if (u8ApicMode == EFI_APIC_MODE_X2APIC)
     558    X2Apic = TRUE;
     559#endif
    529560
    530561  if (X2Apic) {
Note: See TracChangeset for help on using the changeset viewer.

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