2008-01-19 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/linuxbios/console.h: Add header protection. (grub_keyboard_controller_init): New function prototype. * term/i386/pc/at_keyboard.c (KEYBOARD_COMMAND_ISREADY): New macro. (KEYBOARD_COMMAND_READ): Likewise. (KEYBOARD_COMMAND_WRITE): Likewise. (KEYBOARD_SCANCODE_SET1): Likewise. (grub_keyboard_controller_write): New function. (grub_keyboard_controller_read): Likewise. (grub_keyboard_controller_init): Likewise. * term/i386/pc/console.c: Include `<grub/machine/machine.h>'. (grub_console_init): On coreboot/LinuxBIOS, call grub_keyboard_controller_init().
This commit is contained in:
parent
5f5a7c1518
commit
59f1fd8de8
4 changed files with 76 additions and 2 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2008-01-19 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
|
* include/grub/i386/linuxbios/console.h: Add header protection.
|
||||||
|
(grub_keyboard_controller_init): New function prototype.
|
||||||
|
* term/i386/pc/at_keyboard.c (KEYBOARD_COMMAND_ISREADY): New macro.
|
||||||
|
(KEYBOARD_COMMAND_READ): Likewise.
|
||||||
|
(KEYBOARD_COMMAND_WRITE): Likewise.
|
||||||
|
(KEYBOARD_SCANCODE_SET1): Likewise.
|
||||||
|
(grub_keyboard_controller_write): New function.
|
||||||
|
(grub_keyboard_controller_read): Likewise.
|
||||||
|
(grub_keyboard_controller_init): Likewise.
|
||||||
|
|
||||||
|
* term/i386/pc/console.c: Include `<grub/machine/machine.h>'.
|
||||||
|
(grub_console_init): On coreboot/LinuxBIOS, call
|
||||||
|
grub_keyboard_controller_init().
|
||||||
|
|
||||||
2008-01-19 Robert Millan <rmh@aybabtu.com>
|
2008-01-19 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
PowerPC changes provided by Pavel Roskin.
|
PowerPC changes provided by Pavel Roskin.
|
||||||
|
|
|
@ -1 +1,25 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GRUB_CONSOLE_MACHINE_LB_HEADER
|
||||||
|
#define _GRUB_CONSOLE_MACHINE_LB_HEADER 1
|
||||||
#include <grub/i386/pc/console.h>
|
#include <grub/i386/pc/console.h>
|
||||||
|
|
||||||
|
void grub_keyboard_controller_init (void);
|
||||||
|
|
||||||
|
#endif /* ! _GRUB_CONSOLE_MACHINE_LB_HEADER */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -37,6 +37,13 @@
|
||||||
#define KEYBOARD_REG_DATA 0x60
|
#define KEYBOARD_REG_DATA 0x60
|
||||||
#define KEYBOARD_REG_STATUS 0x64
|
#define KEYBOARD_REG_STATUS 0x64
|
||||||
|
|
||||||
|
/* Used for sending commands to the controller. */
|
||||||
|
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)
|
||||||
|
#define KEYBOARD_COMMAND_READ 0x20
|
||||||
|
#define KEYBOARD_COMMAND_WRITE 0x60
|
||||||
|
|
||||||
|
#define KEYBOARD_SCANCODE_SET1 0x40
|
||||||
|
|
||||||
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
|
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
|
||||||
#define KEYBOARD_ISREADY(x) (((x) & 0x01) == 0)
|
#define KEYBOARD_ISREADY(x) (((x) & 0x01) == 0)
|
||||||
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
|
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
|
||||||
|
@ -73,6 +80,28 @@ static char keyboard_map_shift[128] =
|
||||||
'2', '3',
|
'2', '3',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
grub_keyboard_controller_write (grub_uint8_t c)
|
||||||
|
{
|
||||||
|
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
|
||||||
|
grub_outb (KEYBOARD_COMMAND_WRITE, KEYBOARD_REG_STATUS);
|
||||||
|
grub_outb (c, KEYBOARD_REG_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_uint8_t
|
||||||
|
grub_keyboard_controller_read (void)
|
||||||
|
{
|
||||||
|
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
|
||||||
|
grub_outb (KEYBOARD_COMMAND_READ, KEYBOARD_REG_STATUS);
|
||||||
|
return grub_inb (KEYBOARD_REG_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_keyboard_controller_init (void)
|
||||||
|
{
|
||||||
|
grub_keyboard_controller_write (grub_keyboard_controller_read () | KEYBOARD_SCANCODE_SET1);
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: This should become an interrupt service routine. For now
|
/* FIXME: This should become an interrupt service routine. For now
|
||||||
it's just used to catch events from control keys. */
|
it's just used to catch events from control keys. */
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2002,2003,2005,2007 Free Software Foundation, Inc.
|
* Copyright (C) 2002,2003,2005,2007,2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grub/machine/machine.h>
|
||||||
#include <grub/machine/console.h>
|
#include <grub/machine/console.h>
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
@ -148,6 +149,10 @@ static struct grub_term grub_console_term =
|
||||||
void
|
void
|
||||||
grub_console_init (void)
|
grub_console_init (void)
|
||||||
{
|
{
|
||||||
|
#ifdef GRUB_MACHINE_LINUXBIOS
|
||||||
|
grub_keyboard_controller_init ();
|
||||||
|
#endif
|
||||||
|
|
||||||
grub_term_register (&grub_console_term);
|
grub_term_register (&grub_console_term);
|
||||||
grub_term_set_current (&grub_console_term);
|
grub_term_set_current (&grub_console_term);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue