proc.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * Copyright (C) 1995, 1996, 2001 Ralf Baechle
  3. * Copyright (C) 2001, 2004 MIPS Technologies, Inc.
  4. * Copyright (C) 2004 Maciej W. Rozycki
  5. */
  6. #include <linux/delay.h>
  7. #include <linux/kernel.h>
  8. #include <linux/sched.h>
  9. #include <linux/seq_file.h>
  10. #include <asm/bootinfo.h>
  11. #include <asm/cpu.h>
  12. #include <asm/cpu-features.h>
  13. #include <asm/idle.h>
  14. #include <asm/mipsregs.h>
  15. #include <asm/processor.h>
  16. #include <asm/prom.h>
  17. unsigned int vced_count, vcei_count;
  18. /*
  19. * * No lock; only written during early bootup by CPU 0.
  20. * */
  21. static RAW_NOTIFIER_HEAD(proc_cpuinfo_chain);
  22. int __ref register_proc_cpuinfo_notifier(struct notifier_block *nb)
  23. {
  24. return raw_notifier_chain_register(&proc_cpuinfo_chain, nb);
  25. }
  26. int proc_cpuinfo_notifier_call_chain(unsigned long val, void *v)
  27. {
  28. return raw_notifier_call_chain(&proc_cpuinfo_chain, val, v);
  29. }
  30. static int show_cpuinfo(struct seq_file *m, void *v)
  31. {
  32. struct proc_cpuinfo_notifier_args proc_cpuinfo_notifier_args;
  33. unsigned long n = (unsigned long) v - 1;
  34. unsigned int version = cpu_data[n].processor_id;
  35. unsigned int fp_vers = cpu_data[n].fpu_id;
  36. char fmt [64];
  37. int i;
  38. #ifdef CONFIG_SMP
  39. if (!cpu_online(n))
  40. return 0;
  41. #endif
  42. /*
  43. * For the first processor also print the system type
  44. */
  45. if (n == 0) {
  46. seq_printf(m, "system type\t\t: %s\n", get_system_type());
  47. if (mips_get_machine_name())
  48. seq_printf(m, "machine\t\t\t: %s\n",
  49. mips_get_machine_name());
  50. }
  51. seq_printf(m, "processor\t\t: %ld\n", n);
  52. sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
  53. cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : "");
  54. seq_printf(m, fmt, __cpu_name[n],
  55. (version >> 4) & 0x0f, version & 0x0f,
  56. (fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
  57. seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
  58. cpu_data[n].udelay_val / (500000/HZ),
  59. (cpu_data[n].udelay_val / (5000/HZ)) % 100);
  60. seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
  61. seq_printf(m, "microsecond timers\t: %s\n",
  62. cpu_has_counter ? "yes" : "no");
  63. seq_printf(m, "tlb_entries\t\t: %d\n", cpu_data[n].tlbsize);
  64. seq_printf(m, "extra interrupt vector\t: %s\n",
  65. cpu_has_divec ? "yes" : "no");
  66. seq_printf(m, "hardware watchpoint\t: %s",
  67. cpu_has_watch ? "yes, " : "no\n");
  68. if (cpu_has_watch) {
  69. seq_printf(m, "count: %d, address/irw mask: [",
  70. cpu_data[n].watch_reg_count);
  71. for (i = 0; i < cpu_data[n].watch_reg_count; i++)
  72. seq_printf(m, "%s0x%04x", i ? ", " : "" ,
  73. cpu_data[n].watch_reg_masks[i]);
  74. seq_printf(m, "]\n");
  75. }
  76. seq_printf(m, "isa\t\t\t:");
  77. if (cpu_has_mips_1)
  78. seq_printf(m, " mips1");
  79. if (cpu_has_mips_2)
  80. seq_printf(m, "%s", " mips2");
  81. if (cpu_has_mips_3)
  82. seq_printf(m, "%s", " mips3");
  83. if (cpu_has_mips_4)
  84. seq_printf(m, "%s", " mips4");
  85. if (cpu_has_mips_5)
  86. seq_printf(m, "%s", " mips5");
  87. if (cpu_has_mips32r1)
  88. seq_printf(m, "%s", " mips32r1");
  89. if (cpu_has_mips32r2)
  90. seq_printf(m, "%s", " mips32r2");
  91. if (cpu_has_mips32r6)
  92. seq_printf(m, "%s", " mips32r6");
  93. if (cpu_has_mips64r1)
  94. seq_printf(m, "%s", " mips64r1");
  95. if (cpu_has_mips64r2)
  96. seq_printf(m, "%s", " mips64r2");
  97. if (cpu_has_mips64r6)
  98. seq_printf(m, "%s", " mips64r6");
  99. seq_printf(m, "\n");
  100. seq_printf(m, "ASEs implemented\t:");
  101. if (cpu_has_mips16) seq_printf(m, "%s", " mips16");
  102. if (cpu_has_mdmx) seq_printf(m, "%s", " mdmx");
  103. if (cpu_has_mips3d) seq_printf(m, "%s", " mips3d");
  104. if (cpu_has_smartmips) seq_printf(m, "%s", " smartmips");
  105. if (cpu_has_dsp) seq_printf(m, "%s", " dsp");
  106. if (cpu_has_dsp2) seq_printf(m, "%s", " dsp2");
  107. if (cpu_has_mipsmt) seq_printf(m, "%s", " mt");
  108. if (cpu_has_mmips) seq_printf(m, "%s", " micromips");
  109. if (cpu_has_vz) seq_printf(m, "%s", " vz");
  110. if (cpu_has_msa) seq_printf(m, "%s", " msa");
  111. if (cpu_has_eva) seq_printf(m, "%s", " eva");
  112. if (cpu_has_htw) seq_printf(m, "%s", " htw");
  113. if (cpu_has_xpa) seq_printf(m, "%s", " xpa");
  114. seq_printf(m, "\n");
  115. if (cpu_has_mmips) {
  116. seq_printf(m, "micromips kernel\t: %s\n",
  117. (read_c0_config3() & MIPS_CONF3_ISA_OE) ? "yes" : "no");
  118. }
  119. seq_printf(m, "shadow register sets\t: %d\n",
  120. cpu_data[n].srsets);
  121. seq_printf(m, "kscratch registers\t: %d\n",
  122. hweight8(cpu_data[n].kscratch_mask));
  123. seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
  124. seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
  125. sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
  126. cpu_has_vce ? "%u" : "not available");
  127. seq_printf(m, fmt, 'D', vced_count);
  128. seq_printf(m, fmt, 'I', vcei_count);
  129. proc_cpuinfo_notifier_args.m = m;
  130. proc_cpuinfo_notifier_args.n = n;
  131. raw_notifier_call_chain(&proc_cpuinfo_chain, 0,
  132. &proc_cpuinfo_notifier_args);
  133. seq_printf(m, "\n");
  134. return 0;
  135. }
  136. static void *c_start(struct seq_file *m, loff_t *pos)
  137. {
  138. unsigned long i = *pos;
  139. return i < NR_CPUS ? (void *) (i + 1) : NULL;
  140. }
  141. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  142. {
  143. ++*pos;
  144. return c_start(m, pos);
  145. }
  146. static void c_stop(struct seq_file *m, void *v)
  147. {
  148. }
  149. const struct seq_operations cpuinfo_op = {
  150. .start = c_start,
  151. .next = c_next,
  152. .stop = c_stop,
  153. .show = show_cpuinfo,
  154. };