SPM: Add a log level to support output ERROR log
Add a log level TFM_SPM_LOG_ERROR to just enable the SPMLOG_ERRMSGVAL
and SPMLOG_ERRMSG.
Change-Id: I16de565f8059a80c197b94bf82f8020530ccbcac
Signed-off-by: Shawn Shan <Shawn.Shan@arm.com>
diff --git a/secure_fw/spm/include/tfm_spm_log.h b/secure_fw/spm/include/tfm_spm_log.h
index 5a2413a..4ad749e 100644
--- a/secure_fw/spm/include/tfm_spm_log.h
+++ b/secure_fw/spm/include/tfm_spm_log.h
@@ -14,11 +14,15 @@
#include "tfm_hal_spm_logdev.h"
/* The SPM log levels */
-#define TFM_SPM_LOG_LEVEL_DEBUG 2 /* All log APIs output */
-#define TFM_SPM_LOG_LEVEL_RELEASE 1 /*
+#define TFM_SPM_LOG_LEVEL_DEBUG 3 /* All log APIs output */
+#define TFM_SPM_LOG_LEVEL_INFO 2 /*
* All log APIs output except SPMLOG_DBG
* and SPMLOG_DBGMSGVAL
*/
+#define TFM_SPM_LOG_LEVEL_ERROR 1 /*
+ * Only SPMLOG_ERRMSG and SPMLOG_ERRMSGVAL
+ * APIs output.
+ */
#define TFM_SPM_LOG_LEVEL_SILENCE 0 /* All log APIs are suppressed */
#ifndef TFM_SPM_LOG_LEVEL
@@ -38,15 +42,19 @@
#define SPMLOG_DBGMSG(msg)
#endif
-#if (TFM_SPM_LOG_LEVEL >= TFM_SPM_LOG_LEVEL_RELEASE)
+#if (TFM_SPM_LOG_LEVEL >= TFM_SPM_LOG_LEVEL_INFO)
#define SPMLOG_INFMSGVAL(msg, val) spm_log_msgval(msg, sizeof(msg), val)
-#define SPMLOG_ERRMSGVAL(msg, val) spm_log_msgval(msg, sizeof(msg), val)
#define SPMLOG_INFMSG(msg) tfm_hal_output_spm_log(msg, sizeof(msg))
-#define SPMLOG_ERRMSG(msg) tfm_hal_output_spm_log(msg, sizeof(msg))
#else
#define SPMLOG_INFMSGVAL(msg, val)
-#define SPMLOG_ERRMSGVAL(msg, val)
#define SPMLOG_INFMSG(msg)
+#endif
+
+#if (TFM_SPM_LOG_LEVEL >= TFM_SPM_LOG_LEVEL_ERROR)
+#define SPMLOG_ERRMSGVAL(msg, val) spm_log_msgval(msg, sizeof(msg), val)
+#define SPMLOG_ERRMSG(msg) tfm_hal_output_spm_log(msg, sizeof(msg))
+#else
+#define SPMLOG_ERRMSGVAL(msg, val)
#define SPMLOG_ERRMSG(msg)
#endif