From 926ec6f90b177df59e7b8aa9534aa3e6ec003183 Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Thu, 20 Jun 2019 12:05:59 -0500 Subject: Handle unsupported status bit for NVDIMM Encrytion Status The new NVDIMM FW level added an additional bit to the status register. We don't care about this bit so added a check mask to ignore it when we check the status of the encryption operations. Change-Id: I67ddd087ff8d04d7af81ee41549f1522f717d974 CQ: SW468004 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/79335 Reviewed-by: Corey V. Swenson Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- src/usr/isteps/nvdimm/nvdimm.C | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/usr/isteps/nvdimm/nvdimm.C b/src/usr/isteps/nvdimm/nvdimm.C index 7ae805df5..577528a4d 100644 --- a/src/usr/isteps/nvdimm/nvdimm.C +++ b/src/usr/isteps/nvdimm/nvdimm.C @@ -94,7 +94,8 @@ typedef union { uint8_t whole; struct { - uint8_t reserved : 2; // [7:6 + uint8_t reserved : 1; // [7] + uint8_t unsupported_field : 1; // [6] uint8_t erase_pending : 1; // [5] uint8_t encryption_unlocked : 1; // [4] uint8_t encryption_enabled : 1; // [3] @@ -104,6 +105,9 @@ typedef union { } PACKED; } encryption_config_status_t; +// Valid bits to check against (skips reserved and unsupported) +static constexpr uint8_t ENCRYPTION_STATUS_CHECK_MASK = 0x3F; + // Definition of ENCRYPTION_KEY_VALIDATION -- page 5 offset 0x2A typedef union { uint8_t whole; @@ -2435,7 +2439,8 @@ bool nvdimm_encrypt_enable(TargetHandleList &i_nvdimmList) } // Need to handle these cases? - if (!(l_encStatus.whole == 0x01)) + if (!((l_encStatus.whole & ENCRYPTION_STATUS_CHECK_MASK) + == 0x01)) { TRACFCOMP(g_trac_nvdimm, "nvdimm_encrypt_enable() nvdimm[%X] unsupported state 0x%.02X",get_huid(l_nvdimm),l_encStatus.whole); continue; @@ -2497,7 +2502,8 @@ bool nvdimm_encrypt_enable(TargetHandleList &i_nvdimmList) l_success = false; continue; } - if (!(l_encStatus.whole == 0x1F)) + if (!((l_encStatus.whole & ENCRYPTION_STATUS_CHECK_MASK) + == 0x1F)) { TRACFCOMP(g_trac_nvdimm, ERR_MRK"nvdimm_encrypt_enable() nvdimm[%X] encryption enable failed, ENCRYPTION_CONFIG_STATUS=0x%.02X, expected=0x1F ",get_huid(l_nvdimm),l_encStatus.whole); /*@ -- cgit v1.2.1