switch-coreboot/arch/x86/console.c
Stefan Reinauer c275218a89 Add a first bit of a framework. Builds the following parts, in
accordance to the newboot document:

* reset vector (16 bytes)
* vpd (240bytes)
* boot block (8k - 256b)
* lar archive (256-8 k)

The boot block is kind of simple, still. It enables pmode, car, and
starts looking for an initram module in the lar archive.

Note: This doesnt do much at the moment,
as gas seems to produce buggy code in init.S.

Take this as a suggestion of how it might work and please provide
patches fixing it and bringing it into shape.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@62 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-01-29 22:09:50 +00:00

70 lines
1.2 KiB
C

#include <arch/types.h>
#include <arch/hlt.h>
#include <console/loglevel.h>
#include "config.h"
// FIXME: we need this for varargs
#include <stdarg.h>
#if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_DEBUG
#define debug(msg_level, fmt, arg...) printk(msg_level, fmt, ##arg)
#endif
#ifndef LINUXBIOS_EXTRA_VERSION
#define LINUXBIOS_EXTRA_VERSION ""
#endif
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* BIOS_WARNING */
extern int vtxprintf(void (*)(unsigned char), const char *, va_list);
extern void uart8250_tx_byte(unsigned, unsigned char);
int console_loglevel()
{
return 8;
}
void console_tx_byte(unsigned char byte)
{
if (byte == '\n')
uart8250_tx_byte(TTYS0_BASE, '\r');
uart8250_tx_byte(TTYS0_BASE, byte);
}
int printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
if (msg_level >= console_loglevel()) {
return 0;
}
va_start(args, fmt);
i = vtxprintf(console_tx_byte, fmt, args);
va_end(args);
return i;
}
void console_init(void)
{
static const char console_test[] =
"\n\nLinuxBIOS-"
LINUXBIOS_VERSION
LINUXBIOS_EXTRA_VERSION
" "
LINUXBIOS_BUILD
" starting...\n";
printk(BIOS_INFO, console_test);
}
void die(const char *str)
{
printk(BIOS_EMERG,str);
do {
hlt();
} while(1);
}