This source file includes following definitions.
- hwreg_present
- hwreg_write
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include <linux/module.h>
28
29 int hwreg_present(volatile void *regp)
30 {
31 int ret = 0;
32 unsigned long flags;
33 long save_sp, save_vbr;
34 long tmp_vectors[3];
35
36 local_irq_save(flags);
37 __asm__ __volatile__ (
38 "movec %/vbr,%2\n\t"
39 "movel #Lberr1,%4@(8)\n\t"
40 "movec %4,%/vbr\n\t"
41 "movel %/sp,%1\n\t"
42 "moveq #0,%0\n\t"
43 "tstb %3@\n\t"
44 "nop\n\t"
45 "moveq #1,%0\n"
46 "Lberr1:\n\t"
47 "movel %1,%/sp\n\t"
48 "movec %2,%/vbr"
49 : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr)
50 : "a" (regp), "a" (tmp_vectors)
51 );
52 local_irq_restore(flags);
53
54 return ret;
55 }
56 EXPORT_SYMBOL(hwreg_present);
57
58
59
60
61
62 int hwreg_write(volatile void *regp, unsigned short val)
63 {
64 int ret;
65 unsigned long flags;
66 long save_sp, save_vbr;
67 long tmp_vectors[3];
68
69 local_irq_save(flags);
70 __asm__ __volatile__ (
71 "movec %/vbr,%2\n\t"
72 "movel #Lberr2,%4@(8)\n\t"
73 "movec %4,%/vbr\n\t"
74 "movel %/sp,%1\n\t"
75 "moveq #0,%0\n\t"
76 "movew %5,%3@\n\t"
77 "nop\n\t"
78
79
80
81
82 "moveq #1,%0\n"
83 "Lberr2:\n\t"
84 "movel %1,%/sp\n\t"
85 "movec %2,%/vbr"
86 : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr)
87 : "a" (regp), "a" (tmp_vectors), "g" (val)
88 );
89 local_irq_restore(flags);
90
91 return ret;
92 }
93 EXPORT_SYMBOL(hwreg_write);
94