Add some patches to grub.
[people/pmueller/ipfire-2.x.git] / src / patches / grub-0.97-mactel-kbd.patch
1 --- grub-0.97/stage2/asm.S.mactel-kbd 2006-06-12 17:00:10.000000000 -0400
2 +++ grub-0.97/stage2/asm.S 2006-06-12 17:03:38.000000000 -0400
3 @@ -1651,7 +1651,30 @@
4 jnz 3f
5 ret
6
7 -3: /* use keyboard controller */
8 +3: /*
9 + * try to switch gateA20 using PORT92, the "Fast A20 and Init"
10 + * register
11 + */
12 + mov $0x92, %dx
13 + inb %dx, %al
14 + /* skip the port92 code if it's unimplemented (read returns 0xff) */
15 + cmpb $0xff, %al
16 + jz 6f
17 +
18 + /* set or clear bit1, the ALT_A20_GATE bit */
19 + movb 4(%esp), %ah
20 + testb %ah, %ah
21 + jz 4f
22 + orb $2, %al
23 + jmp 5f
24 +4: and $0xfd, %al
25 +
26 + /* clear the INIT_NOW bit; don't accidently reset the machine */
27 +5: and $0xfe, %al
28 + outb %al, %dx
29 +
30 +
31 +6: /* use keyboard controller */
32 pushl %eax
33
34 call gloop1
35 @@ -1661,9 +1684,12 @@
36
37 gloopint1:
38 inb $K_STATUS
39 + cmpb $0xff, %al
40 + jz gloopint1_done
41 andb $K_IBUF_FUL, %al
42 jnz gloopint1
43
44 +gloopint1_done:
45 movb $KB_OUTPUT_MASK, %al
46 cmpb $0, 0x8(%esp)
47 jz gdoit
48 @@ -1684,6 +1710,8 @@
49
50 gloop1:
51 inb $K_STATUS
52 + cmpb $0xff, %al
53 + jz gloop2ret
54 andb $K_IBUF_FUL, %al
55 jnz gloop1
56
57 @@ -1994,8 +2022,25 @@
58 call EXT_C(prot_to_real)
59 .code16
60
61 +.again:
62 + mov $0x11, %ah /* poll kbd */
63 int $0x16
64
65 + jz .again
66 +#if 0
67 +/* XXX handle serial here? -- pj */
68 + jnz .kbd
69 +#endif
70 +.kbd:
71 + mov $0x10, %ah
72 + int $0x16
73 + cmp $0xe0, %al
74 + jnz .not_ext
75 + xor %al, %al
76 +.not_ext:
77 + and %al, %al
78 + jz .func_key
79 +.func_key:
80 movw %ax, %dx /* real_to_prot uses %eax */
81 call translate_keycode
82 call remap_ascii_char
83 @@ -2003,7 +2048,7 @@
84 DATA32 call EXT_C(real_to_prot)
85 .code32
86
87 - movw %dx, %ax
88 + mov %dx, %ax
89
90 pop %ebp
91 ret
92 @@ -2029,7 +2074,7 @@
93 call EXT_C(prot_to_real) /* enter real mode */
94 .code16
95
96 - movb $0x1, %ah
97 + movb $0x11, %ah
98 int $0x16
99
100 DATA32 jz notpending