[PATCH umr 2/4] Add ability to specify VMID in hex
Tom St Denis
tom.stdenis at amd.com
Mon Jul 24 15:25:49 UTC 2017
Signed-off-by: Tom St Denis <tom.stdenis 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 dcab07d7953a..4c720ba48840 100644
--- a/doc/umr.1
+++ b/doc/umr.1
@@ -92,8 +92,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