2007-10-31 22:35:13 +00:00
|
|
|
/*
|
|
|
|
* GRUB -- GRand Unified Bootloader
|
2010-11-26 14:35:40 +00:00
|
|
|
* Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc.
|
2007-10-31 22:35:13 +00:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
#include <grub/dl.h>
|
2011-07-05 21:46:15 +00:00
|
|
|
#include <grub/cpu/io.h>
|
2007-10-31 22:35:13 +00:00
|
|
|
#include <grub/types.h>
|
2010-05-17 00:25:37 +00:00
|
|
|
#include <grub/vga.h>
|
2012-06-28 13:27:54 +00:00
|
|
|
#include <grub/term.h>
|
|
|
|
|
2013-05-30 22:42:33 +00:00
|
|
|
#if defined (GRUB_MACHINE_COREBOOT)
|
|
|
|
#include <grub/machine/console.h>
|
|
|
|
#endif
|
|
|
|
|
2012-06-28 13:27:54 +00:00
|
|
|
/* MODESET is used for testing to force monochrome or colour mode.
|
|
|
|
You shouldn't use mda_text on vga.
|
|
|
|
*/
|
|
|
|
#ifdef MODESET
|
|
|
|
#include <grub/machine/int.h>
|
|
|
|
#endif
|
2007-10-31 22:35:13 +00:00
|
|
|
|
2012-02-28 10:12:32 +00:00
|
|
|
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
|
2012-02-26 23:28:45 +00:00
|
|
|
#include <grub/machine/console.h>
|
|
|
|
#endif
|
|
|
|
|
2011-04-11 21:01:51 +00:00
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2007-10-31 22:35:13 +00:00
|
|
|
#define COLS 80
|
|
|
|
#define ROWS 25
|
|
|
|
|
|
|
|
static int grub_curr_x, grub_curr_y;
|
|
|
|
|
2011-07-05 21:46:15 +00:00
|
|
|
#ifdef __mips__
|
|
|
|
#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb00b8000)
|
2012-06-28 13:27:54 +00:00
|
|
|
#define cr_read grub_vga_cr_read
|
|
|
|
#define cr_write grub_vga_cr_write
|
|
|
|
#elif defined (MODE_MDA)
|
|
|
|
#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb0000)
|
|
|
|
#define cr_read grub_vga_cr_bw_read
|
|
|
|
#define cr_write grub_vga_cr_bw_write
|
|
|
|
static grub_uint8_t cur_color;
|
2011-07-05 21:46:15 +00:00
|
|
|
#else
|
2010-11-26 14:35:40 +00:00
|
|
|
#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb8000)
|
2012-06-28 13:27:54 +00:00
|
|
|
#define cr_read grub_vga_cr_read
|
|
|
|
#define cr_write grub_vga_cr_write
|
2011-07-05 21:46:15 +00:00
|
|
|
#endif
|
2007-10-31 22:35:13 +00:00
|
|
|
|
2012-06-28 13:27:54 +00:00
|
|
|
static grub_uint8_t cur_color = 0x7;
|
|
|
|
|
2007-10-31 22:35:13 +00:00
|
|
|
static void
|
|
|
|
screen_write_char (int x, int y, short c)
|
|
|
|
{
|
2012-06-06 10:20:08 +00:00
|
|
|
VGA_TEXT_SCREEN[y * COLS + x] = grub_cpu_to_le16 (c);
|
2007-10-31 22:35:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static short
|
|
|
|
screen_read_char (int x, int y)
|
|
|
|
{
|
2012-06-06 10:20:08 +00:00
|
|
|
return grub_le_to_cpu16 (VGA_TEXT_SCREEN[y * COLS + x]);
|
2007-10-31 22:35:13 +00:00
|
|
|
}
|
|
|
|
|
2007-11-03 16:46:40 +00:00
|
|
|
static void
|
|
|
|
update_cursor (void)
|
|
|
|
{
|
|
|
|
unsigned int pos = grub_curr_y * COLS + grub_curr_x;
|
2012-06-28 13:27:54 +00:00
|
|
|
cr_write (pos >> 8, GRUB_VGA_CR_CURSOR_ADDR_HIGH);
|
|
|
|
cr_write (pos & 0xFF, GRUB_VGA_CR_CURSOR_ADDR_LOW);
|
2007-11-03 16:46:40 +00:00
|
|
|
}
|
|
|
|
|
2007-10-31 22:35:13 +00:00
|
|
|
static void
|
2008-01-03 22:43:46 +00:00
|
|
|
inc_y (void)
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
|
|
|
grub_curr_x = 0;
|
|
|
|
if (grub_curr_y < ROWS - 1)
|
|
|
|
grub_curr_y++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int x, y;
|
2010-06-21 00:08:48 +00:00
|
|
|
for (y = 0; y < ROWS - 1; y++)
|
2007-10-31 22:35:13 +00:00
|
|
|
for (x = 0; x < COLS; x++)
|
|
|
|
screen_write_char (x, y, screen_read_char (x, y + 1));
|
2010-06-21 00:08:48 +00:00
|
|
|
for (x = 0; x < COLS; x++)
|
2012-06-28 13:27:54 +00:00
|
|
|
screen_write_char (x, ROWS - 1, ' ' | (cur_color << 8));
|
2007-10-31 22:35:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-01-03 22:43:46 +00:00
|
|
|
inc_x (void)
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
2010-01-10 21:35:46 +00:00
|
|
|
if (grub_curr_x >= COLS - 1)
|
2007-10-31 22:35:13 +00:00
|
|
|
inc_y ();
|
|
|
|
else
|
|
|
|
grub_curr_x++;
|
|
|
|
}
|
|
|
|
|
2010-03-17 07:37:48 +00:00
|
|
|
static void
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_vga_text_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
|
|
|
const struct grub_unicode_glyph *c)
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
2010-03-17 07:37:48 +00:00
|
|
|
switch (c->base)
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
|
|
|
case '\b':
|
|
|
|
if (grub_curr_x != 0)
|
|
|
|
screen_write_char (grub_curr_x--, grub_curr_y, ' ');
|
|
|
|
break;
|
|
|
|
case '\n':
|
|
|
|
inc_y ();
|
|
|
|
break;
|
|
|
|
case '\r':
|
|
|
|
grub_curr_x = 0;
|
|
|
|
break;
|
|
|
|
default:
|
2010-03-17 07:37:48 +00:00
|
|
|
screen_write_char (grub_curr_x, grub_curr_y,
|
2012-06-28 13:27:54 +00:00
|
|
|
c->base | (cur_color << 8));
|
2007-10-31 22:35:13 +00:00
|
|
|
inc_x ();
|
|
|
|
}
|
2007-11-03 16:46:40 +00:00
|
|
|
|
|
|
|
update_cursor ();
|
2007-10-31 22:35:13 +00:00
|
|
|
}
|
|
|
|
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
static grub_uint16_t
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_vga_text_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
|
|
|
return (grub_curr_x << 8) | grub_curr_y;
|
|
|
|
}
|
|
|
|
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
static void
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_vga_text_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
|
|
|
grub_uint8_t x, grub_uint8_t y)
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
|
|
|
grub_curr_x = x;
|
|
|
|
grub_curr_y = y;
|
2007-11-03 16:46:40 +00:00
|
|
|
update_cursor ();
|
2007-10-31 22:35:13 +00:00
|
|
|
}
|
|
|
|
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
static void
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_vga_text_cls (struct grub_term_output *term)
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < ROWS * COLS; i++)
|
2012-06-28 13:27:54 +00:00
|
|
|
VGA_TEXT_SCREEN[i] = grub_cpu_to_le16 (' ' | (cur_color << 8));
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_vga_text_gotoxy (term, 0, 0);
|
2007-10-31 22:35:13 +00:00
|
|
|
}
|
|
|
|
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
static void
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_vga_text_setcursor (struct grub_term_output *term __attribute__ ((unused)),
|
|
|
|
int on)
|
2007-10-31 22:35:13 +00:00
|
|
|
{
|
2007-11-03 16:46:40 +00:00
|
|
|
grub_uint8_t old;
|
2012-06-28 13:27:54 +00:00
|
|
|
old = cr_read (GRUB_VGA_CR_CURSOR_START);
|
2008-08-03 17:09:21 +00:00
|
|
|
if (on)
|
2012-06-28 13:27:54 +00:00
|
|
|
cr_write (old & ~GRUB_VGA_CR_CURSOR_START_DISABLE,
|
|
|
|
GRUB_VGA_CR_CURSOR_START);
|
2008-08-03 17:09:21 +00:00
|
|
|
else
|
2012-06-28 13:27:54 +00:00
|
|
|
cr_write (old | GRUB_VGA_CR_CURSOR_START_DISABLE,
|
|
|
|
GRUB_VGA_CR_CURSOR_START);
|
2007-10-31 22:35:13 +00:00
|
|
|
}
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
|
2008-11-22 14:56:52 +00:00
|
|
|
static grub_err_t
|
2012-07-22 14:21:24 +00:00
|
|
|
grub_vga_text_init_real (struct grub_term_output *term)
|
2008-11-22 14:56:52 +00:00
|
|
|
{
|
2012-06-28 13:27:54 +00:00
|
|
|
#ifdef MODESET
|
|
|
|
struct grub_bios_int_registers regs;
|
|
|
|
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
|
|
|
|
|
|
|
#ifdef MODE_MDA
|
|
|
|
regs.eax = 7;
|
|
|
|
#else
|
|
|
|
regs.eax = 3;
|
|
|
|
#endif
|
|
|
|
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
|
|
|
grub_bios_interrupt (0x10, ®s);
|
|
|
|
#endif
|
2010-05-07 00:30:44 +00:00
|
|
|
grub_vga_text_cls (term);
|
2008-11-22 14:56:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-28 13:27:54 +00:00
|
|
|
static grub_err_t
|
2012-07-22 14:21:24 +00:00
|
|
|
grub_vga_text_fini_real (struct grub_term_output *term)
|
2012-06-28 13:27:54 +00:00
|
|
|
{
|
|
|
|
#ifdef MODESET
|
|
|
|
struct grub_bios_int_registers regs;
|
|
|
|
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
|
|
|
|
|
|
|
regs.eax = 3;
|
|
|
|
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
|
|
|
grub_bios_interrupt (0x10, ®s);
|
|
|
|
#endif
|
|
|
|
grub_vga_text_cls (term);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static grub_uint16_t
|
|
|
|
grub_vga_text_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
|
|
|
{
|
|
|
|
return (80 << 8) | 25;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef MODE_MDA
|
|
|
|
|
|
|
|
static void
|
2013-01-21 16:53:41 +00:00
|
|
|
grub_vga_text_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
|
|
|
grub_term_color_state state)
|
2012-06-28 13:27:54 +00:00
|
|
|
{
|
|
|
|
switch (state) {
|
|
|
|
case GRUB_TERM_COLOR_STANDARD:
|
|
|
|
cur_color = GRUB_TERM_DEFAULT_STANDARD_COLOR & 0x7f;
|
|
|
|
break;
|
|
|
|
case GRUB_TERM_COLOR_NORMAL:
|
2013-01-21 16:53:41 +00:00
|
|
|
cur_color = grub_term_normal_color & 0x7f;
|
2012-06-28 13:27:54 +00:00
|
|
|
break;
|
|
|
|
case GRUB_TERM_COLOR_HIGHLIGHT:
|
2013-01-21 16:53:41 +00:00
|
|
|
cur_color = grub_term_highlight_color & 0x7f;
|
2012-06-28 13:27:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
static void
|
|
|
|
grub_vga_text_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
|
|
|
grub_term_color_state state)
|
|
|
|
{
|
|
|
|
switch (state) {
|
|
|
|
case GRUB_TERM_COLOR_STANDARD:
|
|
|
|
cur_color = 0x07;
|
|
|
|
break;
|
|
|
|
case GRUB_TERM_COLOR_NORMAL:
|
|
|
|
cur_color = 0x07;
|
|
|
|
break;
|
|
|
|
case GRUB_TERM_COLOR_HIGHLIGHT:
|
|
|
|
cur_color = 0x70;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
static struct grub_term_output grub_vga_text_term =
|
|
|
|
{
|
2012-06-28 13:27:54 +00:00
|
|
|
#ifdef MODE_MDA
|
|
|
|
.name = "mda_text",
|
|
|
|
#else
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
.name = "vga_text",
|
2012-06-28 13:27:54 +00:00
|
|
|
#endif
|
2012-07-22 14:21:24 +00:00
|
|
|
.init = grub_vga_text_init_real,
|
|
|
|
.fini = grub_vga_text_fini_real,
|
2010-03-17 07:37:48 +00:00
|
|
|
.putchar = grub_vga_text_putchar,
|
2012-06-28 13:27:54 +00:00
|
|
|
.getwh = grub_vga_text_getwh,
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
.getxy = grub_vga_text_getxy,
|
|
|
|
.gotoxy = grub_vga_text_gotoxy,
|
|
|
|
.cls = grub_vga_text_cls,
|
2012-06-28 13:27:54 +00:00
|
|
|
.setcolorstate = grub_vga_text_setcolorstate,
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
.setcursor = grub_vga_text_setcursor,
|
2010-05-09 11:26:52 +00:00
|
|
|
.flags = GRUB_TERM_CODE_TYPE_CP437,
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
};
|
|
|
|
|
2013-05-30 22:42:33 +00:00
|
|
|
/* FIXME: this is was too spaghetti. */
|
|
|
|
|
|
|
|
#ifndef MODE_MDA
|
|
|
|
|
|
|
|
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
|
2012-02-26 23:28:45 +00:00
|
|
|
void grub_vga_text_init (void)
|
|
|
|
#else
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
GRUB_MOD_INIT(vga_text)
|
2012-02-26 23:28:45 +00:00
|
|
|
#endif
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
{
|
2013-05-30 22:42:33 +00:00
|
|
|
#ifdef GRUB_MACHINE_COREBOOT
|
|
|
|
if (!grub_video_coreboot_fbtable)
|
2012-06-28 13:27:54 +00:00
|
|
|
#endif
|
2013-05-30 22:42:33 +00:00
|
|
|
grub_term_register_output ("vga_text", &grub_vga_text_term);
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
}
|
|
|
|
|
2013-05-30 22:42:33 +00:00
|
|
|
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_MULTIBOOT)
|
2012-02-26 23:28:45 +00:00
|
|
|
void grub_vga_text_fini (void)
|
|
|
|
#else
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
GRUB_MOD_FINI(vga_text)
|
2012-02-26 23:28:45 +00:00
|
|
|
#endif
|
2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
|
|
|
{
|
|
|
|
grub_term_unregister_output (&grub_vga_text_term);
|
|
|
|
}
|
2013-05-30 22:42:33 +00:00
|
|
|
|
|
|
|
#endif
|