[v0.98][PPC] Add part number detection using linux device tree

This commit is contained in:
Dr-Noob
2021-08-05 10:06:16 +02:00
parent bcdd5267b2
commit 921e815470
5 changed files with 18 additions and 10 deletions

View File

@@ -32,13 +32,11 @@ int64_t get_freq(struct frequency* freq) {
return freq->max;
}
#ifdef ARCH_X86
#if defined(ARCH_X86) || defined(ARCH_PPC)
char* get_str_cpu_name(struct cpuInfo* cpu) {
return cpu->cpu_name;
}
#endif
#if defined(ARCH_X86) || defined(ARCH_PPC)
char* get_str_sockets(struct topology* topo) {
char* string = emalloc(sizeof(char) * 2);
int32_t sanity_ret = snprintf(string, 2, "%d", topo->sockets);

View File

@@ -116,9 +116,12 @@ struct cpuInfo {
struct topology* topo;
struct features* feat;
#ifdef ARCH_X86
#if defined(ARCH_X86) || defined(ARCH_PPC)
// CPU name from model
char* cpu_name;
#endif
#ifdef ARCH_X86
// Max cpuids levels
uint32_t maxLevels;
// Max cpuids extended levels

View File

@@ -48,7 +48,7 @@
#define COLOR_RESET "\x1b[m"
enum {
#if defined(ARCH_X86)
#if defined(ARCH_X86) || defined(ARCH_PPC)
ATTRIBUTE_NAME,
#elif ARCH_ARM
ATTRIBUTE_SOC,
@@ -77,7 +77,7 @@ enum {
};
static const char* ATTRIBUTE_FIELDS [] = {
#if defined(ARCH_X86)
#if defined(ARCH_X86) || defined(ARCH_PPC)
"Name:",
#elif ARCH_ARM
"SoC:",
@@ -572,6 +572,7 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct colors* cs) {
char* manufacturing_process = get_str_process(cpu);
char* sockets = get_str_sockets(cpu->topo);
char* max_frequency = get_str_freq(cpu->freq);
char* cpu_name = get_str_cpu_name(cpu);
char* n_cores = get_str_topology(cpu->topo, false);
char* n_cores_dual = get_str_topology(cpu->topo, true);
char* altivec = get_str_altivec(cpu);
@@ -582,10 +583,9 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct colors* cs) {
char* l3 = get_str_l3(cpu->cach);
char* pp = get_str_peak_performance(cpu,cpu->topo,get_freq(cpu->freq));
/*
if(cpu->hv->present) {
setAttribute(art, ATTRIBUTE_HYPERVISOR, cpu->hv->hv_name);
}*/
if(cpu_name != NULL) {
setAttribute(art,ATTRIBUTE_NAME,cpu_name);
}
setAttribute(art,ATTRIBUTE_UARCH,uarch);
setAttribute(art,ATTRIBUTE_TECHNOLOGY,manufacturing_process);
setAttribute(art,ATTRIBUTE_FREQUENCY,max_frequency);