summaryrefslogtreecommitdiffstats
path: root/import/chips
diff options
context:
space:
mode:
Diffstat (limited to 'import/chips')
-rw-r--r--import/chips/p9/procedures/ppe/pk/kernel/pk_api.h15
-rw-r--r--import/chips/p9/procedures/ppe/pk/kernel/pk_init.c23
2 files changed, 32 insertions, 6 deletions
diff --git a/import/chips/p9/procedures/ppe/pk/kernel/pk_api.h b/import/chips/p9/procedures/ppe/pk/kernel/pk_api.h
index 8d863562..dab66e0f 100644
--- a/import/chips/p9/procedures/ppe/pk/kernel/pk_api.h
+++ b/import/chips/p9/procedures/ppe/pk/kernel/pk_api.h
@@ -469,10 +469,10 @@ extern uint32_t __pk_timebase_frequency_hz;
extern uint8_t __pk_timebase_rshift;
/// The timebase frequency in KHz
-extern uint32_t __pk_timebase_frequency_khz;
+extern uint32_t __pk_timebase_frequency_khz; //never set or used. Delete?
/// The timebase frequency in Mhz
-extern uint32_t __pk_timebase_frequency_mhz;
+extern uint32_t __pk_timebase_frequency_mhz; //never set or used. Delete?
typedef unsigned long int PkAddress;
@@ -702,6 +702,17 @@ pk_initialize(PkAddress kernel_stack,
PkTimebase initial_timebase,
uint32_t timebase_frequency_hz);
+/**
+ * Set the timebase frequency.
+ * @param[in] The frequency in HZ
+ * @return PK_OK
+ * @pre pk_initialize
+ * @Note This interface is intended for SBE. The timebase frequency value is
+ * used by PK to calcate timed events. Any existing timeouts,
+ * sleeps, or time based pending semaphores are not recalculated.
+ */
+int
+pk_timebase_freq_set(uint32_t timebase_frequency_hz);
// Timebase APIs
diff --git a/import/chips/p9/procedures/ppe/pk/kernel/pk_init.c b/import/chips/p9/procedures/ppe/pk/kernel/pk_init.c
index 79669552..056bf270 100644
--- a/import/chips/p9/procedures/ppe/pk/kernel/pk_init.c
+++ b/import/chips/p9/procedures/ppe/pk/kernel/pk_init.c
@@ -130,6 +130,10 @@ pk_initialize(PkAddress kernel_stack,
__pk_thread_machine_context_default = PK_THREAD_MACHINE_CONTEXT_DEFAULT;
+ //set the shift adjustment to get us closer to the true
+ //timebase frequency (versus what was hardcoded)
+ pk_set_timebase_rshift(timebase_frequency_hz);
+
rc = __pk_stack_init(&kernel_stack, &kernel_stack_size);
if (rc)
@@ -156,10 +160,6 @@ pk_initialize(PkAddress kernel_stack,
//set the trace timebase HZ
g_pk_trace_buf.hz = timebase_frequency_hz;
- //set the shift adjustment to get us closer to the true
- //timebase frequency (versus what was hardcoded)
- pk_set_timebase_rshift(timebase_frequency_hz);
-
if(initial_timebase != PK_TIMEBASE_CONTINUES)
{
//set the timebase ajdustment for trace synchronization
@@ -200,6 +200,21 @@ pk_initialize(PkAddress kernel_stack,
}
+// Set the timebase frequency.
+int
+pk_timebase_freq_set(uint32_t timebase_frequency_hz)
+{
+ __pk_timebase_frequency_hz = timebase_frequency_hz;
+ pk_set_timebase_rshift(timebase_frequency_hz);
+
+#if PK_TRACE_SUPPORT
+ g_pk_trace_buf.hz = timebase_frequency_hz;
+#endif
+ // Does the initial_timebase need to be reset?
+ return PK_OK;
+}
+
+
/// Call the application main()
///
/// __pk_main() is called from the bootloader. It's only purpose is to
OpenPOWER on IntegriCloud