summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2010-02-22 04:33:13 +0000
committerStefan Reinauer <stepan@openbios.org>2010-02-22 04:33:13 +0000
commitd650e9934ff8da9b9cb69e42e642c0ee6d390bf6 (patch)
tree8c6982efa868e828c21d4d427d2678e7e0804668 /util
parent30b90fe4f0b31aa6676f507d3913579453942ba8 (diff)
YABEL update
- drop x86emu + old biosemu in favor of YABEL - Add YABEL_DIRECTHW to get the old biosemu behavior - add support for vesa console using YABEL - add coreboot table entry with console information - add bootsplash support (reads /bootsplash.jpg from CBFS) Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Pattrick Hueper <phueper@hueper.net> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5135 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util')
-rw-r--r--util/x86emu/Makefile72
-rw-r--r--util/x86emu/Makefile.inc8
-rw-r--r--util/x86emu/biosemu.c580
-rw-r--r--util/x86emu/yabel/Makefile.inc1
-rw-r--r--util/x86emu/yabel/biosemu.c11
-rw-r--r--util/x86emu/yabel/compat/functions.c25
-rw-r--r--util/x86emu/yabel/io.c71
-rw-r--r--util/x86emu/yabel/mem.c38
-rw-r--r--util/x86emu/yabel/vbe.c282
9 files changed, 318 insertions, 770 deletions
diff --git a/util/x86emu/Makefile b/util/x86emu/Makefile
index a7b21d119a..e69de29bb2 100644
--- a/util/x86emu/Makefile
+++ b/util/x86emu/Makefile
@@ -1,72 +0,0 @@
-##
-## This file is part of the coreboot project.
-##
-## Copyright (C) 2007 coresystems GmbH
-##
-## 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; either version 2 of the License, or
-## (at your option) any later version.
-##
-## 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
-##
-
-#X86EMU_INCLUDE = -I $(src)/util/x86emu/include
-
-X86EMU_SRC = debug.c decode.c fpu.c ops.c ops2.c prim_ops.c sys.c
-ifeq ($(CONFIG_PCI_OPTION_ROM_RUN_X86EMU),y)
-BIOSEMU_SRC = biosemu.c
-endif
-
-ifeq ($(CONFIG_PCI_OPTION_ROM_RUN_YABEL),y)
-BIOSEMU_SRC = biosemu.c debug.c device.c mem.c io.c interrupt.c
-#TODO: add vbe.c, currently not needed...
-#BIOSEMU_SRC +=vbe.c
-BIOSEMU_SRC +=pmm.c
-#PH: TODO: remove the compat files??
-BIOSEMU_SRC += compat/functions.c
-X86EMU_INCLUDE += -I $(src)/util/x86emu/yabel
-X86EMU_INCLUDE += -I $(src)/util/x86emu
-#TODO: remove these, these are .h files from slof, to make the merge easier...
-X86EMU_INCLUDE += -I $(src)/util/x86emu/yabel/compat
-endif
-REALMODE_SRC = x86.c x86_asm.S
-
-ifeq ($(CONFIG_PCI_OPTION_ROM_RUN_X86EMU),y)
-LIBX86EMU_SRC=$(patsubst %,x86emu/%,$(X86EMU_SRC)) $(BIOSEMU_SRC)
-endif
-
-ifeq ($(CONFIG_PCI_OPTION_ROM_RUN_YABEL),y)
-LIBX86EMU_SRC=$(patsubst %,x86emu/%,$(X86EMU_SRC)) $(patsubst %,yabel/%,$(BIOSEMU_SRC))
-endif
-
-ifeq ($(CONFIG_PCI_OPTION_ROM_RUN_REALMODE),y)
-LIBX86EMU_SRC=$(REALMODE_SRC)
-endif
-
-LIBX86EMU_OBJS = $(patsubst %.c,$(obj)/util/x86emu/%.o,$(LIBX86EMU_SRC))
-# needed for kscope
-PCIROM_SRC += $(patsubst %,$(src)/util/x86emu/%,$(LIBX86EMU_SRC))
-
-
-$(obj)/util/x86emu/libx86emu.a: $(LIBX86EMU_OBJS) $(src)/.config
- @printf " AR $(subst $(shell pwd)/,,$(@))\n"
- $(Q)rm -f $@ # otherwise we always add to the archive
- $(Q)$(AR) qcs $@ $(LIBX86EMU_OBJS)
-
-#
-# This rule is also valid for all subdirectories
-#
-
-$(obj)/util/x86emu/%.o: $(src)/util/x86emu/%.c
- @printf " CC $(subst $(shell pwd)/,,$(@))\n"
- $(Q)mkdir -p $(dir $@)
- $(Q)$(CC) -Werror $(INITCFLAGS) $(X86EMU_INCLUDE) -I$(src)/util/x86emu/include -c $< -o $@
-
diff --git a/util/x86emu/Makefile.inc b/util/x86emu/Makefile.inc
index d71d3c76bc..3d5f1a6ff5 100644
--- a/util/x86emu/Makefile.inc
+++ b/util/x86emu/Makefile.inc
@@ -1,12 +1,11 @@
##
## This file is part of the coreboot project.
##
-## Copyright (C) 2007 coresystems GmbH
+## Copyright (C) 2007-2010 coresystems GmbH
##
## 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; either version 2 of the License, or
-## (at your option) any later version.
+## 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
@@ -18,9 +17,6 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) += x86emu
-obj-$(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) += biosemu.o
-
obj-$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) += x86.o
obj-$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) += x86_asm.o
obj-$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) += x86_interrupts.o
diff --git a/util/x86emu/biosemu.c b/util/x86emu/biosemu.c
index 7c5e3d766f..e69de29bb2 100644
--- a/util/x86emu/biosemu.c
+++ b/util/x86emu/biosemu.c
@@ -1,580 +0,0 @@
-/*
- * This software and ancillary information (herein called SOFTWARE )
- * called LinuxBIOS is made available under the terms described
- * here. The SOFTWARE has been approved for release with associated
- * LA-CC Number 00-34 . Unless otherwise indicated, this SOFTWARE has
- * been authored by an employee or employees of the University of
- * California, operator of the Los Alamos National Laboratory under
- * Contract No. W-7405-ENG-36 with the U.S. Department of Energy. The
- * U.S. Government has rights to use, reproduce, and distribute this
- * SOFTWARE. The public may copy, distribute, prepare derivative works
- * and publicly display this SOFTWARE without charge, provided that this
- * Notice and any statement of authorship are reproduced on all copies.
- * Neither the Government nor the University makes any warranty, express
- * or implied, or assumes any liability or responsibility for the use of
- * this SOFTWARE. If SOFTWARE is modified to produce derivative works,
- * such modified SOFTWARE should be clearly marked, so as not to confuse
- * it with the version available from LANL.
- */
- /*
- * This file is part of the coreboot project.
- *
- * (c) Copyright 2000, Ron Minnich, Advanced Computing Lab, LANL
- * Copyright (C) 2009 coresystems GmbH
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 <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>
-#include <x86emu/x86emu.h>
-#include "x86emu/prim_ops.h"
-
-#define DATA_SEGMENT 0x2000
-#define STACK_SEGMENT 0x1000 //1000:xxxx
-#define STACK_START_OFFSET 0xfffe
-#define INITIAL_EBDA_SEGMENT 0xF600 // segment of the Extended BIOS Data Area
-#define INITIAL_EBDA_SIZE 0x400 // size of the EBDA (at least 1KB!! since size is stored in KB!)
-
-enum {
- PCI_BIOS_PRESENT = 0xB101,
- FIND_PCI_DEVICE = 0xB102,
- FIND_PCI_CLASS_CODE = 0xB103,
- GENERATE_SPECIAL_CYCLE = 0xB106,
- READ_CONFIG_BYTE = 0xB108,
- READ_CONFIG_WORD = 0xB109,
- READ_CONFIG_DWORD = 0xB10A,
- WRITE_CONFIG_BYTE = 0xB10B,
- WRITE_CONFIG_WORD = 0xB10C,
- WRITE_CONFIG_DWORD = 0xB10D,
- GET_IRQ_ROUTING_OPTIONS = 0xB10E,
- SET_PCI_IRQ = 0xB10F
-};
-
-enum {
- SUCCESSFUL = 0x00,
- FUNC_NOT_SUPPORTED = 0x81,
- BAD_VENDOR_ID = 0x83,
- DEVICE_NOT_FOUND = 0x86,
- BAD_REGISTER_NUMBER = 0x87,
- SET_FAILED = 0x88,
- BUFFER_TOO_SMALL = 0x89
-};
-
-#define MEM_WB(where, what) wrb(where, what)
-#define MEM_WW(where, what) wrw(where, what)
-#define MEM_WL(where, what) wrl(where, what)
-
-#define MEM_RB(where) rdb(where)
-#define MEM_RW(where) rdw(where)
-#define MEM_RL(where) rdl(where)
-
-static u8 biosemu_inb(u16 port)
-{
- u8 val;
-
- val = inb(port);
-#ifdef DEBUG
- if (port != 0x40)
- printk("inb(0x%04x) = 0x%02x\n", port, val);
-#endif
-
- return val;
-}
-
-static u16 biosemu_inw(u16 port)
-{
- u16 val;
-
- val = inw(port);
-
-#ifdef DEBUG
- printk("inw(0x%04x) = 0x%04x\n", port, val);
-#endif
- return val;
-}
-
-static u32 biosemu_inl(u16 port)
-{
- u32 val;
-
- val = inl(port);
-
-#ifdef DEBUG
- printk("inl(0x%04x) = 0x%08x\n", port, val);
-#endif
- return val;
-}
-
-static void biosemu_outb(u16 port, u8 val)
-{
-#ifdef DEBUG
- if (port != 0x43)
- printk("outb(0x%02x, 0x%04x)\n", val, port);
-#endif
- outb(val, port);
-}
-
-static void biosemu_outw(u16 port, u16 val)
-{
-#ifdef DEBUG
- printk("outw(0x%04x, 0x%04x)\n", val, port);
-#endif
- outw(val, port);
-}
-
-static void biosemu_outl(u16 port, u32 val)
-{
-#ifdef DEBUG
- printk("outl(0x%08x, 0x%04x)\n", val, port);
-#endif
- outl(val, port);
-}
-
-static X86EMU_pioFuncs biosemu_piofuncs = {
- biosemu_inb, biosemu_inw, biosemu_inl,
- biosemu_outb, biosemu_outw, biosemu_outl
-};
-
-/* Interrupt Handlers */
-
-static int int15_handler(void)
-{
- /* This int15 handler is VIA Tech. and Intel specific. Other chipsets need other
- * handlers. The right way to do this is to move this handler code into
- * the mainboard or northbridge code.
- */
- switch (X86_AX) {
- case 0x5f19:
- X86_EFLAGS |= FB_CF; /* set carry flag */
- break;
- case 0x5f18:
- X86_EAX = 0x5f;
- // MCLK = 133, 32M frame buffer, 256 M main memory
- X86_EBX = 0x545;
- X86_ECX = 0x060;
- X86_EFLAGS &= ~FB_CF;
- break;
- case 0x5f00:
- X86_EAX = 0x8600;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- break;
- case 0x5f01:
- X86_EAX = 0x5f;
- X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768
- X86_EFLAGS &= ~FB_CF;
- break;
- case 0x5f02:
- X86_EAX = 0x5f;
- X86_EBX = (X86_EBX & 0xffff0000) | 2;
- X86_ECX = (X86_ECX & 0xffff0000) | 0x401; // PAL + crt only
- X86_EDX = (X86_EDX & 0xffff0000) | 0; // TV Layout - default
- X86_EFLAGS &= ~FB_CF;
- break;
- case 0x5f0f:
- X86_EAX = 0x860f;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- break;
- /* And now Intel IGD code */
-#define BOOT_DISPLAY_DEFAULT 0
-#define BOOT_DISPLAY_CRT (1 << 0)
-#define BOOT_DISPLAY_TV (1 << 1)
-#define BOOT_DISPLAY_EFP (1 << 2)
-#define BOOT_DISPLAY_LCD (1 << 3)
-#define BOOT_DISPLAY_CRT2 (1 << 4)
-#define BOOT_DISPLAY_TV2 (1 << 5)
-#define BOOT_DISPLAY_EFP2 (1 << 6)
-#define BOOT_DISPLAY_LCD2 (1 << 7)
-
- case 0x5f35:
- X86_EAX = 0x5f;
- X86_ECX = BOOT_DISPLAY_DEFAULT;
- X86_EFLAGS &= ~FB_CF;
- break;
- case 0x5f40:
- X86_EAX = 0x5f;
- X86_ECX = 3; // This is mainboard specific
- printk("DISPLAY=%x\n", X86_ECX);
- X86_EFLAGS &= ~FB_CF;
- break;
- default:
- printk("Unknown INT15 function %04x!\n", X86_AX);
- X86_EFLAGS |= FB_CF; /* set carry flag */
- }
-
- return 1;
-}
-
-static int int1a_handler(void)
-{
- int ret = 0;
- struct device *dev = 0;
-
- switch (X86_AX) {
- case PCI_BIOS_PRESENT:
- X86_AH = 0x00; /* no config space/special cycle support */
- X86_AL = 0x01; /* config mechanism 1 */
- X86_EDX = 'P' | 'C' << 8 | 'I' << 16 | ' ' << 24;
- X86_EBX = 0x0210; /* Version 2.10 */
- X86_ECX = 0xFF00; /* FIXME: Max bus number */
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- break;
- case FIND_PCI_DEVICE:
- /* FIXME: support SI != 0 */
- dev = dev_find_device(X86_DX, X86_CX, dev);
- if (dev != 0) {
- X86_BH = dev->bus->secondary;
- X86_BL = dev->path.pci.devfn;
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- case FIND_PCI_CLASS_CODE:
- /* FixME: support SI != 0 */
- dev = dev_find_class(X86_ECX, dev);
- if (dev != 0) {
- X86_BH = dev->bus->secondary;
- X86_BL = dev->path.pci.devfn;
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- case READ_CONFIG_BYTE:
- dev = dev_find_slot(X86_BH, X86_BL);
- if (dev != 0) {
- X86_CL = pci_read_config8(dev, X86_DI);
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- case READ_CONFIG_WORD:
- dev = dev_find_slot(X86_BH, X86_BL);
- if (dev != 0) {
- X86_CX = pci_read_config16(dev, X86_DI);
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- case READ_CONFIG_DWORD:
- dev = dev_find_slot(X86_BH, X86_BL);
- if (dev != 0) {
- X86_ECX = pci_read_config32(dev, X86_DI);
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- case WRITE_CONFIG_BYTE:
- dev = dev_find_slot(X86_BH, X86_BL);
- if (dev != 0) {
- pci_write_config8(dev, X86_DI, X86_CL);
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- case WRITE_CONFIG_WORD:
- dev = dev_find_slot(X86_BH, X86_BL);
- if (dev != 0) {
- pci_write_config16(dev, X86_DI, X86_CX);
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- case WRITE_CONFIG_DWORD:
- dev = dev_find_slot(X86_BH, X86_BL);
- if (dev != 0) {
- pci_write_config16(dev, X86_DI, X86_ECX);
- X86_AH = SUCCESSFUL;
- X86_EFLAGS &= ~FB_CF; /* clear carry flag */
- ret = 1;
- } else {
- X86_AH = DEVICE_NOT_FOUND;
- X86_EFLAGS |= FB_CF; /* set carry flag */
- ret = 0;
- }
- break;
- default:
- X86_AH = FUNC_NOT_SUPPORTED;
- X86_EFLAGS |= FB_CF;
- break;
- }
-
- return ret;
-}
-
-/* Interrupt multiplexer */
-
-/* Find base address of interrupt handler */
-static u32 getIntVect(int num)
-{
- return MEM_RW(num << 2) + (MEM_RW((num << 2) + 2) << 4);
-}
-
-static int run_bios_int(int num)
-{
- u32 eflags;
-
- eflags = X86_EFLAGS;
- push_word(eflags);
- push_word(X86_CS);
- push_word(X86_IP);
- X86_CS = MEM_RW((num << 2) + 2);
- X86_IP = MEM_RW(num << 2);
-
- return 1;
-}
-
-static void do_int(int num)
-{
- int ret = 0;
-
- printk("int%x (AX=%04x) vector at %x\n", num, X86_AX, getIntVect(num));
-
- switch (num) {
- case 0x10:
- case 0x42:
- case 0x6D:
- if (getIntVect(num) == 0x0000) {
- printk("uninitialized interrupt vector\n");
- ret = 1;
- }
- if (getIntVect(num) == 0xFF065) {
- //ret = int42_handler();
- ret = 1;
- }
- break;
- case 0x15:
- ret = int15_handler();
- ret = 1;
- break;
- case 0x16:
- //ret = int16_handler();
- ret = 0;
- break;
- case 0x1A:
- ret = int1a_handler();
- ret = 1;
- break;
- case 0xe6:
- //ret = intE6_handler();
- ret = 0;
- break;
- default:
- break;
- }
-
- if (!ret)
- ret = run_bios_int(num);
-
-}
-
-/*
- * here we are really paranoid about faking a "real"
- * BIOS. Most of this information was pulled from
- * dosemu.
- */
-static void setup_system_bios(void)
-{
- int i;
-
- /* Set up Interrupt Vectors. The IVT starts at 0x0000:0x0000
- * Additionally, we put some stub code into the F segment for
- * those pesky little buggers that jmp to the hard coded addresses
- * instead of calling int XX. This stub code looks like this
- *
- * CD XX int 0xXX
- * C3 ret
- * F4 hlt
- */
-
- /* int 05 default location (Bound Exceeded) */
- MEM_WL(0x05 << 2, 0xf000ff54);
- MEM_WL(0xfff54, 0xf4c305cd);
- /* int 08 default location (Double Fault) */
- MEM_WL(0x08 << 2, 0xf000fea5);
- MEM_WL(0xffea5, 0xf4c308cd);
- /* int 0E default location (Page Fault) */
- MEM_WL(0x0e << 2, 0xf000ef57);
- MEM_WL(0xfef57, 0xf4c30ecd);
- /* int 10 default location */
- MEM_WL(0x10 << 2, 0xf000f065);
- MEM_WL(0xff065, 0xf4c310cd);
- /* int 11 default location (Get Equipment Configuration) */
- MEM_WL(0x11 << 2, 0xf000f84d);
- MEM_WL(0xff84d, 0xf4c311cd);
- /* int 12 default location (Get Conventional Memory Size) */
- MEM_WL(0x12 << 2, 0xf000f841);
- MEM_WL(0xff841, 0xf4c312cd);
- /* int 13 default location (Disk) */
- MEM_WL(0x13 << 2, 0xf000ec59);
- MEM_WL(0xfec59, 0xf4c313cd);
- /* int 14 default location (Disk) */
- MEM_WL(0x14 << 2, 0xf000e739);
- MEM_WL(0xfe739, 0xf4c314cd);
- /* int 15 default location (I/O System Extensions) */
- MEM_WL(0x15 << 2, 0xf000f859);
- MEM_WL(0xf859, 0xf4c315cd);
- /* int 16 default location */
- MEM_WL(0x16 << 2, 0xf000e82e);
- MEM_WL(0xfe82e, 0xf4c316cd);
- /* int 17 default location (Parallel Port) */
- MEM_WL(0x17 << 2, 0xf000efd2);
- MEM_WL(0xfefd2, 0xf4c317cd);
- /* int 1A default location (RTC, PCI and others) */
- MEM_WL(0x1a << 2, 0xf000fe6e);
- MEM_WL(0xffe6e, 0xf4c31acd);
- /* int 1E default location (FDD table) */
- MEM_WL(0x1e << 2, 0xf000efc7);
- MEM_WL(0xfefc7, 0xf4c31ecd);
- /* font tables default location (int 1F) */
- MEM_WL(0x1f << 2, 0xf000fa6e);
- MEM_WL(0xffa6e, 0xf4c31fcd);
- /* int 42 default location */
- MEM_WL(0x42 << 2, 0xf000f065);
- /* int 6D default location */
- MEM_WL(0x6D << 2, 0xf000f065);
-
- /* Clear EBDA */
- for (i=(INITIAL_EBDA_SEGMENT << 4);
- i<(INITIAL_EBDA_SEGMENT << 4) + INITIAL_EBDA_SIZE; i++)
- MEM_WB(i, 0);
- /* at offset 0h in EBDA is the size of the EBDA in KB */
- MEM_WW((INITIAL_EBDA_SEGMENT << 4) + 0x0, INITIAL_EBDA_SIZE / 1024);
-
- /* Clear BDA */
- for (i=0x400; i<0x500; i+=4)
- MEM_WL(i, 0);
-
- /* Set up EBDA */
- MEM_WW(0x40e, INITIAL_EBDA_SEGMENT);
-
- /* Set RAM size to 16MB (fake) */
- MEM_WW(0x413, 16384);
-
- // TODO Set up more of BDA here
-
- /* setup original ROM BIOS Area (F000:xxxx) */
- const char *date = "06/23/99";
- for (i = 0; date[i]; i++)
- MEM_WB(0xffff5 + i, date[i]);
- /* set up eisa ident string */
- const char *ident = "PCI_ISA";
- for (i = 0; ident[i]; i++)
- MEM_WB(0xfffd9 + i, ident[i]);
-
- // write system model id for IBM-AT
- // according to "Ralf Browns Interrupt List" Int15 AH=C0 Table 515,
- // model FC is the original AT and also used in all DOSEMU Versions.
- MEM_WB(0xFFFFE, 0xfc);
-}
-
-#define BIOSEMU_MEM_BASE 0x00000000
-#define BIOSEMU_MEM_SIZE 0x00100000
-void run_bios(struct device * dev, unsigned long addr)
-{
- int i;
- u16 initialcs = (addr & 0xF0000) >> 4;
- u16 initialip = (addr + 3) & 0xFFFF;
- u16 devfn = (dev->bus->secondary << 8) | dev->path.pci.devfn;
- X86EMU_intrFuncs intFuncs[256];
-
- X86EMU_setMemBase(BIOSEMU_MEM_BASE, BIOSEMU_MEM_SIZE);
- X86EMU_setupPioFuncs(&biosemu_piofuncs);
- for (i = 0; i < 256; i++)
- intFuncs[i] = do_int;
- X86EMU_setupIntrFuncs(intFuncs);
-
- setup_system_bios();
-
- /* cpu setup */
- X86_AX = devfn ? devfn : 0xff;
- X86_DX = 0x80;
- X86_EIP = initialip;
- X86_CS = initialcs;
-
- /* Initialize stack and data segment */
- X86_SS = STACK_SEGMENT;
- X86_SP = STACK_START_OFFSET;;
- X86_DS = DATA_SEGMENT;
-
- /* We need a sane way to return from bios
- * execution. A hlt instruction and a pointer
- * to it, both kept on the stack, will do.
- */
- push_word(0xf4f4); /* hlt; hlt */
- push_word(X86_SS);
- push_word(X86_SP + 2);
-
-#ifdef DEBUG
- //X86EMU_trace_on();
-#endif
-
- printk("Executing Initialization Vector...\n");
- X86EMU_exec();
- printk("Option ROM Exit Status: %04x\n", X86_AX);
-
- /* Check whether the stack is "clean" i.e. containing the HLT
- * instruction we pushed before executing and pointing to the original
- * stack address... indicating that the initialization probably was
- * successful
- */
- if ((pop_word() == 0xf4f4) && (X86_SS == STACK_SEGMENT)
- && (X86_SP == STACK_START_OFFSET)) {
- printk("Stack is clean, initialization successfull!\n");
- } else {
- printk("Stack unclean, initialization probably NOT COMPLETE!!\n");
- printk("SS:SP = %04x:%04x, expected: %04x:%04x\n",
- X86_SS, X86_SP, STACK_SEGMENT, STACK_START_OFFSET);
- }
-}
diff --git a/util/x86emu/yabel/Makefile.inc b/util/x86emu/yabel/Makefile.inc
index fc6a8a0a9f..f89de9b7dd 100644
--- a/util/x86emu/yabel/Makefile.inc
+++ b/util/x86emu/yabel/Makefile.inc
@@ -5,4 +5,5 @@ obj-y += interrupt.o
obj-y += io.o
obj-y += mem.o
obj-y += pmm.o
+obj-y += vbe.o
subdirs-y += compat
diff --git a/util/x86emu/yabel/biosemu.c b/util/x86emu/yabel/biosemu.c
index df202814a4..09a98b50b6 100644
--- a/util/x86emu/yabel/biosemu.c
+++ b/util/x86emu/yabel/biosemu.c
@@ -86,10 +86,15 @@ biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev, unsigned long rom_ad
// in case we jump somewhere unexpected, or execution is finished,
// fill the biosmem with hlt instructions (0xf4)
- memset(biosmem, 0xf4, biosmem_size);
+ // But we have to be careful: If biosmem is 0x00000000 we're running
+ // in the lower 1MB and we must not wipe memory like that.
+ if (biosmem) {
+ DEBUG_PRINTF("Clearing biosmem\n");
+ memset(biosmem, 0xf4, biosmem_size);
+ }
+
+ X86EMU_setMemBase(biosmem, biosmem_size);
- M.mem_base = (long) biosmem;
- M.mem_size = biosmem_size;
DEBUG_PRINTF("membase set: %08x, size: %08x\n", (int) M.mem_base,
(int) M.mem_size);
diff --git a/util/x86emu/yabel/compat/functions.c b/util/x86emu/yabel/compat/functions.c
index 600b0ba38a..599e82e54e 100644
--- a/util/x86emu/yabel/compat/functions.c
+++ b/util/x86emu/yabel/compat/functions.c
@@ -16,24 +16,41 @@
#include <types.h>
#include <string.h>
#include <device/device.h>
+#include "../debug.h"
-#define VMEM_SIZE 1024 *1024 /* 1 MB */
+#define VMEM_SIZE (1024 * 1024) /* 1 MB */
+#if !defined(CONFIG_YABEL_DIRECTHW) || (!CONFIG_YABEL_DIRECTHW)
#ifdef CONFIG_YABEL_VIRTMEM_LOCATION
u8* vmem = (u8 *) CONFIG_YABEL_VIRTMEM_LOCATION;
#else
u8* vmem = (u8 *) (16*1024*1024); /* default to 16MB */
#endif
+#else
+u8* vmem = NULL;
+#endif
u32 biosemu(u8 *biosmem, u32 biosmem_size, struct device *dev,
unsigned long rom_addr);
+#if CONFIG_BOOTSPLASH
+void vbe_set_graphics(void);
+#endif
void run_bios(struct device * dev, unsigned long addr)
{
+
biosemu(vmem, VMEM_SIZE, dev, addr);
- memcpy(0x0, vmem + 0x0, 0x400);
- memcpy(0x400, vmem + 0x400, 0x100);
- memcpy(0xc0000, vmem + 0xc0000, 0x10000);
+
+#if CONFIG_BOOTSPLASH
+ vbe_set_graphics();
+#endif
+
+ if (vmem != NULL) {
+ printf("Copying legacy memory from 0x%08x to the lower 1MB\n", vmem);
+ memcpy(0x00000, vmem + 0x00000, 0x400); // IVT
+ memcpy(0x00400, vmem + 0x00400, 0x100); // BDA
+ memcpy(0xc0000, vmem + 0xc0000, 0x10000); // VGA OPROM
+ }
}
u64 get_time(void)
diff --git a/util/x86emu/yabel/io.c b/util/x86emu/yabel/io.c
index fd205e4dd6..9bb2df4960 100644
--- a/util/x86emu/yabel/io.c
+++ b/util/x86emu/yabel/io.c
@@ -80,6 +80,76 @@ inl(u16 port)
return 0;
}
#endif
+
+#if defined(CONFIG_YABEL_DIRECTHW) && (CONFIG_YABEL_DIRECTHW == 1)
+u8 my_inb(X86EMU_pioAddr addr)
+{
+ u8 val;
+
+ val = inb(addr);
+#ifdef CONFIG_DEBUG
+ if ((debug_flags & DEBUG_IO) && (addr != 0x40))
+ printk("inb(0x%04x) = 0x%02x\n", addr, val);
+#endif
+
+ return val;
+}
+
+u16 my_inw(X86EMU_pioAddr addr)
+{
+ u16 val;
+
+ val = inw(addr);
+
+#ifdef CONFIG_DEBUG
+ if (debug_flags & DEBUG_IO)
+ printk("inw(0x%04x) = 0x%04x\n", addr, val);
+#endif
+ return val;
+}
+
+u32 my_inl(X86EMU_pioAddr addr)
+{
+ u32 val;
+
+ val = inl(addr);
+
+#ifdef CONFIG_DEBUG
+ if (debug_flags & DEBUG_IO)
+ printk("inl(0x%04x) = 0x%08x\n", addr, val);
+#endif
+ return val;
+}
+
+void my_outb(X86EMU_pioAddr addr, u8 val)
+{
+#ifdef CONFIG_DEBUG
+ if ((debug_flags & DEBUG_IO) && (addr != 0x43))
+ printk("outb(0x%02x, 0x%04x)\n", val, addr);
+#endif
+ outb(val, addr);
+}
+
+void my_outw(X86EMU_pioAddr addr, u16 val)
+{
+#ifdef CONFIG_DEBUG
+ if (debug_flags & DEBUG_IO)
+ printk("outw(0x%04x, 0x%04x)\n", val, addr);
+#endif
+ outw(val, addr);
+}
+
+void my_outl(X86EMU_pioAddr addr, u32 val)
+{
+#ifdef CONFIG_DEBUG
+ if (debug_flags & DEBUG_IO)
+ printk("outl(0x%08x, 0x%04x)\n", val, addr);
+#endif
+ outl(val, addr);
+}
+
+#else
+
u32 pci_cfg_read(X86EMU_pioAddr addr, u8 size);
void pci_cfg_write(X86EMU_pioAddr addr, u32 val, u8 size);
u8 handle_port_61h(void);
@@ -479,3 +549,4 @@ handle_port_61h(void)
//finally read the value from the io_buffer
return *((u8 *) (bios_device.io_buffer + 0x61));
}
+#endif
diff --git a/util/x86emu/yabel/mem.c b/util/x86emu/yabel/mem.c
index 294e76db1a..1cf66ddff7 100644
--- a/util/x86emu/yabel/mem.c
+++ b/util/x86emu/yabel/mem.c
@@ -168,6 +168,7 @@ extern u64 get_time(void);
void update_time(u32);
+#if !defined(CONFIG_YABEL_DIRECTHW) || (!CONFIG_YABEL_DIRECTHW)
// read byte from memory
u8
my_rdb(u32 addr)
@@ -436,6 +437,43 @@ my_wrl(u32 addr, u32 val)
out32le((void *) (M.mem_base + addr), val);
}
}
+#else
+u8
+my_rdb(u32 addr)
+{
+ return rdb(addr);
+}
+
+u16
+my_rdw(u32 addr)
+{
+ return rdw(addr);
+}
+
+u32
+my_rdl(u32 addr)
+{
+ return rdl(addr);
+}
+
+void
+my_wrb(u32 addr, u8 val)
+{
+ wrb(addr, val);
+}
+
+void
+my_wrw(u32 addr, u16 val)
+{
+ wrw(addr, val);
+}
+
+void
+my_wrl(u32 addr, u32 val)
+{
+ wrl(addr, val);
+}
+#endif
//update time in BIOS Data Area
//DWord at offset 0x6c is the timer ticks since midnight, timer is running at 18Hz
diff --git a/util/x86emu/yabel/vbe.c b/util/x86emu/yabel/vbe.c
index db60630771..90b468bd25 100644
--- a/util/x86emu/yabel/vbe.c
+++ b/util/x86emu/yabel/vbe.c
@@ -13,6 +13,12 @@
#include <string.h>
#include <types.h>
+#if CONFIG_BOOTSPLASH
+#include <boot/coreboot_tables.h>
+#endif
+
+#include <arch/byteorder.h>
+#define ntohl(x) be32_to_cpu(x)
#include "debug.h"
@@ -26,18 +32,14 @@
#include "interrupt.h"
#include "device.h"
-static X86EMU_memFuncs my_mem_funcs = {
- my_rdb, my_rdw, my_rdl,
- my_wrb, my_wrw, my_wrl
-};
+#include <cbfs.h>
-static X86EMU_pioFuncs my_pio_funcs = {
- my_inb, my_inw, my_inl,
- my_outb, my_outw, my_outl
-};
+#include <delay.h>
+#include "../../src/lib/jpeg.h"
// pointer to VBEInfoBuffer, set by vbe_prepare
u8 *vbe_info_buffer = 0;
+
// virtual BIOS Memory
u8 *biosmem;
u32 biosmem_size;
@@ -73,17 +75,57 @@ typedef struct {
} vbe_info_t;
typedef struct {
+ u16 mode_attributes; // 00
+ u8 win_a_attributes; // 02
+ u8 win_b_attributes; // 03
+ u16 win_granularity; // 04
+ u16 win_size; // 06
+ u16 win_a_segment; // 08
+ u16 win_b_segment; // 0a
+ u32 win_func_ptr; // 0c
+ u16 bytes_per_scanline; // 10
+ u16 x_resolution; // 12
+ u16 y_resolution; // 14
+ u8 x_charsize; // 16
+ u8 y_charsize; // 17
+ u8 number_of_planes; // 18
+ u8 bits_per_pixel; // 19
+ u8 number_of_banks; // 20
+ u8 memory_model; // 21
+ u8 bank_size; // 22
+ u8 number_of_image_pages; // 23
+ u8 reserved_page;
+ u8 red_mask_size;
+ u8 red_mask_pos;
+ u8 green_mask_size;
+ u8 green_mask_pos;
+ u8 blue_mask_size;
+ u8 blue_mask_pos;
+ u8 reserved_mask_size;
+ u8 reserved_mask_pos;
+ u8 direct_color_mode_info;
+ u32 phys_base_ptr;
+ u32 offscreen_mem_offset;
+ u16 offscreen_mem_size;
+ u8 reserved[206];
+} __attribute__ ((__packed__)) vesa_mode_info_t;
+
+typedef struct {
u16 video_mode;
- u8 mode_info_block[256];
- u16 attributes;
- u16 linebytes;
- u16 x_resolution;
- u16 y_resolution;
- u8 x_charsize;
- u8 y_charsize;
- u8 bits_per_pixel;
- u8 memory_model;
- u32 framebuffer_address;
+ union {
+ vesa_mode_info_t vesa;
+ u8 mode_info_block[256];
+ };
+ // our crap
+ //u16 attributes;
+ //u16 linebytes;
+ //u16 x_resolution;
+ //u16 y_resolution;
+ //u8 x_charsize;
+ //u8 y_charsize;
+ //u8 bits_per_pixel;
+ //u8 memory_model;
+ //u32 framebuffer_address;
} vbe_mode_info_t;
typedef struct {
@@ -94,7 +136,7 @@ typedef struct {
} vbe_ddc_info_t;
static inline u8
-vbe_prepare()
+vbe_prepare(void)
{
vbe_info_buffer = biosmem + (VBE_SEGMENT << 4); // segment:offset off VBE Data Area
//clear buffer
@@ -209,6 +251,7 @@ vbe_get_mode_info(vbe_mode_info_t * mode_info)
__func__, mode_info->video_mode, M.x86.R_AH);
return M.x86.R_AH;
}
+
//pointer to mode_info_block is in ES:DI
memcpy(mode_info->mode_info_block,
biosmem + ((M.x86.R_ES << 4) + M.x86.R_DI),
@@ -217,34 +260,6 @@ vbe_get_mode_info(vbe_mode_info_t * mode_info)
//printf("Mode Info Dump:");
//dump(mode_info_block, 64);
- // offset 0: 16bit le mode attributes
- mode_info->attributes = in16le(mode_info->mode_info_block);
-
- // offset 16: 16bit le bytes per scan line
- mode_info->linebytes = in16le(mode_info->mode_info_block + 16);
-
- // offset 18: 16bit le x resolution
- mode_info->x_resolution = in16le(mode_info->mode_info_block + 18);
-
- // offset 20: 16bit le y resolution
- mode_info->y_resolution = in16le(mode_info->mode_info_block + 20);
-
- // offset 22: 8bit le x charsize
- mode_info->x_charsize = *(mode_info->mode_info_block + 22);
-
- // offset 23: 8bit le y charsize
- mode_info->y_charsize = *(mode_info->mode_info_block + 23);
-
- // offset 25: 8bit le bits per pixel
- mode_info->bits_per_pixel = *(mode_info->mode_info_block + 25);
-
- // offset 27: 8bit le memory model
- mode_info->memory_model = *(mode_info->mode_info_block + 27);
-
- // offset 40: 32bit le containg offset of frame buffer memory ptr
- mode_info->framebuffer_address =
- in32le(mode_info->mode_info_block + 40);
-
return 0;
}
@@ -482,56 +497,22 @@ vbe_get_ddc_info(vbe_ddc_info_t * ddc_info)
}
u32
-vbe_get_info(u8 argc, char ** argv)
+vbe_get_info(void)
{
u8 rval;
- u32 i;
- if (argc < 4) {
- printf
- ("Usage %s <vmem_base> <device_path> <address of screen_info_t>\n",
- argv[0]);
- int i = 0;
- for (i = 0; i < argc; i++) {
- printf("argv[%d]: %s\n", i, argv[i]);
- }
- return -1;
- }
+ int i;
+
+ // XXX FIXME these need to be filled with sane values
+
// get a copy of input struct...
- screen_info_input_t input =
- *((screen_info_input_t *) strtoul((char *) argv[4], 0, 16));
+ screen_info_input_t input;
// output is pointer to the address passed as argv[4]
- screen_info_t *output =
- (screen_info_t *) strtoul((char *) argv[4], 0, 16);
+ screen_info_t local_output;
+ screen_info_t *output = &local_output;
+ // zero input
+ memset(&input, 0, sizeof(screen_info_input_t));
// zero output
- memset(output, 0, sizeof(screen_info_t));
-
- // argv[1] is address of virtual BIOS mem...
- // argv[2] is the size
- biosmem = (u8 *) strtoul(argv[1], 0, 16);
- biosmem_size = strtoul(argv[2], 0, 16);;
- if (biosmem_size < MIN_REQUIRED_VMEM_SIZE) {
- printf("Error: Not enough virtual memory: %x, required: %x!\n",
- biosmem_size, MIN_REQUIRED_VMEM_SIZE);
- return -1;
- }
- // argv[3] is the device to open and use...
- if (dev_init((char *) argv[3]) != 0) {
- printf("Error initializing device!\n");
- return -1;
- }
- //setup interrupt handler
- X86EMU_intrFuncs intrFuncs[256];
- for (i = 0; i < 256; i++)
- intrFuncs[i] = handleInterrupt;
- X86EMU_setupIntrFuncs(intrFuncs);
- X86EMU_setupPioFuncs(&my_pio_funcs);
- X86EMU_setupMemFuncs(&my_mem_funcs);
-
- // set mem_base
- M.mem_base = (long) biosmem;
- M.mem_size = biosmem_size;
- DEBUG_PRINTF_VBE("membase set: %08x, size: %08x\n", (int) M.mem_base,
- (int) M.mem_size);
+ memset(&output, 0, sizeof(screen_info_t));
vbe_info_t info;
rval = vbe_info(&info);
@@ -613,7 +594,9 @@ vbe_get_info(u8 argc, char ** argv)
while ((mode_info.video_mode = info.video_mode_list[i]) != 0xFFFF) {
//DEBUG_PRINTF_VBE("%x: Mode: %04x\n", i, mode_info.video_mode);
vbe_get_mode_info(&mode_info);
-#if 0
+
+ // FIXME all these values are little endian!
+
DEBUG_PRINTF_VBE("Video Mode 0x%04x available, %s\n",
mode_info.video_mode,
(mode_info.attributes & 0x1) ==
@@ -646,13 +629,13 @@ vbe_get_info(u8 argc, char ** argv)
mode_info.memory_model);
DEBUG_PRINTF_VBE("\tFramebuffer Offset: %08x\n",
mode_info.framebuffer_address);
-#endif
- if ((mode_info.bits_per_pixel == input.color_depth)
- && (mode_info.x_resolution <= input.max_screen_width)
- && ((mode_info.attributes & 0x80) != 0) // framebuffer mode
- && ((mode_info.attributes & 0x10) != 0) // graphics
- && ((mode_info.attributes & 0x8) != 0) // color
- && (mode_info.x_resolution > best_mode_info.x_resolution)) // better than previous best_mode
+
+ if ((mode_info.vesa.bits_per_pixel == input.color_depth)
+ && (le16_to_cpu(mode_info.vesa.x_resolution) <= input.max_screen_width)
+ && ((le16_to_cpu(mode_info.vesa.mode_attributes) & 0x80) != 0) // framebuffer mode
+ && ((le16_to_cpu(mode_info.vesa.mode_attributes) & 0x10) != 0) // graphics
+ && ((le16_to_cpu(mode_info.vesa.mode_attributes) & 0x8) != 0) // color
+ && (le16_to_cpu(mode_info.vesa.x_resolution) > le16_to_cpu(best_mode_info.vesa.x_resolution))) // better than previous best_mode
{
// yiiiihaah... we found a new best mode
memcpy(&best_mode_info, &mode_info, sizeof(mode_info));
@@ -757,12 +740,12 @@ vbe_get_info(u8 argc, char ** argv)
vbe_set_color(0x00, 0x00000000);
vbe_set_color(0xFF, 0x00FFFFFF);
- output->screen_width = best_mode_info.x_resolution;
- output->screen_height = best_mode_info.y_resolution;
- output->screen_linebytes = best_mode_info.linebytes;
- output->color_depth = best_mode_info.bits_per_pixel;
+ output->screen_width = le16_to_cpu(best_mode_info.vesa.x_resolution);
+ output->screen_height = le16_to_cpu(best_mode_info.vesa.y_resolution);
+ output->screen_linebytes = le16_to_cpu(best_mode_info.vesa.bytes_per_scanline);
+ output->color_depth = best_mode_info.vesa.bits_per_pixel;
output->framebuffer_address =
- best_mode_info.framebuffer_address;
+ le32_to_cpu(best_mode_info.vesa.phys_base_ptr);
} else {
printf("%s: No suitable video mode found!\n", __func__);
//unset display_type...
@@ -770,3 +753,92 @@ vbe_get_info(u8 argc, char ** argv)
}
return 0;
}
+
+#if CONFIG_BOOTSPLASH
+vbe_mode_info_t mode_info;
+
+void vbe_set_graphics(void)
+{
+ u8 rval;
+ int i;
+
+ vbe_info_t info;
+ rval = vbe_info(&info);
+ if (rval != 0)
+ return;
+
+ DEBUG_PRINTF_VBE("VbeSignature: %s\n", info.signature);
+ DEBUG_PRINTF_VBE("VbeVersion: 0x%04x\n", info.version);
+ DEBUG_PRINTF_VBE("OemString: %s\n", info.oem_string_ptr);
+ DEBUG_PRINTF_VBE("Capabilities:\n");
+ DEBUG_PRINTF_VBE("\tDAC: %s\n",
+ (info.capabilities & 0x1) ==
+ 0 ? "fixed 6bit" : "switchable 6/8bit");
+ DEBUG_PRINTF_VBE("\tVGA: %s\n",
+ (info.capabilities & 0x2) ==
+ 0 ? "compatible" : "not compatible");
+ DEBUG_PRINTF_VBE("\tRAMDAC: %s\n",
+ (info.capabilities & 0x4) ==
+ 0 ? "normal" : "use blank bit in Function 09h");
+
+ mode_info.video_mode = (1 << 14) | CONFIG_FRAMEBUFFER_VESA_MODE;
+ vbe_get_mode_info(&mode_info);
+ unsigned char *framebuffer =
+ (unsigned char *) le32_to_cpu(mode_info.vesa.phys_base_ptr);
+ DEBUG_PRINTF_VBE("FRAMEBUFFER: 0x%08x\n", framebuffer);
+ vbe_set_mode(&mode_info);
+
+ struct jpeg_decdata *decdata;
+ decdata = malloc(sizeof(*decdata));
+
+ /* Switching Intel IGD to 1MB video memory will break this. Who
+ * cares. */
+ int imagesize = 1024*768*2;
+
+ struct cbfs_file *file = cbfs_find("bootsplash.jpg");
+ if (!file) {
+ DEBUG_PRINTF_VBE("Could not find bootsplash.jpg\n");
+ return;
+ }
+ unsigned char *jpeg = ((unsigned char *)file) + ntohl(file->offset);
+ DEBUG_PRINTF_VBE("Splash at %08x ...\n", jpeg);
+ dump(jpeg, 64);
+
+ int ret = 0;
+ DEBUG_PRINTF_VBE("Decompressing boot splash screen...\n");
+ ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata);
+ DEBUG_PRINTF_VBE("returns %x\n", ret);
+}
+
+void fill_lb_framebuffer(struct lb_framebuffer *framebuffer)
+{
+ framebuffer->physical_address = le32_to_cpu(mode_info.vesa.phys_base_ptr);
+
+ framebuffer->x_resolution = le16_to_cpu(mode_info.vesa.x_resolution);
+ framebuffer->y_resolution = le16_to_cpu(mode_info.vesa.y_resolution);
+ framebuffer->bytes_per_line = le16_to_cpu(mode_info.vesa.bytes_per_scanline);
+ framebuffer->bits_per_pixel = mode_info.vesa.bits_per_pixel;
+
+ framebuffer->red_mask_pos = mode_info.vesa.red_mask_pos;
+ framebuffer->red_mask_size = mode_info.vesa.red_mask_size;
+
+ framebuffer->green_mask_pos = mode_info.vesa.green_mask_pos;
+ framebuffer->green_mask_size = mode_info.vesa.green_mask_size;
+
+ framebuffer->blue_mask_pos = mode_info.vesa.blue_mask_pos;
+ framebuffer->blue_mask_size = mode_info.vesa.blue_mask_size;
+
+ framebuffer->reserved_mask_pos = mode_info.vesa.reserved_mask_pos;
+ framebuffer->reserved_mask_size = mode_info.vesa.reserved_mask_size;
+}
+
+void vbe_textmode_console(void)
+{
+ /* Wait, just a little bit more, pleeeease ;-) */
+ delay(2);
+
+ M.x86.R_EAX = 0x0003;
+ runInt10();
+}
+
+#endif