76679cd3a4
* 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).
62 lines
1.9 KiB
C
62 lines
1.9 KiB
C
/*
|
|
* GRUB -- GRand Unified Bootloader
|
|
* Copyright (C) 2002,2003,2005,2007,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/>.
|
|
*/
|
|
|
|
#include <grub/machine/console.h>
|
|
#include <grub/term.h>
|
|
#include <grub/types.h>
|
|
|
|
static struct grub_term_input grub_console_term_input =
|
|
{
|
|
.name = "console",
|
|
.checkkey = grub_console_checkkey,
|
|
.getkey = grub_console_getkey,
|
|
};
|
|
|
|
static struct grub_term_output grub_console_term_output =
|
|
{
|
|
.name = "console",
|
|
.putchar = grub_console_putchar,
|
|
.getcharwidth = grub_console_getcharwidth,
|
|
.getwh = grub_console_getwh,
|
|
.getxy = grub_console_getxy,
|
|
.gotoxy = grub_console_gotoxy,
|
|
.cls = grub_console_cls,
|
|
.setcolorstate = grub_console_setcolorstate,
|
|
.setcolor = grub_console_setcolor,
|
|
.getcolor = grub_console_getcolor,
|
|
.setcursor = grub_console_setcursor,
|
|
.flags = 0,
|
|
};
|
|
|
|
void
|
|
grub_console_init (void)
|
|
{
|
|
grub_term_register_output (&grub_console_term_output);
|
|
grub_term_register_input (&grub_console_term_input);
|
|
}
|
|
|
|
void
|
|
grub_console_fini (void)
|
|
{
|
|
/* This is to make sure the console is restored to text mode before
|
|
we boot. */
|
|
grub_term_set_current_output (&grub_console_term_output);
|
|
|
|
grub_term_unregister_input (&grub_console_term_input);
|
|
grub_term_unregister_output (&grub_console_term_output);
|
|
}
|