summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRyan King <rpking@us.ibm.com>2018-10-05 15:17:32 -0400
committerChristian R. Geddes <crgeddes@us.ibm.com>2018-10-30 13:05:43 -0500
commit44f196de4e6f0350ae7ff6f35ca76400f34ee017 (patch)
tree3d357e0d6583b638762ed7b97b2099960fe4cd9a /src
parentf0bc4fed86e5ad4f887a5d7717006669fd118dd9 (diff)
downloadtalos-hostboot-44f196de4e6f0350ae7ff6f35ca76400f34ee017.tar.gz
talos-hostboot-44f196de4e6f0350ae7ff6f35ca76400f34ee017.zip
Add sensor cache read as an explorer inband command
A read of the sensor cache is done via 2 32-byte MMIO reads. There is no system implementation that can handle a 32 byte transaction size currently, but implement the structure and wrapper so it is available. Change-Id: Ib7e11d08fcc2989de0ee79ca3405a5c268b779c3 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67106 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com> Reviewed-by: Benjamin Gass <bgass@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67618 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: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C87
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H38
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H1
3 files changed, 126 insertions, 0 deletions
diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C
index 9a0c3ee00..a6fe8105e 100644
--- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C
+++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C
@@ -469,6 +469,93 @@ fapi_try_exit:
return fapi2::current_err;
}
+
+
+
+///
+/// @brief Converts a little endian data array to a sensor_cache_struct
+/// @param[in] i_data little endian data to process
+/// @param[out] o_data sensor cache structure
+/// @return true if success false if failure
+/// @note helper function - returning a bool and will have true FFDC in a separate function
+///
+bool sensor_cache_struct_from_little_endian(const std::vector<uint8_t>& i_data,
+ sensor_cache_struct& o_data)
+{
+ uint32_t l_idx = 0;
+ bool l_rc = readLE(i_data, l_idx, o_data.status);
+ l_rc &= readLE(i_data, l_idx, o_data.ocmb_dts);
+ l_rc &= readLE(i_data, l_idx, o_data.mem_dts0);
+ l_rc &= readLE(i_data, l_idx, o_data.mem_dts1);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_reads);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_writes);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_activations);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_powerups);
+ l_rc &= readLE(i_data, l_idx, o_data.self_timed_refresh);
+ l_rc &= readLEArray(i_data, SENSOR_CACHE_PADDING_SIZE_0, l_idx, o_data.reserved0);
+ l_rc &= readLE(i_data, l_idx, o_data.frame_count);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_arrival_histo_base);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_arrival_histo_low);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_arrival_histo_med);
+ l_rc &= readLE(i_data, l_idx, o_data.mba_arrival_histo_high);
+ l_rc &= readLE(i_data, l_idx, o_data.initial_packet1);
+ l_rc &= readLEArray(i_data, SENSOR_CACHE_PADDING_SIZE_1, l_idx, o_data.reserved1);
+
+ return l_rc;
+}
+
+///
+/// @brief Converts a little endian data array to a sensor_cache_struct
+/// @param[in] i_target OCMB target on which to operate
+/// @param[in] i_data little endian data to process
+/// @param[out] o_data sensor cache structure
+/// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+/// @note helper function to allow for checking FFDC
+///
+fapi2::ReturnCode sensor_cache_struct_from_little_endian(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>&
+ i_target,
+ const std::vector<uint8_t>& i_data,
+ sensor_cache_struct& o_data)
+{
+ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
+ FAPI_ASSERT( sensor_cache_struct_from_little_endian(i_data,
+ o_data),
+ fapi2::EXP_INBAND_LE_DATA_RANGE()
+ .set_TARGET(i_target)
+ .set_FUNCTION(mss::exp::READ_SENSOR_CACHE_STRUCT)
+ .set_DATA_SIZE(i_data.size())
+ .set_MAX_INDEX(sizeof(sensor_cache_struct)),
+ "%s Failed to convert from data to sensor_cache_struct data size %u expected size %u",
+ mss::c_str(i_target), i_data.size(), sizeof(sensor_cache_struct));
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Reads the complete 64 byte sensor cache on the selected Explorer
+///
+/// @param[in] i_target The Explorer chip to read data from
+/// @param[out] o_data The data read from the buffer
+///
+/// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+///
+fapi2::ReturnCode getSensorCache(
+ const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
+ sensor_cache_struct& o_data)
+{
+ std::vector<uint8_t> l_data(static_cast<int>(sizeof(o_data)));
+
+ // The sensor cache is accessed exclusively via 2 32-byte MMIO reads
+ FAPI_TRY(fapi2::getMMIO(i_target, EXPLR_IB_SENSOR_CACHE_ADDR, 32, l_data));
+
+ FAPI_TRY(sensor_cache_struct_from_little_endian(i_target, l_data, o_data));
+
+fapi_try_exit:
+ FAPI_DBG("%s Exiting with return code : 0x%08X...", mss::c_str(i_target), (uint64_t) fapi2::current_err);
+ return fapi2::current_err;
+}
+
} // ns ib
} // ns exp
diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H
index f8d6fb367..4a0b6571e 100644
--- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H
+++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H
@@ -121,6 +121,8 @@ static const uint64_t EXPLR_IB_CMD_ADDR = EXPLR_IB_MMIO_OFFSET | EXPLR_IB_CMD_S
static const uint64_t EXPLR_IB_RSP_ADDR = EXPLR_IB_MMIO_OFFSET | EXPLR_IB_RSP_SRAM_ADDR;
static const uint64_t EXPLR_IB_DATA_ADDR = EXPLR_IB_MMIO_OFFSET | EXPLR_IB_DATA_SRAM_ADDR;
+static const uint64_t EXPLR_IB_SENSOR_CACHE_ADDR = EXPLR_IB_MMIO_OFFSET | 0x40084200;
+
//--------------------------------------------------------------------------------
// Utilities
//--------------------------------------------------------------------------------
@@ -264,6 +266,29 @@ fapi2::ReturnCode host_fw_response_struct_from_little_endian(const fapi2::Target
const std::vector<uint8_t>& i_data,
host_fw_response_struct& o_response);
+///
+/// @brief Converts a little endian data array to a sensor_cache_struct
+/// @param[in] i_data little endian data to process
+/// @param[out] o_data sensor cache structure
+/// @return true if success false if failure
+/// @note helper function - returning a bool and will have true FFDC in a separate function
+///
+bool sensor_cache_struct_from_little_endian(const std::vector<uint8_t>& i_data,
+ sensor_cache_struct& o_data);
+
+///
+/// @brief Converts a little endian data array to a sensor_cache_struct
+/// @param[in] i_target OCMB target on which to operate
+/// @param[in] i_data little endian data to process
+/// @param[out] o_data sensor cache structure
+/// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+/// @note helper function to allow for checking FFDC
+///
+fapi2::ReturnCode sensor_cache_struct_from_little_endian(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>&
+ i_target,
+ const std::vector<uint8_t>& i_data,
+ sensor_cache_struct& o_data);
+
//--------------------------------------------------------------------------------
// Write operations
//--------------------------------------------------------------------------------
@@ -430,6 +455,19 @@ fapi2::ReturnCode getRSP(
host_fw_response_struct& o_rsp) ;
+
+
+/// @brief Reads the complete 64 byte sensor cache on the selected Explorer
+///
+/// @param[in] i_target The Explorer chip to read data from
+/// @param[out] o_data The data read from the buffer
+///
+/// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+fapi2::ReturnCode getSensorCache(
+ const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
+ sensor_cache_struct& o_data) ;
+
+
//--------------------------------------------------------------------------------
} // ns ib
diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H
index 5769ec258..53bedae7c 100644
--- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H
+++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H
@@ -49,6 +49,7 @@ enum ffdc_codes
EXP_I2C_GET_FIELD = 0x0000,
EXP_I2C_SET_FIELD = 0x0001,
READ_HOST_FW_RESPONSE_STRUCT = 0x0003,
+ READ_SENSOR_CACHE_STRUCT = 0x0004,
};
namespace i2c
OpenPOWER on IntegriCloud