setup.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Display CPU info in /proc/cpuinfo.
  3. *
  4. * Copyright (C) 2003, Axis Communications AB.
  5. */
  6. #include <linux/config.h>
  7. #include <linux/seq_file.h>
  8. #include <linux/proc_fs.h>
  9. #include <linux/delay.h>
  10. #include <linux/param.h>
  11. #ifdef CONFIG_PROC_FS
  12. #define HAS_FPU 0x0001
  13. #define HAS_MMU 0x0002
  14. #define HAS_ETHERNET100 0x0004
  15. #define HAS_TOKENRING 0x0008
  16. #define HAS_SCSI 0x0010
  17. #define HAS_ATA 0x0020
  18. #define HAS_USB 0x0040
  19. #define HAS_IRQ_BUG 0x0080
  20. #define HAS_MMU_BUG 0x0100
  21. struct cpu_info {
  22. char *cpu_model;
  23. unsigned short rev;
  24. unsigned short cache_size;
  25. unsigned short flags;
  26. };
  27. /* Some of these model are here for historical reasons only. */
  28. static struct cpu_info cpinfo[] = {
  29. {"ETRAX 1", 0, 0, 0},
  30. {"ETRAX 2", 1, 0, 0},
  31. {"ETRAX 3", 2, 0, 0},
  32. {"ETRAX 4", 3, 0, 0},
  33. {"Simulator", 7, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
  34. {"ETRAX 100", 8, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_IRQ_BUG},
  35. {"ETRAX 100", 9, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
  36. {"ETRAX 100LX", 10, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
  37. | HAS_MMU | HAS_MMU_BUG},
  38. {"ETRAX 100LX v2", 11, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
  39. | HAS_MMU},
  40. {"ETRAX FS", 32, 32, HAS_ETHERNET100 | HAS_ATA | HAS_MMU},
  41. {"Unknown", 0, 0, 0}
  42. };
  43. int
  44. show_cpuinfo(struct seq_file *m, void *v)
  45. {
  46. int i;
  47. int cpu = (int)v - 1;
  48. int entries;
  49. unsigned long revision;
  50. struct cpu_info *info;
  51. entries = sizeof cpinfo / sizeof(struct cpu_info);
  52. info = &cpinfo[entries - 1];
  53. #ifdef CONFIG_SMP
  54. if (!cpu_online(cpu))
  55. return 0;
  56. #endif
  57. revision = rdvr();
  58. for (i = 0; i < entries; i++) {
  59. if (cpinfo[i].rev == revision) {
  60. info = &cpinfo[i];
  61. break;
  62. }
  63. }
  64. return seq_printf(m,
  65. "processor\t: %d\n"
  66. "cpu\t\t: CRIS\n"
  67. "cpu revision\t: %lu\n"
  68. "cpu model\t: %s\n"
  69. "cache size\t: %d KB\n"
  70. "fpu\t\t: %s\n"
  71. "mmu\t\t: %s\n"
  72. "mmu DMA bug\t: %s\n"
  73. "ethernet\t: %s Mbps\n"
  74. "token ring\t: %s\n"
  75. "scsi\t\t: %s\n"
  76. "ata\t\t: %s\n"
  77. "usb\t\t: %s\n"
  78. "bogomips\t: %lu.%02lu\n\n",
  79. cpu,
  80. revision,
  81. info->cpu_model,
  82. info->cache_size,
  83. info->flags & HAS_FPU ? "yes" : "no",
  84. info->flags & HAS_MMU ? "yes" : "no",
  85. info->flags & HAS_MMU_BUG ? "yes" : "no",
  86. info->flags & HAS_ETHERNET100 ? "10/100" : "10",
  87. info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
  88. info->flags & HAS_SCSI ? "yes" : "no",
  89. info->flags & HAS_ATA ? "yes" : "no",
  90. info->flags & HAS_USB ? "yes" : "no",
  91. (loops_per_jiffy * HZ + 500) / 500000,
  92. ((loops_per_jiffy * HZ + 500) / 5000) % 100);
  93. }
  94. #endif /* CONFIG_PROC_FS */
  95. void
  96. show_etrax_copyright(void)
  97. {
  98. printk(KERN_INFO
  99. "Linux/CRISv32 port on ETRAX FS (C) 2003, 2004 Axis Communications AB\n");
  100. }