Skip to content

Commit

Permalink
AVSBUS: Enable CRC checking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vanderp authored and dcrowell77 committed Jun 15, 2017
1 parent 5c93d3a commit 0201f39
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 52 deletions.
95 changes: 44 additions & 51 deletions src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

//##############################################################################


Expand Down Expand Up @@ -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.");
}


Expand Down
2 changes: 1 addition & 1 deletion src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H
Original file line number Diff line number Diff line change
Expand Up @@ -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);



Expand Down

0 comments on commit 0201f39

Please sign in to comment.