Author: mcayland Date: Mon Jan 7 13:57:54 2013 New Revision: 1083 URL: http://tracker.coreboot.org/trac/openbios/changeset/1083
Log: adb_kbd.c: Implement dummy get-key-map word for the ADB keyboard package.
This word is used by some bootloaders to detect keypresses at startup e.g. to enable verbose boot. The current implementation simply returns an empty array (indicating no keys are pressed) as the key/bitmap mapping is unknown; however this allows bootloaders which make use of the word to execute.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/drivers/adb_kbd.c
Modified: trunk/openbios-devel/drivers/adb_kbd.c ============================================================================== --- trunk/openbios-devel/drivers/adb_kbd.c Mon Jan 7 13:57:51 2013 (r1082) +++ trunk/openbios-devel/drivers/adb_kbd.c Mon Jan 7 13:57:54 2013 (r1083) @@ -42,11 +42,13 @@ }
static void keyboard_read(void); +static void keyboard_getkeymap(void);
NODE_METHODS( keyboard ) = { { "open", keyboard_open }, { "close", keyboard_close }, { "read", keyboard_read }, + { "get-key-map", keyboard_getkeymap }, };
/* VT100 escape sequences */ @@ -471,6 +473,7 @@ int next_key; char sequence[ADB_MAX_SEQUENCE_LEN]; int len; + char keytable[32]; };
static adb_dev_t *my_adb_dev = NULL; @@ -531,6 +534,21 @@ ADB_kbd_us, ADB_sequences); kbd->next_key = -1; kbd->len = 0; + + /* Debugging BootX: the lines below force get-key-map to report that + * cmd-V is being held down, which forces BootX to run in verbose mode + * for debugging. + * + * TODO: if we can find a mapping between the get-key-map bitmap and + * ADB scancodes, the keyboard driver should be altered to update this + * accordingly. + */ + + /* + kbd->keytable[3] = 0x40; + kbd->keytable[28] = 0x10; + */ + dev->state = kbd; my_adb_dev = dev; } @@ -566,3 +584,12 @@ } PUSH(i); } + +/* ( -- keymap ) (?) */ +/* should return a pointer to an array with 32 bytes (256 bits) */ +static void keyboard_getkeymap(void) +{ + adb_kbd_t *kbd = my_adb_dev->state; + + PUSH( pointer2cell(kbd->keytable) ); +}