Skip to content

Commit

Permalink
Pass Uid instead of NULL.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
StevenPontsler authored and gldiviney committed Mar 26, 2019
1 parent bd1cde3 commit d4c23cb
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DcpmPkg/cli/ShowDimmsCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ ShowDimms(
goto Finish;
}

ReturnCode = GetPreferredDimmIdAsString(pUninitializedDimms[DimmIndex].DimmHandle, NULL, DimmStr,
ReturnCode = GetPreferredDimmIdAsString(pUninitializedDimms[DimmIndex].DimmHandle, pUninitializedDimms[DimmIndex].DimmUid, DimmStr,
MAX_DIMM_UID_LENGTH);
pDimmErrStr = CatSPrint(NULL, FORMAT_STR, UNKNOWN_ATTRIB_VAL);

Expand Down
28 changes: 28 additions & 0 deletions DcpmPkg/driver/Core/Dimm.c
Original file line number Diff line number Diff line change
Expand Up @@ -6198,6 +6198,34 @@ GetDimmUid(
return ReturnCode;
}

/**
Set Obj Status when DIMM is not found using Id expected by end user
@param[in] DimmId the Pid for the DIMM that was not found
@param[in] pDimms Pointer to head of list where DimmId should be found
@param[out] pCommandStatus Pointer to command status structure
**/
VOID
SetObjStatusForDimmNotFound(
IN UINT16 DimmId,
IN LIST_ENTRY *pDimms,
OUT COMMAND_STATUS *pCommandStatus
)
{
DIMM *pCurrentDimm = NULL;

pCurrentDimm = GetDimmByPid(DimmId, pDimms);
if (pCurrentDimm != NULL) {
SetObjStatusForDimm(pCommandStatus, pCurrentDimm, NVM_ERR_DIMM_NOT_FOUND);
pCurrentDimm = NULL;
}
else
{
SetObjStatus(pCommandStatus, DimmId, NULL, 0, NVM_ERR_DIMM_NOT_FOUND);
}
}

/**
Set object status for DIMM
Expand Down
15 changes: 15 additions & 0 deletions DcpmPkg/driver/Core/Dimm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,21 @@ Clears the PCD Cache on each DIMM in the global DIMM list
**/
EFI_STATUS ClearPcdCacheOnDimmList(VOID);

/**
Set Obj Status when DIMM is not found using Id expected by end user
@param[in] DimmId the Pid for the DIMM that was not found
@param[in] pDimms Pointer to head of list where DimmId should be found
@param[out] pCommandStatus Pointer to command status structure
**/
VOID
SetObjStatusForDimmNotFound(
IN UINT16 DimmId,
IN LIST_ENTRY *pDimms,
OUT COMMAND_STATUS *pCommandStatus
);

/**
Set object status for DIMM
Expand Down
20 changes: 18 additions & 2 deletions DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,12 @@ VerifyTargetDimms (
pCurrentDimm = GetDimmByPid(DimmIds[Index], pDimmList);
if (pCurrentDimm == NULL) {
NVDIMM_DBG("Failed on GetDimmByPid. Does DIMM 0x%04x exist?", DimmIds[Index]);
SetObjStatus(pCommandStatus, DimmIds[Index], NULL, 0, NVM_ERR_DIMM_NOT_FOUND);
// if dimm was not found, it is probably in the opposite list of dimms so call function with that list
if (UninitializedDimms) {
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.Dimms, pCommandStatus);
} else {
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.UninitializedDimms, pCommandStatus);
}
goto Finish;
}

Expand Down Expand Up @@ -1403,7 +1408,12 @@ VerifyTargetDimms (
pCurrentDimm = GetDimmByPid(DimmIds[Index], pDimmList);
if (pCurrentDimm == NULL) {
NVDIMM_DBG("Failed on GetDimmByPid. Does DIMM 0x%04x exist?", DimmIds[Index]);
SetObjStatus(pCommandStatus, DimmIds[Index], NULL, 0, NVM_ERR_DIMM_NOT_FOUND);
// if dimm was not found, it is probably in the opposite list of dimms so call function with that list
if (UninitializedDimms) {
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.Dimms, pCommandStatus);
} else {
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.UninitializedDimms, pCommandStatus);
}
goto Finish;
} else {
Found = FALSE;
Expand All @@ -1414,6 +1424,12 @@ VerifyTargetDimms (
}
}
if (SocketIdsCount > 0 && !Found) {
// if dimm was not found, it is probably in the opposite list of dimms so call function with that list
if (UninitializedDimms) {
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.Dimms, pCommandStatus);
} else {
SetObjStatusForDimmNotFound(DimmIds[Index], &gNvmDimmData->PMEMDev.UninitializedDimms, pCommandStatus);
}
SetObjStatusForDimm(pCommandStatus, pCurrentDimm, NVM_ERR_DIMM_NOT_FOUND);
goto Finish;
}
Expand Down

0 comments on commit d4c23cb

Please sign in to comment.