| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
 | 14 | #include "mach.h" | 
 | 15 |  | 
 | 16 | static int cpuinfo_print (struct seq_file *m, void *v) | 
 | 17 | { | 
 | 18 | 	extern unsigned long loops_per_jiffy; | 
 | 19 | 	 | 
 | 20 | 	seq_printf (m, "CPU-Family:	v850\nCPU-Arch:	%s\n", CPU_ARCH); | 
 | 21 |  | 
 | 22 | #ifdef CPU_MODEL_LONG | 
 | 23 | 	seq_printf (m, "CPU-Model:	%s (%s)\n", CPU_MODEL, CPU_MODEL_LONG); | 
 | 24 | #else | 
 | 25 | 	seq_printf (m, "CPU-Model:	%s\n", CPU_MODEL); | 
 | 26 | #endif | 
 | 27 |  | 
 | 28 | #ifdef CPU_CLOCK_FREQ | 
 | 29 | 	seq_printf (m, "CPU-Clock:	%ld (%ld MHz)\n", | 
 | 30 | 		    (long)CPU_CLOCK_FREQ, | 
 | 31 | 		    (long)CPU_CLOCK_FREQ / 1000000); | 
 | 32 | #endif | 
 | 33 |  | 
 | 34 | 	seq_printf (m, "BogoMips:	%lu.%02lu\n", | 
 | 35 | 		    loops_per_jiffy/(500000/HZ), | 
 | 36 | 		    (loops_per_jiffy/(5000/HZ)) % 100); | 
 | 37 |  | 
 | 38 | #ifdef PLATFORM_LONG | 
 | 39 | 	seq_printf (m, "Platform:	%s (%s)\n", PLATFORM, PLATFORM_LONG); | 
 | 40 | #elif defined (PLATFORM) | 
 | 41 | 	seq_printf (m, "Platform:	%s\n", PLATFORM); | 
 | 42 | #endif | 
 | 43 |  | 
 | 44 | 	return 0; | 
 | 45 | } | 
 | 46 |  | 
 | 47 | static void *cpuinfo_start (struct seq_file *m, loff_t *pos) | 
 | 48 | { | 
 | 49 | 	return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL; | 
 | 50 | } | 
 | 51 |  | 
 | 52 | static void *cpuinfo_next (struct seq_file *m, void *v, loff_t *pos) | 
 | 53 | { | 
 | 54 | 	++*pos; | 
 | 55 | 	return cpuinfo_start (m, pos); | 
 | 56 | } | 
 | 57 |  | 
 | 58 | static void cpuinfo_stop (struct seq_file *m, void *v) | 
 | 59 | { | 
 | 60 | } | 
 | 61 |  | 
 | 62 | struct seq_operations cpuinfo_op = { | 
 | 63 | 	.start	= cpuinfo_start, | 
 | 64 | 	.next	= cpuinfo_next, | 
 | 65 | 	.stop	= cpuinfo_stop, | 
 | 66 | 	.show	= cpuinfo_print | 
 | 67 | }; |