Permalink
Browse files

gpu: show more dt info

Signed-off-by: Burt P <pburt0@gmail.com>
  • Loading branch information...
bp0 authored and lpereira committed Sep 9, 2018
1 parent 62964b7 commit da50fabd1897462531153a5a27366eb0ad7d0413
Showing with 28 additions and 10 deletions.
  1. +14 −5 hardinfo/gpu_util.c
  2. +2 −1 includes/gpu_util.h
  3. +12 −4 modules/devices/gpu.c
View
@@ -21,6 +21,9 @@
#include "hardinfo.h"
#include "gpu_util.h"
#include "cpu_util.h" /* for EMPIFNULL() */
nvgpu *nvgpu_new() {
return g_new0(nvgpu, 1);
}
@@ -255,7 +258,8 @@ gpud *dt_soc_gpu() {
{ "arm,mali", "ARM", "Mali family" },
{ NULL, NULL }
};
char *dt_gpu_path = NULL, *compat_path = NULL;
char tmp_path[256] = "";
char *dt_gpu_path = NULL;
char *compat = NULL;
char *vendor = NULL, *device = NULL;
int i;
@@ -271,8 +275,8 @@ gpud *dt_soc_gpu() {
if (dt_gpu_path == NULL)
goto dt_gpu_end;
compat_path = g_strdup_printf("%s/compatible", dt_gpu_path);
compat = dtr_get_string(compat_path, 1);
snprintf(tmp_path, 255, "%s/compatible", dt_gpu_path);
compat = dtr_get_string(tmp_path, 1);
if (compat == NULL)
goto dt_gpu_end;
@@ -292,6 +296,13 @@ gpud *dt_soc_gpu() {
gpu->dt_compat = compat;
gpu->dt_vendor = vendor;
gpu->dt_device = device;
gpu->dt_path = dt_gpu_path;
snprintf(tmp_path, 255, "%s/status", dt_gpu_path);
gpu->dt_status = dtr_get_string(tmp_path, 1);
snprintf(tmp_path, 255, "%s/name", dt_gpu_path);
gpu->dt_name = dtr_get_string(tmp_path, 1);
EMPIFNULL(gpu->dt_name);
EMPIFNULL(gpu->dt_status);
gpu->id = strdup("dt-soc-gpu");
gpu->location = strdup("SOC");
@@ -304,8 +315,6 @@ gpud *dt_soc_gpu() {
dt_gpu_end:
free(dt_gpu_path);
free(compat_path);
dtr_free(dt);
return gpu;
}
View
@@ -39,7 +39,8 @@ typedef struct gpud {
char *drm_dev;
char *sysfs_drm_path;
pcid *pci_dev;
char *dt_compat;
char *dt_compat, *dt_status, *dt_name, *dt_path;
const char *dt_vendor, *dt_device;
nvgpu *nv_info;
View
@@ -177,14 +177,22 @@ int _dt_soc_gpu(gpud *gpu) {
gpu_list = h_strdup_cprintf("$%s$%s=%s\n", gpu_list, key, key, name);
gchar *str = g_strdup_printf("[%s]\n"
/* Location */ "%s=%s\n"
/* dt compat */ "%s=%s\n"
/* Vendor */ "%s=%s\n"
/* Device */ "%s=%s\n",
/* Device */ "%s=%s\n"
"[%s]\n"
/* Path */ "%s=%s\n"
/* Compat */ "%s=%s\n"
/* Status */ "%s=%s\n"
/* Name */ "%s=%s\n",
_("Device Information"),
_("Location"), gpu->location,
_("DT Compatibility"), gpu->dt_compat,
_("Vendor"), vendor,
_("Device"), device
_("Device"), device,
_("Device Tree Node"),
_("Path"), gpu->dt_path,
_("Compatible"), gpu->dt_compat,
_("Status"), gpu->dt_status,
_("Name"), gpu->dt_name
);
moreinfo_add_with_prefix("DEV", key, str); /* str now owned by morinfo */
return 1;

0 comments on commit da50fab

Please sign in to comment.