summaryrefslogtreecommitdiffstats
path: root/src/include/bootloader/bootloader.H
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2017-03-23 17:04:01 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-04-06 11:49:50 -0400
commita37daa7eab139979f822e8af1b1509245a095377 (patch)
treed4fe9cc6885e619a05dce7ddc9401ed76c407518 /src/include/bootloader/bootloader.H
parent2d98932ebfff3cbf8dbe63252dcb22c32acfe85b (diff)
downloadtalos-hostboot-a37daa7eab139979f822e8af1b1509245a095377.tar.gz
talos-hostboot-a37daa7eab139979f822e8af1b1509245a095377.zip
Switch bootloader assert to do a bl_terminate
Also provide options to provide a bootloader trace byte or return code Change-Id: Id1ae0fdd349258aa16f43dd25b787b005d8661d6 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38389 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/bootloader/bootloader.H')
-rw-r--r--src/include/bootloader/bootloader.H126
1 files changed, 85 insertions, 41 deletions
diff --git a/src/include/bootloader/bootloader.H b/src/include/bootloader/bootloader.H
index 74e2364ee..3c75770de 100644
--- a/src/include/bootloader/bootloader.H
+++ b/src/include/bootloader/bootloader.H
@@ -39,20 +39,100 @@
#include <kernel/terminate.H>
#include <kernel/hbterminatetypes.H>
#include <bootloader/bootloaderif.H>
+#include <bootloader/bootloader_trace.H>
+#include <bootloader/hbblreasoncodes.H>
extern "C" void task_end_stub();
extern "C" void enterHBB(uint64_t i_hbb_hrmor, uint64_t i_hbb_offset);
-#define assert(expr) \
+#define printk(format...)
+
+/**
+ * @brief Handle setting up to terminate Bootloader
+ *
+ * @param[in] i_moduleID ID for module where terminate is occurring
+ * @param[in] i_reasoncode Reason code for why terminating
+ * @param[in] i_word7 Data for SRC word 7 / @userdata2[0:31]
+ * (optional, default is 0)
+ * @param[in] i_word8 Data for SRC word 8 / @userdata2[32:63]
+ * (optional, default is 0)
+ * @param[in] i_executeTI Flag for calling terminateExecuteTI
+ * (optional, default is true)
+ * @param[in] i_failAddr Address associated with termination
+ * (SRC word 6 / @userdata1[32:63],
+ * optional, default is 0)
+ */
+inline void bl_terminate(uint8_t i_moduleID,
+ uint16_t i_reasoncode,
+ uint32_t i_word7 = 0,
+ uint32_t i_word8 = 0,
+ bool i_executeTI = true,
+ uint64_t i_failAddr = 0)
+{
+ termWriteSRC(TI_BOOTLOADER,
+ i_reasoncode,
+ i_failAddr);
+
+ termModifySRC(i_moduleID,
+ i_word7,
+ i_word8);
+
+ if(i_executeTI)
+ {
+ terminateExecuteTI();
+ }
+}
+
+/**
+ * @brief Macro to assert using bl_terminate
+ *
+ * Calls bl_terminate with default module id and reason code for assert
+ */
+#define __ASSERT() \
+{\
+ bl_terminate(Bootloader::MOD_BOOTLOADER_ASSERT,Bootloader::RC_ASSERT);\
+}
+
+/**
+ * @brief Macro to assert with custom trace
+ *
+ * Calls Bootloader trace and assert macro
+ */
+#define __ASSERT_W_TRACE(trace) \
+{ \
+ BOOTLOADER_TRACE(trace);\
+ __ASSERT();\
+}
+
+/**
+ * @brief Macro to assert using bl_terminate with custom trace and reason code.
+ *
+ * Calls Bootloader trace and provides a custom reason code to bl_terminate
+ */
+#define __ASSERT_W_TRACE_RC(trace,rc) \
+{ \
+ BOOTLOADER_TRACE(trace);\
+ bl_terminate(Bootloader::MOD_BOOTLOADER_ASSERT, rc);\
+}
+
+
+// Macro tricks to determine which assert macro to call
+#define GET_MACRO(_1,_2,_3,FUNC,...) FUNC
+
+/**
+ * @brief Standard assert macro.
+ *
+ * Verifies condition, uses GET_MACRO to determine which assert macro to call.
+ * Supports asserting via bl_terminate with custom trace and/or reason code
+ */
+#define assert(expr, ...) \
{\
- if (unlikely(!(expr)))\
+ if(unlikely(!(expr))) \
{\
- task_end_stub();\
+ GET_MACRO(0, ##__VA_ARGS__, __ASSERT_W_TRACE_RC, __ASSERT_W_TRACE, __ASSERT)(__VA_ARGS__) \
}\
}
-#define printk(format...)
-
namespace Bootloader{
/**
* @brief Get the current HBBL HRMOR
@@ -108,42 +188,6 @@ namespace Bootloader{
uint32_t i_size,
MMIOLoadStoreSizes i_ld_st_size);
- /**
- * @brief Handle setting up to terminate Bootloader
- *
- * @param[in] i_moduleID ID for module where terminate is occurring
- * @param[in] i_reasoncode Reason code for why terminating
- * @param[in] i_word7 Data for SRC word 7 / @userdata2[0:31]
- * (optional, default is 0)
- * @param[in] i_word8 Data for SRC word 8 / @userdata2[32:63]
- * (optional, default is 0)
- * @param[in] i_executeTI Flag for calling terminateExecuteTI
- * (optional, default is true)
- * @param[in] i_failAddr Address associated with termination
- * (SRC word 6 / @userdata1[32:63],
- * optional, default is 0)
- */
- inline void bl_terminate(uint8_t i_moduleID,
- uint16_t i_reasoncode,
- uint32_t i_word7 = 0,
- uint32_t i_word8 = 0,
- bool i_executeTI = true,
- uint64_t i_failAddr = 0)
- {
- termWriteSRC(TI_BOOTLOADER,
- i_reasoncode,
- i_failAddr);
-
- termModifySRC(i_moduleID,
- i_word7,
- i_word8);
-
- if(i_executeTI)
- {
- terminateExecuteTI();
- }
- }
-
/** @enum HbbLengths
* @brief List of HBB lengths.
*
OpenPOWER on IntegriCloud