proc.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. static int show_cpuinfo(struct seq_file *m, void *v)
  19. {
  20. unsigned long n = (unsigned long) v - 1;
  21. unsigned int version = cpu_data[n].processor_id;
  22. unsigned int fp_vers = cpu_data[n].fpu_id;
  23. char fmt [64];
  24. int i;
  25. #ifdef CONFIG_SMP
  26. if (!cpu_online(n))
  27. return 0;
  28. #endif
  29. /*
  30. * For the first processor also print the system type
  31. */
  32. if (n == 0) {
  33. seq_printf(m, "system type\t\t: %s\n", get_system_type());
  34. if (mips_get_machine_name())
  35. seq_printf(m, "machine\t\t\t: %s\n",
  36. mips_get_machine_name());
  37. }
  38. seq_printf(m, "processor\t\t: %ld\n", n);
  39. sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
  40. cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : "");
  41. seq_printf(m, fmt, __cpu_name[n],
  42. (version >> 4) & 0x0f, version & 0x0f,
  43. (fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
  44. seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
  45. cpu_data[n].udelay_val / (500000/HZ),
  46. (cpu_data[n].udelay_val / (5000/HZ)) % 100);
  47. seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
  48. seq_printf(m, "microsecond timers\t: %s\n",
  49. cpu_has_counter ? "yes" : "no");
  50. seq_printf(m, "tlb_entries\t\t: %d\n", cpu_data[n].tlbsize);
  51. seq_printf(m, "extra interrupt vector\t: %s\n",
  52. cpu_has_divec ? "yes" : "no");
  53. seq_printf(m, "hardware watchpoint\t: %s",
  54. cpu_has_watch ? "yes, " : "no\n");
  55. if (cpu_has_watch) {
  56. seq_printf(m, "count: %d, address/irw mask: [",
  57. cpu_data[n].watch_reg_count);
  58. for (i = 0; i < cpu_data[n].watch_reg_count; i++)
  59. seq_printf(m, "%s0x%04x", i ? ", " : "" ,
  60. cpu_data[n].watch_reg_masks[i]);
  61. seq_printf(m, "]\n");
  62. }
  63. if (cpu_has_mips_r) {
  64. seq_printf(m, "isa\t\t\t: mips1");
  65. if (cpu_has_mips_2)
  66. seq_printf(m, "%s", " mips2");
  67. if (cpu_has_mips_3)
  68. seq_printf(m, "%s", " mips3");
  69. if (cpu_has_mips_4)
  70. seq_printf(m, "%s", " mips4");
  71. if (cpu_has_mips_5)
  72. seq_printf(m, "%s", " mips5");
  73. if (cpu_has_mips32r1)
  74. seq_printf(m, "%s", " mips32r1");
  75. if (cpu_has_mips32r2)
  76. seq_printf(m, "%s", " mips32r2");
  77. if (cpu_has_mips64r1)
  78. seq_printf(m, "%s", " mips64r1");
  79. if (cpu_has_mips64r2)
  80. seq_printf(m, "%s", " mips64r2");
  81. seq_printf(m, "\n");
  82. }
  83. seq_printf(m, "ASEs implemented\t:");
  84. if (cpu_has_mips16) seq_printf(m, "%s", " mips16");
  85. if (cpu_has_mdmx) seq_printf(m, "%s", " mdmx");
  86. if (cpu_has_mips3d) seq_printf(m, "%s", " mips3d");
  87. if (cpu_has_smartmips) seq_printf(m, "%s", " smartmips");
  88. if (cpu_has_dsp) seq_printf(m, "%s", " dsp");
  89. if (cpu_has_dsp2) seq_printf(m, "%s", " dsp2");
  90. if (cpu_has_mipsmt) seq_printf(m, "%s", " mt");
  91. if (cpu_has_mmips) seq_printf(m, "%s", " micromips");
  92. if (cpu_has_vz) seq_printf(m, "%s", " vz");
  93. seq_printf(m, "\n");
  94. if (cpu_has_mmips) {
  95. seq_printf(m, "micromips kernel\t: %s\n",
  96. (read_c0_config3() & MIPS_CONF3_ISA_OE) ? "yes" : "no");
  97. }
  98. seq_printf(m, "shadow register sets\t: %d\n",
  99. cpu_data[n].srsets);
  100. seq_printf(m, "kscratch registers\t: %d\n",
  101. hweight8(cpu_data[n].kscratch_mask));
  102. seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
  103. sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
  104. cpu_has_vce ? "%u" : "not available");
  105. seq_printf(m, fmt, 'D', vced_count);
  106. seq_printf(m, fmt, 'I', vcei_count);
  107. seq_printf(m, "\n");
  108. return 0;
  109. }
  110. static void *c_start(struct seq_file *m, loff_t *pos)
  111. {
  112. unsigned long i = *pos;
  113. return i < NR_CPUS ? (void *) (i + 1) : NULL;
  114. }
  115. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  116. {
  117. ++*pos;
  118. return c_start(m, pos);
  119. }
  120. static void c_stop(struct seq_file *m, void *v)
  121. {
  122. }
  123. const struct seq_operations cpuinfo_op = {
  124. .start = c_start,
  125. .next = c_next,
  126. .stop = c_stop,
  127. .show = show_cpuinfo,
  128. };