procfs.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * arch/v850/kernel/procfs.c -- Introspection functions for /proc filesystem
  3. *
  4. * Copyright (C) 2001,02 NEC Corporation
  5. * Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General
  8. * Public License. See the file COPYING in the main directory of this
  9. * archive for more details.
  10. *
  11. * Written by Miles Bader <miles@gnu.org>
  12. */
  13. #include "mach.h"
  14. static int cpuinfo_print (struct seq_file *m, void *v)
  15. {
  16. extern unsigned long loops_per_jiffy;
  17. seq_printf (m, "CPU-Family: v850\nCPU-Arch: %s\n", CPU_ARCH);
  18. #ifdef CPU_MODEL_LONG
  19. seq_printf (m, "CPU-Model: %s (%s)\n", CPU_MODEL, CPU_MODEL_LONG);
  20. #else
  21. seq_printf (m, "CPU-Model: %s\n", CPU_MODEL);
  22. #endif
  23. #ifdef CPU_CLOCK_FREQ
  24. seq_printf (m, "CPU-Clock: %ld (%ld MHz)\n",
  25. (long)CPU_CLOCK_FREQ,
  26. (long)CPU_CLOCK_FREQ / 1000000);
  27. #endif
  28. seq_printf (m, "BogoMips: %lu.%02lu\n",
  29. loops_per_jiffy/(500000/HZ),
  30. (loops_per_jiffy/(5000/HZ)) % 100);
  31. #ifdef PLATFORM_LONG
  32. seq_printf (m, "Platform: %s (%s)\n", PLATFORM, PLATFORM_LONG);
  33. #elif defined (PLATFORM)
  34. seq_printf (m, "Platform: %s\n", PLATFORM);
  35. #endif
  36. return 0;
  37. }
  38. static void *cpuinfo_start (struct seq_file *m, loff_t *pos)
  39. {
  40. return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
  41. }
  42. static void *cpuinfo_next (struct seq_file *m, void *v, loff_t *pos)
  43. {
  44. ++*pos;
  45. return cpuinfo_start (m, pos);
  46. }
  47. static void cpuinfo_stop (struct seq_file *m, void *v)
  48. {
  49. }
  50. struct seq_operations cpuinfo_op = {
  51. .start = cpuinfo_start,
  52. .next = cpuinfo_next,
  53. .stop = cpuinfo_stop,
  54. .show = cpuinfo_print
  55. };