VirtualBox

Ignore:
Timestamp:
Aug 7, 2008 6:12:17 PM (16 years ago)
Author:
vboxsync
Message:

DevAPIC: CFGM*Def and cosmetics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevAPIC.cpp

    r11219 r11222  
    16791679     * Validate configuration.
    16801680     */
    1681     if (!CFGMR3AreValuesValid(pCfgHandle, "IOAPIC\0GCEnabled\0R0Enabled\0"))
     1681    if (!CFGMR3AreValuesValid(pCfgHandle, "IOAPIC\0" "GCEnabled\0" "R0Enabled\0"))
    16821682        return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
    16831683
    1684     rc = CFGMR3QueryBool (pCfgHandle, "IOAPIC", &fIOAPIC);
    1685     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1686         fIOAPIC = true;
    1687     else if (VBOX_FAILURE (rc))
     1684    rc = CFGMR3QueryBoolDef(pCfgHandle, "IOAPIC", &fIOAPIC, true);
     1685    if (RT_FAILURE(rc))
    16881686        return PDMDEV_SET_ERROR(pDevIns, rc,
    16891687                                N_("Configuration error: Failed to read \"IOAPIC\""));
    16901688
    1691     rc = CFGMR3QueryBool(pCfgHandle, "GCEnabled", &fGCEnabled);
    1692     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1693         fGCEnabled = true;
    1694     else
     1689    rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true);
     1690    if (RT_FAILURE(rc))
    16951691        return PDMDEV_SET_ERROR(pDevIns, rc,
    16961692                                N_("Configuration error: Failed to query boolean value \"GCEnabled\""));
    1697     Log(("APIC: fGCEnabled=%d\n", fGCEnabled));
    1698 
    1699     rc = CFGMR3QueryBool(pCfgHandle, "R0Enabled", &fR0Enabled);
    1700     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    1701         fR0Enabled = true;
    1702     else
     1693
     1694    rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true);
     1695    if (RT_FAILURE(rc))
    17031696        return PDMDEV_SET_ERROR(pDevIns, rc,
    17041697                                N_("Configuration error: Failed to query boolean value \"R0Enabled\""));
    1705     Log(("APIC: fR0Enabled=%d\n", fR0Enabled));
     1698    Log(("APIC: fR0Enabled=%RTbool fGCEnabled=%RTbool fIOAPIC=%RTbool\n", fR0Enabled, fGCEnabled, fIOAPIC));
    17061699
    17071700    /*
     
    17641757    Assert(pDevIns->pDevHlp->pfnAPICRegister);
    17651758    rc = pDevIns->pDevHlp->pfnAPICRegister(pDevIns, &ApicReg, &pData->pApicHlpR3);
    1766     if (VBOX_FAILURE(rc))
     1759    if (RT_FAILURE(rc))
    17671760    {
    1768         AssertMsgFailed(("APICRegister -> %Vrc\n", rc));
     1761        AssertLogRelMsgFailed(("APICRegister -> %Vrc\n", rc));
    17691762        return rc;
    17701763    }
     
    17951788    rc = PDMDevHlpMMIORegister(pDevIns, pData->apicbase & ~0xfff, 0x1000, pData,
    17961789                               apicMMIOWrite, apicMMIORead, NULL, "APIC Memory");
    1797     if (VBOX_FAILURE(rc))
     1790    if (RT_FAILURE(rc))
    17981791        return rc;
    17991792
     
    18031796        rc = PDMDevHlpMMIORegisterGC(pDevIns, pData->apicbase & ~0xfff, 0x1000, 0,
    18041797                                     "apicMMIOWrite", "apicMMIORead", NULL);
    1805         if (VBOX_FAILURE(rc))
     1798        if (RT_FAILURE(rc))
    18061799            return rc;
    18071800    }
     
    18121805        rc = PDMDevHlpMMIORegisterR0(pDevIns, pData->apicbase & ~0xfff, 0x1000, 0,
    18131806                                     "apicMMIOWrite", "apicMMIORead", NULL);
    1814         if (VBOX_FAILURE(rc))
     1807        if (RT_FAILURE(rc))
    18151808            return rc;
    18161809    }
     
    18211814    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, apicTimer,
    18221815                                "APIC Timer", &pData->CTX_SUFF(pTimer));
    1823     if (VBOX_FAILURE(rc))
     1816    if (RT_FAILURE(rc))
    18241817        return rc;
    18251818    pData->pTimerR0 = TMTimerR0Ptr(pData->CTX_SUFF(pTimer));
     
    18311824    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1 /* version */,
    18321825                              sizeof(*pData), NULL, apicSaveExec, NULL, NULL, apicLoadExec, NULL);
    1833     if (VBOX_FAILURE(rc))
     1826    if (RT_FAILURE(rc))
    18341827        return rc;
    18351828
     
    20272020     * Validate and read the configuration.
    20282021     */
    2029     if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0R0Enabled\0"))
     2022    if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0" "R0Enabled\0"))
    20302023        return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
    20312024
    2032     rc = CFGMR3QueryBool(pCfgHandle, "GCEnabled", &fGCEnabled);
    2033     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    2034         fGCEnabled = true;
    2035     else if (VBOX_FAILURE(rc))
     2025    rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true);
     2026    if (RT_FAILURE(rc))
    20362027        return PDMDEV_SET_ERROR(pDevIns, rc,
    20372028                                N_("Configuration error: Failed to query boolean value \"GCEnabled\""));
    2038     Log(("IOAPIC: fGCEnabled=%d\n", fGCEnabled));
    2039 
    2040     rc = CFGMR3QueryBool(pCfgHandle, "R0Enabled", &fR0Enabled);
    2041     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    2042         fR0Enabled = true;
    2043     else if (VBOX_FAILURE(rc))
     2029
     2030    rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true);
     2031    if (RT_FAILURE(rc))
    20442032        return PDMDEV_SET_ERROR(pDevIns, rc,
    20452033                                N_("Configuration error: Failed to query boolean value \"R0Enabled\""));
    2046     Log(("IOAPIC: fR0Enabled=%d\n", fR0Enabled));
     2034    Log(("IOAPIC: fR0Enabled=%RTbool fGCEnabled=%RTbool\n", fR0Enabled, fGCEnabled));
    20472035
    20482036    /*
     
    20632051    IoApicReg.pszSetIrqR0 = fR0Enabled ? "ioapicSetIrq" : NULL;
    20642052    rc = pDevIns->pDevHlp->pfnIOAPICRegister(pDevIns, &IoApicReg, &s->pIoApicHlpR3);
    2065     if (VBOX_FAILURE(rc))
     2053    if (RT_FAILURE(rc))
    20662054    {
    20672055        AssertMsgFailed(("IOAPICRegister -> %Vrc\n", rc));
     
    20742062    rc = PDMDevHlpMMIORegister(pDevIns, 0xfec00000, 0x1000, s,
    20752063                               ioapicMMIOWrite, ioapicMMIORead, NULL, "I/O APIC Memory");
    2076     if (VBOX_FAILURE(rc))
     2064    if (RT_FAILURE(rc))
    20772065        return rc;
    20782066
     
    20822070        rc = PDMDevHlpMMIORegisterGC(pDevIns, 0xfec00000, 0x1000, 0,
    20832071                                     "ioapicMMIOWrite", "ioapicMMIORead", NULL);
    2084         if (VBOX_FAILURE(rc))
     2072        if (RT_FAILURE(rc))
    20852073            return rc;
    20862074    }
     
    20912079        rc = PDMDevHlpMMIORegisterR0(pDevIns, 0xfec00000, 0x1000, 0,
    20922080                                     "ioapicMMIOWrite", "ioapicMMIORead", NULL);
    2093         if (VBOX_FAILURE(rc))
     2081        if (RT_FAILURE(rc))
    20942082            return rc;
    20952083    }
     
    20972085    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1 /* version */,
    20982086                              sizeof(*s), NULL, ioapicSaveExec, NULL, NULL, ioapicLoadExec, NULL);
    2099     if (VBOX_FAILURE(rc))
     2087    if (RT_FAILURE(rc))
    21002088        return rc;
    21012089
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