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>
This commit is contained in:
Joshua Cov
2012-04-13 21:08:26 +02:00
committed by H. Peter Anvin
parent c2c21e9bb1
commit b2d0b7a061
5 changed files with 58 additions and 19 deletions

View File

@@ -57,14 +57,20 @@ static void copy_boot_params(void)
}
/*
* Set the keyboard repeat rate to maximum. Unclear why this
* Query the keyboard lock status as given by the BIOS, and
* set the keyboard repeat rate to maximum. Unclear why the latter
* is done here; this might be possible to kill off as stale code.
*/
static void keyboard_set_repeat(void)
static void keyboard_init(void)
{
struct biosregs ireg;
struct biosregs ireg, oreg;
initregs(&ireg);
ireg.ax = 0x0305;
ireg.ah = 0x02; /* Get keyboard status */
intcall(0x16, &ireg, &oreg);
boot_params.kbd_status = oreg.al;
ireg.ax = 0x0305; /* Set keyboard repeat rate */
intcall(0x16, &ireg, NULL);
}
@@ -151,8 +157,8 @@ void main(void)
/* Detect memory layout */
detect_memory();
/* Set keyboard repeat rate (why?) */
keyboard_set_repeat();
/* Set keyboard repeat rate (why?) and query the lock flags */
keyboard_init();
/* Query MCA information */
query_mca();