summaryrefslogtreecommitdiffstats
path: root/src/import
diff options
context:
space:
mode:
authorRaja Das <rajadas2@in.ibm.com>2016-10-21 02:01:42 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-10-28 11:27:11 -0400
commitdd0395e4b8ae2fabcf3ca899f851c22d13bbd922 (patch)
tree1805113a250fb38cec73e54c8916c2d86e3e747c /src/import
parent5bdc6a3d7c990b58b2d3149b0593d3970a86433b (diff)
downloadtalos-sbe-dd0395e4b8ae2fabcf3ca899f851c22d13bbd922.tar.gz
talos-sbe-dd0395e4b8ae2fabcf3ca899f851c22d13bbd922.zip
Thread Control Stop precedure update
RTC: 163286 Change-Id: Ideed55453791c461e10dc731aab0409d5b7cccad Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31604 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Reviewed-by: James N. Klazynski <jklazyns@us.ibm.com> Reviewed-by: Joseph J. McGill <jmcgill@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31607 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Diffstat (limited to 'src/import')
-rw-r--r--src/import/chips/p9/procedures/hwp/core/p9_thread_control.C107
1 files changed, 60 insertions, 47 deletions
diff --git a/src/import/chips/p9/procedures/hwp/core/p9_thread_control.C b/src/import/chips/p9/procedures/hwp/core/p9_thread_control.C
index ed817cd7..45210949 100644
--- a/src/import/chips/p9/procedures/hwp/core/p9_thread_control.C
+++ b/src/import/chips/p9/procedures/hwp/core/p9_thread_control.C
@@ -575,64 +575,77 @@ fapi2::ReturnCode p9_thread_control_stop(
FAPI_DBG("p9_thread_control_stop : Initiating stop command to core PC logic for threads 0x%x",
i_threads);
- // Pre-condition for stopping is that the threads are running (see figure 5.3 in the workbook)
- // How to reconcile with 5.5.1 which says "invalid in maint mode?" Is that just a sub-precondition?
- // TODO: Do we want to check to see if all threads are stopped and just bypass this if they are?
+ // Check if the thread is already stopped, in that condition the procedure
+ // should simply say thread stop success and no error.
+ bool l_isStopped = false;
+ FAPI_TRY(threads_stopped(i_target, i_threads, o_rasStatusReg, l_isStopped),
+ "p9_thread_control_stop: unable to determine if threads are stopped. threads: 0x%x",
+ i_threads);
+
+ if(false == l_isStopped)
{
- bool l_running = false;
- FAPI_TRY(threads_running(i_target, i_threads, o_rasStatusReg, l_running),
- "p9_thread_control_stop: unable to determine if threads are running. threads: 0x%x",
- i_threads);
+ // Pre-condition for stopping is that the threads are running (see figure 5.3 in the workbook)
+ // How to reconcile with 5.5.1 which says "invalid in maint mode?" Is that just a sub-precondition?
+ {
+ bool l_running = false;
+ FAPI_TRY(threads_running(i_target, i_threads, o_rasStatusReg, l_running),
+ "p9_thread_control_stop: unable to determine if threads are running. threads: 0x%x",
+ i_threads);
- PTC_ASSERT_WARN(l_running == true,
- i_warncheck,
- fapi2::P9_THREAD_CONTROL_STOP_PRE_NOTRUNNING()
- .set_CORE_TARGET(i_target)
- .set_THREAD(i_threads),
- "p9_thread_control_stop: ERROR: Threads cannot be stopped because they aren't running (threads=%x).", i_threads);
- }
+ PTC_ASSERT_WARN(l_running == true,
+ i_warncheck,
+ fapi2::P9_THREAD_CONTROL_STOP_PRE_NOTRUNNING()
+ .set_CORE_TARGET(i_target)
+ .set_THREAD(i_threads),
+ "p9_thread_control_stop: ERROR: Threads cannot be stopped because they aren't running (threads=%x).", i_threads);
+ }
- // Block interrupts while stopped
- {
- fapi2::buffer<uint64_t> l_mode_data;
- FAPI_TRY(fapi2::getScom(i_target, C_RAS_MODEREG, l_mode_data),
- "p9_thread_control_step: getScom error when reading ras_modreg for threads 0x%x",
- i_threads);
+ // Block interrupts while stopped
+ {
+ fapi2::buffer<uint64_t> l_mode_data;
+ FAPI_TRY(fapi2::getScom(i_target, C_RAS_MODEREG, l_mode_data),
+ "p9_thread_control_step: getScom error when reading ras_modreg for threads 0x%x",
+ i_threads);
- l_mode_data.setBit<RAS_MODE_MR_FENCE_INTERRUPTS>();
- FAPI_TRY(fapi2::putScom(i_target, C_RAS_MODEREG, l_mode_data),
- "p9_thread_control_step: putScom error when issuing ras_modreg step mode for threads 0x%x",
- i_threads);
- }
+ l_mode_data.setBit<RAS_MODE_MR_FENCE_INTERRUPTS>();
+ FAPI_TRY(fapi2::putScom(i_target, C_RAS_MODEREG, l_mode_data),
+ "p9_thread_control_step: putScom error when issuing ras_modreg step mode for threads 0x%x",
+ i_threads);
+ }
- // Stop the threads
- {
- fapi2::buffer<uint64_t> l_scom_data(g_control_reg_map[i_threads] >> CORE_STOP);
+ // Stop the threads
+ {
+ fapi2::buffer<uint64_t> l_scom_data(g_control_reg_map[i_threads] >> CORE_STOP);
- FAPI_TRY(fapi2::putScom(i_target, C_DIRECT_CONTROLS, l_scom_data),
- "p9_thread_control_stop: putScom error when issuing sp_stop for threads 0x%x",
+ FAPI_TRY(fapi2::putScom(i_target, C_DIRECT_CONTROLS, l_scom_data),
+ "p9_thread_control_stop: putScom error when issuing sp_stop for threads 0x%x",
+ i_threads);
+ }
+
+ // Post-conditions check
+ {
+ bool l_stopped = false;
+ FAPI_TRY(threads_stopped(i_target, i_threads, o_rasStatusReg, l_stopped),
+ "p9_thread_control_stop: unable to determine if threads are stopped. threads: 0x%x",
+ i_threads);
+
+ PTC_ASSERT_WARN(l_stopped == true,
+ i_warncheck,
+ fapi2::P9_THREAD_CONTROL_STOP_FAIL()
+ .set_CORE_TARGET(i_target)
+ .set_THREAD(i_threads),
+ "p9_thread_control_stop: ERROR: Thread Stop issued, but the threads are running. "
+ "Stop might have failed for threads 0x%x", i_threads);
+ }
+ FAPI_INF("p9_thread_control_stop : stop command issued for threads 0x%x",
i_threads);
}
-
- // Post-conditions check
+ else
{
- bool l_stopped = false;
- FAPI_TRY(threads_stopped(i_target, i_threads, o_rasStatusReg, l_stopped),
- "p9_thread_control_stop: unable to determine if threads are stopped. threads: 0x%x",
- i_threads);
-
- PTC_ASSERT_WARN(l_stopped == true,
- i_warncheck,
- fapi2::P9_THREAD_CONTROL_STOP_FAIL()
- .set_CORE_TARGET(i_target)
- .set_THREAD(i_threads),
- "p9_thread_control_stop: ERROR: Thread Stop issued, but the threads are running. "
- "Stop might have failed for threads 0x%x", i_threads);
+ FAPI_INF("p9_thread_control_stop : skipped calling stop cmd, since "
+ "thread [0x%x] already in stop mode", i_threads);
}
- FAPI_INF("p9_thread_control_stop : stop command issued for threads 0x%x",
- i_threads);
-
fapi_try_exit:
return fapi2::current_err;
}
OpenPOWER on IntegriCloud