Skip to content

Commit d4c23cb

Browse files
StevenPontslergldiviney
authored andcommitted
Pass Uid instead of NULL.
Attempt to find DIMM in other list of DIMMs and if found use value from it to set the Obj Status so message appears as expected. Signed-off-by: Steven Pontsler <[email protected]>
1 parent bd1cde3 commit d4c23cb

File tree

4 files changed

+62
-3
lines changed

4 files changed

+62
-3
lines changed

DcpmPkg/cli/ShowDimmsCommand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ ShowDimms(
598598
goto Finish;
599599
}
600600

601-
ReturnCode = GetPreferredDimmIdAsString(pUninitializedDimms[DimmIndex].DimmHandle, NULL, DimmStr,
601+
ReturnCode = GetPreferredDimmIdAsString(pUninitializedDimms[DimmIndex].DimmHandle, pUninitializedDimms[DimmIndex].DimmUid, DimmStr,
602602
MAX_DIMM_UID_LENGTH);
603603
pDimmErrStr = CatSPrint(NULL, FORMAT_STR, UNKNOWN_ATTRIB_VAL);
604604

DcpmPkg/driver/Core/Dimm.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6198,6 +6198,34 @@ GetDimmUid(
61986198
return ReturnCode;
61996199
}
62006200

6201+
/**
6202+
Set Obj Status when DIMM is not found using Id expected by end user
6203+
6204+
@param[in] DimmId the Pid for the DIMM that was not found
6205+
@param[in] pDimms Pointer to head of list where DimmId should be found
6206+
@param[out] pCommandStatus Pointer to command status structure
6207+
6208+
**/
6209+
VOID
6210+
SetObjStatusForDimmNotFound(
6211+
IN UINT16 DimmId,
6212+
IN LIST_ENTRY *pDimms,
6213+
OUT COMMAND_STATUS *pCommandStatus
6214+
)
6215+
{
6216+
DIMM *pCurrentDimm = NULL;
6217+
6218+
pCurrentDimm = GetDimmByPid(DimmId, pDimms);
6219+
if (pCurrentDimm != NULL) {
6220+
SetObjStatusForDimm(pCommandStatus, pCurrentDimm, NVM_ERR_DIMM_NOT_FOUND);
6221+
pCurrentDimm = NULL;
6222+
}
6223+
else
6224+
{
6225+
SetObjStatus(pCommandStatus, DimmId, NULL, 0, NVM_ERR_DIMM_NOT_FOUND);
6226+
}
6227+
}
6228+
62016229
/**
62026230
Set object status for DIMM
62036231

DcpmPkg/driver/Core/Dimm.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,21 @@ Clears the PCD Cache on each DIMM in the global DIMM list
17641764
**/
17651765
EFI_STATUS ClearPcdCacheOnDimmList(VOID);
17661766

1767+
/**
1768+
Set Obj Status when DIMM is not found using Id expected by end user
1769+
1770+
@param[in] DimmId the Pid for the DIMM that was not found
1771+
@param[in] pDimms Pointer to head of list where DimmId should be found
1772+
@param[out] pCommandStatus Pointer to command status structure
1773+
1774+
**/
1775+
VOID
1776+
SetObjStatusForDimmNotFound(
1777+
IN UINT16 DimmId,
1778+
IN LIST_ENTRY *pDimms,
1779+
OUT COMMAND_STATUS *pCommandStatus
1780+
);
1781+
17671782
/**
17681783
Set object status for DIMM
17691784

DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,12 @@ VerifyTargetDimms (
13681368
pCurrentDimm = GetDimmByPid(DimmIds[Index], pDimmList);
13691369
if (pCurrentDimm == NULL) {
13701370
NVDIMM_DBG("Failed on GetDimmByPid. Does DIMM 0x%04x exist?", DimmIds[Index]);
1371-
SetObjStatus(pCommandStatus, DimmIds[Index], NULL, 0, NVM_ERR_DIMM_NOT_FOUND);
1371+
// if dimm was not found, it is probably in the opposite list of dimms so call function with that list
1372+
if (UninitializedDimms) {
1373+
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.Dimms, pCommandStatus);
1374+
} else {
1375+
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.UninitializedDimms, pCommandStatus);
1376+
}
13721377
goto Finish;
13731378
}
13741379

@@ -1403,7 +1408,12 @@ VerifyTargetDimms (
14031408
pCurrentDimm = GetDimmByPid(DimmIds[Index], pDimmList);
14041409
if (pCurrentDimm == NULL) {
14051410
NVDIMM_DBG("Failed on GetDimmByPid. Does DIMM 0x%04x exist?", DimmIds[Index]);
1406-
SetObjStatus(pCommandStatus, DimmIds[Index], NULL, 0, NVM_ERR_DIMM_NOT_FOUND);
1411+
// if dimm was not found, it is probably in the opposite list of dimms so call function with that list
1412+
if (UninitializedDimms) {
1413+
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.Dimms, pCommandStatus);
1414+
} else {
1415+
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.UninitializedDimms, pCommandStatus);
1416+
}
14071417
goto Finish;
14081418
} else {
14091419
Found = FALSE;
@@ -1414,6 +1424,12 @@ VerifyTargetDimms (
14141424
}
14151425
}
14161426
if (SocketIdsCount > 0 && !Found) {
1427+
// if dimm was not found, it is probably in the opposite list of dimms so call function with that list
1428+
if (UninitializedDimms) {
1429+
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.Dimms, pCommandStatus);
1430+
} else {
1431+
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.UninitializedDimms, pCommandStatus);
1432+
}
14171433
SetObjStatusForDimm(pCommandStatus, pCurrentDimm, NVM_ERR_DIMM_NOT_FOUND);
14181434
goto Finish;
14191435
}

0 commit comments

Comments
 (0)