[PATCH umr] Add ability to write registers by address

Tom St Denis tstdenis82 at gmail.com
Wed Mar 15 13:09:01 UTC 2017


Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
---
 src/app/main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/app/main.c b/src/app/main.c
index 88b4feaf0058..72c29d6a26d4 100644
--- a/src/app/main.c
+++ b/src/app/main.c
@@ -216,9 +216,14 @@ int main(int argc, char **argv)
 			}
 		} else if (!strcmp(argv[i], "--write") || !strcmp(argv[i], "-w")) {
 			if (i + 2 < argc) {
+				uint32_t reg, val;
+
 				if (!asic)
 					asic = get_asic();
-				umr_set_register(asic, argv[i+1], argv[i+2]);
+				if (sscanf(argv[i+1], "%"SCNx32, &reg) == 1 && sscanf(argv[i+2], "%"SCNx32, &val) == 1)
+					umr_write_reg(asic, reg * 4, val);
+				else
+					umr_set_register(asic, argv[i+1], argv[i+2]);
 				i += 2;
 				options.need_scan = 0;
 			} else {
-- 
2.12.0



More information about the amd-gfx mailing list