[PATCH] rtas_dbg: Fix the large negative values in rtas_dbg

18 views
Skip to first unread message

Likhitha Korrapati

<likhitha@linux.ibm.com>
unread,
Nov 17, 2023, 1:42:58 AM11/17/23
to powerpc-utils-devel@googlegroups.com, shirisha@linux.ibm.com, likhitha@linux.ibm.com
without the patch:
[root@xxx powerpc-utils]# rtas_dbg -l ibm,rks-hcalls
Could not get rtas token for ibm,indicator-0002
Could not get rtas token for ibm,integrated-stop-self
Could not get rtas token for ibm,indicator-9005
Could not get rtas token for ibm,extended-os-term
Could not get rtas token for ibm,indicator-0001
Could not get rtas token for ibm,sensor-0009
Could not get rtas token for ibm,recoverable-epow3
Could not get rtas token for ibm,sensor-9005
Could not get rtas token for ibm,change-msix-capable
Could not get rtas token for ibm,sensor-0005
Could not get rtas token for ibm,sensor-0001
ibm,rks-hcalls -536870912

The large negatives values are due to incompatible format(%d).
The data type of the token variable is uint32_t.This patch
modifies the format(%u) to align with its data type(uint32_t).

with the patch:
[root@xxx powerpc-utils]# ./src/rtas_dbg -l ibm,rks-hcalls
Could not get rtas token for ibm,indicator-0002
Could not get rtas token for ibm,integrated-stop-self
Could not get rtas token for ibm,indicator-9005
Could not get rtas token for ibm,extended-os-term
Could not get rtas token for ibm,indicator-0001
Could not get rtas token for ibm,sensor-0009
Could not get rtas token for ibm,recoverable-epow3
Could not get rtas token for ibm,sensor-9005
Could not get rtas token for ibm,change-msix-capable
Could not get rtas token for ibm,sensor-0005
Could not get rtas token for ibm,sensor-0001
ibm,rks-hcalls 3758096384

Reported-by: Shirisha Ganta <shir...@linux.ibm.com>
Signed-off-by: Likhitha Korrapati <likh...@linux.ibm.com>
---
src/rtas_dbg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rtas_dbg.c b/src/rtas_dbg.c
index ebc7474..6c7854a 100644
--- a/src/rtas_dbg.c
+++ b/src/rtas_dbg.c
@@ -200,10 +200,10 @@ void print_rtas_tokens(struct rtas_token *tok, struct rtas_token *tok_list)
struct rtas_token *t;

if (tok)
- printf("%-40s%d\n", tok->name, tok->token);
+ printf("%-40s%u\n", tok->name, tok->token);
else {
for (t = tok_list; t; t = t->next)
- printf("%-40s%d\n", t->name, t->token);
+ printf("%-40s%u\n", t->name, t->token);
}
}

@@ -217,7 +217,7 @@ int set_rtas_dbg(struct rtas_token *tok)
args.nret = htobe32(1);
args.args[0] = htobe32(tok->token);

- printf("Enabling rtas debug for %s (%d)\n", tok->name, tok->token);
+ printf("Enabling rtas debug for %s (%u)\n", tok->name, tok->token);

rc = rtas(&args);

--
2.39.1

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Nov 29, 2023, 5:17:30 PM11/29/23
to Likhitha Korrapati, powerpc-utils-devel@googlegroups.com, shirisha@linux.ibm.com
Reply all
Reply to author
Forward
0 new messages