OMAP3: PM: Ensure MUSB block can idle when driver not loaded
[linux-ginger.git] / arch / blackfin / kernel / kgdb_test.c
blobdbcf3e45cb0baefef5136967e33744fef40b64fb
1 /*
2 * arch/blackfin/kernel/kgdb_test.c - Blackfin kgdb tests
4 * Copyright 2005-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/proc_fs.h>
14 #include <asm/current.h>
15 #include <asm/uaccess.h>
16 #include <asm/system.h>
18 #include <asm/blackfin.h>
20 static char cmdline[256];
21 static unsigned long len;
23 #ifndef CONFIG_SMP
24 static int num1 __attribute__((l1_data));
26 void kgdb_l1_test(void) __attribute__((l1_text));
28 void kgdb_l1_test(void)
30 printk(KERN_ALERT "L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
31 printk(KERN_ALERT "L1 : code function addr = 0x%p\n", kgdb_l1_test);
32 num1 = num1 + 10 ;
33 printk(KERN_ALERT "L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
34 return ;
36 #endif
38 #if L2_LENGTH
40 static int num2 __attribute__((l2));
41 void kgdb_l2_test(void) __attribute__((l2));
43 void kgdb_l2_test(void)
45 printk(KERN_ALERT "L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
46 printk(KERN_ALERT "L2 : code function addr = 0x%p\n", kgdb_l2_test);
47 num2 = num2 + 20 ;
48 printk(KERN_ALERT "L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
49 return ;
52 #endif
55 int kgdb_test(char *name, int len, int count, int z)
57 printk(KERN_DEBUG "kgdb name(%d): %s, %d, %d\n", len, name, count, z);
58 count = z;
59 return count;
62 static int test_proc_output(char *buf)
64 kgdb_test("hello world!", 12, 0x55, 0x10);
65 #ifndef CONFIG_SMP
66 kgdb_l1_test();
67 #endif
68 #if L2_LENGTH
69 kgdb_l2_test();
70 #endif
72 return 0;
75 static int test_read_proc(char *page, char **start, off_t off,
76 int count, int *eof, void *data)
78 int len;
80 len = test_proc_output(page);
81 if (len <= off+count)
82 *eof = 1;
83 *start = page + off;
84 len -= off;
85 if (len > count)
86 len = count;
87 if (len < 0)
88 len = 0;
89 return len;
92 static int test_write_proc(struct file *file, const char *buffer,
93 unsigned long count, void *data)
95 if (count >= 256)
96 len = 255;
97 else
98 len = count;
100 memcpy(cmdline, buffer, count);
101 cmdline[len] = 0;
103 return len;
106 static int __init kgdbtest_init(void)
108 struct proc_dir_entry *entry;
110 entry = create_proc_entry("kgdbtest", 0, NULL);
111 if (entry == NULL)
112 return -ENOMEM;
114 entry->read_proc = test_read_proc;
115 entry->write_proc = test_write_proc;
116 entry->data = NULL;
118 return 0;
121 static void __exit kgdbtest_exit(void)
123 remove_proc_entry("kgdbtest", NULL);
126 module_init(kgdbtest_init);
127 module_exit(kgdbtest_exit);
128 MODULE_LICENSE("GPL");