riscv/cpu: add more information to show on cpuinfo
Signed-off-by: Mohamad Noor Alim Hussin <mnalim@efinixinc.com>
This commit is contained in:
@@ -102,14 +102,39 @@ static void c_stop(struct seq_file *m, void *v)
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned int to_mhz(unsigned int num)
|
||||
{
|
||||
return num/(1000*1000);
|
||||
}
|
||||
|
||||
static unsigned int to_kb(unsigned int num)
|
||||
{
|
||||
return num/1024;
|
||||
}
|
||||
|
||||
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);
|
||||
const char *compat, *isa, *mmu;
|
||||
const char *board, *cpu_name;
|
||||
unsigned int icache, dcache, l2_cache;
|
||||
unsigned int freq;
|
||||
|
||||
if (!of_property_read_string(node, "board", &board))
|
||||
seq_printf(m, "board name\t: %s\n", board);
|
||||
if (!of_property_read_string(node, "cpu-name", &cpu_name))
|
||||
seq_printf(m, "cpu name\t: %s\n", cpu_name);
|
||||
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_u32(node, "clock-frequency", &freq))
|
||||
seq_printf(m, "cpu MHz\t\t: %u\n", to_mhz(freq));
|
||||
if (!of_property_read_u32(node, "i-cache-size", &icache))
|
||||
seq_printf(m, "i-cache-size\t: %u KB\n", to_kb(icache));
|
||||
if (!of_property_read_u32(node, "d-cache-size", &dcache))
|
||||
seq_printf(m, "d-cache-size \t: %u KB\n", to_kb(dcache));
|
||||
if (!of_property_read_u32(node, "l2-cache-size", &l2_cache))
|
||||
seq_printf(m, "l2-cache-size \t: %u KB\n", to_kb(l2_cache));
|
||||
if (!of_property_read_string(node, "riscv,isa", &isa))
|
||||
print_isa(m, isa);
|
||||
if (!of_property_read_string(node, "mmu-type", &mmu))
|
||||
|
||||
Reference in New Issue
Block a user