diff options
-rw-r--r-- | hw/fsp/fsp-attn.c | 8 | ||||
-rw-r--r-- | include/fsp-attn.h | 18 | ||||
-rw-r--r-- | libc/include/assert.h | 3 |
3 files changed, 24 insertions, 5 deletions
diff --git a/hw/fsp/fsp-attn.c b/hw/fsp/fsp-attn.c index 07c99c0..9edc920 100644 --- a/hw/fsp/fsp-attn.c +++ b/hw/fsp/fsp-attn.c @@ -95,8 +95,12 @@ void update_sp_attn_area(const char *msg) ti_attn->src_word[0] = (uint32_t)generate_hex_word((uint64_t)__builtin_return_address(0)); - ti_attn->msg_len = strlen(msg); - sprintf(ti_attn->msg, "%s", msg); + snprintf(ti_attn->msg.gitid, GITID_LEN, "%s", gitid); + __backtrace(ti_attn->msg.bt_buf, BT_FRAME_LEN); + snprintf(ti_attn->msg.file_info, FILE_INFO_LEN, "%s", msg); + + ti_attn->msg_len = GITID_LEN + BT_FRAME_LEN + + strlen(ti_attn->msg.file_info); } /* Intialises SP attention area */ diff --git a/include/fsp-attn.h b/include/fsp-attn.h index 0149b7c..947c49f 100644 --- a/include/fsp-attn.h +++ b/include/fsp-attn.h @@ -57,6 +57,20 @@ struct sp_attn_area { #define SRC_LEN 32 /* Max limit of user data size is 940 (due to attention area size) */ #define TI_MSG_LEN 940 + +/* Maximum sapphire version length (approx) */ +#define GITID_LEN 40 +/* Upto 10 frames each of length 40 bytes + header = 430 bytes */ +#define BT_FRAME_LEN 430 +/* File info length : Use the rest of the memory for file details */ +#define FILE_INFO_LEN (TI_MSG_LEN - GITID_LEN - BT_FRAME_LEN) + +struct user_data { + char gitid[GITID_LEN]; + char bt_buf[BT_FRAME_LEN]; + char file_info[FILE_INFO_LEN]; +} __packed; + /* Terminate Immediate Attention */ struct ti_attn { /* Command valid */ @@ -84,8 +98,8 @@ struct ti_attn { /* ASCII data */ char src[SRC_LEN]; uint32_t msg_len; - /* User data: Simple error message */ - char msg[TI_MSG_LEN]; + /* User data: Debug details */ + struct user_data msg; } __packed __align(ATTN_AREA_SZ); /* Hypervisor Service Routine Data area: Structure is not used as of today, diff --git a/libc/include/assert.h b/libc/include/assert.h index fbfb2cc..68f01ab 100644 --- a/libc/include/assert.h +++ b/libc/include/assert.h @@ -18,7 +18,8 @@ extern void update_sp_attn_area(const char *msg); #define assert(cond) \ do { if (!(cond)) { \ update_sp_attn_area(__FILE__ \ - ":" stringify(__LINE__)); \ + ":" stringify(__LINE__) \ + ":" stringify(cond)); \ assert_fail(__FILE__ \ ":" stringify(__LINE__) \ ":" stringify(cond)); } \ |