summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2019-02-26 12:13:49 -0500
committerTom St Denis <tom.stdenis@amd.com>2019-02-26 12:13:49 -0500
commitefeb1491d58f8b38be63065f9e26d15baa97caf5 (patch)
tree49e67b062d7ab455bf483edf0c90d94c1ee877e9
parent684f938ac47082d7543e5863bed92c4f7ff5c6e4 (diff)
fix a variety of diagnostics from newer versions of gcc
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
-rw-r--r--src/app/main.c11
-rw-r--r--src/app/top.c2
-rw-r--r--src/lib/bitfield_print.c2
-rw-r--r--src/lib/discover_by_did.c2
-rw-r--r--src/lib/lowlevel/linux/discover.c6
-rw-r--r--src/lib/lowlevel/linux/mem.c3
-rw-r--r--src/lib/umr_read_sdma_stream.c2
-rw-r--r--src/lib/umr_sdma_decode_opcodes.c2
8 files changed, 20 insertions, 10 deletions
diff --git a/src/app/main.c b/src/app/main.c
index 2ddb60e..28b731c 100644
--- a/src/app/main.c
+++ b/src/app/main.c
@@ -230,7 +230,9 @@ int main(int argc, char **argv)
}
} else if (!strcmp(argv[i], "--force") || !strcmp(argv[i], "-f")) {
if (i + 1 < argc) {
- if (sscanf(argv[i+1], "0x%lx", &options.forcedid) == 0) {
+ unsigned long did;
+ if (sscanf(argv[i+1], "0x%lx", &did) == 0) {
+ options.forcedid = did;
strncpy(options.dev_name, argv[i+1], sizeof(options.dev_name) - 1);
options.forcedid = 0;
}
@@ -702,7 +704,10 @@ int main(int argc, char **argv)
"\n\t--profiler, -prof [pixel= | vertex= | compute=]<nsamples> [ring]"
"\n\t\tCapture 'nsamples' samples of wave data. Optionally specify a ring to search"
"\n\t\tfor IBs that point to shaders. Defaults to 'gfx'. Additionally, the type"
- "\n\t\tof shader can be selected for as well to only profile a given type.\n"
+ "\n\t\tof shader can be selected for as well to only profile a given type.\n",
+ UMR_BUILD_VER, UMR_BUILD_REV);
+
+printf(
"\n*** Virtual Memory Access ***\n"
"\n\tVMIDs are specified in umr as 16 bit numbers where the lower 8 bits"
"\n\tindicate the hardware VMID and the upper 8 bits indicate the which VM space to use."
@@ -735,7 +740,7 @@ int main(int argc, char **argv)
"\n\t\tDump an IB packet at an address with an optional VMID. The length is specified"
"\n\t\tin bytes. The type of decoder <pm> is optional and defaults to PM4 packets."
"\n\t\tCan specify '3' for SDMA packets.\n"
-"\n\n", UMR_BUILD_VER, UMR_BUILD_REV);
+"\n\n");
exit(EXIT_SUCCESS);
} else {
fprintf(stderr, "[ERROR]: Unknown option <%s>\n", argv[i]);
diff --git a/src/app/top.c b/src/app/top.c
index d130319..8e7a3c0 100644
--- a/src/app/top.c
+++ b/src/app/top.c
@@ -768,7 +768,7 @@ static void grab_vram(struct umr_asic *asic)
static void analyze_drm_info(struct umr_asic *asic)
{
- char region[256], name[256], line[256];
+ char region[256], name[256], line[512];
unsigned long old_pid, pid, id, size, tot_vram, tot_gtt, tot_vis_vram;
FILE *f;
unsigned long long vram_addr;
diff --git a/src/lib/bitfield_print.c b/src/lib/bitfield_print.c
index bbedf9f..76f52e8 100644
--- a/src/lib/bitfield_print.c
+++ b/src/lib/bitfield_print.c
@@ -38,7 +38,7 @@
*/
void umr_bitfield_default(struct umr_asic *asic, char *asicname, char *ipname, char *regname, char *bitname, int start, int stop, uint32_t value)
{
- char buf[256], fpath[256];
+ char buf[512], fpath[256];
struct umr_options options = asic->options;
if (options.bitfields) {
snprintf(fpath, sizeof(fpath)-1, "%s.%s.%s%s%s.", asicname, ipname, CYAN, regname, RST);
diff --git a/src/lib/discover_by_did.c b/src/lib/discover_by_did.c
index 9049077..da2b0b3 100644
--- a/src/lib/discover_by_did.c
+++ b/src/lib/discover_by_did.c
@@ -255,7 +255,7 @@ static const struct {
static int find_first_did(long did, long start_instance)
{
- char name[128], device[128];
+ char name[128], device[256];
FILE *f, *f2;
int x;
diff --git a/src/lib/lowlevel/linux/discover.c b/src/lib/lowlevel/linux/discover.c
index 819898f..f81947d 100644
--- a/src/lib/lowlevel/linux/discover.c
+++ b/src/lib/lowlevel/linux/discover.c
@@ -120,7 +120,7 @@ static int find_pci_instance(const char* pci_string)
*/
struct umr_asic *umr_discover_asic(struct umr_options *options)
{
- char driver[256], name[256], fname[256];
+ char driver[512], name[256], fname[256];
FILE *f;
unsigned did;
struct umr_asic *asic;
@@ -139,6 +139,7 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
if (options->pci.domain || options->pci.bus ||
options->pci.slot || options->pci.func) {
int parsed_did;
+ unsigned long did;
snprintf(options->pci.name, sizeof(options->pci.name), "%04x:%02x:%02x.%x",
options->pci.domain, options->pci.bus, options->pci.slot,
@@ -153,7 +154,8 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
if (!options->quiet) perror("Cannot open PCI device name under sysfs (is a display attached?)");
return NULL;
}
- parsed_did = fscanf(f, "0x%04lx", &trydid);
+ parsed_did = fscanf(f, "0x%04lx", &did);
+ trydid = did;
fclose(f);
if (parsed_did != 1) {
if (!options->quiet) printf("Could not read device id");
diff --git a/src/lib/lowlevel/linux/mem.c b/src/lib/lowlevel/linux/mem.c
index a031030..1df4550 100644
--- a/src/lib/lowlevel/linux/mem.c
+++ b/src/lib/lowlevel/linux/mem.c
@@ -53,7 +53,8 @@ uint64_t umr_vm_dma_to_phys(struct umr_asic *asic, uint64_t dma_addr)
*/
int umr_access_sram(struct umr_asic *asic, uint64_t address, uint32_t size, void *dst, int write_en)
{
- int fd, need_close=0, r;
+ int fd, need_close=0;
+ uint32_t r;
DEBUG("Reading physical sys addr: 0x" PRIx64 "\n", address);
diff --git a/src/lib/umr_read_sdma_stream.c b/src/lib/umr_read_sdma_stream.c
index 4300b72..4905ddd 100644
--- a/src/lib/umr_read_sdma_stream.c
+++ b/src/lib/umr_read_sdma_stream.c
@@ -82,6 +82,8 @@ struct umr_sdma_stream *umr_sdma_decode_stream(struct umr_asic *asic, int vmid,
{
struct umr_sdma_stream *ops, *ps;
+(void)vmid;
+
ps = ops = calloc(1, sizeof *ops);
if (!ps) {
fprintf(stderr, "[ERROR]: Out of memory\n");
diff --git a/src/lib/umr_sdma_decode_opcodes.c b/src/lib/umr_sdma_decode_opcodes.c
index 27ea27e..f4503e4 100644
--- a/src/lib/umr_sdma_decode_opcodes.c
+++ b/src/lib/umr_sdma_decode_opcodes.c
@@ -30,7 +30,7 @@ struct umr_sdma_stream *umr_sdma_decode_stream_opcodes(struct umr_asic *asic, st
{
uint32_t n;
struct umr_sdma_stream *os = stream;
- static const char *poll_regmem_funcs[] = { "always", "<", "<=", "==", "!=", ">=", ">", "N/A" };
+ static char *poll_regmem_funcs[] = { "always", "<", "<=", "==", "!=", ">=", ">", "N/A" };
n = 0;
while (os) {