[Skiboot] [PATCH 6/7] core/stack: Rename backtrace functions, get rid of wrappers

Andrew Donnellan andrew.donnellan at au1.ibm.com
Mon Mar 18 15:28:59 AEDT 2019


Rename ___backtrace() to backtrace_create() and ___print_backtrace() to
backtrace_print(). Get rid of __backtrace() and __print_backtrace()
wrappers.

Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
 core/stack.c        | 13 +++++++------
 hw/fsp/fsp-attn.c   |  4 ++--
 hw/ipmi/ipmi-attn.c |  5 ++---
 include/stack.h     | 32 +++++---------------------------
 4 files changed, 16 insertions(+), 38 deletions(-)

diff --git a/core/stack.c b/core/stack.c
index 2e47cd4dbd4a..d33d2fe771f7 100644
--- a/core/stack.c
+++ b/core/stack.c
@@ -27,8 +27,9 @@
 static struct bt_entry bt_buf[STACK_BUF_ENTRIES];
 
 /* Dumps backtrace to buffer */
-void __nomcount ___backtrace(struct bt_entry *entries, unsigned int max_ents,
-			     struct bt_metadata *metadata)
+void __nomcount backtrace_create(struct bt_entry *entries,
+				 unsigned int max_ents,
+				 struct bt_metadata *metadata)
 {
 	unsigned long *fp = __builtin_frame_address(0);
 	unsigned long top_adj = top_of_ram;
@@ -61,8 +62,8 @@ void __nomcount ___backtrace(struct bt_entry *entries, unsigned int max_ents,
 	metadata->pir = mfspr(SPR_PIR);
 }
 
-void ___print_backtrace(struct bt_entry *entries, struct bt_metadata *metadata,
-			char *out_buf, unsigned int *len, bool symbols)
+void backtrace_print(struct bt_entry *entries, struct bt_metadata *metadata,
+		     char *out_buf, unsigned int *len, bool symbols)
 {
 	static char bt_text_buf[4096];
 	int i, l = 0, max;
@@ -127,8 +128,8 @@ void backtrace(void)
 
 	lock(&bt_lock);
 
-	___backtrace(bt_buf, STACK_BUF_ENTRIES, &metadata);
-	___print_backtrace(bt_buf, &metadata, NULL, NULL, true);
+	backtrace_create(bt_buf, STACK_BUF_ENTRIES, &metadata);
+	backtrace_print(bt_buf, &metadata, NULL, NULL, true);
 
 	unlock(&bt_lock);
 }
diff --git a/hw/fsp/fsp-attn.c b/hw/fsp/fsp-attn.c
index 6774dd84cee7..667d9ab5810c 100644
--- a/hw/fsp/fsp-attn.c
+++ b/hw/fsp/fsp-attn.c
@@ -106,10 +106,10 @@ static void update_sp_attn_area(const char *msg)
 		cpu_to_be32((uint32_t)((uint64_t)__builtin_return_address(0) & 0xffffffff));
 
 	snprintf(ti_attn->msg.version, VERSION_LEN, "%s", version);
-	___backtrace(bt_buf, STACK_BUF_ENTRIES, &metadata);
+	backtrace_create(bt_buf, STACK_BUF_ENTRIES, &metadata);
 	metadata.token = OPAL_LAST + 1;
 	len = BT_FRAME_LEN;
-	___print_backtrace(bt_buf, &metadata, ti_attn->msg.bt_buf, &len, false);
+	backtrace_print(bt_buf, &metadata, ti_attn->msg.bt_buf, &len, false);
 	snprintf(ti_attn->msg.file_info, FILE_INFO_LEN, "%s", msg);
 
 	ti_attn->msg_len = VERSION_LEN + BT_FRAME_LEN +
diff --git a/hw/ipmi/ipmi-attn.c b/hw/ipmi/ipmi-attn.c
index 8407188401a3..c6c1c59b5f34 100644
--- a/hw/ipmi/ipmi-attn.c
+++ b/hw/ipmi/ipmi-attn.c
@@ -53,10 +53,9 @@ static void ipmi_log_terminate_event(const char *msg)
 	ti_size = IPMI_TI_BUFFER_SIZE - ti_len;
 
 	/* Backtrace */
-	___backtrace(bt_buf, STACK_BUF_ENTRIES, &metadata);
+	backtrace_create(bt_buf, STACK_BUF_ENTRIES, &metadata);
 	metadata.token = OPAL_LAST + 1;
-	___print_backtrace(bt_buf, &metadata, ti_buffer + ti_len, &ti_size,
-			   true);
+	backtrace_print(bt_buf, &metadata, ti_buffer + ti_len, &ti_size, true);
 
 	/* Create eSEL event and commit */
 	elog_buf = opal_elog_create(&e_info(OPAL_RC_ATTN), 0);
diff --git a/include/stack.h b/include/stack.h
index d8baf8dc7773..004beb047471 100644
--- a/include/stack.h
+++ b/include/stack.h
@@ -125,35 +125,13 @@ struct bt_metadata {
 extern void *boot_stack_top;
 
 /* Create a backtrace */
-void ___backtrace(struct bt_entry *entries, unsigned int max_ents,
-		  struct bt_metadata *metadata);
-
-static inline void __backtrace(struct bt_entry *entries, unsigned int *count)
-{
-	struct bt_metadata metadata;
-
-	___backtrace(entries, *count, &metadata);
-
-	*count = metadata.ents;
-}
+void backtrace_create(struct bt_entry *entries, unsigned int max_ents,
+		      struct bt_metadata *metadata);
 
 /* Convert a backtrace to ASCII */
-extern void ___print_backtrace(struct bt_entry *entries,
-			       struct bt_metadata *metadata, char *out_buf,
-			       unsigned int *len, bool symbols);
-
-static inline void __print_backtrace(unsigned int pir, struct bt_entry *entries,
-				     unsigned int count, char *out_buf,
-				     unsigned int *len, bool symbols)
-{
-	struct bt_metadata metadata = {
-		.ents = count,
-		.token = OPAL_LAST + 1,
-		.r1_caller = 0,
-		.pir = pir
-	};
-	___print_backtrace(entries, &metadata, out_buf, len, symbols);
-}
+extern void backtrace_print(struct bt_entry *entries,
+			    struct bt_metadata *metadata, char *out_buf,
+			    unsigned int *len, bool symbols);
 
 /* For use by debug code, create and print backtrace, uses a static buffer */
 extern void backtrace(void);
-- 
2.11.0



More information about the Skiboot mailing list