Skip to contentSkip to conversation

remove casts and replace with portable formatters in output

PATCH New Tom St Denis 1 participant 1 message Jun 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove casts and replace with portable formatters in output

---
 src/lib/dump_ib.c             |  18 +--
 src/lib/read_vram.c           | 210 +++++++++++++++++-----------------
 src/lib/umr_llvm_disasm.c     |   8 +-
 src/lib/umr_read_pm4_stream.c |   4 +-
 4 files changed, 120 insertions(+), 120 deletions(-)
src/lib/dump_ib.c +9 -9
index 2ac5f57b3e76..7c23db1191b8 100644
@@ -36,18 +36,18 @@ void umr_dump_ib(struct umr_asic *asic, struct umr_ring_decoder *decoder)
 	uint32_t *data = NULL, x;
 	static const char *hubs[] = { "gfxhub", "mmhub" };
 
-	printf("Dumping IB at (%s%s%s) VMID:%u 0x%llx of %u words from ",
+	printf("Dumping IB at (%s%s%s) VMID:%u 0x%" PRIx64 " of %u words from ",
 		GREEN, hubs[decoder->next_ib_info.vmid >> 8], RST,
 		(unsigned)decoder->next_ib_info.vmid & 0xFF,
-		(unsigned long long)decoder->next_ib_info.ib_addr,
+		decoder->next_ib_info.ib_addr,
 		(unsigned)decoder->next_ib_info.size/4);
 
 	if (decoder->src.ib_addr == 0)
 		printf("ring[%s%u%s]", BLUE, (unsigned)decoder->src.addr, RST);
 	else
-		printf("IB[%s%u%s@%s0x%llx%s + %s0x%x%s]",
+		printf("IB[%s%u%s@%s0x%" PRIx64 "%s + %s0x%x%s]",
 			BLUE, (int)decoder->src.vmid, RST,
-			YELLOW, (unsigned long long)decoder->src.ib_addr, RST,
+			YELLOW, decoder->src.ib_addr, RST,
 			YELLOW, (unsigned)decoder->src.addr * 4, RST);
 
 	printf("\n");
@@ -60,9 +60,9 @@ void umr_dump_ib(struct umr_asic *asic, struct umr_ring_decoder *decoder)
 		decoder->sdma.cur_opcode = 0xFFFFFFFF;
 		for (x = 0; x < decoder->next_ib_info.size/4; x++) {
 			decoder->next_ib_info.addr = x;
-			printf("IB[%s%u%s@%s0x%llx%s + %s0x%-4x%s] = %s0x%08lx%s ... ",
+			printf("IB[%s%u%s@%s0x%" PRIx64 "%s + %s0x%-4x%s] = %s0x%08lx%s ... ",
 				BLUE, decoder->next_ib_info.vmid, RST,
-				YELLOW, (unsigned long long)decoder->next_ib_info.ib_addr, RST,
+				YELLOW, decoder->next_ib_info.ib_addr, RST,
 				YELLOW, (unsigned)x * 4, RST,
 				GREEN, (unsigned long)data[x], RST);
 			umr_print_decode(asic, decoder, data[x]);
@@ -79,11 +79,11 @@ void umr_dump_shaders(struct umr_asic *asic, struct umr_ring_decoder *decoder, s
 
 	shader = decoder->shader;
 	while (shader) {
-		printf("Disassembly of shader %u@0x%llx of length %u bytes from IB[%s%u%s@%s0x%llx%s + %s0x%x%s]\n",
-				shader->vmid, (unsigned long long)shader->addr,
+		printf("Disassembly of shader %u@0x%" PRIx64 " of length %u bytes from IB[%s%u%s@%s0x%" PRIx64 "%s + %s0x%x%s]\n",
+				shader->vmid, shader->addr,
 				shader->size,
 				BLUE, (unsigned)shader->vmid, RST,
-				YELLOW, (unsigned long long)shader->src.ib_base, RST,
+				YELLOW, shader->src.ib_base, RST,
 				YELLOW, (unsigned)shader->src.ib_offset * 4, RST);
 		umr_vm_disasm(asic, shader->vmid, shader->addr, 0, shader->size, 0, wd);
 		printf("\n");
src/lib/read_vram.c +105 -105

359 lines not on this page · raw message

src/lib/umr_llvm_disasm.c +4 -4
index 64f7d16ba61e..936c05792e8d 100644
@@ -167,11 +167,11 @@ int umr_vm_disasm(struct umr_asic *asic, unsigned vmid, uint64_t addr, uint64_t
 			printf(" * ");
 		else
 			printf("   ");
-		printf("pgm[%s%lu%s@%s0x%llx%s + %s0x%-4x%s] = %s0x%08lx%s\t%s%-60s%s\t",
-			BLUE, (unsigned long)vmid, RST,
-			YELLOW, (unsigned long long)addr, RST,
+		printf("pgm[%s%u%s@%s0x%" PRIx64 "%s + %s0x%-4x%s] = %s0x%08" PRIx32 "%s\t%s%-60s%s\t",
+			BLUE, (unsigned)vmid, RST,
+			YELLOW, addr, RST,
 			YELLOW, (unsigned)x * 4, RST,
-			BLUE, (unsigned long)opcodes[y], RST,
+			BLUE, opcodes[y], RST,
 			GREEN, opcode_strs[y], RST);
 		free(opcode_strs[y]);
 
src/lib/umr_read_pm4_stream.c +2 -2
index 4ad03ed1b9d4..6111e6931190 100644
@@ -79,7 +79,7 @@ static void parse_pm4(struct umr_asic *asic, int vmid, struct umr_pm4_stream *ps
 				tvmid = vmid;
 			buf = calloc(1, size);
 			if (umr_read_vram(asic, tvmid, addr, size, buf) < 0)
-				fprintf(stderr, "[ERROR]: Could not read IB at %u:0x%llx\n", (unsigned)tvmid, (unsigned long long)addr);
+				fprintf(stderr, "[ERROR]: Could not read IB at %u:0x%" PRIx64 "\n", (unsigned)tvmid, addr);
 			else
 				ps->ib = umr_pm4_decode_stream(asic, tvmid, buf, size / 4);
 			free(buf);
@@ -251,7 +251,7 @@ struct umr_pm4_stream *umr_pm4_decode_stream(struct umr_asic *asic, int vmid, ui
 				void *buf;
 				buf = calloc(1, uvd_ib.size);
 				if (umr_read_vram(asic, uvd_ib.vmid, uvd_ib.addr, uvd_ib.size, buf) < 0)
-					fprintf(stderr, "[ERROR]: Could not read IB at %u:0x%llx\n", (unsigned)uvd_ib.vmid, (unsigned long long)uvd_ib.addr);
+					fprintf(stderr, "[ERROR]: Could not read IB at %u:0x%" PRIx64 "\n", (unsigned)uvd_ib.vmid, uvd_ib.addr);
 				else
 					ps->ib = umr_pm4_decode_stream(asic, uvd_ib.vmid, buf, uvd_ib.size / 4);
 				free(buf);
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx