[PATCH umr 2/4] Add ability to specify VMID in hex

Tom St Denis tom.stdenis at amd.com
Tue Jul 25 17:23:22 UTC 2017


Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
Acked-by: Alex Deucher <alexander.deucher at amd.com>
---
 doc/umr.1      |  5 +++--
 src/app/main.c | 11 +++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/umr.1 b/doc/umr.1
index 9384c2430bda..0a991f9923a4 100644
--- a/doc/umr.1
+++ b/doc/umr.1
@@ -89,8 +89,9 @@ will operate regardless of whether GFX PG is enabled or not.  Can use
 to decode the wave bitfields.
 .IP "--vram, -v [vmid@]<address> <size>"
 Read 'size' bytes (in hex) from the address specified (in hexadecimal) from VRAM
-to stdout.  Optionally specify the VMID (in decimal) treating the address as a
-virtual address instead.  Can use 'use_pci' to directly access VRAM.
+to stdout.  Optionally specify the VMID (in decimal or in hex with a 0x prefix)
+treating the address as a virtual address instead.  Can use 'use_pci' to
+directly access VRAM.
 
 .IP "--update, -u" <filename>
 Specify update file to add, change, or delete registers from the register
diff --git a/src/app/main.c b/src/app/main.c
index d8278a93e1cc..6e0bc57200b0 100644
--- a/src/app/main.c
+++ b/src/app/main.c
@@ -346,10 +346,13 @@ int main(int argc, char **argv)
 				if (!asic)
 					asic = get_asic();
 
-				if ((n = sscanf(argv[i+1], "%"SCNu32"@%"SCNx64, &vmid, &address)) != 2) {
-					sscanf(argv[i+1], "%"SCNx64, &address);
-					vmid = 0xFFFF;
-				}
+				// allow specifying the vmid in hex as well so
+				// people can add the HUB flags more easily
+				if ((n = sscanf(argv[i+1], "0x%"SCNx32"@%"SCNx64, &vmid, &address)) != 2)
+					if ((n = sscanf(argv[i+1], "%"SCNu32"@%"SCNx64, &vmid, &address)) != 2) {
+						sscanf(argv[i+1], "%"SCNx64, &address);
+						vmid = UMR_LINEAR_HUB;
+					}
 				sscanf(argv[i+2], "%"SCNx32, &size);
 				while (size) {
 					n = size > sizeof(buf) ? sizeof(buf) : size;
-- 
2.12.0



More information about the amd-gfx mailing list