summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2019-03-29 12:50:29 -0400
committerTom St Denis <tom.stdenis@amd.com>2019-03-29 12:52:20 -0400
commit075418cdac2754728105edf1384095094fc0baea (patch)
treeb7726b82294c3d0c8e823c40445aa3d99f2e501c
parenta00932ad5c6a18481fd7e090e6e4abada87c8d8d (diff)
allow discovery without a debugfs 'name' entry
In certain configurations the debugfs file 'name' might not be populated with a device entry if no frame buffer is attached. For instance in headless or A+I setups. In these configurations you can use the syntax umr -i ${instance} -f ${asicname} ... To issue debugfs commands (registers/waves/etc) to a device without 'name' contents. Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
-rw-r--r--src/lib/lowlevel/linux/discover.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/lib/lowlevel/linux/discover.c b/src/lib/lowlevel/linux/discover.c
index 4d3f2c1..8b7b252 100644
--- a/src/lib/lowlevel/linux/discover.c
+++ b/src/lib/lowlevel/linux/discover.c
@@ -200,22 +200,21 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
r = fscanf(f, "%*s %s", name);
fclose(f);
- if (r != 1)
- return NULL;
-
- // strip off dev= for kernels > 4.7
- if (strstr(name, "dev="))
- memmove(name, name+4, strlen(name)-3);
-
- if (!strlen(options->pci.name)) {
- // read the PCI info
- strcpy(options->pci.name, name);
- sscanf(name, "%04x:%02x:%02x.%x",
- &options->pci.domain,
- &options->pci.bus,
- &options->pci.slot,
- &options->pci.func);
- need_config_scan = 1;
+ if (r == 1) {
+ // strip off dev= for kernels > 4.7
+ if (strstr(name, "dev="))
+ memmove(name, name+4, strlen(name)-3);
+
+ if (!strlen(options->pci.name)) {
+ // read the PCI info
+ strcpy(options->pci.name, name);
+ sscanf(name, "%04x:%02x:%02x.%x",
+ &options->pci.domain,
+ &options->pci.bus,
+ &options->pci.slot,
+ &options->pci.func);
+ need_config_scan = 1;
+ }
}
}