VirtualBox

Changeset 101038 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Sep 7, 2023 9:21:54 AM (17 months ago)
Author:
vboxsync
Message:

Initial commit (based draft v2 / on patch v5) for implementing platform architecture support for x86 and ARM: Re-applied FirmwareSettings[.h|.cpp] changes. bugref:10384

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/FirmwareSettingsImpl.cpp

    r101037 r101038  
    11/* $Id$ */
    22/** @file
    3  * VirtualBox COM class implementation - Machine BIOS settings.
     3 * VirtualBox COM class implementation - Machine firmware settings.
    44 */
    55
     
    2626 */
    2727
    28 #define LOG_GROUP LOG_GROUP_MAIN_BIOSSETTINGS
    29 #include "BIOSSettingsImpl.h"
     28#define LOG_GROUP LOG_GROUP_MAIN_FIRMWARESETTINGS
     29#include "FirmwareSettingsImpl.h"
    3030#include "MachineImpl.h"
    3131#include "GuestOSTypeImpl.h"
     
    4141////////////////////////////////////////////////////////////////////////////////
    4242//
    43 // BIOSSettings private data definition
     43// FirmwareSettings private data definition
    4444//
    4545////////////////////////////////////////////////////////////////////////////////
    4646
    47 struct BIOSSettings::Data
     47struct FirmwareSettings::Data
    4848{
    4949    Data()
     
    5252
    5353    Machine * const             pMachine;
    54     ComObjPtr<BIOSSettings>    pPeer;
     54    ComObjPtr<FirmwareSettings> pPeer;
    5555
    5656    // use the XML settings structure in the members for simplicity
    57     Backupable<settings::BIOSSettings> bd;
     57    Backupable<settings::FirmwareSettings> bd;
    5858};
    5959
     
    6161/////////////////////////////////////////////////////////////////////////////
    6262
    63 DEFINE_EMPTY_CTOR_DTOR(BIOSSettings)
    64 
    65 HRESULT BIOSSettings::FinalConstruct()
     63DEFINE_EMPTY_CTOR_DTOR(FirmwareSettings)
     64
     65HRESULT FirmwareSettings::FinalConstruct()
    6666{
    6767    return BaseFinalConstruct();
    6868}
    6969
    70 void BIOSSettings::FinalRelease()
     70void FirmwareSettings::FinalRelease()
    7171{
    7272    uninit();
     
    8282 * @returns COM result indicator
    8383 */
    84 HRESULT BIOSSettings::init(Machine *aParent)
     84HRESULT FirmwareSettings::init(Machine *aParent)
    8585{
    8686    LogFlowThisFuncEnter();
     
    107107
    108108/**
    109  *  Initializes the BIOS settings object given another BIOS settings object
     109 *  Initializes the firmware settings object given another firmware settings object
    110110 *  (a kind of copy constructor). This object shares data with
    111111 *  the object passed as an argument.
     
    114114 *  it shares data with is destroyed.
    115115 */
    116 HRESULT BIOSSettings::init(Machine *aParent, BIOSSettings *that)
     116HRESULT FirmwareSettings::init(Machine *aParent, FirmwareSettings *that)
    117117{
    118118    LogFlowThisFuncEnter();
     
    144144 *  of the original object passed as an argument.
    145145 */
    146 HRESULT BIOSSettings::initCopy(Machine *aParent, BIOSSettings *that)
     146HRESULT FirmwareSettings::initCopy(Machine *aParent, FirmwareSettings *that)
    147147{
    148148    LogFlowThisFuncEnter();
     
    173173 *  Called either from FinalRelease() or by the parent when it gets destroyed.
    174174 */
    175 void BIOSSettings::uninit()
     175void FirmwareSettings::uninit()
    176176{
    177177    LogFlowThisFuncEnter();
     
    193193}
    194194
    195 // IBIOSSettings properties
     195// IFirmwareSettings properties
    196196/////////////////////////////////////////////////////////////////////////////
    197197
    198198
    199 HRESULT BIOSSettings::getLogoFadeIn(BOOL *enabled)
     199HRESULT FirmwareSettings::getLogoFadeIn(BOOL *enabled)
    200200{
    201201    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    206206}
    207207
    208 HRESULT BIOSSettings::setLogoFadeIn(BOOL enable)
     208HRESULT FirmwareSettings::setLogoFadeIn(BOOL enable)
    209209{
    210210    /* the machine needs to be mutable */
     
    219219    alock.release();
    220220    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    221     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    222 
    223     return S_OK;
    224 }
    225 
    226 
    227 HRESULT BIOSSettings::getLogoFadeOut(BOOL *enabled)
     221    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     222
     223    return S_OK;
     224}
     225
     226
     227HRESULT FirmwareSettings::getLogoFadeOut(BOOL *enabled)
    228228{
    229229    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    234234}
    235235
    236 HRESULT BIOSSettings::setLogoFadeOut(BOOL enable)
     236HRESULT FirmwareSettings::setLogoFadeOut(BOOL enable)
    237237{
    238238    /* the machine needs to be mutable */
     
    247247    alock.release();
    248248    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    249     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    250 
    251     return S_OK;
    252 }
    253 
    254 
    255 HRESULT BIOSSettings::getLogoDisplayTime(ULONG *displayTime)
     249    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     250
     251    return S_OK;
     252}
     253
     254
     255HRESULT FirmwareSettings::getLogoDisplayTime(ULONG *displayTime)
    256256{
    257257    if (!displayTime)
     
    265265}
    266266
    267 HRESULT BIOSSettings::setLogoDisplayTime(ULONG displayTime)
     267HRESULT FirmwareSettings::setLogoDisplayTime(ULONG displayTime)
    268268{
    269269    /* the machine needs to be mutable */
     
    278278    alock.release();
    279279    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    280     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    281 
    282     return S_OK;
    283 }
    284 
    285 
    286 HRESULT BIOSSettings::getLogoImagePath(com::Utf8Str &imagePath)
     280    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     281
     282    return S_OK;
     283}
     284
     285
     286HRESULT FirmwareSettings::getLogoImagePath(com::Utf8Str &imagePath)
    287287{
    288288    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    292292}
    293293
    294 HRESULT BIOSSettings::setLogoImagePath(const com::Utf8Str &imagePath)
     294HRESULT FirmwareSettings::setLogoImagePath(const com::Utf8Str &imagePath)
    295295{
    296296    /* the machine needs to be mutable */
     
    305305    alock.release();
    306306    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    307     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    308 
    309     return S_OK;
    310 }
    311 
    312 HRESULT BIOSSettings::getBootMenuMode(BIOSBootMenuMode_T *bootMenuMode)
    313 {
    314     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    315 
    316     *bootMenuMode = m->bd->biosBootMenuMode;
    317     return S_OK;
    318 }
    319 
    320 HRESULT BIOSSettings::setBootMenuMode(BIOSBootMenuMode_T bootMenuMode)
    321 {
    322     /* the machine needs to be mutable */
    323     AutoMutableStateDependency adep(m->pMachine);
    324     if (FAILED(adep.hrc())) return adep.hrc();
    325 
    326     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    327 
    328     m->bd.backup();
    329     m->bd->biosBootMenuMode = bootMenuMode;
    330 
    331     alock.release();
    332     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    333     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    334 
    335     return S_OK;
    336 }
    337 
    338 
    339 HRESULT BIOSSettings::getACPIEnabled(BOOL *enabled)
     307    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     308
     309    return S_OK;
     310}
     311
     312HRESULT FirmwareSettings::getBootMenuMode(FirmwareBootMenuMode_T *bootMenuMode)
     313{
     314    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     315
     316    *bootMenuMode = m->bd->enmBootMenuMode;
     317    return S_OK;
     318}
     319
     320HRESULT FirmwareSettings::setBootMenuMode(FirmwareBootMenuMode_T bootMenuMode)
     321{
     322    /* the machine needs to be mutable */
     323    AutoMutableStateDependency adep(m->pMachine);
     324    if (FAILED(adep.hrc())) return adep.hrc();
     325
     326    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     327
     328    m->bd.backup();
     329    m->bd->enmBootMenuMode = bootMenuMode;
     330
     331    alock.release();
     332    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
     333    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     334
     335    return S_OK;
     336}
     337
     338
     339HRESULT FirmwareSettings::getACPIEnabled(BOOL *enabled)
    340340{
    341341    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    346346}
    347347
    348 HRESULT BIOSSettings::setACPIEnabled(BOOL enable)
     348HRESULT FirmwareSettings::setACPIEnabled(BOOL enable)
    349349{
    350350    /* the machine needs to be mutable */
     
    359359    alock.release();
    360360    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    361     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    362 
    363     return S_OK;
    364 }
    365 
    366 
    367 HRESULT BIOSSettings::getIOAPICEnabled(BOOL *aIOAPICEnabled)
     361    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     362
     363    return S_OK;
     364}
     365
     366
     367HRESULT FirmwareSettings::getIOAPICEnabled(BOOL *aIOAPICEnabled)
    368368{
    369369    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    374374}
    375375
    376 HRESULT BIOSSettings::setIOAPICEnabled(BOOL aIOAPICEnabled)
     376HRESULT FirmwareSettings::getFirmwareType(FirmwareType_T *aType)
     377{
     378    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     379
     380    *aType = m->bd->firmwareType;
     381
     382    return S_OK;
     383}
     384
     385HRESULT FirmwareSettings::setFirmwareType(FirmwareType_T aType)
     386{
     387    /* the machine needs to be mutable */
     388    AutoMutableStateDependency adep(m->pMachine);
     389    if (FAILED(adep.hrc())) return adep.hrc();
     390
     391    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     392
     393    m->bd.backup();
     394    m->bd->firmwareType = aType;
     395
     396    alock.release();
     397
     398    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // pMachine is const, needs no locking
     399    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     400    Utf8Str strNVRAM = m->pMachine->i_getDefaultNVRAMFilename();
     401    mlock.release();
     402
     403    m->pMachine->i_getNVRAMStore()->i_updateNonVolatileStorageFile(strNVRAM);
     404
     405    return S_OK;
     406}
     407
     408HRESULT FirmwareSettings::setIOAPICEnabled(BOOL aIOAPICEnabled)
    377409{
    378410    /* the machine needs to be mutable */
     
    387419    alock.release();
    388420    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    389     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    390 
    391     return S_OK;
    392 }
    393 
    394 
    395 HRESULT BIOSSettings::getAPICMode(APICMode_T *aAPICMode)
     421    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     422
     423    return S_OK;
     424}
     425
     426
     427HRESULT FirmwareSettings::getAPICMode(APICMode_T *aAPICMode)
    396428{
    397429    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    402434}
    403435
    404 HRESULT BIOSSettings::setAPICMode(APICMode_T aAPICMode)
     436HRESULT FirmwareSettings::setAPICMode(APICMode_T aAPICMode)
    405437{
    406438    /* the machine needs to be mutable */
     
    415447    alock.release();
    416448    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    417     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    418 
    419     return S_OK;
    420 }
    421 
    422 
    423 HRESULT BIOSSettings::getPXEDebugEnabled(BOOL *enabled)
     449    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     450
     451    return S_OK;
     452}
     453
     454
     455HRESULT FirmwareSettings::getPXEDebugEnabled(BOOL *enabled)
    424456{
    425457    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    430462}
    431463
    432 HRESULT BIOSSettings::setPXEDebugEnabled(BOOL enable)
     464HRESULT FirmwareSettings::setPXEDebugEnabled(BOOL enable)
    433465{
    434466    /* the machine needs to be mutable */
     
    443475    alock.release();
    444476    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    445     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    446 
    447     return S_OK;
    448 }
    449 
    450 
    451 HRESULT BIOSSettings::getTimeOffset(LONG64 *offset)
     477    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     478
     479    return S_OK;
     480}
     481
     482
     483HRESULT FirmwareSettings::getTimeOffset(LONG64 *offset)
    452484{
    453485    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    458490}
    459491
    460 HRESULT BIOSSettings::setTimeOffset(LONG64 offset)
     492HRESULT FirmwareSettings::setTimeOffset(LONG64 offset)
    461493{
    462494    /* the machine needs to be mutable */
     
    471503    alock.release();
    472504    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    473     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    474 
    475     return S_OK;
    476 }
    477 
    478 
    479 HRESULT BIOSSettings::getSMBIOSUuidLittleEndian(BOOL *enabled)
     505    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     506
     507    return S_OK;
     508}
     509
     510
     511HRESULT FirmwareSettings::getSMBIOSUuidLittleEndian(BOOL *enabled)
    480512{
    481513    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    486518}
    487519
    488 HRESULT BIOSSettings::setSMBIOSUuidLittleEndian(BOOL enable)
     520HRESULT FirmwareSettings::setSMBIOSUuidLittleEndian(BOOL enable)
    489521{
    490522    /* the machine needs to be mutable */
     
    499531    alock.release();
    500532    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    501     m->pMachine->i_setModified(Machine::IsModified_BIOS);
    502 
    503     return S_OK;
    504 }
    505 
    506 
    507 // IBIOSSettings methods
     533    m->pMachine->i_setModified(Machine::IsModified_Firmware);
     534
     535    return S_OK;
     536}
     537
     538
     539// IFirmwareSettings methods
    508540/////////////////////////////////////////////////////////////////////////////
    509541
     
    519551 *  @note Locks this object for writing.
    520552 */
    521 HRESULT BIOSSettings::i_loadSettings(const settings::BIOSSettings &data)
     553HRESULT FirmwareSettings::i_loadSettings(const settings::FirmwareSettings &data)
    522554{
    523555    AutoCaller autoCaller(this);
     
    539571 *  @note Locks this object for reading.
    540572 */
    541 HRESULT BIOSSettings::i_saveSettings(settings::BIOSSettings &data)
     573HRESULT FirmwareSettings::i_saveSettings(settings::FirmwareSettings &data)
    542574{
    543575    AutoCaller autoCaller(this);
     
    551583}
    552584
    553 void BIOSSettings::i_rollback()
     585FirmwareType_T FirmwareSettings::i_getFirmwareType() const
     586{
     587    return m->bd->firmwareType;
     588}
     589
     590void FirmwareSettings::i_rollback()
    554591{
    555592    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    557594}
    558595
    559 void BIOSSettings::i_commit()
     596void FirmwareSettings::i_commit()
    560597{
    561598    /* sanity */
     
    583620}
    584621
    585 void BIOSSettings::i_copyFrom(BIOSSettings *aThat)
     622void FirmwareSettings::i_copyFrom(FirmwareSettings *aThat)
    586623{
    587624    AssertReturnVoid(aThat != NULL);
     
    604641}
    605642
    606 void BIOSSettings::i_applyDefaults(GuestOSType *aOsType)
     643void FirmwareSettings::i_applyDefaults(GuestOSType *aOsType)
    607644{
    608645    /* sanity */
     
    612649    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    613650
    614     /* Initialize default BIOS settings here */
     651    /* Initialize default firmware settings here */
    615652    if (aOsType)
     653    {
     654        HRESULT hrc = aOsType->COMGETTER(RecommendedFirmware)(&m->bd->firmwareType);
     655        AssertComRC(hrc);
     656
    616657        m->bd->fIOAPICEnabled = aOsType->i_recommendedIOAPIC();
     658    }
    617659    else
     660    {
     661        m->bd->firmwareType   = FirmwareType_BIOS; /** @todo BUGBUG Handle ARM? */
    618662        m->bd->fIOAPICEnabled = true;
    619 }
    620 
    621 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
     663    }
     664
     665    /// @todo r=andy BUGBUG Is this really enough here? What about the other stuff?
     666}
     667
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