Send power management events to the Trusted OS (TLK)
This patch adds PM handlers to TLKD for the system suspend/resume and
system poweroff/reset cases. TLK expects all SMCs through a single
handler, which then fork out into multiple handlers depending on the
SMC. We tap into the same single entrypoint by restoring the S-EL1
context before passing the PM event via register 'x0'. On completion
of the PM event, TLK sends a completion SMC and TLKD then moves on
with the PM process.
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
diff --git a/include/bl32/payloads/tlk.h b/include/bl32/payloads/tlk.h
index bdfcc9a..6ce1eb6 100644
--- a/include/bl32/payloads/tlk.h
+++ b/include/bl32/payloads/tlk.h
@@ -43,6 +43,9 @@
#define TLK_REGISTER_LOGBUF TLK_TOS_STD_FID(0x1)
#define TLK_REGISTER_REQBUF TLK_TOS_STD_FID(0x2)
#define TLK_RESUME_FID TLK_TOS_STD_FID(0x100)
+#define TLK_SYSTEM_SUSPEND TLK_TOS_STD_FID(0xE001)
+#define TLK_SYSTEM_RESUME TLK_TOS_STD_FID(0xE002)
+#define TLK_SYSTEM_OFF TLK_TOS_STD_FID(0xE003)
/*
* SMC function IDs that TLK uses to signal various forms of completions
@@ -52,6 +55,9 @@
#define TLK_PREEMPTED (0x32000002 | (1 << 31))
#define TLK_ENTRY_DONE (0x32000003 | (1 << 31))
#define TLK_VA_TRANSLATE (0x32000004 | (1 << 31))
+#define TLK_SUSPEND_DONE (0x32000005 | (1 << 31))
+#define TLK_RESUME_DONE (0x32000006 | (1 << 31))
+#define TLK_SYSTEM_OFF_DONE (0x32000007 | (1 << 31))
/*
* Trusted Application specific function IDs