Printing coreboot debug messages on VGA console is pretty much useless, since
initializing VGA happens pretty much as the last thing before starting the payload. Hence, drop VGA console support, as we did in coreboot v3. - Drop VGA and BTEXT console support. Console is meant to be debugging only, and by the time graphics comes up 99% of the risky stuff has already happened. Note: This patch does not remove hardware init but only the actual output functionality. The ragexl driver needs some extra love, but that's for another day - factor out die() and post() - drop some leftover RAMBASE < 0x100000 checks. Signed-off-by: Stefan Reinauer <stepan@coreboot.org> Acked-by: QingPei Wang<wangqingpei@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6111 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
committed by
Stefan Reinauer
parent
e9c447326a
commit
abc0c85516
@ -133,13 +133,9 @@ config USBDEBUG_DEFAULT_PORT
|
||||
on your mainboard) is highly board-specific, and you'll likely
|
||||
have to find out by trial-and-error.
|
||||
|
||||
config CONSOLE_VGA
|
||||
bool "Use VGA console once initialized"
|
||||
default n
|
||||
|
||||
# TODO: Deps?
|
||||
# TODO: Improve description.
|
||||
config CONSOLE_VGA_ONBOARD_AT_FIRST
|
||||
config ONBOARD_VGA_IS_PRIMARY
|
||||
bool "Use onboard VGA as primary video device"
|
||||
default n
|
||||
help
|
||||
@ -322,14 +318,6 @@ config DEFAULT_CONSOLE_LOGLEVEL
|
||||
help
|
||||
Map the log level config names to an integer.
|
||||
|
||||
config CONSOLE_BTEXT
|
||||
bool
|
||||
default n
|
||||
|
||||
config CONSOLE_SROM
|
||||
bool
|
||||
default n
|
||||
|
||||
config CONSOLE_LOGBUF
|
||||
bool
|
||||
default n
|
||||
|
@ -2,18 +2,19 @@ ramstage-y += printk.c
|
||||
ramstage-y += console.c
|
||||
ramstage-y += vtxprintf.c
|
||||
ramstage-y += vsprintf.c
|
||||
ramstage-y += post.c
|
||||
ramstage-y += die.c
|
||||
|
||||
smm-y += printk.c
|
||||
smm-y += vtxprintf.c
|
||||
|
||||
romstage-y += vtxprintf.c
|
||||
romstage-$(CONFIG_CACHE_AS_RAM) += console.c
|
||||
romstage-y += post.c
|
||||
romstage-y += die.c
|
||||
|
||||
driver-$(CONFIG_CONSOLE_SERIAL8250) += uart8250_console.c
|
||||
driver-$(CONFIG_USBDEBUG) += usbdebug_console.c
|
||||
driver-$(CONFIG_CONSOLE_VGA) += vga_console.c
|
||||
driver-$(CONFIG_CONSOLE_BTEXT) += btext_console.c
|
||||
driver-$(CONFIG_CONSOLE_BTEXT) += font-8x16.c
|
||||
driver-$(CONFIG_CONSOLE_LOGBUF) += logbuf_console.c
|
||||
driver-$(CONFIG_CONSOLE_NE2K) += ne2k_console.c
|
||||
|
||||
|
@ -1,454 +0,0 @@
|
||||
/*
|
||||
* Procedures for drawing on the screen early on in the boot process.
|
||||
*
|
||||
* Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
||||
*
|
||||
* move to coreboot by LYH yhlu@tyan.com
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
#include <delay.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <arch/io.h>
|
||||
|
||||
#include <console/console.h>
|
||||
#include <device/device.h>
|
||||
#include <device/pci.h>
|
||||
#include <device/pci_ids.h>
|
||||
#include <device/pci_ops.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <arch/io.h>
|
||||
#include <string.h>
|
||||
#include <console/console.h>
|
||||
|
||||
|
||||
#include <arch/byteorder.h>
|
||||
|
||||
#include <console/btext.h>
|
||||
|
||||
//#define NO_SCROLL
|
||||
|
||||
#ifndef NO_SCROLL
|
||||
static void scrollscreen(void);
|
||||
#endif
|
||||
|
||||
static void draw_byte(unsigned char c, u32 locX, u32 locY);
|
||||
#if 0
|
||||
static void draw_byte_32(unsigned char *bits, u32 *base, u32 rb);
|
||||
static void draw_byte_16(unsigned char *bits, u32 *base, u32 rb);
|
||||
#endif
|
||||
static void draw_byte_8(unsigned char *bits, u32 *base, u32 rb);
|
||||
|
||||
static u32 g_loc_X;
|
||||
static u32 g_loc_Y;
|
||||
static u32 g_max_loc_X;
|
||||
static u32 g_max_loc_Y;
|
||||
|
||||
#define CHAR_256 0
|
||||
|
||||
#if CHAR_256==1
|
||||
#define cmapsz (16*256)
|
||||
#else
|
||||
#define cmapsz (16*96)
|
||||
#endif
|
||||
|
||||
extern unsigned char vga_font[cmapsz];
|
||||
|
||||
u32 boot_text_mapped;
|
||||
|
||||
boot_infos_t disp_bi;
|
||||
|
||||
#define BTEXT
|
||||
#define BTDATA
|
||||
|
||||
|
||||
/* This function will enable the early boot text when doing OF booting. This
|
||||
* way, xmon output should work too
|
||||
*/
|
||||
void
|
||||
btext_setup_display(u32 width, u32 height, u32 depth, u32 pitch,
|
||||
unsigned long address)
|
||||
{
|
||||
boot_infos_t* bi = &disp_bi;
|
||||
|
||||
g_loc_X = 0;
|
||||
g_loc_Y = 0;
|
||||
g_max_loc_X = width / 8;
|
||||
g_max_loc_Y = height / 16;
|
||||
// bi->logicalDisplayBase = (unsigned char *)address;
|
||||
bi->dispDeviceBase = (unsigned char *)address;
|
||||
bi->dispDeviceRowBytes = pitch;
|
||||
bi->dispDeviceDepth = depth;
|
||||
bi->dispDeviceRect[0] = bi->dispDeviceRect[1] = 0;
|
||||
bi->dispDeviceRect[2] = width;
|
||||
bi->dispDeviceRect[3] = height;
|
||||
boot_text_mapped = 0;
|
||||
}
|
||||
|
||||
/* Here's a small text engine to use during early boot
|
||||
* or for debugging purposes
|
||||
*
|
||||
* todo:
|
||||
*
|
||||
* - build some kind of vgacon with it to enable early printk
|
||||
* - move to a separate file
|
||||
* - add a few video driver hooks to keep in sync with display
|
||||
* changes.
|
||||
*/
|
||||
|
||||
void
|
||||
map_boot_text(void)
|
||||
{
|
||||
#if 0
|
||||
unsigned long base, offset, size;
|
||||
boot_infos_t *bi = &disp_bi;
|
||||
|
||||
if (bi->dispDeviceBase == 0)
|
||||
return;
|
||||
base = ((unsigned long) bi->dispDeviceBase) & 0xFFFFF000UL;
|
||||
offset = ((unsigned long) bi->dispDeviceBase) - base;
|
||||
size = bi->dispDeviceRowBytes * bi->dispDeviceRect[3] + offset
|
||||
+ bi->dispDeviceRect[0];
|
||||
bi->logicalDisplayBase = ioremap(base,0x800000 );
|
||||
if (bi->logicalDisplayBase == 0)
|
||||
return;
|
||||
// bi->logicalDisplayBase += offset;
|
||||
#endif
|
||||
boot_text_mapped = 1;
|
||||
}
|
||||
|
||||
/* Calc the base address of a given point (x,y) */
|
||||
static unsigned char * BTEXT
|
||||
calc_base(boot_infos_t *bi, u32 x, u32 y)
|
||||
{
|
||||
unsigned char *base;
|
||||
#if 0
|
||||
base = bi->logicalDisplayBase;
|
||||
if (base == 0)
|
||||
#endif
|
||||
base = bi->dispDeviceBase;
|
||||
base += (x + bi->dispDeviceRect[0]) * (bi->dispDeviceDepth >> 3);
|
||||
base += (y + bi->dispDeviceRect[1]) * bi->dispDeviceRowBytes;
|
||||
return base;
|
||||
}
|
||||
|
||||
/* Adjust the display to a new resolution */
|
||||
void
|
||||
btext_update_display(unsigned long phys, u32 width, u32 height,
|
||||
u32 depth, u32 pitch)
|
||||
{
|
||||
boot_infos_t *bi = &disp_bi;
|
||||
#if 0
|
||||
if (bi->dispDeviceBase == 0)
|
||||
return;
|
||||
/* check it's the same frame buffer (within 256MB) */
|
||||
if ((phys ^ (unsigned long)bi->dispDeviceBase) & 0xf0000000)
|
||||
return;
|
||||
#endif
|
||||
|
||||
bi->dispDeviceBase = (u8 *) phys;
|
||||
bi->dispDeviceRect[0] = 0;
|
||||
bi->dispDeviceRect[1] = 0;
|
||||
bi->dispDeviceRect[2] = width;
|
||||
bi->dispDeviceRect[3] = height;
|
||||
bi->dispDeviceDepth = depth;
|
||||
bi->dispDeviceRowBytes = pitch;
|
||||
if (boot_text_mapped) {
|
||||
#if 0
|
||||
iounmap(bi->logicalDisplayBase);
|
||||
#endif
|
||||
boot_text_mapped = 0;
|
||||
}
|
||||
map_boot_text();
|
||||
g_loc_X = 0;
|
||||
g_loc_Y = 0;
|
||||
g_max_loc_X = width / 8;
|
||||
g_max_loc_Y = height / 16;
|
||||
}
|
||||
|
||||
void BTEXT btext_clearscreen(void)
|
||||
{
|
||||
boot_infos_t* bi = &disp_bi;
|
||||
u32 *base = (u32 *)calc_base(bi, 0, 0);
|
||||
u32 width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
|
||||
(bi->dispDeviceDepth >> 3)) >> 2;
|
||||
u32 i,j;
|
||||
|
||||
for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1]); i++)
|
||||
{
|
||||
u32 *ptr = base;
|
||||
for(j=width; j; --j)
|
||||
*(ptr++) = 0;
|
||||
base += (bi->dispDeviceRowBytes >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
__inline__ void dcbst(const void* addr)
|
||||
{
|
||||
__asm__ __volatile__ ("dcbst 0,%0" :: "r" (addr));
|
||||
}
|
||||
|
||||
void BTEXT btext_flushscreen(void)
|
||||
{
|
||||
boot_infos_t* bi = &disp_bi;
|
||||
u32 *base = (unsigned long *)calc_base(bi, 0, 0);
|
||||
u32 width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
|
||||
(bi->dispDeviceDepth >> 3)) >> 2;
|
||||
u32 i,j;
|
||||
|
||||
for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1]); i++)
|
||||
{
|
||||
u32 *ptr = base;
|
||||
for(j=width; j>0; j-=8) {
|
||||
dcbst(ptr);
|
||||
ptr += 8;
|
||||
}
|
||||
base += (bi->dispDeviceRowBytes >> 2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_SCROLL
|
||||
static BTEXT void
|
||||
scrollscreen(void)
|
||||
{
|
||||
boot_infos_t* bi = &disp_bi;
|
||||
u32 *src = (u32 *)calc_base(bi,0,16);
|
||||
u32 *dst = (u32 *)calc_base(bi,0,0);
|
||||
u32 width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
|
||||
(bi->dispDeviceDepth >> 3)) >> 2;
|
||||
u32 i,j;
|
||||
|
||||
for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++)
|
||||
{
|
||||
u32 *src_ptr = src;
|
||||
u32 *dst_ptr = dst;
|
||||
for(j=width; j; --j)
|
||||
*(dst_ptr++) = *(src_ptr++);
|
||||
src += (bi->dispDeviceRowBytes >> 2);
|
||||
dst += (bi->dispDeviceRowBytes >> 2);
|
||||
}
|
||||
for (i=0; i<16; i++)
|
||||
{
|
||||
u32 *dst_ptr = dst;
|
||||
for(j=width; j; --j)
|
||||
*(dst_ptr++) = 0;
|
||||
dst += (bi->dispDeviceRowBytes >> 2);
|
||||
}
|
||||
}
|
||||
#endif /* ndef NO_SCROLL */
|
||||
|
||||
void BTEXT btext_drawchar(char c)
|
||||
{
|
||||
u32 cline = 0;
|
||||
|
||||
if (!boot_text_mapped)
|
||||
return;
|
||||
|
||||
switch (c) {
|
||||
case '\b':
|
||||
if (g_loc_X > 0)
|
||||
--g_loc_X;
|
||||
break;
|
||||
case '\t':
|
||||
g_loc_X = (g_loc_X & -8) + 8;
|
||||
break;
|
||||
case '\r':
|
||||
g_loc_X = 0;
|
||||
break;
|
||||
case '\n':
|
||||
g_loc_X = 0;
|
||||
g_loc_Y++;
|
||||
cline = 1;
|
||||
break;
|
||||
default:
|
||||
draw_byte(c, g_loc_X++, g_loc_Y);
|
||||
}
|
||||
if (g_loc_X >= g_max_loc_X) {
|
||||
g_loc_X = 0;
|
||||
g_loc_Y++;
|
||||
cline = 1;
|
||||
}
|
||||
#ifndef NO_SCROLL
|
||||
while (g_loc_Y >= g_max_loc_Y) {
|
||||
scrollscreen();
|
||||
g_loc_Y--;
|
||||
}
|
||||
#else
|
||||
/* wrap around from bottom to top of screen so we don't
|
||||
waste time scrolling each line. -- paulus. */
|
||||
if (g_loc_Y >= g_max_loc_Y)
|
||||
g_loc_Y = 0;
|
||||
if (cline) {
|
||||
for (x = 0; x < g_max_loc_X; ++x)
|
||||
draw_byte(' ', x, g_loc_Y);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
void BTEXT
|
||||
btext_drawstring(const char *c)
|
||||
{
|
||||
if (!boot_text_mapped)
|
||||
return;
|
||||
while (*c)
|
||||
btext_drawchar(*c++);
|
||||
}
|
||||
|
||||
void BTEXT
|
||||
btext_drawhex(u32 v)
|
||||
{
|
||||
static char hex_table[] = "0123456789abcdef";
|
||||
|
||||
if (!boot_text_mapped)
|
||||
return;
|
||||
btext_drawchar(hex_table[(v >> 28) & 0x0000000FUL]);
|
||||
btext_drawchar(hex_table[(v >> 24) & 0x0000000FUL]);
|
||||
btext_drawchar(hex_table[(v >> 20) & 0x0000000FUL]);
|
||||
btext_drawchar(hex_table[(v >> 16) & 0x0000000FUL]);
|
||||
btext_drawchar(hex_table[(v >> 12) & 0x0000000FUL]);
|
||||
btext_drawchar(hex_table[(v >> 8) & 0x0000000FUL]);
|
||||
btext_drawchar(hex_table[(v >> 4) & 0x0000000FUL]);
|
||||
btext_drawchar(hex_table[(v >> 0) & 0x0000000FUL]);
|
||||
btext_drawchar(' ');
|
||||
}
|
||||
#endif
|
||||
static void BTEXT
|
||||
draw_byte(unsigned char c, u32 locX, u32 locY)
|
||||
{
|
||||
boot_infos_t* bi = &disp_bi;
|
||||
unsigned char *base = calc_base(bi, locX << 3, locY << 4);
|
||||
#if CHAR_256==1
|
||||
unsigned char *font = &vga_font[((u32)c) * 16];
|
||||
#else
|
||||
unsigned char *font = &vga_font[((u32)c-0x20) * 16]; // skip the first 0x20
|
||||
#endif
|
||||
u32 rb = bi->dispDeviceRowBytes;
|
||||
|
||||
switch(bi->dispDeviceDepth) {
|
||||
#if 0
|
||||
case 24:
|
||||
case 32:
|
||||
draw_byte_32(font, (u32 *)base, rb);
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
draw_byte_16(font, (u32 *)base, rb);
|
||||
break;
|
||||
#endif
|
||||
case 8:
|
||||
draw_byte_8(font, (u32 *)base, rb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
static u32 expand_bits_8[16] BTDATA = {
|
||||
#if defined(__BIG_ENDIAN)
|
||||
0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
|
||||
0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
|
||||
0xff000000,0xff0000ff,0xff00ff00,0xff00ffff,
|
||||
0xffff0000,0xffff00ff,0xffffff00,0xffffffff
|
||||
#elif defined(__LITTLE_ENDIAN)
|
||||
0x00000000,0xff000000,0x00ff0000,0xffff0000,
|
||||
0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00,
|
||||
0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff,
|
||||
0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff
|
||||
#else
|
||||
#error FIXME: No endianness??
|
||||
#endif
|
||||
};
|
||||
#if 0
|
||||
static const u32 expand_bits_16[4] BTDATA = {
|
||||
#if defined(__BIG_ENDIAN)
|
||||
0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
|
||||
#elif defined(__LITTLE_ENDIAN)
|
||||
0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
|
||||
#else
|
||||
#error FIXME: No endianness??
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
#if 0
|
||||
static void BTEXT
|
||||
draw_byte_32(unsigned char *font, u32 *base, u32 rb)
|
||||
{
|
||||
u32 l, bits;
|
||||
u32 fg = 0xFFFFFFFF;
|
||||
u32 bg = 0x00000000;
|
||||
|
||||
for (l = 0; l < 16; ++l)
|
||||
{
|
||||
bits = *font++;
|
||||
base[0] = (-(bits >> 7) & fg) ^ bg;
|
||||
base[1] = (-((bits >> 6) & 1) & fg) ^ bg;
|
||||
base[2] = (-((bits >> 5) & 1) & fg) ^ bg;
|
||||
base[3] = (-((bits >> 4) & 1) & fg) ^ bg;
|
||||
base[4] = (-((bits >> 3) & 1) & fg) ^ bg;
|
||||
base[5] = (-((bits >> 2) & 1) & fg) ^ bg;
|
||||
base[6] = (-((bits >> 1) & 1) & fg) ^ bg;
|
||||
base[7] = (-(bits & 1) & fg) ^ bg;
|
||||
base = (u32 *) ((char *)base + rb);
|
||||
}
|
||||
}
|
||||
|
||||
static void BTEXT
|
||||
draw_byte_16(unsigned char *font, u32 *base, u32 rb)
|
||||
{
|
||||
u32 l, bits;
|
||||
u32 fg = 0xFFFFFFFF;
|
||||
u32 bg = 0x00000000;
|
||||
u32 *eb = expand_bits_16;
|
||||
|
||||
for (l = 0; l < 16; ++l)
|
||||
{
|
||||
bits = *font++;
|
||||
base[0] = (eb[bits >> 6] & fg) ^ bg;
|
||||
base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;
|
||||
base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;
|
||||
base[3] = (eb[bits & 3] & fg) ^ bg;
|
||||
base = (u32 *) ((char *)base + rb);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
static void BTEXT
|
||||
draw_byte_8(unsigned char *font, u32 *base, u32 rb)
|
||||
{
|
||||
u32 l, bits;
|
||||
u32 fg = 0x0F0F0F0F;
|
||||
u32 bg = 0x00000000;
|
||||
u32 *eb = expand_bits_8;
|
||||
|
||||
for (l = 0; l < 16; ++l)
|
||||
{
|
||||
bits = *font++;
|
||||
base[0] = (eb[bits >> 4] & fg) ^ bg;
|
||||
base[1] = (eb[bits & 0xf] & fg) ^ bg;
|
||||
base = (u32 *) ((char *)base + rb);
|
||||
}
|
||||
}
|
||||
|
||||
void btext_init(void)
|
||||
{
|
||||
btext_setup_display(640, 480, 8, 640,0xfc000000);
|
||||
// Not realy init
|
||||
// It will be init in xlinit.c because We only can access fb after the device resource is allocated and enabled.
|
||||
|
||||
}
|
||||
|
||||
void btext_tx_byte(unsigned char data)
|
||||
{
|
||||
btext_drawchar(data);
|
||||
}
|
||||
|
||||
static const struct console_driver btext_console __console = {
|
||||
.init = btext_init,
|
||||
.tx_byte = btext_tx_byte,
|
||||
.rx_byte = 0,
|
||||
.tst_byte = 0,
|
||||
};
|
||||
|
@ -91,28 +91,6 @@ int console_tst_byte(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write POST information
|
||||
*/
|
||||
void post_code(u8 value)
|
||||
{
|
||||
#if !defined(CONFIG_NO_POST) || CONFIG_NO_POST==0
|
||||
#if CONFIG_SERIAL_POST==1
|
||||
printk(BIOS_EMERG, "POST: 0x%02x\n", value);
|
||||
#endif
|
||||
outb(value, 0x80);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Report a fatal error */
|
||||
void __attribute__((noreturn)) die(const char *msg)
|
||||
{
|
||||
printk(BIOS_EMERG, "%s", msg);
|
||||
//post_code(0xff);
|
||||
for (;;)
|
||||
hlt(); /* Halt */
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void console_init(void)
|
||||
@ -129,24 +107,4 @@ void console_init(void)
|
||||
" starting...\n";
|
||||
print_info(console_test);
|
||||
}
|
||||
|
||||
void post_code(u8 value)
|
||||
{
|
||||
#if !defined(CONFIG_NO_POST) || CONFIG_NO_POST==0
|
||||
#if CONFIG_SERIAL_POST==1
|
||||
print_emerg("POST: 0x");
|
||||
print_emerg_hex8(value);
|
||||
print_emerg("\n");
|
||||
#endif
|
||||
outb(value, 0x80);
|
||||
#endif
|
||||
}
|
||||
|
||||
void die(const char *str)
|
||||
{
|
||||
print_emerg(str);
|
||||
do {
|
||||
hlt();
|
||||
} while(1);
|
||||
}
|
||||
#endif
|
||||
|
33
src/console/die.c
Normal file
33
src/console/die.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2003 Eric Biederman
|
||||
*
|
||||
* This program 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; version 2 of
|
||||
* the License.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <arch/io.h>
|
||||
#include <arch/hlt.h>
|
||||
#include <console/console.h>
|
||||
|
||||
/* Report a fatal error */
|
||||
void __attribute__((noreturn)) die(const char *msg)
|
||||
{
|
||||
print_emerg(msg);
|
||||
do {
|
||||
hlt();
|
||||
} while(1);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
37
src/console/post.c
Normal file
37
src/console/post.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2003 Eric Biederman
|
||||
*
|
||||
* This program 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; version 2 of
|
||||
* the License.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <arch/io.h>
|
||||
#include <console/console.h>
|
||||
|
||||
/* Write POST information */
|
||||
|
||||
void post_code(uint8_t value)
|
||||
{
|
||||
#if !defined(CONFIG_NO_POST) || CONFIG_NO_POST==0
|
||||
#if CONFIG_SERIAL_POST==1
|
||||
print_emerg("POST: 0x");
|
||||
print_emerg_hex8(value);
|
||||
print_emerg("\n");
|
||||
#endif
|
||||
outb(value, 0x80);
|
||||
#endif
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* modified from original freebios code
|
||||
* by Steve M. Gehlbach <steve@kesa.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* * make vga_console_init take FB location, columns, lines and starting
|
||||
* column/line.
|
||||
* * track a word offset, and not columns/lines. The offset is needed more
|
||||
* often than columns/lines and the latter two can be calculated easily.
|
||||
* * then implement real vga scrolling, instead of memcpying stuff around.
|
||||
*
|
||||
* -- libv.
|
||||
*/
|
||||
|
||||
#include <arch/io.h>
|
||||
#include <string.h>
|
||||
#include <pc80/vga_io.h>
|
||||
#include <pc80/vga.h>
|
||||
#include <console/console.h>
|
||||
|
||||
/* The video buffer, should be replaced by symbol in ldscript.ld */
|
||||
static char *vidmem;
|
||||
static int total_lines, total_columns;
|
||||
static int current_line, current_column;
|
||||
static int vga_console_inited = 0;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void vga_console_init(void)
|
||||
{
|
||||
vidmem = (char *) VGA_FB;
|
||||
total_columns = VGA_COLUMNS;
|
||||
total_lines = VGA_LINES;
|
||||
current_column = 0;
|
||||
current_line = 0;
|
||||
|
||||
vga_console_inited = 1;
|
||||
}
|
||||
|
||||
static void vga_scroll(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
memcpy(vidmem, vidmem + total_columns * 2, (total_lines - 1) * total_columns * 2);
|
||||
for (i = (total_lines - 1) * total_columns * 2; i < total_lines * total_columns * 2; i += 2)
|
||||
vidmem[i] = ' ';
|
||||
}
|
||||
|
||||
static void
|
||||
vga_tx_byte(unsigned char byte)
|
||||
{
|
||||
if (!vga_console_inited)
|
||||
return;
|
||||
|
||||
switch (byte) {
|
||||
case '\n':
|
||||
current_line++;
|
||||
current_column = 0;
|
||||
break;
|
||||
case '\r':
|
||||
current_column = 0;
|
||||
break;
|
||||
case '\b':
|
||||
current_column--;
|
||||
break;
|
||||
case '\t':
|
||||
current_column += 4;
|
||||
break;
|
||||
case '\a': /* beep */
|
||||
break;
|
||||
default:
|
||||
vidmem[((current_column + (current_line * total_columns)) * 2)] = byte;
|
||||
vidmem[((current_column + (current_line * total_columns)) * 2) +1] = 0x07;
|
||||
current_column++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (current_column < 0)
|
||||
current_column = 0;
|
||||
if (current_column >= total_columns) {
|
||||
current_line++;
|
||||
current_column = 0;
|
||||
}
|
||||
if (current_line >= total_lines) {
|
||||
vga_scroll();
|
||||
current_line--;
|
||||
}
|
||||
|
||||
/* move the cursor */
|
||||
vga_cr_write(0x0E, (current_column + (current_line * total_columns)) >> 8);
|
||||
vga_cr_write(0x0F, (current_column + (current_line * total_columns)) & 0x0ff);
|
||||
}
|
||||
|
||||
static const struct console_driver vga_console __console ={
|
||||
.init = 0,
|
||||
.tx_byte = vga_tx_byte,
|
||||
.rx_byte = 0,
|
||||
.tst_byte = 0,
|
||||
};
|
Reference in New Issue
Block a user