Changeset 43209 in vbox
- Timestamp:
- Sep 5, 2012 6:04:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/DevOVMF.cpp
r43157 r43209 79 79 uint32_t idxOpBuffer; 80 80 EFIVAR OperationVarOp; 81 int cNvramVar aibles;81 int cNvramVariables; 82 82 int iNvramLastIndex; 83 RTLISTANCHORNvramVariableList;83 EFIVAR NvramVariableList; 84 84 int idxCurrentVar; 85 85 PEFIVAR pCurrentVarOp; … … 170 170 SSMFIELD_ENTRY (NVRAMDESC, u32Status), 171 171 SSMFIELD_ENTRY (NVRAMDESC, idxOpBuffer), 172 SSMFIELD_ENTRY 173 SSMFIELD_ENTRY (NVRAMDESC, cNvramVar aibles),172 SSMFIELD_ENTRY_IGNORE (NVRAMDESC, OperationVarOp), 173 SSMFIELD_ENTRY (NVRAMDESC, cNvramVariables), 174 174 SSMFIELD_ENTRY (NVRAMDESC, iNvramLastIndex), 175 175 SSMFIELD_ENTRY_IGNORE (NVRAMDESC, NvramVariableList), … … 208 208 { 209 209 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); 213 213 RTListNodeRemove(&pEfiVar->List); 214 214 RTMemFree(pEfiVar); … … 224 224 PEFIVAR pEfiVar = NULL; 225 225 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) 227 228 { 228 229 LogFlowFunc(("pEfiVar:%p\n", pEfiVar)); 230 idxVar++; 229 231 if ( pEfiVar 230 232 && RTUuidCompare(pUuid, &pEfiVar->uuid) == 0 … … 236 238 } 237 239 } 240 Assert(pThis->NVRAM.cNvramVariables >= idxVar); 238 241 LogFlowFuncLeaveRC(rc); 239 242 return rc; … … 268 271 break; 269 272 } 270 RTListAppend((PRTLISTNODE)&pThis->NVRAM.NvramVariableList, &pEfiVar->List); 273 pThis->NVRAM.cNvramVariables++; 274 RTListAppend((PRTLISTNODE)&pThis->NVRAM.NvramVariableList.List, &pEfiVar->List); 271 275 } 272 276 if ( RT_FAILURE(rc) … … 284 288 pThis->Lun0.pNvramDown->pfnFlushNvramStorage(pThis->Lun0.pNvramDown); 285 289 286 RTListForEach((PRTLISTNODE)&pThis->NVRAM.NvramVariableList , pEfiVar, EFIVAR, List)290 RTListForEach((PRTLISTNODE)&pThis->NVRAM.NvramVariableList.List, pEfiVar, EFIVAR, List) 287 291 { 288 292 pThis->Lun0.pNvramDown->pfnStoreNvramValue(pThis->Lun0.pNvramDown, … … 295 299 idxVar++; 296 300 } 301 Assert((pThis->NVRAM.cNvramVariables == idxVar)); 297 302 return VINF_SUCCESS; 298 303 } … … 392 397 LogFlowFuncEnter(); 393 398 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)); 400 412 LogFlowFuncLeaveRC(rc); 401 413 return rc; … … 414 426 if (uVersion == 1) 415 427 { 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); 418 432 int idxVariable = 0; 419 Assert(RTListIsEmpty(&pThis->NVRAM.NvramVariableList ));420 RTListInit(&pThis->NVRAM.NvramVariableList );421 for (idxVariable = 0; idxVariable < pThis->NVRAM.cNvramVar aibles; ++idxVariable)433 Assert(RTListIsEmpty(&pThis->NVRAM.NvramVariableList.List)); 434 RTListInit(&pThis->NVRAM.NvramVariableList.List); 435 for (idxVariable = 0; idxVariable < pThis->NVRAM.cNvramVariables; ++idxVariable) 422 436 { 423 437 PEFIVAR pEfiVar = (PEFIVAR)RTMemAllocZ(sizeof(EFIVAR)); 424 438 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 426 443 RTListInit(&pEfiVar->List); 427 RTListAppend(&pThis->NVRAM.NvramVariableList, &pEfiVar->List); 444 RTListAppend(&pThis->NVRAM.NvramVariableList.List, &pEfiVar->List); 445 428 446 if (pThis->NVRAM.idxCurrentVar == pEfiVar->idxVariable) 429 447 pThis->NVRAM.pCurrentVarOp = pEfiVar; … … 440 458 PDEVEFI pThis = PDMINS_2_DATA(pDevIns, PDEVEFI); 441 459 LogFlowFuncEnter(); 442 if (RTListIsEmpty(&pThis->NVRAM.NvramVariableList ))460 if (RTListIsEmpty(&pThis->NVRAM.NvramVariableList.List)) 443 461 nvramLoad(pThis); 444 462 LogFlowFuncLeaveRC(rc); … … 738 756 RTMemFree(pEfiVar); 739 757 pThis->NVRAM.u32Status = EFI_VARIABLE_OP_STATUS_OK; 740 pThis->NVRAM.cNvramVar aibles--;758 pThis->NVRAM.cNvramVariables--; 741 759 } 742 760 else … … 767 785 memcpy(pEfiVar, &pThis->NVRAM.OperationVarOp, sizeof(EFIVAR)); 768 786 RTListInit(&pEfiVar->List); 769 RTListAppend(&pThis->NVRAM.NvramVariableList , &pEfiVar->List);787 RTListAppend(&pThis->NVRAM.NvramVariableList.List, &pEfiVar->List); 770 788 pThis->NVRAM.u32Status = EFI_VARIABLE_OP_STATUS_OK; 771 pThis->NVRAM.cNvramVar aibles++;789 pThis->NVRAM.cNvramVariables++; 772 790 pEfiVar->idxVariable = pThis->NVRAM.iNvramLastIndex; 773 791 pThis->NVRAM.iNvramLastIndex++; 774 792 } 775 793 } 794 LogFunc(("cNvramVariables:%d, iNvramLastIndex:%d\n", pThis->NVRAM.cNvramVariables, pThis->NVRAM.iNvramLastIndex)); 776 795 break; 777 796 case EFI_VARIABLE_OP_QUERY_NEXT: … … 1260 1279 uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion); 1261 1280 memcpy(&pThis->aUuid, &uuid, sizeof pThis->aUuid); 1262 RTListInit((PRTLISTNODE)&pThis->NVRAM.NvramVariableList );1281 RTListInit((PRTLISTNODE)&pThis->NVRAM.NvramVariableList.List); 1263 1282 1264 1283
Note:
See TracChangeset
for help on using the changeset viewer.