Add monochrome text support (mda_text, aka `hercules' in grub-legacy).

* grub-core/Makefile.core.def (mda_text): New module.
	* grub-core/lib/legacy_parse.c (grub_legacy_parse): Support `hercules'.
	* grub-core/term/i386/vga_common.c (grub_console_cur_color): Moved to ..
	* grub-core/term/i386/pc/vga_text.c (cur_color): ... here
	* grub-core/term/i386/pc/console.c (grub_console_cur_color): ... and
	here.
	* grub-core/term/i386/vga_common.c (grub_console_getwh): Moved to ..
	* grub-core/term/i386/pc/vga_text.c (grub_console_getwh): ... here
	* grub-core/term/i386/pc/console.c (grub_console_getwh): ... and
	here.
	* grub-core/term/i386/vga_common.c (grub_console_setcolorstate): Moved
	to ..
	* grub-core/term/i386/pc/vga_text.c (grub_console_setcolorstate):
	... here
	* grub-core/term/i386/pc/console.c (grub_console_setcolorstate): ... and
	here.
	* grub-core/term/i386/vga_common.c: Removed.
	* include/grub/i386/vga_common.h: Likewise.
	* include/grub/vga.h (grub_vga_cr_bw_write): New function.
	(grub_vga_cr_bw_read): Likewise.
	* include/grub/vgaregs.h (GRUB_VGA_IO_CR_BW_INDEX): New enum value.
	(GRUB_VGA_IO_CR_BW_DATA): Likewise.
	* grub-core/term/i386/pc/vga_text.c [MODE_MDA]: Call
	grub_vga_cr_bw_read/grub_vga_cr_bw_write instead of
	grub_vga_cr_read/grub_vga_cr_write.
	(grub_vga_text_setcolorstate) [MODE_MDA]: Ignore color.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-28 15:27:54 +02:00
parent 5f91f70146
commit c35fc5bd15
10 changed files with 213 additions and 110 deletions

View file

@ -24,7 +24,6 @@
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/term.h>
#include <grub/i386/vga_common.h>
/* Initialize the console system. */
void grub_console_init (void);

View file

@ -1,32 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,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/>.
*/
#ifndef GRUB_VGA_COMMON_CPU_HEADER
#define GRUB_VGA_COMMON_CPU_HEADER 1
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/term.h>
extern grub_uint8_t grub_console_cur_color;
grub_uint16_t grub_console_getwh (struct grub_term_output *term);
void grub_console_setcolorstate (struct grub_term_output *term,
grub_term_color_state state);
#endif /* ! GRUB_VGA_COMMON_CPU_HEADER */

View file

@ -56,6 +56,20 @@ grub_vga_cr_read (grub_uint8_t addr)
return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_DATA);
}
static inline void
grub_vga_cr_bw_write (grub_uint8_t val, grub_uint8_t addr)
{
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_INDEX);
grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_DATA);
}
static inline grub_uint8_t
grub_vga_cr_bw_read (grub_uint8_t addr)
{
grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_INDEX);
return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_BW_DATA);
}
static inline void
grub_vga_sr_write (grub_uint8_t val, grub_uint8_t addr)
{

View file

@ -26,6 +26,8 @@
enum
{
GRUB_VGA_IO_CR_BW_INDEX = 0x3b4,
GRUB_VGA_IO_CR_BW_DATA = 0x3b5,
GRUB_VGA_IO_ARX = 0x3c0,
GRUB_VGA_IO_ARX_READ = 0x3c1,
GRUB_VGA_IO_MISC_WRITE = 0x3c2,