summaryrefslogtreecommitdiffstats
path: root/src/hwpf/src/plat
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2016-10-21 18:11:41 -0500
committerAMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com>2016-12-01 04:44:03 -0500
commit7e9ef2247c142869c58d7fe3ffac8a0bb1cdb12f (patch)
treeea4809198e0ba06ff0aae73b943c754c1e863f9e /src/hwpf/src/plat
parentba6c6e611b394a60fa68c10dcc6925bb50afc590 (diff)
downloadtalos-sbe-7e9ef2247c142869c58d7fe3ffac8a0bb1cdb12f.tar.gz
talos-sbe-7e9ef2247c142869c58d7fe3ffac8a0bb1cdb12f.zip
Update fapi::delay implementation
Change-Id: I1194b6819de9c9c4935e2761b984de1f40ba9aec Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31680 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com> Reviewed-by: AMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com>
Diffstat (limited to 'src/hwpf/src/plat')
-rw-r--r--src/hwpf/src/plat/plat_utils.C32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/hwpf/src/plat/plat_utils.C b/src/hwpf/src/plat/plat_utils.C
index 4b5a60ea..41b9a53b 100644
--- a/src/hwpf/src/plat/plat_utils.C
+++ b/src/hwpf/src/plat/plat_utils.C
@@ -39,6 +39,13 @@
namespace fapi2
{
+ // Define own function rather than using PK function
+ // This is required as PK function does not scale well for low
+ // frequency till istep 2.7
+ inline uint64_t delayCycles(uint64_t i_nanoSeconds )
+ {
+ return ( i_nanoSeconds/1000) * ( g_sbefreq /(1000*1000));
+ }
/// @brief Delay this thread.
///
ReturnCode delay(uint64_t i_nanoSeconds, uint64_t i_simCycles, bool i_fixed /* = false*/)
@@ -51,8 +58,6 @@ namespace fapi2
#ifndef __FAPI_DELAY_SIM__
-#define PK_NANOSECONDS_SBE(n) ((PkTimebase)((PK_BASE_FREQ_HZ * (PkTimebase)(n)) / (1024*1024*1024)))
-
PkTimebase target_time;
PkTimebase current_time;
PkMachineContext ctx;
@@ -61,33 +66,12 @@ namespace fapi2
// Only execute if nanoSeconds is non-zero (eg a real wait)
if (i_nanoSeconds)
{
- // @todo For SBE applications, the time accuracy can be traded off
- // for space with the PK_NANOSECONDS_SBE implemenation as the compiler
- // use shift operations for the unit normalizing division.
-
// The critical section enter/exit set is done to ensure the timebase
// operations are non-interrupible.
pk_critical_section_enter(&ctx);
- //
- // The "accurate" version is the next line.
- // target_time = pk_timebase_get() + PK_INTERVAL_SCALE(PK_NANOSECONDS(i_nanoSeconds));
- uint64_t cycles = 0;
- if( SBE::isSimicsRunning() )
- {
- cycles = PK_INTERVAL_SCALE(
- PK_NANOSECONDS_SBE(i_nanoSeconds));
- }
- else
- {
- // TODO via RTC 163216
- // Fix for the timer ( using in cycle mode )
- // Check what should be the right approach for time calculatin.
- cycles = PK_INTERVAL_SCALE(
- PK_NANOSECONDS_SBE(i_nanoSeconds)) * 64;
- }
- target_time = pk_timebase_get() + cycles;
+ target_time = pk_timebase_get() + delayCycles( i_nanoSeconds);
do
{
OpenPOWER on IntegriCloud