handle lack of pckbd more gracefully

kb_init() panics, if no keyboard controller is found during self-test.
Instead of panic, the driver should quit the init process and tell it the SEF .

Change-Id: Icdfb7125f5d4062f46cfbbdbbb9e54ac4b273642
This commit is contained in:
rlfnb 2015-06-03 07:56:35 +02:00 committed by Lionel Sambuc
parent af4345b097
commit e1e2bc96d2

View file

@ -250,7 +250,7 @@ kbc_read(void)
/* /*
* Initialize the keyboard hardware. * Initialize the keyboard hardware.
*/ */
static void static int
kb_init(void) kb_init(void)
{ {
int r, ccb; int r, ccb;
@ -272,8 +272,10 @@ kb_init(void)
/* Execute Controller Self Test. */ /* Execute Controller Self Test. */
kbc_cmd0(0xAA); kbc_cmd0(0xAA);
r = kbc_read(); r = kbc_read();
if (r != 0x55) if (r != 0x55){
panic("PCKBD: Controller self-test failed.\n"); printf("PCKBD: Controller self-test failed.\n");
return EGENERIC;
}
/* Set interrupt handler and enable keyboard IRQ. */ /* Set interrupt handler and enable keyboard IRQ. */
irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */ irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */
@ -316,6 +318,7 @@ kb_init(void)
kb_wait(); kb_wait();
set_leds(0); set_leds(0);
return OK;
} }
/* /*
@ -466,7 +469,10 @@ pckbd_init(int UNUSED(type), sef_init_info_t *UNUSED(info))
init_timer(&tmr_kbd_wd); init_timer(&tmr_kbd_wd);
/* Initialize the keyboard. */ /* Initialize the keyboard. */
kb_init(); int r;
if((r = kb_init())!=OK){
return r;
}
/* Announce the driver's presence. */ /* Announce the driver's presence. */
if (aux_available != 0) if (aux_available != 0)