Skip to content

Commit

Permalink
Changes added to showMemoryResources command to error out in case PCD…
Browse files Browse the repository at this point in the history
… is deleted/missing on any of the Dimms.

Signed-off-by: Sandesh Shetty <[email protected]>
  • Loading branch information
sshetty1991 authored and StevenPontsler committed Aug 27, 2019
1 parent a02db53 commit b6cb581
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion DcpmPkg/cli/ShowMemoryResourcesCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <Library/ShellLib.h>
#include <Library/HiiLib.h>
#include <Library/BaseMemoryLib.h>
#include "ShowMemoryResourcesCommand.h"
#include <Debug.h>
Expand Down Expand Up @@ -63,6 +64,7 @@ ShowMemoryResources(
UINT16 UnitsOption = DISPLAY_SIZE_UNIT_UNKNOWN;
UINT16 UnitsToDisplay = FixedPcdGet32(PcdDcpmmCliDefaultCapacityUnit);
CHAR16 *pCapacityStr = NULL;
CHAR16 *pPcdMissingStr = NULL;
DISPLAY_PREFERENCES DisplayPreferences;
PRINT_CONTEXT *pPrinterCtx = NULL;

Expand Down Expand Up @@ -109,7 +111,12 @@ ShowMemoryResources(
}

ReturnCode = pNvmDimmConfigProtocol->GetMemoryResourcesInfo(pNvmDimmConfigProtocol, &MemoryResourcesInfo);
if (EFI_ERROR(ReturnCode)) {
if (EFI_LOAD_ERROR == ReturnCode) {
pPcdMissingStr = HiiGetString(gNvmDimmCliHiiHandle, STRING_TOKEN(STR_DCPMM_STATUS_CURR_CONF_MISSING), NULL);
PRINTER_SET_MSG(pPrinterCtx, ReturnCode, pPcdMissingStr);
goto Finish;
}
else if (EFI_ERROR(ReturnCode)) {
PRINTER_SET_MSG(pPrinterCtx, ReturnCode, L"Error: GetMemoryResourcesInfo Failed\n");
goto Finish;
}
Expand Down Expand Up @@ -147,6 +154,7 @@ ShowMemoryResources(
Finish:
PRINTER_CONFIGURE_DATA_ATTRIBUTES(pPrinterCtx, DS_MEMORY_RESOURCES_PATH, &ShowMemResourcesDataSetAttribs);
PRINTER_PROCESS_SET_BUFFER(pPrinterCtx);
FREE_POOL_SAFE(pPcdMissingStr);
NVDIMM_EXIT_I64(ReturnCode);

return ReturnCode;
Expand Down
Binary file modified DcpmPkg/common/NvmStatus.uni
Binary file not shown.
6 changes: 6 additions & 0 deletions DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -3892,6 +3892,12 @@ GetMemoryResourcesInfo(
}
#endif // OS_BUILD

// PCD CCUR table missing in DIMM
if (pDimm->ConfigStatus == DIMM_CONFIG_UNDEFINED) {
ReturnCode = EFI_LOAD_ERROR;
goto Finish;
}

ReturnCode = GetCapacities(pDimm->DimmID, &VolatileCapacity, &AppDirectCapacity,
&UnconfiguredCapacity, &ReservedCapacity, &InaccessibleCapacity);
if (EFI_ERROR(ReturnCode)) {
Expand Down

0 comments on commit b6cb581

Please sign in to comment.