MLK-23302-2 tools: perf: header: add support for checking socname
Add support for checking socname for ARCH arm64. Reviewed-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
edb9b10ee1
commit
409cc3e78f
|
@ -66,3 +66,31 @@ char *get_cpuid_str(struct perf_pmu *pmu)
|
|||
perf_cpu_map__put(cpus);
|
||||
return buf;
|
||||
}
|
||||
|
||||
#define LEN 20
|
||||
|
||||
int soc_version_check(const char *soc_name __maybe_unused)
|
||||
{
|
||||
FILE *soc_fd;
|
||||
char name[LEN];
|
||||
|
||||
soc_fd = fopen("/sys/devices/soc0/soc_id", "r");
|
||||
if (!soc_fd) {
|
||||
pr_debug("fopen failed for file /sys/devices/soc0/soc_id\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!fgets(name, LEN, soc_fd)) {
|
||||
pr_debug("get soc name failed\n");
|
||||
fclose(soc_fd);
|
||||
return false;
|
||||
}
|
||||
fclose(soc_fd);
|
||||
|
||||
name[strlen(name) - 1] = '\0';
|
||||
|
||||
if (!strcmp(name, soc_name))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -844,6 +844,15 @@ int __weak strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* default soc_version_check(): nothing gets recorded
|
||||
* actual implementation must be in arch/$(SRCARCH)/util/header.c
|
||||
*/
|
||||
int __weak soc_version_check(const char *soc_name __maybe_unused)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* default get_cpuid(): nothing gets recorded
|
||||
* actual implementation must be in arch/$(SRCARCH)/util/header.c
|
||||
|
|
|
@ -165,4 +165,6 @@ int get_cpuid(char *buffer, size_t sz);
|
|||
|
||||
char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused);
|
||||
int strcmp_cpuid_str(const char *s1, const char *s2);
|
||||
|
||||
int soc_version_check(const char *soc_name __maybe_unused);
|
||||
#endif /* __PERF_HEADER_H */
|
||||
|
|
Loading…
Reference in New Issue