Merge from trunk
This commit is contained in:
commit
d94000ed13
210 changed files with 4949 additions and 2557 deletions
|
@ -33,6 +33,13 @@ static int pending_key = -1;
|
|||
#define KEYBOARD_STATUS_CTRL_L (1 << 4)
|
||||
#define KEYBOARD_STATUS_CTRL_R (1 << 5)
|
||||
#define KEYBOARD_STATUS_CAPS_LOCK (1 << 6)
|
||||
#define KEYBOARD_STATUS_NUM_LOCK (1 << 7)
|
||||
|
||||
static grub_uint8_t led_status;
|
||||
|
||||
#define KEYBOARD_LED_SCROLL (1 << 0)
|
||||
#define KEYBOARD_LED_NUM (1 << 1)
|
||||
#define KEYBOARD_LED_CAPS (1 << 2)
|
||||
|
||||
static char keyboard_map[128] =
|
||||
{
|
||||
|
@ -66,9 +73,15 @@ static char keyboard_map_shift[128] =
|
|||
static grub_uint8_t grub_keyboard_controller_orig;
|
||||
|
||||
static void
|
||||
grub_keyboard_controller_write (grub_uint8_t c)
|
||||
keyboard_controller_wait_untill_ready ()
|
||||
{
|
||||
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
|
||||
}
|
||||
|
||||
static void
|
||||
grub_keyboard_controller_write (grub_uint8_t c)
|
||||
{
|
||||
keyboard_controller_wait_untill_ready ();
|
||||
grub_outb (KEYBOARD_COMMAND_WRITE, KEYBOARD_REG_STATUS);
|
||||
grub_outb (c, KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
@ -76,11 +89,20 @@ grub_keyboard_controller_write (grub_uint8_t c)
|
|||
static grub_uint8_t
|
||||
grub_keyboard_controller_read (void)
|
||||
{
|
||||
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
|
||||
keyboard_controller_wait_untill_ready ();
|
||||
grub_outb (KEYBOARD_COMMAND_READ, KEYBOARD_REG_STATUS);
|
||||
return grub_inb (KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_controller_led (grub_uint8_t led_status)
|
||||
{
|
||||
keyboard_controller_wait_untill_ready ();
|
||||
grub_outb (0xed, KEYBOARD_REG_DATA);
|
||||
keyboard_controller_wait_untill_ready ();
|
||||
grub_outb (led_status & 0x7, KEYBOARD_REG_DATA);
|
||||
}
|
||||
|
||||
/* FIXME: This should become an interrupt service routine. For now
|
||||
it's just used to catch events from control keys. */
|
||||
static void
|
||||
|
@ -159,14 +181,37 @@ grub_at_keyboard_getkey_noblock (void)
|
|||
switch (code)
|
||||
{
|
||||
case CAPS_LOCK:
|
||||
at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK;
|
||||
/* Caps lock sends scan code twice. Get the second one and discard it. */
|
||||
while (grub_keyboard_getkey () == -1);
|
||||
|
||||
at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK;
|
||||
led_status ^= KEYBOARD_LED_CAPS;
|
||||
keyboard_controller_led (led_status);
|
||||
|
||||
#ifdef DEBUG_AT_KEYBOARD
|
||||
grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK));
|
||||
#endif
|
||||
key = -1;
|
||||
break;
|
||||
case NUM_LOCK:
|
||||
/* Num lock sends scan code twice. Get the second one and discard it. */
|
||||
while (grub_keyboard_getkey () == -1);
|
||||
|
||||
at_keyboard_status ^= KEYBOARD_STATUS_NUM_LOCK;
|
||||
led_status ^= KEYBOARD_LED_NUM;
|
||||
keyboard_controller_led (led_status);
|
||||
|
||||
#ifdef DEBUG_AT_KEYBOARD
|
||||
grub_dprintf ("atkeyb", "num_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_NUM_LOCK));
|
||||
#endif
|
||||
key = -1;
|
||||
break;
|
||||
case SCROLL_LOCK:
|
||||
/* For scroll lock we don't keep track of status. Only update its led. */
|
||||
led_status ^= KEYBOARD_LED_SCROLL;
|
||||
keyboard_controller_led (led_status);
|
||||
key = -1;
|
||||
break;
|
||||
default:
|
||||
if (at_keyboard_status & (KEYBOARD_STATUS_CTRL_L | KEYBOARD_STATUS_CTRL_R))
|
||||
key = keyboard_map[code] - 'a' + 1;
|
||||
|
|
|
@ -190,7 +190,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
|
|||
virtual_screen.font = grub_font_get (font_name);
|
||||
if (!virtual_screen.font)
|
||||
return grub_error (GRUB_ERR_BAD_FONT,
|
||||
"No font loaded.");
|
||||
"no font loaded");
|
||||
virtual_screen.width = width;
|
||||
virtual_screen.height = height;
|
||||
virtual_screen.offset_x = x;
|
||||
|
|
|
@ -163,7 +163,7 @@ grub_vga_mod_init (void)
|
|||
set_start_address (PAGE_OFFSET (page));
|
||||
font = grub_font_get (""); /* Choose any font, for now. */
|
||||
if (!font)
|
||||
return grub_error (GRUB_ERR_BAD_FONT, "No font loaded.");
|
||||
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* ofconsole.c -- Open Firmware console for GRUB. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,2004,2005,2007,2008,2009 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
|
||||
|
@ -43,17 +43,17 @@ struct color
|
|||
int blue;
|
||||
};
|
||||
|
||||
#define MAX 0xff
|
||||
static struct color colors[8] =
|
||||
static struct color colors[] =
|
||||
{
|
||||
{ 0, 0, 0},
|
||||
{ MAX, 0, 0},
|
||||
{ 0, MAX, 0},
|
||||
{ MAX, MAX, 0},
|
||||
{ 0, 0, MAX},
|
||||
{ MAX, 0, MAX},
|
||||
{ 0, MAX, MAX},
|
||||
{ MAX, MAX, MAX}
|
||||
// {R, G, B}
|
||||
{0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xA8}, // 1 = blue
|
||||
{0x00, 0xA8, 0x00}, // 2 = green
|
||||
{0x00, 0xA8, 0xA8}, // 3 = cyan
|
||||
{0xA8, 0x00, 0x00}, // 4 = red
|
||||
{0xA8, 0x00, 0xA8}, // 5 = magenta
|
||||
{0xFE, 0xFE, 0x54}, // 6 = yellow
|
||||
{0xFE, 0xFE, 0xFE} // 7 = white
|
||||
};
|
||||
|
||||
static grub_uint8_t grub_ofconsole_normal_color = 0x7;
|
||||
|
@ -131,8 +131,9 @@ static void
|
|||
grub_ofconsole_setcolor (grub_uint8_t normal_color,
|
||||
grub_uint8_t highlight_color)
|
||||
{
|
||||
grub_ofconsole_normal_color = normal_color;
|
||||
grub_ofconsole_highlight_color = highlight_color;
|
||||
/* Discard bright bit. */
|
||||
grub_ofconsole_normal_color = normal_color & 0x77;
|
||||
grub_ofconsole_highlight_color = highlight_color & 0x77;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -345,7 +346,7 @@ grub_ofconsole_init_input (void)
|
|||
if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &stdin_ihandle,
|
||||
sizeof stdin_ihandle, &actual)
|
||||
|| actual != sizeof stdin_ihandle)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot find stdin");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -354,7 +355,6 @@ static grub_err_t
|
|||
grub_ofconsole_init_output (void)
|
||||
{
|
||||
grub_ssize_t actual;
|
||||
int col;
|
||||
|
||||
/* The latest PowerMacs don't actually initialize the screen for us, so we
|
||||
* use this trick to re-open the output device (but we avoid doing this on
|
||||
|
@ -365,12 +365,13 @@ grub_ofconsole_init_output (void)
|
|||
if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", &stdout_ihandle,
|
||||
sizeof stdout_ihandle, &actual)
|
||||
|| actual != sizeof stdout_ihandle)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot find stdout");
|
||||
|
||||
/* Initialize colors. */
|
||||
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
|
||||
{
|
||||
for (col = 0; col < 7; col++)
|
||||
unsigned col;
|
||||
for (col = 0; col < ARRAY_SIZE (colors); col++)
|
||||
grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red,
|
||||
colors[col].green, colors[col].blue);
|
||||
|
||||
|
|
|
@ -501,7 +501,7 @@ grub_cmd_serial (grub_extcmd_t cmd,
|
|||
unit = grub_strtoul (state[0].arg, 0, 0);
|
||||
serial_settings.port = serial_hw_get_port (unit);
|
||||
if (!serial_settings.port)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad unit number.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad unit number");
|
||||
}
|
||||
|
||||
if (state[1].set)
|
||||
|
|
|
@ -103,7 +103,7 @@ grub_terminfo_set_current (const char *str)
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminfo type.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminfo type");
|
||||
}
|
||||
|
||||
/* Wrapper for grub_putchar to write strings. */
|
||||
|
@ -168,7 +168,7 @@ grub_cmd_terminfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
else if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters");
|
||||
else
|
||||
return grub_terminfo_set_current (args[0]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue