Merge to Fedora kernel-2.6.17-1.2187_FC5 patched with stable patch-2.6.17.13-vs2...
[linux-2.6.git] / include / asm-i386 / mach-default / mach_traps.h
1 /*
2  *  include/asm-i386/mach-default/mach_traps.h
3  *
4  *  Machine specific NMI handling for generic.
5  *  Split out from traps.c by Osamu Tomita <tomita@cinet.co.jp>
6  */
7 #ifndef _MACH_TRAPS_H
8 #define _MACH_TRAPS_H
9
10 #include <asm/mc146818rtc.h>
11
12 static inline void clear_mem_error(unsigned char reason)
13 {
14         reason = (reason & 0xf) | 4;
15         outb(reason, 0x61);
16 }
17
18 static inline void clear_io_check_error(unsigned char reason)
19 {
20         unsigned long i;
21
22         reason = (reason & 0xf) | 8;
23         outb(reason, 0x61);
24         i = 2000;
25         while (--i) udelay(1000);
26         reason &= ~8;
27         outb(reason, 0x61);
28 }
29
30 static inline unsigned char get_nmi_reason(void)
31 {
32         return inb(0x61);
33 }
34
35 static inline void reassert_nmi(void)
36 {
37         int old_reg = -1;
38
39         if (do_i_have_lock_cmos())
40                 old_reg = current_lock_cmos_reg();
41         else
42                 lock_cmos(0); /* register doesn't matter here */
43         outb(0x8f, 0x70);
44         inb(0x71);              /* dummy */
45         outb(0x0f, 0x70);
46         inb(0x71);              /* dummy */
47         if (old_reg >= 0)
48                 outb(old_reg, 0x70);
49         else
50                 unlock_cmos();
51 }
52
53 #endif /* !_MACH_TRAPS_H */