aboutsummaryrefslogtreecommitdiff
path: root/include/timebase.h
diff options
context:
space:
mode:
authorAnshuman Khandual <khandual@linux.vnet.ibm.com>2014-08-13 14:27:45 +0530
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-08-13 19:01:36 +1000
commit087e04598ed74146c2f2eab5666cd4d4b53b6974 (patch)
treed0d4c15c2f4fae090f05cda1a2df20d51baf7d46 /include/timebase.h
parent0a22f85f524f366a3e2ef2af4a3faa0e9cef26ca (diff)
downloadskiboot-087e04598ed74146c2f2eab5666cd4d4b53b6974.zip
skiboot-087e04598ed74146c2f2eab5666cd4d4b53b6974.tar.gz
skiboot-087e04598ed74146c2f2eab5666cd4d4b53b6974.tar.bz2
dpo: Add OPAL interface to access the DPO timeout
This patch adds a OPAL interface to fetch the DPO timeout. This functionality is required to synchronously query Sapphire about how much seconds are remaining for a forced system shutdown which is useful in cases where the host has missed the OPAL_MSG_DPO for some reason like system boot, reboot or kexec operations. This ensures host can still query about the DPO timeout status and act. This patch also adds helper routine to convert time base into seconds. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'include/timebase.h')
-rw-r--r--include/timebase.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/timebase.h b/include/timebase.h
index a1b787f..4537256 100644
--- a/include/timebase.h
+++ b/include/timebase.h
@@ -57,6 +57,11 @@ static inline unsigned long secs_to_tb(unsigned long secs)
return secs * tb_hz;
}
+static inline unsigned long tb_to_secs(unsigned long tb)
+{
+ return tb / tb_hz;
+}
+
static inline unsigned long msecs_to_tb(unsigned long msecs)
{
return msecs * (tb_hz / 1000);