summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRahul Batra <rbatra@us.ibm.com>2017-09-26 12:26:44 -0500
committerJoshua Hunsberger <jahunsbe@us.ibm.com>2017-10-23 19:23:08 -0500
commite4c5f89bc82bd6f5b1c9965394bb358609a62a1f (patch)
treeb41a9b0f5dcc35c5f7a80e599297cbc7fe13e4a0
parentb4694b0560015216226dfcffb96e3e7ce1bc7d91 (diff)
downloadtalos-hcode-e4c5f89bc82bd6f5b1c9965394bb358609a62a1f.tar.gz
talos-hcode-e4c5f89bc82bd6f5b1c9965394bb358609a62a1f.zip
PGPE: AVS Driver Updates
-Adds checks for SlaveACK -Adds code to resync in case of non-zero SlaveAck Change-Id: I130126474621f8f8c4d55a3c34bb75de4a2dcc06 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46752 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Juan R. Medina <jrmedina@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA <prasadbgr@in.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
-rw-r--r--import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.c159
-rw-r--r--import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.h7
-rw-r--r--import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/pgpe_panic_codes.h10
3 files changed, 127 insertions, 49 deletions
diff --git a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.c b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.c
index 3d5f3990..13e94827 100644
--- a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.c
+++ b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.c
@@ -106,7 +106,11 @@ uint8_t pollVoltageTransDone(void)
if (ongoingFlag)
{
- rc = 1;
+ rc = AVS_RC_ONGOING_TIMEOUT;
+ }
+ else
+ {
+ rc = AVS_RC_SUCCESS;
}
return rc;
@@ -140,8 +144,9 @@ uint8_t driveIdleFrame(void)
//#################################################################################################
uint8_t driveWrite(uint32_t CmdDataType, uint32_t CmdData)
{
- uint8_t rc = 0;
+ uint8_t rc = 0, retryCnt = 0, done = 0;
uint32_t ocbRegWriteData = 0;
+ uint32_t ocbRegReadData = 0;
uint32_t RailSelect = in32(OCB_OCCS2) & AVS_RAIL_NUM_MASK;
uint32_t StartCode = 1;
@@ -163,12 +168,52 @@ uint8_t driveWrite(uint32_t CmdDataType, uint32_t CmdData)
CRC = CRC_calc(ocbRegWriteData);
ocbRegWriteData = ocbRegWriteData | CRC;
- // Send frame
- //PK_TRACE_DBG("RegWrite=0x%x", ocbRegWriteData);
- out32(OCB_O2SWD0A | BusMask, ocbRegWriteData);
+ do
+ {
+ // Send frame
+ out32(OCB_O2SWD0A | BusMask, ocbRegWriteData);
- // Wait on o2s_ongoing = 0
- rc = pollVoltageTransDone();
+ // Wait on o2s_ongoing = 0
+ rc = pollVoltageTransDone();
+
+ if (rc)
+ {
+ done = 1;
+ }
+ else
+ {
+ ocbRegReadData = in32(OCB_O2SRD0A | BusMask);
+ PK_TRACE_DBG("AVS_W:ReadData=0x%04x", ocbRegReadData);
+
+ //Non-zero SlaveAck
+ if(ocbRegReadData & 0xC0000000)
+ {
+ PK_TRACE_DBG("AVS_W:Error Slave Ack");
+
+ //Retry one-time
+ if (retryCnt)
+ {
+ rc = AVS_RC_RESYNC_ERROR;
+ done = 1;
+ }
+ else
+ {
+ retryCnt++;
+ rc = driveIdleFrame();
+
+ if (rc)
+ {
+ done = 1;
+ }
+ }
+ }
+ else
+ {
+ done = 1;
+ }
+ }
+ }
+ while(!done);
return rc;
}
@@ -179,7 +224,7 @@ uint8_t driveWrite(uint32_t CmdDataType, uint32_t CmdData)
//#################################################################################################
uint8_t driveRead(uint32_t CmdDataType, uint32_t* CmdData)
{
- uint8_t rc = 0;
+ uint8_t rc = 0, retryCnt = 0, done = 0;
uint32_t ocbRegReadData = 0;
uint32_t ocbRegWriteData = 0;
@@ -205,22 +250,53 @@ uint8_t driveRead(uint32_t CmdDataType, uint32_t* CmdData)
CRC = CRC_calc(ocbRegWriteData);
ocbRegWriteData = ocbRegWriteData | CRC;
- // Send frame
- out32(OCB_O2SWD0A | BusMask, ocbRegWriteData);
+ do
+ {
+ // Send frame
+ out32(OCB_O2SWD0A | BusMask, ocbRegWriteData);
- // Wait on o2s_ongoing = 0
- rc = pollVoltageTransDone();
+ // Wait on o2s_ongoing = 0
+ rc = pollVoltageTransDone();
- if (rc)
- {
- PK_TRACE_ERR("AVS_READ: OnGoingFlag timeout");
- PGPE_PANIC_AND_TRACE(PGPE_AVS_READ_ONGOING_FLAG_TIMEOUT);
+ if (rc)
+ {
+ done = 1;
+ }
+ else
+ {
+ // Read returned voltage value from Read frame
+ ocbRegReadData = in32(OCB_O2SRD0A | BusMask);
+ PK_TRACE_DBG("AVS_READ: RegRead=0x%04x", ocbRegReadData);
+
+ //Non-zero SlaveAck
+ if(ocbRegReadData & 0xC0000000)
+ {
+ PK_TRACE_DBG("AVS_W:Error Slave Ack");
+
+ if (retryCnt)
+ {
+ rc = AVS_RC_RESYNC_ERROR;
+ done = 1;
+ }
+ else
+ {
+ retryCnt++;
+ rc = driveIdleFrame();
+
+ if (rc)
+ {
+ done = 1;
+ }
+ }
+ }
+ else
+ {
+ *CmdData = (ocbRegReadData >> 8) & 0x0000FFFF;
+ done = 1;
+ }
+ }
}
-
- // Read returned voltage value from Read frame
- ocbRegReadData = in32(OCB_O2SRD0A | BusMask);
- PK_TRACE_DBG("RegRead=0x%x", ocbRegReadData);
- *CmdData = (ocbRegReadData >> 8) & 0x0000FFFF;
+ while(!done);
return rc;
}
@@ -322,29 +398,24 @@ void external_voltage_control_write(uint32_t vext_write_mv)
// Drive write transaction with a target voltage on a particular rail and wait on o2s_ongoing=0
rc = driveWrite(CmdDataType, vext_write_mv);
- if (rc)
+ switch (rc)
{
- PK_TRACE_ERR("AVS_WRITE: Drive Write FAIL");
- PGPE_PANIC_AND_TRACE(PGPE_AVS_WRITE_DRIVE_WRITE);
+ case AVS_RC_SUCCESS:
+ PK_TRACE_DBG("AVS_WRITE: Success!");
+ break;
+
+ case AVS_RC_ONGOING_TIMEOUT:
+ PK_TRACE_ERR("AVS_WRITE: OnGoing Flag Timeout");
+ PGPE_PANIC_AND_TRACE(PGPE_AVS_WRITE_ONGOING_FLAG_TIMEOUT);
+ break;
+
+ case AVS_RC_RESYNC_ERROR:
+ PK_TRACE_ERR("AVS_WRITE: Resync Error");
+ GPE_PUTSCOM(OCB_OCCLFIR_OR, BIT64(59)); //OCCLFIR[59]=AVS Resync Error
+ PGPE_PANIC_AND_TRACE(PGPE_AVS_RESYNC_ERROR);
+ break;
+
+ default:
+ break;
}
-
-#if !EPM_P9_TUNING
- uint32_t CmdDataRead = 0;
- // Drive read transaction to return the voltage on the same rail and wait on o2s_ongoing=0
- rc = driveRead(CmdDataType, &CmdDataRead);
-
- if (rc)
- {
- PK_TRACE_ERR("AVS_WRITE: Drive Read FAIL");
- PGPE_PANIC_AND_TRACE(PGPE_AVS_WRITE_DRIVE_READ);
- }
-
- if (CmdDataRead != vext_write_mv)
- {
- PK_TRACE_ERR("AVS_WRITE: Miscompare, Read=%dmV != Write=%dmV", CmdDataRead, vext_write_mv);
- PGPE_PANIC_AND_TRACE(PGPE_AVS_WRITE_RW_MISCOMPARE);
- }
-
-#endif
-
}
diff --git a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.h b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.h
index 643fe438..574c62c3 100644
--- a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.h
+++ b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/avs_driver.h
@@ -38,6 +38,13 @@ enum AVS_DRIVER
AVS_DRIVER_MIN_EXTERNAL_VOLTAGE = 500
};
+enum AVS_DRIVER_RETURN_CODES
+{
+ AVS_RC_SUCCESS = 0,
+ AVS_RC_ONGOING_TIMEOUT = 1,
+ AVS_RC_RESYNC_ERROR = 2
+};
+
void
external_voltage_control_init(uint32_t* vext_read_mv);
diff --git a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/pgpe_panic_codes.h b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/pgpe_panic_codes.h
index 592cf59c..0e2403d7 100644
--- a/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/pgpe_panic_codes.h
+++ b/import/chips/p9/procedures/ppe_closed/pgpe/pstate_gpe/pgpe_panic_codes.h
@@ -47,11 +47,11 @@ PGPE_UIH_EIMR_STACK_UNDERFLOW = 0x1c00,
PGPE_UIH_EIMR_STACK_OVERFLOW = 0x1c01,
PGPE_UIH_PHANTOM_INTERRUPT = 0x1c02,
PGPE_AVS_READ_ONGOING_FLAG_TIMEOUT = 0x1c03,
-PGPE_AVS_INIT_DRIVE_IDLE_FRAME = 0x1c04,
-PGPE_AVS_INIT_DRIVE_READ = 0x1c05,
-PGPE_AVS_WRITE_DRIVE_WRITE = 0x1c06,
-PGPE_AVS_WRITE_DRIVE_READ = 0x1c07,
-PGPE_AVS_WRITE_RW_MISCOMPARE = 0x1c08,
+PGPE_AVS_WRITE_ONGOING_FLAG_TIMEOUT = 0x1c04,
+PGPE_AVS_INIT_DRIVE_IDLE_FRAME = 0x1c05,
+PGPE_AVS_INIT_DRIVE_READ = 0x1c06,
+PGPE_AVS_RESYNC_ERROR = 0x1c07,
+//_UNUSED_1c08 = 0x1c08,
//_UNUSED_1c19 = 0x1c19,
//_UNUSED_1c0c = 0x1c0a,
PGPE_UNEXPECTED_OCC_FIR_IRQ = 0x1c0d,
OpenPOWER on IntegriCloud