VirtualBox

Changeset 101318 in vbox


Ignore:
Timestamp:
Sep 29, 2023 3:13:07 PM (18 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159318
Message:

Main: Move findEfiRom to the common code and add a PlatformArchitecture_T parameter to IVirtualBox::CheckFirmwarePresent to differentiate between x86 and ARM, bugref:10528

Location:
trunk/src/VBox/Main
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r101302 r101318  
    27042704  <interface
    27052705    name="IVirtualBox" extends="$unknown"
    2706     uuid="901ac662-0b6e-4b19-a0ac-21cb54d4d5b2"
     2706    uuid="d644ad1e-c501-4fc7-9ab6-aa6d763bc540"
    27072707    wsmap="managed"
    27082708    rest="managed"
     
    38933893        downloaded from.
    38943894      </desc>
     3895      <param name="platformArchitecture" type="PlatformArchitecture" dir="in">
     3896        <desc>
     3897          Architecture of firmware to check.
     3898        </desc>
     3899      </param>
    38953900      <param name="firmwareType" type="FirmwareType" dir="in">
    38963901        <desc>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r101035 r101318  
    12561256DECL_HIDDEN_THROW(Utf8Str *) GetExtraDataBoth(IVirtualBox *pVirtualBox, IMachine *pMachine, const char *pszName, Utf8Str *pStrValue);
    12571257
     1258#ifndef VBOX_WITH_EFI_IN_DD2
     1259DECLHIDDEN(int) findEfiRom(IVirtualBox* vbox, PlatformArchitecture_T aPlatformArchitecture, FirmwareType_T aFirmwareType, Utf8Str *pEfiRomFile);
     1260#endif
     1261
    12581262#endif /* !MAIN_INCLUDED_ConsoleImpl_h */
    12591263/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r101299 r101318  
    438438                                   ComPtr<ICloudNetwork> &aNetwork);
    439439    HRESULT removeCloudNetwork(const ComPtr<ICloudNetwork> &aNetwork);
    440     HRESULT checkFirmwarePresent(FirmwareType_T aFirmwareType,
     440    HRESULT checkFirmwarePresent(PlatformArchitecture_T aPlatformArchitecture,
     441                                 FirmwareType_T aFirmwareType,
    441442                                 const com::Utf8Str &aVersion,
    442443                                 com::Utf8Str &aUrl,
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigCommon.cpp

    r101173 r101318  
    34213421}
    34223422
     3423
     3424#ifndef VBOX_WITH_EFI_IN_DD2
     3425DECLHIDDEN(int) findEfiRom(IVirtualBox* vbox, PlatformArchitecture_T aPlatformArchitecture, FirmwareType_T aFirmwareType, Utf8Str *pEfiRomFile)
     3426{
     3427    Bstr aFilePath, empty;
     3428    BOOL fPresent = FALSE;
     3429    HRESULT hrc = vbox->CheckFirmwarePresent(aPlatformArchitecture, aFirmwareType, empty.raw(),
     3430                                             empty.asOutParam(), aFilePath.asOutParam(), &fPresent);
     3431    AssertComRCReturn(hrc, Global::vboxStatusCodeFromCOM(hrc));
     3432
     3433    if (!fPresent)
     3434    {
     3435        LogRel(("Failed to find an EFI ROM file.\n"));
     3436        return VERR_FILE_NOT_FOUND;
     3437    }
     3438
     3439    *pEfiRomFile = Utf8Str(aFilePath);
     3440
     3441    return VINF_SUCCESS;
     3442}
     3443#endif
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigX86.cpp

    r101271 r101318  
    194194    }
    195195};
    196 
    197 #ifndef VBOX_WITH_EFI_IN_DD2
    198 static int findEfiRom(IVirtualBox* vbox, FirmwareType_T aFirmwareType, Utf8Str *pEfiRomFile)
    199 {
    200     Bstr aFilePath, empty;
    201     BOOL fPresent = FALSE;
    202     HRESULT hrc = vbox->CheckFirmwarePresent(aFirmwareType, empty.raw(),
    203                                              empty.asOutParam(), aFilePath.asOutParam(), &fPresent);
    204     AssertComRCReturn(hrc, Global::vboxStatusCodeFromCOM(hrc));
    205 
    206     if (!fPresent)
    207     {
    208         LogRel(("Failed to find an EFI ROM file.\n"));
    209         return VERR_FILE_NOT_FOUND;
    210     }
    211 
    212     *pEfiRomFile = Utf8Str(aFilePath);
    213 
    214     return VINF_SUCCESS;
    215 }
    216 #endif
    217196
    218197/**
     
    16761655#else
    16771656            Utf8Str efiRomFile;
    1678             vrc = findEfiRom(virtualBox, eFwType, &efiRomFile);
     1657            vrc = findEfiRom(virtualBox, PlatformArchitecture_x86, eFwType, &efiRomFile);
    16791658            AssertRCReturn(vrc, vrc);
    16801659            const char *pszEfiRomFile = efiRomFile.c_str();
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r101299 r101318  
    470470};
    471471
     472
     473/**
     474 * VirtualBox firmware descriptor.
     475 */
     476typedef struct VBOXFWDESC
     477{
     478    FirmwareType_T  enmType;
     479    bool            fBuiltIn;
     480    const char     *pszFileName;
     481    const char     *pszUrl;
     482} VBoxFwDesc;
     483typedef const VBOXFWDESC *PVBOXFWDESC;
     484
     485
    472486// constructor / destructor
    473487/////////////////////////////////////////////////////////////////////////////
     
    18851899}
    18861900
    1887 HRESULT VirtualBox::checkFirmwarePresent(FirmwareType_T aFirmwareType,
     1901HRESULT VirtualBox::checkFirmwarePresent(PlatformArchitecture_T aPlatformArchitecture,
     1902                                         FirmwareType_T aFirmwareType,
    18881903                                         const com::Utf8Str &aVersion,
    18891904                                         com::Utf8Str &aUrl,
     
    18931908    NOREF(aVersion);
    18941909
    1895     static const struct
    1896     {
    1897         FirmwareType_T  enmType;
    1898         bool            fBuiltIn;
    1899         const char     *pszFileName;
    1900         const char     *pszUrl;
    1901     }
    1902     firmwareDesc[] =
     1910    static const VBOXFWDESC s_FwDescX86[] =
    19031911    {
    19041912        {   FirmwareType_BIOS,    true,  NULL,             NULL },
     
    19141922    };
    19151923
    1916     for (size_t i = 0; i < sizeof(firmwareDesc) / sizeof(firmwareDesc[0]); i++)
    1917     {
    1918         if (aFirmwareType != firmwareDesc[i].enmType)
     1924    static const VBOXFWDESC s_FwDescArm[] =
     1925    {
     1926#ifdef VBOX_WITH_EFI_IN_DD2
     1927        {   FirmwareType_EFI32,   true,  "VBoxEFIAArch32.fd",   NULL },
     1928        {   FirmwareType_EFI64,   true,  "VBoxEFIAArch64.fd",   NULL },
     1929#else
     1930        {   FirmwareType_EFI32,   false, "VBoxEFIAArch32.fd",   "http://virtualbox.org/firmware/VBoxEFIAArch32.fd" },
     1931        {   FirmwareType_EFI64,   false, "VBoxEFIAArch64.fd",   "http://virtualbox.org/firmware/VBoxEFIAArch64.fd" },
     1932#endif
     1933    };
     1934
     1935    PVBOXFWDESC pFwDesc = NULL;
     1936    uint32_t cFwDesc = 0;
     1937    if (aPlatformArchitecture == PlatformArchitecture_x86)
     1938    {
     1939        pFwDesc = &s_FwDescX86[0];
     1940        cFwDesc = RT_ELEMENTS(s_FwDescX86);
     1941    }
     1942    else if (aPlatformArchitecture == PlatformArchitecture_ARM)
     1943    {
     1944        pFwDesc = &s_FwDescArm[0];
     1945        cFwDesc = RT_ELEMENTS(s_FwDescArm);
     1946    }
     1947    else
     1948        return E_INVALIDARG;
     1949
     1950    for (size_t i = 0; i < cFwDesc; i++)
     1951    {
     1952        if (aFirmwareType != pFwDesc->enmType)
     1953        {
     1954            pFwDesc++;
    19191955            continue;
     1956        }
    19201957
    19211958        /* compiled-in firmware */
    1922         if (firmwareDesc[i].fBuiltIn)
    1923         {
    1924             aFile = firmwareDesc[i].pszFileName;
     1959        if (pFwDesc->fBuiltIn)
     1960        {
     1961            aFile = pFwDesc->pszFileName;
    19251962            *aResult = TRUE;
    19261963            break;
     
    19281965
    19291966        Utf8Str    fullName;
    1930         Utf8StrFmt shortName("Firmware%c%s", RTPATH_DELIMITER, firmwareDesc[i].pszFileName);
     1967        Utf8StrFmt shortName("Firmware%c%s", RTPATH_DELIMITER, pFwDesc->pszFileName);
    19311968        int vrc = i_calculateFullPath(shortName, fullName);
    19321969        AssertRCReturn(vrc, VBOX_E_IPRT_ERROR);
     
    19411978        vrc = RTPathExecDir(szVBoxPath, RTPATH_MAX);
    19421979        AssertRCReturn(vrc, VBOX_E_IPRT_ERROR);
    1943         vrc = RTPathAppend(szVBoxPath, sizeof(szVBoxPath), firmwareDesc[i].pszFileName);
     1980        vrc = RTPathAppend(szVBoxPath, sizeof(szVBoxPath), pFwDesc->pszFileName);
    19441981        AssertRCReturn(vrc, VBOX_E_IPRT_ERROR);
    19451982        if (RTFileExists(szVBoxPath))
     
    19511988
    19521989        /** @todo account for version in the URL */
    1953         aUrl = firmwareDesc[i].pszUrl;
     1990        aUrl = pFwDesc->pszUrl;
    19541991        *aResult = FALSE;
    19551992
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