[Skiboot] [PATCH] getscom/getsram/putscom: Parse chip-id as hex

Anton Blanchard anton at samba.org
Tue Aug 30 07:20:34 AEST 2016


We print the chip-id in hex (without a leading 0x), but we fail to
parse that same value correctly in getscom/getsram/putscom:

 # getscom -l
 ...
 80000000 | DD2.0 | Centaur memory buffer

 # getscom -c 80000000 201140a
 Error -19 reading XSCOM

Fix this by assuming base 16 when parsing chip-id.

Signed-off-by: Anton Blanchard <anton at samba.org>
---
 external/xscom-utils/getscom.c | 2 +-
 external/xscom-utils/getsram.c | 2 +-
 external/xscom-utils/putscom.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/external/xscom-utils/getscom.c b/external/xscom-utils/getscom.c
index e6eb54d..fd5aeb6 100644
--- a/external/xscom-utils/getscom.c
+++ b/external/xscom-utils/getscom.c
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
 			addr = strtoull(optarg, NULL, 16);
 			break;
 		case 'c':
-			chip_id = strtoul(optarg, NULL, 0);
+			chip_id = strtoul(optarg, NULL, 16);
 			break;
 		case 'h':
 			print_usage(0);
diff --git a/external/xscom-utils/getsram.c b/external/xscom-utils/getsram.c
index 569f60e..65acc19 100644
--- a/external/xscom-utils/getsram.c
+++ b/external/xscom-utils/getsram.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
 			addr = strtoull(optarg, NULL, 16);
 			break;
 		case 'c':
-			chip_id = strtoul(optarg, NULL, 0);
+			chip_id = strtoul(optarg, NULL, 16);
 			break;
 		case 'n':
 			occ_channel = strtoul(optarg, NULL, 0);
diff --git a/external/xscom-utils/putscom.c b/external/xscom-utils/putscom.c
index 01a71c6..7eaa59e 100644
--- a/external/xscom-utils/putscom.c
+++ b/external/xscom-utils/putscom.c
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
 			got_val = true;
 			break;
 		case 'c':
-			chip_id = strtoul(optarg, NULL, 0);
+			chip_id = strtoul(optarg, NULL, 16);
 			break;
 		case 'v':
 			printf("xscom utils version %s\n", version);
-- 
2.7.4



More information about the Skiboot mailing list