Merge mainline.

This commit is contained in:
Manoel Rebelo Abranches 2011-04-01 04:45:37 -03:00
commit 50ee5d686d
193 changed files with 9983 additions and 1425 deletions

View file

@ -257,6 +257,8 @@ grub_keyboard_controller_write (grub_uint8_t c)
grub_outb (c, KEYBOARD_REG_DATA);
}
#if !defined (GRUB_MACHINE_MIPS_YEELOONG) && !defined (GRUB_MACHINE_QEMU)
static grub_uint8_t
grub_keyboard_controller_read (void)
{
@ -265,6 +267,8 @@ grub_keyboard_controller_read (void)
return grub_inb (KEYBOARD_REG_DATA);
}
#endif
static int
write_mode (int mode)
{
@ -326,6 +330,11 @@ set_scancodes (void)
return;
}
#if !(defined (GRUB_MACHINE_MIPS_YEELOONG) || defined (GRUB_MACHINE_QEMU))
current_set = 1;
return;
#endif
grub_keyboard_controller_write (grub_keyboard_controller_orig
& ~KEYBOARD_AT_TRANSLATE);
@ -490,7 +499,7 @@ static int
grub_keyboard_getkey (void)
{
int key;
int is_break;
int is_break = 0;
key = fetch_key (&is_break);
if (key == -1)
@ -558,8 +567,13 @@ grub_keyboard_controller_init (struct grub_term_input *term __attribute__ ((unus
keyboard_controller_wait_until_ready ();
grub_inb (KEYBOARD_REG_DATA);
}
#if defined (GRUB_MACHINE_MIPS_YEELOONG) || defined (GRUB_MACHINE_QEMU)
grub_keyboard_controller_orig = 0;
grub_keyboard_orig_set = 2;
#else
grub_keyboard_controller_orig = grub_keyboard_controller_read ();
grub_keyboard_orig_set = query_mode ();
#endif
set_scancodes ();
keyboard_controller_led (led_status);

View file

@ -532,21 +532,8 @@ dirty_region_is_empty (void)
}
static void
dirty_region_add (int x, int y, unsigned int width, unsigned int height)
dirty_region_add_real (int x, int y, unsigned int width, unsigned int height)
{
if ((width == 0) || (height == 0))
return;
if (repaint_scheduled)
{
x = virtual_screen.offset_x;
y = virtual_screen.offset_y;
width = virtual_screen.width;
height = virtual_screen.height;
repaint_scheduled = 0;
repaint_was_scheduled = 1;
}
if (dirty_region_is_empty ())
{
dirty_region.top_left_x = x;
@ -567,6 +554,22 @@ dirty_region_add (int x, int y, unsigned int width, unsigned int height)
}
}
static void
dirty_region_add (int x, int y, unsigned int width, unsigned int height)
{
if ((width == 0) || (height == 0))
return;
if (repaint_scheduled)
{
dirty_region_add_real (virtual_screen.offset_x, virtual_screen.offset_y,
virtual_screen.width, virtual_screen.height);
repaint_scheduled = 0;
repaint_was_scheduled = 1;
}
dirty_region_add_real (x, y, width, height);
}
static void
dirty_region_add_virtualscreen (void)
{
@ -945,6 +948,8 @@ calculate_normal_character_width (grub_font_t font)
if (glyph->device_width > width)
width = glyph->device_width;
}
if (!width)
return 8;
return width;
}

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007, 2008 Free Software Foundation, Inc.
* Copyright (C) 2007, 2008, 2010 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
@ -27,18 +27,18 @@
static int grub_curr_x, grub_curr_y;
#define VGA_TEXT_SCREEN 0xb8000
#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb8000)
static void
screen_write_char (int x, int y, short c)
{
((short *) VGA_TEXT_SCREEN)[y * COLS + x] = c;
VGA_TEXT_SCREEN[y * COLS + x] = c;
}
static short
screen_read_char (int x, int y)
{
return ((short *) VGA_TEXT_SCREEN)[y * COLS + x];
return VGA_TEXT_SCREEN[y * COLS + x];
}
static void
@ -120,7 +120,7 @@ grub_vga_text_cls (struct grub_term_output *term)
{
int i;
for (i = 0; i < ROWS * COLS; i++)
((short *) VGA_TEXT_SCREEN)[i] = ' ' | (grub_console_cur_color << 8);
VGA_TEXT_SCREEN[i] = ' ' | (grub_console_cur_color << 8);
grub_vga_text_gotoxy (term, 0, 0);
}

View file

@ -170,6 +170,8 @@ grub_ofconsole_init_output (struct grub_term_output *term)
grub_ofconsole_dimensions ();
grub_terminfo_output_init (term);
return 0;
}

