Skip to content

Commit

Permalink
NVDIMM update code
Browse files Browse the repository at this point in the history
This code does the actual NVDIMM update.
Refer to JEDEC BAEBI spec for details
https://www.jedec.org/standards-documents/docs/jesd245a

Change-Id: I8ac6f7695b8a056bb6d8e627d89b4e5e06398f1d
RTC:202536
CMVC-Prereq: 1080592
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71680
Reviewed-by: TSUNG K. YEUNG <tyeung@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Mar 29, 2019
1 parent 33e7c6d commit f5ab52a
Show file tree
Hide file tree
Showing 9 changed files with 2,062 additions and 289 deletions.
20 changes: 20 additions & 0 deletions src/include/usr/isteps/nvdimm/nvdimmreasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ enum nvdimmModuleId
NVDIMM_CHECK_READY = 0x18,
NOTIFY_NVDIMM_PROTECTION_CHG = 0x19,
NVDIMM_RUN_UPDATE = 0x1A,
UPDATE_IMAGE = 0x1B,
UPDATE_IMAGE_DATA = 0x1C,
CHANGE_FW_UPDATE_MODE = 0x1D,
WAIT_FW_OPS_COMPLETE = 0x1E,
BYTE_REGION_BLOCK_TRANSFER = 0x1F,
VALIDATE_FW_HEADER = 0x20,
COMMIT_FW_REGION = 0x21,
CLEAR_FW_DATA_BLOCK = 0x22,
VALIDATE_FW_IMAGE = 0x23,
WAIT_FW_OPS_BLOCK_RECEIVED = 0x24,
};

/**
Expand Down Expand Up @@ -114,6 +124,16 @@ enum nvdimmReasonCode
NVDIMM_NOT_READY = NVDIMM_COMP_ID | 0x1B, // NVDIMM not ready for host to access
NVDIMM_NULL_FIRMWARE_REQUEST_PTR = NVDIMM_COMP_ID | 0x1C, // Firmware request is NULL
NVDIMM_UNSUPPORTED_NVDIMM_TYPE = NVDIMM_COMP_ID | 0x1D, // Unsupported NVDIMM type for update
NVDIMM_OPERATION_IN_PROGRESS = NVDIMM_COMP_ID | 0x1E, // NV controller is busy
NVDIMM_CHECKSUM_ERROR = NVDIMM_COMP_ID | 0x1F, // Checksum error between host and nv calculated
NVDIMM_ZERO_TOTAL_REGIONS = NVDIMM_COMP_ID | 0x20, // Zero write regions calculated
NVDIMM_UPDATE_MODE_UNCHANGED = NVDIMM_COMP_ID | 0x21, // Unable to change update mode
NVDIMM_FW_OPS_IN_PROGRESS_TIMEOUT = NVDIMM_COMP_ID | 0x22, // Operations In Progress timeout
NVDIMM_DATA_SIZE_TOO_LARGE = NVDIMM_COMP_ID | 0x23, // Trying to write too much data
NVDIMM_DATA_SIZE_INVALID = NVDIMM_COMP_ID | 0x24, // Data size is invalid
NVDIMM_BLOCK_NOT_RECEIVED = NVDIMM_COMP_ID | 0x25, // Block data not received
NVDIMM_FW_OPS_NOT_SUCCESSFUL = NVDIMM_COMP_ID | 0x26, // Unsuccessful Firmware Operation
NVDIMM_BASE_SERVICES_NOT_READY = NVDIMM_COMP_ID | 0x27, // spBaseServices not ready for LID access
};

enum UserDetailsTypes
Expand Down
1 change: 1 addition & 0 deletions src/include/usr/util/utilmclmgr.H
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ extern const ComponentID g_MclCompId;
extern const ComponentID g_PowervmCompId;
extern const ComponentID g_OpalCompId;
extern const ComponentID g_UcdCompId;
extern const ComponentID g_NvdimmCompId;

// @enum Permission Types for MCL Component
enum class CompFlags : uint16_t
Expand Down
5 changes: 0 additions & 5 deletions src/usr/isteps/nvdimm/nvdimm.C
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ namespace NVDIMM
#define NVDIMM_SET_USER_DATA_2_TIMEOUT(left_32_polled, right_32_timeout) \
NVDIMM_SET_USER_DATA_1(left_32_polled, right_32_timeout)

#define ADDRESS(uint16_address) \
uint16_address & 0x00FF

#define PAGE(uint16_address) \
(uint16_address >> 8) & 0x000F

typedef struct ops_timeoutInfo{
const char * desc;
Expand Down
18 changes: 18 additions & 0 deletions src/usr/isteps/nvdimm/nvdimm.H
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ enum i2cReg : uint16_t
TYPED_BLOCK_DATA_OFFSET = 0x3E0,
};

// i2cReg macros
#define ADDRESS(uint16_address) \
uint16_address & 0x00FF

#define PAGE(uint16_address) \
(uint16_address >> 8) & 0x000F

// Up to 10 pages per BAEBI Spec,
// but use page 0 mostly
enum page : uint8_t
Expand Down Expand Up @@ -416,6 +423,17 @@ errlHndl_t nvdimmOpenPage(TARGETING::Target *i_nvdimm, uint8_t i_page);
* the error log.
*/
errlHndl_t nvdimmPollStatus(TARGETING::Target *i_nvdimm, ops_id i_ops_id, uint32_t &o_poll);


/**
* @brief This function sets the energy supply policy to device-managed
*
* @param[in] i_nvdimm - nvdimm target with NV controller
*
* @return errlHndl_t - Null if successful, otherwise a pointer to
* the error log.
*/
errlHndl_t nvdimmSetESPolicy(TARGETING::Target* i_nvdimm);
} //End NVDIMM namespace


Expand Down

0 comments on commit f5ab52a

Please sign in to comment.