setup.c 2.7 KB

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