VirtualBox

Changeset 43209 in vbox


Ignore:
Timestamp:
Sep 5, 2012 6:04:59 PM (12 years ago)
Author:
vboxsync
Message:

EFI: nits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/DevOVMF.cpp

    r43157 r43209  
    7979    uint32_t        idxOpBuffer;
    8080    EFIVAR          OperationVarOp;
    81     int             cNvramVaraibles;
     81    int             cNvramVariables;
    8282    int             iNvramLastIndex;
    83     RTLISTANCHOR    NvramVariableList;
     83    EFIVAR          NvramVariableList;
    8484    int             idxCurrentVar;
    8585    PEFIVAR         pCurrentVarOp;
     
    170170        SSMFIELD_ENTRY          (NVRAMDESC, u32Status),
    171171        SSMFIELD_ENTRY          (NVRAMDESC, idxOpBuffer),
    172         SSMFIELD_ENTRY          (NVRAMDESC, OperationVarOp),
    173         SSMFIELD_ENTRY          (NVRAMDESC, cNvramVaraibles),
     172        SSMFIELD_ENTRY_IGNORE   (NVRAMDESC, OperationVarOp),
     173        SSMFIELD_ENTRY          (NVRAMDESC, cNvramVariables),
    174174        SSMFIELD_ENTRY          (NVRAMDESC, iNvramLastIndex),
    175175        SSMFIELD_ENTRY_IGNORE   (NVRAMDESC, NvramVariableList),
     
    208208{
    209209    PEFIVAR pEfiVar = NULL;
    210     while (!RTListIsEmpty(&pThis->NVRAM.NvramVariableList))
    211     {
    212         pEfiVar = RTListNodeGetNext(&pThis->NVRAM.NvramVariableList, EFIVAR, List);
     210    while (!RTListIsEmpty(&pThis->NVRAM.NvramVariableList.List))
     211    {
     212        pEfiVar = RTListNodeGetNext(&pThis->NVRAM.NvramVariableList.List, EFIVAR, List);
    213213        RTListNodeRemove(&pEfiVar->List);
    214214        RTMemFree(pEfiVar);
     
    224224    PEFIVAR pEfiVar = NULL;
    225225    LogFlowFunc(("pszVariableName:%s, pUuid:%RTuuid\n", pszVariableName, pUuid));
    226     RTListForEach((PRTLISTNODE)&pThis->NVRAM.NvramVariableList, pEfiVar, EFIVAR, List)
     226    int idxVar = 0;
     227    RTListForEach((PRTLISTNODE)&pThis->NVRAM.NvramVariableList.List, pEfiVar, EFIVAR, List)
    227228    {
    228229        LogFlowFunc(("pEfiVar:%p\n", pEfiVar));
     230        idxVar++;
    229231        if (   pEfiVar
    230232            && RTUuidCompare(pUuid, &pEfiVar->uuid) == 0
     
    236238        }
    237239    }
     240    Assert(pThis->NVRAM.cNvramVariables >= idxVar);
    238241    LogFlowFuncLeaveRC(rc);
    239242    return rc;
     
    268271            break;
    269272        }
    270         RTListAppend((PRTLISTNODE)&pThis->NVRAM.NvramVariableList, &pEfiVar->List);
     273        pThis->NVRAM.cNvramVariables++;
     274        RTListAppend((PRTLISTNODE)&pThis->NVRAM.NvramVariableList.List, &pEfiVar->List);
    271275    }
    272276    if (   RT_FAILURE(rc)
     
    284288    pThis->Lun0.pNvramDown->pfnFlushNvramStorage(pThis->Lun0.pNvramDown);
    285289
    286     RTListForEach((PRTLISTNODE)&pThis->NVRAM.NvramVariableList, pEfiVar, EFIVAR, List)
     290    RTListForEach((PRTLISTNODE)&pThis->NVRAM.NvramVariableList.List, pEfiVar, EFIVAR, List)
    287291    {
    288292        pThis->Lun0.pNvramDown->pfnStoreNvramValue(pThis->Lun0.pNvramDown,
     
    295299        idxVar++;
    296300    }
     301    Assert((pThis->NVRAM.cNvramVariables == idxVar));
    297302    return VINF_SUCCESS;
    298303}
     
    392397    LogFlowFuncEnter();
    393398    PDEVEFI pThis = PDMINS_2_DATA(pDevIns, PDEVEFI);
    394     SSMR3PutStructEx(pSSM, &pThis->NVRAM, sizeof(NVRAMDESC), 0, g_aEfiNvramDescField, NULL);
    395     SSMR3PutStructEx(pSSM, &pThis->NVRAM.OperationVarOp, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
    396     RTListForEach((PRTLISTNODE)&pThis->NVRAM.NvramVariableList, pEfiVar, EFIVAR, List)
    397     {
    398         SSMR3PutStructEx(pSSM, pEfiVar, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
    399     }
     399    rc = SSMR3PutStructEx(pSSM, &pThis->NVRAM, sizeof(NVRAMDESC), 0, g_aEfiNvramDescField, NULL);
     400    AssertRCReturn(rc, rc);
     401    rc = SSMR3PutStructEx(pSSM, &pThis->NVRAM.OperationVarOp, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
     402    AssertRCReturn(rc, rc);
     403    int idxV = 0;
     404    RTListForEach(&pThis->NVRAM.NvramVariableList.List, pEfiVar, EFIVAR, List)
     405    {
     406        rc = SSMR3PutStructEx(pSSM, pEfiVar, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
     407        AssertRCReturn(rc, rc);
     408        idxV++;
     409    }
     410    Assert((pThis->NVRAM.cNvramVariables == idxV));
     411    Log2(("idxV: %d\n", idxV));
    400412    LogFlowFuncLeaveRC(rc);
    401413    return rc;
     
    414426    if (uVersion == 1)
    415427    {
    416         SSMR3GetStructEx(pSSM, &pThis->NVRAM, sizeof(NVRAMDESC), 0, g_aEfiNvramDescField, NULL);
    417         SSMR3GetStructEx(pSSM, &pThis->NVRAM.OperationVarOp, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
     428        rc = SSMR3GetStructEx(pSSM, &pThis->NVRAM, sizeof(NVRAMDESC), 0, g_aEfiNvramDescField, NULL);
     429        AssertRCReturn(rc, rc);
     430        rc = SSMR3GetStructEx(pSSM, &pThis->NVRAM.OperationVarOp, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
     431        AssertRCReturn(rc, rc);
    418432        int idxVariable = 0;
    419         Assert(RTListIsEmpty(&pThis->NVRAM.NvramVariableList));
    420         RTListInit(&pThis->NVRAM.NvramVariableList);
    421         for (idxVariable = 0; idxVariable < pThis->NVRAM.cNvramVaraibles; ++idxVariable)
     433        Assert(RTListIsEmpty(&pThis->NVRAM.NvramVariableList.List));
     434        RTListInit(&pThis->NVRAM.NvramVariableList.List);
     435        for (idxVariable = 0; idxVariable < pThis->NVRAM.cNvramVariables; ++idxVariable)
    422436        {
    423437            PEFIVAR pEfiVar = (PEFIVAR)RTMemAllocZ(sizeof(EFIVAR));
    424438            AssertPtrReturn(pEfiVar, VERR_NO_MEMORY);
    425             SSMR3GetStructEx(pSSM, pEfiVar, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
     439
     440            rc = SSMR3GetStructEx(pSSM, pEfiVar, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
     441            AssertRCReturn(rc, rc);
     442
    426443            RTListInit(&pEfiVar->List);
    427             RTListAppend(&pThis->NVRAM.NvramVariableList, &pEfiVar->List);
     444            RTListAppend(&pThis->NVRAM.NvramVariableList.List, &pEfiVar->List);
     445
    428446            if (pThis->NVRAM.idxCurrentVar == pEfiVar->idxVariable)
    429447                pThis->NVRAM.pCurrentVarOp = pEfiVar;
     
    440458    PDEVEFI pThis = PDMINS_2_DATA(pDevIns, PDEVEFI);
    441459    LogFlowFuncEnter();
    442     if (RTListIsEmpty(&pThis->NVRAM.NvramVariableList))
     460    if (RTListIsEmpty(&pThis->NVRAM.NvramVariableList.List))
    443461        nvramLoad(pThis);
    444462    LogFlowFuncLeaveRC(rc);
     
    738756                                    RTMemFree(pEfiVar);
    739757                                    pThis->NVRAM.u32Status = EFI_VARIABLE_OP_STATUS_OK;
    740                                     pThis->NVRAM.cNvramVaraibles--;
     758                                    pThis->NVRAM.cNvramVariables--;
    741759                                }
    742760                                else
     
    767785                                memcpy(pEfiVar, &pThis->NVRAM.OperationVarOp, sizeof(EFIVAR));
    768786                                RTListInit(&pEfiVar->List);
    769                                 RTListAppend(&pThis->NVRAM.NvramVariableList, &pEfiVar->List);
     787                                RTListAppend(&pThis->NVRAM.NvramVariableList.List, &pEfiVar->List);
    770788                                pThis->NVRAM.u32Status = EFI_VARIABLE_OP_STATUS_OK;
    771                                 pThis->NVRAM.cNvramVaraibles++;
     789                                pThis->NVRAM.cNvramVariables++;
    772790                                pEfiVar->idxVariable = pThis->NVRAM.iNvramLastIndex;
    773791                                pThis->NVRAM.iNvramLastIndex++;
    774792                            }
    775793                        }
     794                        LogFunc(("cNvramVariables:%d, iNvramLastIndex:%d\n", pThis->NVRAM.cNvramVariables, pThis->NVRAM.iNvramLastIndex));
    776795                        break;
    777796                        case EFI_VARIABLE_OP_QUERY_NEXT:
     
    12601279    uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion);
    12611280    memcpy(&pThis->aUuid, &uuid, sizeof pThis->aUuid);
    1262     RTListInit((PRTLISTNODE)&pThis->NVRAM.NvramVariableList);
     1281    RTListInit((PRTLISTNODE)&pThis->NVRAM.NvramVariableList.List);
    12631282
    12641283
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