diff options
author | Joshua Cov <joshuacov@googlemail.com> | 2012-04-13 15:08:26 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-05-08 17:19:41 -0400 |
commit | b2d0b7a061bfddd27155c7dcd53f365d9dc0c7c3 (patch) | |
tree | 8063c6df479723b7adc509ee2aad728889faa9a4 /arch/x86/boot/main.c | |
parent | c2c21e9bb17549e8add4ff76931bcec2e2d3ad48 (diff) |
keyboard: Use BIOS Keyboard variable to set Numlock
The PC BIOS does provide a NUMLOCK flag containing the desired state
of this LED. This patch sets the current state according to the data
in the bios.
[ hpa: fixed __weak declaration without definition, changed "inline"
to "static inline" ]
Signed-Off-By: Joshua Cov <joshuacov@googlemail.com>
Link: http://lkml.kernel.org/r/CAKL7Q7rvq87TNS1T_Km8fW_5OzS%2BSbYazLXKxW-6ztOxo3zorg@mail.gmail.com
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/boot/main.c')
-rw-r--r-- | arch/x86/boot/main.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 40358c8905b..cf6083d444f 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c | |||
@@ -57,14 +57,20 @@ static void copy_boot_params(void) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * Set the keyboard repeat rate to maximum. Unclear why this | 60 | * Query the keyboard lock status as given by the BIOS, and |
61 | * set the keyboard repeat rate to maximum. Unclear why the latter | ||
61 | * is done here; this might be possible to kill off as stale code. | 62 | * is done here; this might be possible to kill off as stale code. |
62 | */ | 63 | */ |
63 | static void keyboard_set_repeat(void) | 64 | static void keyboard_init(void) |
64 | { | 65 | { |
65 | struct biosregs ireg; | 66 | struct biosregs ireg, oreg; |
66 | initregs(&ireg); | 67 | initregs(&ireg); |
67 | ireg.ax = 0x0305; | 68 | |
69 | ireg.ah = 0x02; /* Get keyboard status */ | ||
70 | intcall(0x16, &ireg, &oreg); | ||
71 | boot_params.kbd_status = oreg.al; | ||
72 | |||
73 | ireg.ax = 0x0305; /* Set keyboard repeat rate */ | ||
68 | intcall(0x16, &ireg, NULL); | 74 | intcall(0x16, &ireg, NULL); |
69 | } | 75 | } |
70 | 76 | ||
@@ -151,8 +157,8 @@ void main(void) | |||
151 | /* Detect memory layout */ | 157 | /* Detect memory layout */ |
152 | detect_memory(); | 158 | detect_memory(); |
153 | 159 | ||
154 | /* Set keyboard repeat rate (why?) */ | 160 | /* Set keyboard repeat rate (why?) and query the lock flags */ |
155 | keyboard_set_repeat(); | 161 | keyboard_init(); |
156 | 162 | ||
157 | /* Query MCA information */ | 163 | /* Query MCA information */ |
158 | query_mca(); | 164 | query_mca(); |