5 #ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_LOG_H_
6 #define OPENTITAN_SW_DEVICE_LIB_RUNTIME_LOG_H_
101 extern char _dv_log_offset[];
109 #define OT_FAIL_IF_64_BIT_LOG(arg) OT_FAIL_IF_64_BIT(arg, LOG)
119 #define OT_CHECK_VALID_LOG_ARGS(...) \
120 OT_VA_FOR_EACH(OT_FAIL_IF_64_BIT_LOG, ##__VA_ARGS__)
132 #define LOG(severity, format, ...) \
134 OT_CHECK_VALID_LOG_ARGS(__VA_ARGS__); \
135 if (kDeviceLogBypassUartAddress != 0) { \
141 __attribute__((section(".logs.fields"))) \
142 static const log_fields_t kLogFields = \
143 LOG_MAKE_FIELDS_(severity, format, ##__VA_ARGS__); \
144 base_log_internal_dv((const log_fields_t*)((char*)&kLogFields + (uintptr_t)&_dv_log_offset), \
145 OT_VA_ARGS_COUNT(format, ##__VA_ARGS__), \
148 static const log_fields_t log_fields = \
149 LOG_MAKE_FIELDS_(severity, format, ##__VA_ARGS__); \
150 base_log_internal_core(&log_fields, ##__VA_ARGS__); \
157 #define LOG_MAKE_FIELDS_(_severity, _format, ...) \
159 .severity = _severity, .file_name = "" __FILE__ "", .line = __LINE__, \
160 .nargs = OT_VA_ARGS_COUNT(_format, ##__VA_ARGS__), .format = _format, \
171 #define LOG_INFO(...) LOG(kLogSeverityInfo, __VA_ARGS__)
181 #define LOG_WARNING(...) LOG(kLogSeverityWarn, __VA_ARGS__)
191 #define LOG_ERROR(...) LOG(kLogSeverityError, __VA_ARGS__)
204 #define LOG_FATAL(...) LOG(kLogSeverityFatal, __VA_ARGS__)