From be430d881285f72df6dd932c06811d62463dfe88 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Mon, 20 Jun 2016 17:18:42 +1000 Subject: Add fwts annotations for critical errors Signed-off-by: Stewart Smith --- core/hostservices.c | 8 ++++++++ core/opal.c | 5 +++++ core/utils.c | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/core/hostservices.c b/core/hostservices.c index 672b57f..6aea670 100644 --- a/core/hostservices.c +++ b/core/hostservices.c @@ -238,6 +238,10 @@ static void hservice_mark(void) static void hservice_assert(void) { + /** + * @fwts-label HBRTassert + * @fwts-advice HBRT triggered assert: you need to debug HBRT + */ prlog(PR_EMERG, "HBRT: Assertion from hostservices\n"); abort(); } @@ -488,6 +492,10 @@ static int hservice_lid_load(uint32_t lid, void **buf, size_t *len) prlog(PR_INFO, "HBRT: Lid load request for 0x%08x\n", lid); if (list_empty(&hbrt_lid_list)) { /* Should not happen */ + /** + * @fwts-label HBRTlidLoadFail + * @fwts-advice Firmware should have aborted boot + */ prlog(PR_CRIT, "HBRT: LID Load failed\n"); abort(); } diff --git a/core/opal.c b/core/opal.c index b6411f0..a9d3c41 100644 --- a/core/opal.c +++ b/core/opal.c @@ -269,6 +269,11 @@ void opal_del_poller(void (*poller)(void *data)) * if anybody uses it, print a warning and leak the entry, don't * free it. */ + /** + * @fwts-label UnsupportedOPALdelpoller + * @fwts-advice Currently removing a poller is DANGEROUS and + * MUST NOT be done in production firmware. + */ prlog(PR_ALERT, "WARNING: Unsupported opal_del_poller." " Interesting locking issues, don't call this.\n"); diff --git a/core/utils.c b/core/utils.c index 4bb89df..d21881e 100644 --- a/core/utils.c +++ b/core/utils.c @@ -27,6 +27,13 @@ unsigned long __stack_chk_guard = 0xdeadf00dbaad300dULL; void __noreturn assert_fail(const char *msg) { + /** + * @fwts-label FailedAssert + * @fwts-advice OPAL hit an assert(). During normal usage (even + * testing) we should never hit an assert. There are other code + * paths for controlled shutdown/panic in the event of catastrophic + * errors. + */ prlog(PR_EMERG, "Assert fail: %s\n", msg); _abort(msg); } -- cgit v1.1