summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp
diff options
context:
space:
mode:
authorBrian Vanderpool <vanderp@us.ibm.com>2017-06-12 10:59:22 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-06-15 17:04:46 -0400
commit0201f395cf6ecc4650a4fdf4fc6c95228eee9722 (patch)
tree89d285322cd09c88627cd08e13600cbe496f40fe /src/import/chips/p9/procedures/hwp
parent5c93d3af13e783e833a6a2fec091ffb9ae01b695 (diff)
downloadtalos-hostboot-0201f395cf6ecc4650a4fdf4fc6c95228eee9722.tar.gz
talos-hostboot-0201f395cf6ecc4650a4fdf4fc6c95228eee9722.zip
AVSBUS: Enable CRC checking
Change-Id: Icd49ced518cb8f8ca24fb019181a3aaba07f386b RTC: 174723 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41690 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Michael S. Floyd <mfloyd@us.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41692 Reviewed-by: Hostboot Team <hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-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>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp')
-rw-r--r--src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.C95
-rw-r--r--src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H2
2 files changed, 45 insertions, 52 deletions
diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.C b/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.C
index a4a30e42d..13d1f3af6 100644
--- a/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.C
+++ b/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.C
@@ -40,45 +40,41 @@
//##############################################################################
// Function which generates a 3 bit CRC value for 29 bit data
//##############################################################################
-uint32_t
-avsCRCcalc(const uint32_t i_data)
+#define AVS_CRC_MASK 0x00000007
+#define AVS_CRC_DATA_MASK 0xFFFFFFF8
+uint32_t avsCRCcalc(const uint32_t i_avs_cmd)
{
- //Polynomial= x^3 + x^2 + 1 = 1*x^3 + 0*x^2 + 1*x^1 + 1*x^0 = divisor(1011)
+ //Polynomial= x^3 + x^1 + x^0 = 1*x^3 + 0*x^2 + 1*x^1 + 1*x^0 = divisor(1011)
- uint32_t l_crc_value = 0;
- uint32_t l_data, l_msb_xor, l_crc_0, l_crc_1, l_crc_2, l_data_msb_shifted;
- uint32_t l_crc = 0;
+ uint32_t o_crc_value = 0;
+ uint32_t l_polynomial = 0xB0000000;
+ uint32_t l_msb = 0x80000000;
- // CRC computation code for polynomial 0b1011 for P9
- l_data = i_data >> 3;
+ o_crc_value = i_avs_cmd & AVS_CRC_DATA_MASK;
- for (uint8_t i = 0; i <= 31; i++)
+ while (o_crc_value & AVS_CRC_DATA_MASK)
{
+ if (o_crc_value & l_msb)
+ {
+ //if l_msb is 1'b1, divide by l_polynomial and shift l_polynomial
+ // to the right
+ o_crc_value = o_crc_value ^ l_polynomial;
+ l_polynomial = l_polynomial >> 1;
+ }
+ else
+ {
+ // if l_msb is zero, shift l_polynomial
+ l_polynomial = l_polynomial >> 1;
+ }
-
- // Get the Data MSB into LSB position
- l_data_msb_shifted = (l_data) >> 31;
-
- // Compute the XOR value
- l_msb_xor = l_data_msb_shifted ^ ((l_crc & 0x00000004) >> 2);
-
- l_crc_0 = (l_crc & 0x00000002) << 1;
- l_crc_1 = (l_crc & 0x00000001) ^ l_msb_xor;
- l_crc_2 = l_msb_xor;
-
- l_crc = (l_crc_0) | (l_crc_1 << 1) | (l_crc_2);
-
- // Shift out the used MSB
- l_data = l_data << 1;
-
+ l_msb = l_msb >> 1;
}
- l_crc_value = l_crc;
+ FAPI_INF("The computed CRC Value is %d", o_crc_value)
- FAPI_INF("The computed CRC Value is %d", l_crc_value)
-
- return l_crc_value;
+ return o_crc_value;
}
+
//##############################################################################
@@ -536,54 +532,51 @@ avsValidateResponse(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target,
}
else
{
- FAPI_INF("Incorrect response received - Computed CRC %X Received %X - Full Response %08X", l_rsp_computed_crc,
- l_rsp_rcvd_crc, l_rsp_data);
+ FAPI_INF("Incorrect response received - Computed CRC %X Received %X - Full Response %08X",
+ l_rsp_computed_crc, l_rsp_rcvd_crc, l_rsp_data);
- // @todo RTC 174723 - Hostboot CI isn't generating the correct response. Report a good response
- // The asserts will be added back after the .xml is mirrored to hostboot
- o_goodResponse = true;
if(l_rsp_data == 0x00000000)
{
FAPI_DBG("ERROR: AVS command failed failed. All 0 response data received possibly due to AVSBus IO RI/DIs disabled.");
-// FAPI_ASSERT((i_throw_assert != true),
-// fapi2::PM_AVSBUS_ZERO_RESP_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
-// "ERROR: AVS command failed failed. All 0 response data received possibly due to AVSBus IO RI/DIs disabled.");
+ FAPI_ASSERT((i_throw_assert != true),
+ fapi2::PM_AVSBUS_ZERO_RESP_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
+ "ERROR: AVS command failed failed. All 0 response data received possibly due to AVSBus IO RI/DIs disabled.");
}
else if(l_rsp_data == 0xFFFFFFFF)
{
FAPI_DBG("ERROR: AVS command failed failed. No response from VRM device, Check AVSBus interface connectivity to VRM in system.");
-// FAPI_ASSERT((i_throw_assert != true),
-// fapi2::PM_AVSBUS_NO_RESP_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
-// "ERROR: AVS command failed failed. No response from VRM device, Check AVSBus interface connectivity to VRM in system.");
+ FAPI_ASSERT((i_throw_assert != true),
+ fapi2::PM_AVSBUS_NO_RESP_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
+ "ERROR: AVS command failed failed. No response from VRM device, Check AVSBus interface connectivity to VRM in system.");
}
else if(l_rsp_rcvd_crc != l_rsp_computed_crc)
{
FAPI_DBG("ERROR: AVS command failed failed. Bad CRC detected by P9 on AVSBus Slave Segement.");
-// FAPI_ASSERT((i_throw_assert != true),
-// fapi2::PM_AVSBUS_MASTER_BAD_CRC_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
-// "ERROR: AVS command failed failed. Bad CRC detected by P9 on AVSBus Slave Segement.");
+ FAPI_ASSERT((i_throw_assert != true),
+ fapi2::PM_AVSBUS_MASTER_BAD_CRC_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
+ "ERROR: AVS command failed failed. Bad CRC detected by P9 on AVSBus Slave Segement.");
}
else if(l_data_status_code == 0x02)
{
FAPI_DBG("ERROR: AVS command failed failed. Bad CRC indicated by Slave VRM on AVSBus Master Segement.");
-// FAPI_ASSERT((i_throw_assert != true),
-// fapi2::PM_AVSBUS_SLAVE_BAD_CRC_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
-// "ERROR: AVS command failed failed. Bad CRC indicated by Slave VRM on AVSBus Master Segement.");
+ FAPI_ASSERT((i_throw_assert != true),
+ fapi2::PM_AVSBUS_SLAVE_BAD_CRC_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
+ "ERROR: AVS command failed failed. Bad CRC indicated by Slave VRM on AVSBus Master Segement.");
}
else if(l_data_status_code == 0x01)
{
FAPI_DBG("ERROR: AVS command failed failed. Valid data sent but no action is taken due to unavailable resource.");
-// FAPI_ASSERT((i_throw_assert != true),
-// fapi2::PM_AVSBUS_UNAVAILABLE_RESOURCE_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
-// "ERROR: AVS command failed failed. Valid data sent but no action is taken due to unavailable resource.");
+ FAPI_ASSERT((i_throw_assert != true),
+ fapi2::PM_AVSBUS_UNAVAILABLE_RESOURCE_ERROR().set_TARGET(i_target).set_BUS(i_avsBusNum).set_BRIDGE(i_o2sBridgeNum),
+ "ERROR: AVS command failed failed. Valid data sent but no action is taken due to unavailable resource.");
}
else if(l_data_status_code == 0x03)
{
FAPI_DBG("ERROR: AVS command failed failed. Unknown resource, invalid data, incorrect data or incorrect action.");
-// FAPI_ASSERT((i_throw_assert != true), fapi2::PM_AVSBUS_INVALID_DATA_ERROR().set_TARGET(i_target),
-// "ERROR: AVS command failed failed. Unknown resource, invalid data, incorrect data or incorrect action.");
+ FAPI_ASSERT((i_throw_assert != true), fapi2::PM_AVSBUS_INVALID_DATA_ERROR().set_TARGET(i_target),
+ "ERROR: AVS command failed failed. Unknown resource, invalid data, incorrect data or incorrect action.");
}
diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H b/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H
index 64526c1e7..e430c7854 100644
--- a/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H
+++ b/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H
@@ -167,7 +167,7 @@ const uint32_t OCB_OIMR1_MASK_VALUES[2][2] =
///@param[i] i_data
///@return 3 bit CRC result (right aligned)
-uint32_t avsCRCcalc(uint32_t i_data);
+uint32_t avsCRCcalc(uint32_t i_avs_cmd);
OpenPOWER on IntegriCloud