1 /* 1 2 * CPU-version specific code 3 * 4 * Copyright (C) 2007-2009 Michal Simek <monst 5 * Copyright (C) 2006-2009 PetaLogix 6 * 7 * This file is subject to the terms and condi 8 * License. See the file "COPYING" in the main 9 * for more details. 10 */ 11 12 #include <linux/init.h> 13 #include <linux/string.h> 14 #include <linux/seq_file.h> 15 #include <linux/cpu.h> 16 #include <linux/initrd.h> 17 18 #include <linux/bug.h> 19 #include <asm/cpuinfo.h> 20 #include <linux/delay.h> 21 #include <linux/io.h> 22 #include <asm/page.h> 23 #include <linux/param.h> 24 #include <asm/pvr.h> 25 #include <asm/sections.h> 26 #include <asm/setup.h> 27 28 static int show_cpuinfo(struct seq_file *m, vo 29 { 30 char *fpga_family = "Unknown"; 31 char *cpu_ver = "Unknown"; 32 int i; 33 34 /* Denormalised to get the fpga family 35 for (i = 0; family_string_lookup[i].s 36 if (cpuinfo.fpga_family_code = 37 fpga_family = (char *) 38 break; 39 } 40 } 41 42 /* Denormalised to get the hw version 43 for (i = 0; cpu_ver_lookup[i].s != NUL 44 if (cpuinfo.ver_code == cpu_ve 45 cpu_ver = (char *)cpu_ 46 break; 47 } 48 } 49 50 seq_printf(m, 51 "CPU-Family: MicroBlaze\n" 52 "FPGA-Arch: %s\n" 53 "CPU-Ver: %s, %s endian\ 54 "CPU-MHz: %d.%02d\n" 55 "BogoMips: %lu.%02lu\n", 56 fpga_family, 57 cpu_ver, 58 cpuinfo.endian ? "little" : 59 cpuinfo.cpu_clock_freq / 10 60 cpuinfo.cpu_clock_freq % 10 61 loops_per_jiffy / (500000 / 62 (loops_per_jiffy / (5000 / 63 64 seq_printf(m, 65 "HW:\n Shift:\t\t%s\n" 66 " MSR:\t\t%s\n" 67 " PCMP:\t\t%s\n" 68 " DIV:\t\t%s\n", 69 (cpuinfo.use_instr & PVR0_U 70 (cpuinfo.use_instr & PVR2_U 71 (cpuinfo.use_instr & PVR2_U 72 (cpuinfo.use_instr & PVR0_U 73 74 seq_printf(m, " MMU:\t\t%x\n", cpuinfo 75 76 seq_printf(m, 77 " MUL:\t\t%s\n" 78 " FPU:\t\t%s\n", 79 (cpuinfo.use_mult & PVR2_US 80 (cpuinfo.use_mult & PVR0_US 81 (cpuinfo.use_fpu & PVR2_USE 82 (cpuinfo.use_fpu & PVR0_USE 83 84 seq_printf(m, 85 " Exc:\t\t%s%s%s%s%s%s%s%s\ 86 (cpuinfo.use_exc & PVR2_OPC 87 (cpuinfo.use_exc & PVR2_UNA 88 (cpuinfo.use_exc & PVR2_ILL 89 (cpuinfo.use_exc & PVR2_IOP 90 (cpuinfo.use_exc & PVR2_DOP 91 (cpuinfo.use_exc & PVR2_DIV 92 (cpuinfo.use_exc & PVR2_FPU 93 (cpuinfo.use_exc & PVR2_USE 94 95 seq_printf(m, 96 "Stream-insns:\t%sprivilege 97 cpuinfo.mmu_privins ? "un" 98 99 if (cpuinfo.use_icache) 100 seq_printf(m, 101 "Icache:\t\t%ukB\tl 102 cpuinfo.icache_size 103 cpuinfo.icache_line 104 else 105 seq_puts(m, "Icache:\t\tno\n") 106 107 if (cpuinfo.use_dcache) { 108 seq_printf(m, 109 "Dcache:\t\t%ukB\tl 110 cpuinfo.dcache_size 111 cpuinfo.dcache_line 112 seq_puts(m, "Dcache-Policy:\t" 113 if (cpuinfo.dcache_wb) 114 seq_puts(m, "write-bac 115 else 116 seq_puts(m, "write-thr 117 } else { 118 seq_puts(m, "Dcache:\t\tno\n") 119 } 120 121 seq_printf(m, 122 "HW-Debug:\t%s\n", 123 cpuinfo.hw_debug ? "yes" : 124 125 seq_printf(m, 126 "PVR-USR1:\t%02x\n" 127 "PVR-USR2:\t%08x\n", 128 cpuinfo.pvr_user1, 129 cpuinfo.pvr_user2); 130 131 seq_printf(m, "Page size:\t%lu\n", PAG 132 133 return 0; 134 } 135 136 static void *c_start(struct seq_file *m, loff_ 137 { 138 int i = *pos; 139 140 return i < NR_CPUS ? (void *) (i + 1) 141 } 142 143 static void *c_next(struct seq_file *m, void * 144 { 145 ++*pos; 146 return c_start(m, pos); 147 } 148 149 static void c_stop(struct seq_file *m, void *v 150 { 151 } 152 153 const struct seq_operations cpuinfo_op = { 154 .start = c_start, 155 .next = c_next, 156 .stop = c_stop, 157 .show = show_cpuinfo, 158 }; 159
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.