View file

@ -41,7 +41,7 @@ static const struct grub_arg_option options[] =
{0, 0, 0, 0, 0, 0}
};
struct grub_serial_port *grub_serial_ports;
static struct grub_serial_port *grub_serial_ports;
struct grub_serial_output_state
{
@ -69,7 +69,7 @@ serial_fetch (grub_term_input_t term)
return data->port->driver->fetch (data->port);
}
struct grub_serial_input_state grub_serial_terminfo_input =
static const struct grub_serial_input_state grub_serial_terminfo_input_template =
{
.tinfo =
{
@ -77,7 +77,7 @@ struct grub_serial_input_state grub_serial_terminfo_input =
}
};
struct grub_serial_output_state grub_serial_terminfo_output =
static const struct grub_serial_output_state grub_serial_terminfo_output_template =
{
.tinfo =
{
@ -87,7 +87,11 @@ struct grub_serial_output_state grub_serial_terminfo_output =
}
};
int registered = 0;
static struct grub_serial_input_state grub_serial_terminfo_input;
static struct grub_serial_output_state grub_serial_terminfo_output;
static int registered = 0;
static struct grub_term_input grub_serial_term_input =
{
@ -100,6 +104,7 @@ static struct grub_term_input grub_serial_term_input =
static struct grub_term_output grub_serial_term_output =
{
.name = "serial",
.init = grub_terminfo_output_init,
.putchar = grub_terminfo_putchar,
.getwh = grub_terminfo_getwh,
.getxy = grub_terminfo_getxy,
@ -216,6 +221,8 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
{
if (!registered)
{
grub_terminfo_output_register (&grub_serial_term_output, "vt100");
grub_term_register_input ("serial", &grub_serial_term_input);
grub_term_register_output ("serial", &grub_serial_term_output);
}
@ -337,6 +344,14 @@ GRUB_MOD_INIT(serial)
cmd = grub_register_extcmd ("serial", grub_cmd_serial, 0,
N_("[OPTIONS...]"),
N_("Configure serial port."), options);
grub_memcpy (&grub_serial_terminfo_output,
&grub_serial_terminfo_output_template,
sizeof (grub_serial_terminfo_output));
grub_memcpy (&grub_serial_terminfo_input,
&grub_serial_terminfo_input_template,
sizeof (grub_serial_terminfo_input));
#ifndef GRUB_MACHINE_EMU
grub_ns8250_init ();
#endif

View file

@ -403,6 +403,8 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
/* Backspace: Ctrl-h. */
if (c == 0x7f)
c = '\b';
if (c < 0x20 && c != '\t' && c!= '\b' && c != '\n' && c != '\r')
c = GRUB_TERM_CTRL | (c - 1 + 'a');
*len = 1;
keys[0] = c;
return;
@ -512,6 +514,13 @@ grub_terminfo_input_init (struct grub_term_input *termi)
return GRUB_ERR_NONE;
}
grub_err_t
grub_terminfo_output_init (struct grub_term_output *term)
{
grub_terminfo_cls (term);
return GRUB_ERR_NONE;
}
/* GRUB Command. */
static grub_err_t

View file

@ -435,7 +435,7 @@ grub_usb_keyboard_getkeystatus (struct grub_term_input *term)
return interpret_status (termdata->status) | termdata->mods;
}
struct grub_usb_attach_desc attach_hook =
static struct grub_usb_attach_desc attach_hook =
{
.class = GRUB_USB_CLASS_HID,
.hook = grub_usb_keyboard_attach