Changeset 101038 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Sep 7, 2023 9:21:54 AM (17 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/FirmwareSettingsImpl.cpp
r101037 r101038 1 1 /* $Id$ */ 2 2 /** @file 3 * VirtualBox COM class implementation - Machine BIOSsettings.3 * VirtualBox COM class implementation - Machine firmware settings. 4 4 */ 5 5 … … 26 26 */ 27 27 28 #define LOG_GROUP LOG_GROUP_MAIN_ BIOSSETTINGS29 #include " BIOSSettingsImpl.h"28 #define LOG_GROUP LOG_GROUP_MAIN_FIRMWARESETTINGS 29 #include "FirmwareSettingsImpl.h" 30 30 #include "MachineImpl.h" 31 31 #include "GuestOSTypeImpl.h" … … 41 41 //////////////////////////////////////////////////////////////////////////////// 42 42 // 43 // BIOSSettings private data definition43 // FirmwareSettings private data definition 44 44 // 45 45 //////////////////////////////////////////////////////////////////////////////// 46 46 47 struct BIOSSettings::Data47 struct FirmwareSettings::Data 48 48 { 49 49 Data() … … 52 52 53 53 Machine * const pMachine; 54 ComObjPtr< BIOSSettings>pPeer;54 ComObjPtr<FirmwareSettings> pPeer; 55 55 56 56 // use the XML settings structure in the members for simplicity 57 Backupable<settings:: BIOSSettings> bd;57 Backupable<settings::FirmwareSettings> bd; 58 58 }; 59 59 … … 61 61 ///////////////////////////////////////////////////////////////////////////// 62 62 63 DEFINE_EMPTY_CTOR_DTOR( BIOSSettings)64 65 HRESULT BIOSSettings::FinalConstruct()63 DEFINE_EMPTY_CTOR_DTOR(FirmwareSettings) 64 65 HRESULT FirmwareSettings::FinalConstruct() 66 66 { 67 67 return BaseFinalConstruct(); 68 68 } 69 69 70 void BIOSSettings::FinalRelease()70 void FirmwareSettings::FinalRelease() 71 71 { 72 72 uninit(); … … 82 82 * @returns COM result indicator 83 83 */ 84 HRESULT BIOSSettings::init(Machine *aParent)84 HRESULT FirmwareSettings::init(Machine *aParent) 85 85 { 86 86 LogFlowThisFuncEnter(); … … 107 107 108 108 /** 109 * Initializes the BIOS settings object given another BIOSsettings object109 * Initializes the firmware settings object given another firmware settings object 110 110 * (a kind of copy constructor). This object shares data with 111 111 * the object passed as an argument. … … 114 114 * it shares data with is destroyed. 115 115 */ 116 HRESULT BIOSSettings::init(Machine *aParent, BIOSSettings *that)116 HRESULT FirmwareSettings::init(Machine *aParent, FirmwareSettings *that) 117 117 { 118 118 LogFlowThisFuncEnter(); … … 144 144 * of the original object passed as an argument. 145 145 */ 146 HRESULT BIOSSettings::initCopy(Machine *aParent, BIOSSettings *that)146 HRESULT FirmwareSettings::initCopy(Machine *aParent, FirmwareSettings *that) 147 147 { 148 148 LogFlowThisFuncEnter(); … … 173 173 * Called either from FinalRelease() or by the parent when it gets destroyed. 174 174 */ 175 void BIOSSettings::uninit()175 void FirmwareSettings::uninit() 176 176 { 177 177 LogFlowThisFuncEnter(); … … 193 193 } 194 194 195 // I BIOSSettings properties195 // IFirmwareSettings properties 196 196 ///////////////////////////////////////////////////////////////////////////// 197 197 198 198 199 HRESULT BIOSSettings::getLogoFadeIn(BOOL *enabled)199 HRESULT FirmwareSettings::getLogoFadeIn(BOOL *enabled) 200 200 { 201 201 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 206 206 } 207 207 208 HRESULT BIOSSettings::setLogoFadeIn(BOOL enable)208 HRESULT FirmwareSettings::setLogoFadeIn(BOOL enable) 209 209 { 210 210 /* the machine needs to be mutable */ … … 219 219 alock.release(); 220 220 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 227 HRESULT FirmwareSettings::getLogoFadeOut(BOOL *enabled) 228 228 { 229 229 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 234 234 } 235 235 236 HRESULT BIOSSettings::setLogoFadeOut(BOOL enable)236 HRESULT FirmwareSettings::setLogoFadeOut(BOOL enable) 237 237 { 238 238 /* the machine needs to be mutable */ … … 247 247 alock.release(); 248 248 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 255 HRESULT FirmwareSettings::getLogoDisplayTime(ULONG *displayTime) 256 256 { 257 257 if (!displayTime) … … 265 265 } 266 266 267 HRESULT BIOSSettings::setLogoDisplayTime(ULONG displayTime)267 HRESULT FirmwareSettings::setLogoDisplayTime(ULONG displayTime) 268 268 { 269 269 /* the machine needs to be mutable */ … … 278 278 alock.release(); 279 279 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 286 HRESULT FirmwareSettings::getLogoImagePath(com::Utf8Str &imagePath) 287 287 { 288 288 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 292 292 } 293 293 294 HRESULT BIOSSettings::setLogoImagePath(const com::Utf8Str &imagePath)294 HRESULT FirmwareSettings::setLogoImagePath(const com::Utf8Str &imagePath) 295 295 { 296 296 /* the machine needs to be mutable */ … … 305 305 alock.release(); 306 306 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 312 HRESULT 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 320 HRESULT 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 339 HRESULT FirmwareSettings::getACPIEnabled(BOOL *enabled) 340 340 { 341 341 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 346 346 } 347 347 348 HRESULT BIOSSettings::setACPIEnabled(BOOL enable)348 HRESULT FirmwareSettings::setACPIEnabled(BOOL enable) 349 349 { 350 350 /* the machine needs to be mutable */ … … 359 359 alock.release(); 360 360 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 367 HRESULT FirmwareSettings::getIOAPICEnabled(BOOL *aIOAPICEnabled) 368 368 { 369 369 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 374 374 } 375 375 376 HRESULT BIOSSettings::setIOAPICEnabled(BOOL aIOAPICEnabled) 376 HRESULT 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 385 HRESULT 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 408 HRESULT FirmwareSettings::setIOAPICEnabled(BOOL aIOAPICEnabled) 377 409 { 378 410 /* the machine needs to be mutable */ … … 387 419 alock.release(); 388 420 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 427 HRESULT FirmwareSettings::getAPICMode(APICMode_T *aAPICMode) 396 428 { 397 429 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 402 434 } 403 435 404 HRESULT BIOSSettings::setAPICMode(APICMode_T aAPICMode)436 HRESULT FirmwareSettings::setAPICMode(APICMode_T aAPICMode) 405 437 { 406 438 /* the machine needs to be mutable */ … … 415 447 alock.release(); 416 448 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 455 HRESULT FirmwareSettings::getPXEDebugEnabled(BOOL *enabled) 424 456 { 425 457 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 430 462 } 431 463 432 HRESULT BIOSSettings::setPXEDebugEnabled(BOOL enable)464 HRESULT FirmwareSettings::setPXEDebugEnabled(BOOL enable) 433 465 { 434 466 /* the machine needs to be mutable */ … … 443 475 alock.release(); 444 476 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 483 HRESULT FirmwareSettings::getTimeOffset(LONG64 *offset) 452 484 { 453 485 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 458 490 } 459 491 460 HRESULT BIOSSettings::setTimeOffset(LONG64 offset)492 HRESULT FirmwareSettings::setTimeOffset(LONG64 offset) 461 493 { 462 494 /* the machine needs to be mutable */ … … 471 503 alock.release(); 472 504 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 511 HRESULT FirmwareSettings::getSMBIOSUuidLittleEndian(BOOL *enabled) 480 512 { 481 513 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 486 518 } 487 519 488 HRESULT BIOSSettings::setSMBIOSUuidLittleEndian(BOOL enable)520 HRESULT FirmwareSettings::setSMBIOSUuidLittleEndian(BOOL enable) 489 521 { 490 522 /* the machine needs to be mutable */ … … 499 531 alock.release(); 500 532 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 // I BIOSSettings methods533 m->pMachine->i_setModified(Machine::IsModified_Firmware); 534 535 return S_OK; 536 } 537 538 539 // IFirmwareSettings methods 508 540 ///////////////////////////////////////////////////////////////////////////// 509 541 … … 519 551 * @note Locks this object for writing. 520 552 */ 521 HRESULT BIOSSettings::i_loadSettings(const settings::BIOSSettings &data)553 HRESULT FirmwareSettings::i_loadSettings(const settings::FirmwareSettings &data) 522 554 { 523 555 AutoCaller autoCaller(this); … … 539 571 * @note Locks this object for reading. 540 572 */ 541 HRESULT BIOSSettings::i_saveSettings(settings::BIOSSettings &data)573 HRESULT FirmwareSettings::i_saveSettings(settings::FirmwareSettings &data) 542 574 { 543 575 AutoCaller autoCaller(this); … … 551 583 } 552 584 553 void BIOSSettings::i_rollback() 585 FirmwareType_T FirmwareSettings::i_getFirmwareType() const 586 { 587 return m->bd->firmwareType; 588 } 589 590 void FirmwareSettings::i_rollback() 554 591 { 555 592 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 557 594 } 558 595 559 void BIOSSettings::i_commit()596 void FirmwareSettings::i_commit() 560 597 { 561 598 /* sanity */ … … 583 620 } 584 621 585 void BIOSSettings::i_copyFrom(BIOSSettings *aThat)622 void FirmwareSettings::i_copyFrom(FirmwareSettings *aThat) 586 623 { 587 624 AssertReturnVoid(aThat != NULL); … … 604 641 } 605 642 606 void BIOSSettings::i_applyDefaults(GuestOSType *aOsType)643 void FirmwareSettings::i_applyDefaults(GuestOSType *aOsType) 607 644 { 608 645 /* sanity */ … … 612 649 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 613 650 614 /* Initialize default BIOSsettings here */651 /* Initialize default firmware settings here */ 615 652 if (aOsType) 653 { 654 HRESULT hrc = aOsType->COMGETTER(RecommendedFirmware)(&m->bd->firmwareType); 655 AssertComRC(hrc); 656 616 657 m->bd->fIOAPICEnabled = aOsType->i_recommendedIOAPIC(); 658 } 617 659 else 660 { 661 m->bd->firmwareType = FirmwareType_BIOS; /** @todo BUGBUG Handle ARM? */ 618 662 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.