From d9160de47755bf7d4aa6eebcd8a73b827671375b Mon Sep 17 00:00:00 2001 From: Chris Smart Date: Thu, 21 Jul 2016 17:10:48 +1000 Subject: core/timer: Add support for platform specific heartbeat The timer code currently has a default and a special check for FSP machines or those with SLW timer facility. This patch adds support for platform quirk to set the timer. Signed-off-by: Chris Smart Acked-by: Michael Neuling [stewart@linux.vnet.ibm.com: fix whitespace issue] Signed-off-by: Stewart Smith --- core/timer.c | 16 ++++++++++------ include/platform.h | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/timer.c b/core/timer.c index 8bfba4a..210e2a0 100644 --- a/core/timer.c +++ b/core/timer.c @@ -245,22 +245,26 @@ void check_timers(bool from_interrupt) void late_init_timers(void) { + int heartbeat = HEARTBEAT_DEFAULT_MS; + /* Add a property requesting the OS to call opal_poll_event() at * a specified interval in order for us to run our background * low priority pollers. * + * If a platform quirk exists, use that, else use the default. + * * If we have an SLW timer facility, we run this 10 times slower, * we could possibly completely get rid of it. * * We use a value in milliseconds, we don't want this to ever be * faster than that. */ - if (slw_timer_ok() || fsp_present()) { - dt_add_property_cells(opal_node, "ibm,heartbeat-ms", - HEARTBEAT_DEFAULT_MS * 10); - } else { - dt_add_property_cells(opal_node, "ibm,heartbeat-ms", - HEARTBEAT_DEFAULT_MS); + if (platform.heartbeat_time) { + heartbeat = platform.heartbeat_time(); + } else if (slw_timer_ok() || fsp_present()) { + heartbeat = HEARTBEAT_DEFAULT_MS * 10; } + + dt_add_property_cells(opal_node, "ibm,heartbeat-ms", heartbeat); } #endif diff --git a/include/platform.h b/include/platform.h index d07994f..062a941 100644 --- a/include/platform.h +++ b/include/platform.h @@ -159,6 +159,10 @@ struct platform { */ int64_t (*sensor_read)(uint32_t sensor_hndl, int token, uint32_t *sensor_data); + /* + * Return the heartbeat time + */ + int (*heartbeat_time)(void); /* * OPAL terminate -- cgit v1.1