Skip to content

Commit

Permalink
RISC-V: ACPI: cpu: Enable cpuinfo for ACPI systems
Browse files Browse the repository at this point in the history
On ACPI based platforms, few details like ISA need to be read
from the ACPI table. Enable cpuinfo on ACPI based systems.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
  • Loading branch information
vlsunil authored and avpatel committed Aug 19, 2022
1 parent 76e32ed commit 3a0948b
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions arch/riscv/kernel/cpu.c
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2012 Regents of the University of California
*/

#include <linux/acpi.h>
#include <linux/cpu.h>
#include <linux/init.h>
#include <linux/seq_file.h>
Expand Down Expand Up @@ -231,26 +232,48 @@ static void c_stop(struct seq_file *m, void *v)
{
}

#ifdef CONFIG_ACPI
void acpi_print_hart_info(struct seq_file *m,
unsigned long cpu)
{
char isa[256];

if(!acpi_get_riscv_isa(cpu, isa))
print_isa(m, isa);

}
#endif

static int c_show(struct seq_file *m, void *v)
{
unsigned long cpu_id = (unsigned long)v - 1;
struct device_node *node = of_get_cpu_node(cpu_id, NULL);
struct riscv_cpuinfo *ci = per_cpu_ptr(&riscv_cpuinfo, cpu_id);
struct device_node *node;
const char *compat, *isa;

seq_printf(m, "processor\t: %lu\n", cpu_id);
seq_printf(m, "hart\t\t: %lu\n", cpuid_to_hartid_map(cpu_id));
if (!of_property_read_string(node, "riscv,isa", &isa))
print_isa(m, isa);

if (acpi_disabled) {
node = of_get_cpu_node(cpu_id, NULL);
if (!of_property_read_string(node, "riscv,isa", &isa))
print_isa(m, isa);
if (!of_property_read_string(node, "compatible", &compat)
&& strcmp(compat, "riscv"))
seq_printf(m, "uarch\t\t: %s\n", compat);
of_node_put(node);
}
#ifdef CONFIG_ACPI
else {
acpi_print_hart_info(m, cpu_id);
}
#endif

print_mmu(m);
if (!of_property_read_string(node, "compatible", &compat)
&& strcmp(compat, "riscv"))
seq_printf(m, "uarch\t\t: %s\n", compat);
seq_printf(m, "mvendorid\t: 0x%lx\n", ci->mvendorid);
seq_printf(m, "marchid\t\t: 0x%lx\n", ci->marchid);
seq_printf(m, "mimpid\t\t: 0x%lx\n", ci->mimpid);
seq_puts(m, "\n");
of_node_put(node);

return 0;
}
Expand Down

0 comments on commit 3a0948b

Please sign in to comment.