This patch contains the necessary changes to util/x86emu of the v3 tree to use

it in the v2 tree as well. Requires the yabel-prereq.diff patch in order to
work in v2.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Joseph Smith <joe@settoplinux.org>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@1141 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2009-03-01 10:08:06 +00:00
parent cc295dd73a
commit be57458c77
21 changed files with 167 additions and 18 deletions

17
util/x86emu/Config.lb Normal file
View file

@ -0,0 +1,17 @@
uses CONFIG_PCI_OPTION_ROM_RUN_YABEL
uses CONFIG_PCI_OPTION_ROM_RUN_VM86
if CONFIG_PCI_OPTION_ROM_RUN_YABEL
dir yabel
dir x86emu
else
if CONFIG_PCI_OPTION_ROM_RUN_VM86
object vm86.o
object vm86_gdt.o
else
object biosemu.o
dir pcbios
dir x86emu
end
end

View file

@ -20,6 +20,7 @@
* 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
@ -35,8 +36,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if COREBOOT_V2
#include <arch/io.h>
#include <console/console.h>
#else
#include <io.h>
#include <console.h>
#endif
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
@ -96,9 +102,10 @@ u8 x_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;
}
@ -109,7 +116,9 @@ u16 x_inw(u16 port)
val = inw(port);
#ifdef DEBUG
printk("inw(0x%04x) = 0x%04x\n", port, val);
#endif
return val;
}
@ -119,26 +128,34 @@ u32 x_inl(u16 port)
val = inl(port);
#ifdef DEBUG
printk("inl(0x%04x) = 0x%08x\n", port, val);
#endif
return val;
}
void x_outb(u16 port, u8 val)
{
#ifdef DEBUG
if (port != 0x43)
printk("outb(0x%02x, 0x%04x)\n", val, port);
#endif
outb(val, port);
}
void x_outw(u16 port, u16 val)
{
#ifdef DEBUG
printk("outw(0x%04x, 0x%04x)\n", val, port);
#endif
outw(val, port);
}
void x_outl(u16 port, u32 val)
{
#ifdef DEBUG
printk("outl(0x%08x, 0x%04x)\n", val, port);
#endif
outl(val, port);
}
@ -324,6 +341,7 @@ void run_bios(struct device * dev, unsigned long addr)
unsigned short initialcs = (addr & 0xF0000) >> 4;
unsigned short initialip = (addr + 3) & 0xFFFF;
unsigned short devfn = dev->bus->secondary << 8 | dev->path.pci.devfn;
X86EMU_intrFuncs intFuncs[256];
X86EMU_setMemBase(0, 0x100000);

View file

@ -0,0 +1 @@
object pcibios.o

View file

@ -35,7 +35,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if COREBOOT_V2
#include <console/console.h>
#else
#include <console.h>
#endif
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
@ -61,7 +65,11 @@ int pcibios_handler(void)
break;
case FIND_PCI_DEVICE:
/* FixME: support SI != 0 */
#if COREBOOT_V2
dev = dev_find_device(X86_DX, X86_CX, dev);
#else
dev = dev_find_pci_device(X86_DX, X86_CX, dev);
#endif
if (dev != 0) {
X86_BH = dev->bus->secondary;
X86_BL = dev->path.pci.devfn;

View file

@ -4,7 +4,7 @@
* Copyright (C) 2000 Scyld Computing Corporation
* Copyright (C) 2001 University of California. LA-CC Number 01-67.
* Copyright (C) 2005 Nick.Barker9@btinternet.com
* Copyright (C) 2007 coresystems GmbH
* Copyright (C) 2007-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
@ -25,9 +25,15 @@
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <console.h>
#include <string.h>
#if COREBOOT_V2
#include <console/console.h>
#include <arch/io.h>
#define printk(lvl, x...) printk_debug(x)
#else
#include <console.h>
#include <io.h>
#endif
/* The address arguments to this function are PHYSICAL ADDRESSES */
static void real_mode_switch_call_vga(unsigned long devfn)
@ -539,7 +545,6 @@ void run_bios(struct device *dev, unsigned long addr)
*(unsigned char *) i = 0;
}
setup_realmode_idt();
real_mode_switch_call_vga((dev->bus->secondary << 8) | dev->path.pci.devfn);
}
@ -586,7 +591,11 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
vendorid = *pedx;
devindex = *pesi;
dev = 0;
#if COREBOOT_V2
while ((dev = dev_find_device(vendorid, devid, dev))) {
#else
while ((dev = dev_find_pci_device(vendorid, devid, dev))) {
#endif
if (devindex <= 0)
break;
devindex--;

View file

@ -33,7 +33,11 @@ __asm__ (
" .globl gdtarg\n"
"gdtarg: \n"
" .word gdt_limit \n"
#if COREBOOT_V2
" .long gdt \n"
#else
" .long gdtptr \n"
#endif
/* compute the table limit */
"__mygdt_limit = __mygdt_end - __mygdt - 1 \n"
@ -74,6 +78,7 @@ __asm__ (
"__mygdt_end: \n"
#if !COREBOOT_V2
/* FIXME: This does probably not belong here */
" .globl idtarg\n"
"idtarg:\n"
@ -83,6 +88,7 @@ __asm__ (
"_idt:\n"
" .fill 20, 8, 0\n" // # idt is unitiailzed
"_idt_end:\n"
#endif
/* Declare a pointer to where our idt is going to be i.e. at mem zero */
" .globl __myidt\n"

View file

@ -0,0 +1,7 @@
object debug.o
object decode.o
object fpu.o
object ops.o
object ops2.o
object prim_ops.o
object sys.o

View file

@ -46,7 +46,11 @@
#include "debug.h"
#include "prim_ops.h"
#if 1 /* Coreboot needs to map prinkf to printk. */
#if COREBOOT_V2
#include "arch/io.h"
#else
#include "io.h"
#endif
#else
#include <sys/io.h>
#endif

View file

@ -0,0 +1,9 @@
object biosemu.o
object debug.o
object device.o
object interrupt.o
object io.o
object mem.o
object pmm.o
object vbe.o
dir compat

View file

@ -13,13 +13,19 @@
#include <string.h>
#include <types.h>
#if !COREBOOT_V2
#include <cpu.h>
#endif
#include "debug.h"
#include <x86emu/x86emu.h>
#include <x86emu/regs.h>
#if COREBOOT_V2
#include "../x86emu/prim_ops.h"
#else
#include <x86emu/prim_ops.h> // for push_word
#endif
#include "biosemu.h"
#include "io.h"
@ -28,7 +34,11 @@
#include "device.h"
#include "pmm.h"
#if COREBOOT_V2
#include "compat/rtas.h"
#else
#include <rtas.h>
#endif
#include <device/device.h>

View file

@ -0,0 +1 @@
object functions.o

View file

@ -14,8 +14,10 @@
*/
#include <types.h>
#include <device/device.h>
#if !COREBOOT_V2
#include <config.h>
#endif
#include <device/device.h>
#define VMEM_SIZE 1024 *1024 /* 1 MB */

View file

@ -10,7 +10,9 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#if !COREBOOT_V2
#include <cpu.h>
#endif
#include "debug.h"

View file

@ -19,7 +19,11 @@ extern u32 debug_flags;
extern void x86emu_dump_xregs(void);
/* printf is not available in coreboot... use printk */
#if COREBOOT_V2
#include <console/console.h>
#else
#include <console.h>
#endif
/* uurgs... yuck... x86emu/x86emu.h is redefining printk... we include it here
* and use its redefinition of printk
* TODO: FIX!!!! */

View file

@ -12,13 +12,17 @@
#include "device.h"
#if COREBOOT_V2
#include "compat/rtas.h"
#else
#include "rtas.h"
#endif
#include <string.h>
#include "debug.h"
#include <device/device.h>
#include <device/pci_ops.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <device/resource.h>
/* the device we are working with... */
@ -47,6 +51,10 @@ biosemu_dev_get_addr_info(void)
struct resource *r;
u8 bus = bios_device.dev->bus->link;
u16 devfn = bios_device.dev->path.pci.devfn;
bios_device.bus = bus;
bios_device.devfn = devfn;
DEBUG_PRINTF("bus: %x, devfn: %x\n", bus, devfn);
for (i = 0; i < bios_device.dev->resources; i++) {
r = &bios_device.dev->resource[i];
@ -388,7 +396,11 @@ biosemu_dev_init(struct device * device)
{
u8 rval = 0;
//init bios_device struct
#if COREBOOT_V2
DEBUG_PRINTF("%s\n", __func__);
#else
DEBUG_PRINTF("%s(%s)\n", __func__, device->dtsname);
#endif
memset(&bios_device, 0, sizeof(bios_device));
#ifndef CONFIG_PCI_OPTION_ROM_RUN_YABEL

View file

@ -14,11 +14,16 @@
#define DEVICE_LIB_H
#include <types.h>
#if COREBOOT_V2
#include <arch/byteorder.h>
#include "compat/of.h"
#else
#include <cpu.h>
#include <byteorder.h>
#include "of.h"
#endif
#include "debug.h"
#include <byteorder.h>
// a Expansion Header Struct as defined in Plug and Play BIOS Spec 1.0a Chapter 3.2
typedef struct {

View file

@ -10,7 +10,11 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#if COREBOOT_V2
#include "compat/rtas.h"
#else
#include <rtas.h>
#endif
#include "biosemu.h"
#include "mem.h"
@ -19,9 +23,14 @@
#include "pmm.h"
#include <x86emu/x86emu.h>
#if COREBOOT_V2
#include "../x86emu/prim_ops.h"
#else
#include <x86emu/prim_ops.h>
#endif
#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
#include <device/pci.h>
#include <device/pci_ops.h>
#endif

View file

@ -10,16 +10,21 @@
* IBM Corporation - initial implementation
*****************************************************************************/
#include <cpu.h>
#include "device.h"
#include "rtas.h"
#include "debug.h"
#include "device.h"
#include <types.h>
#include <x86emu/x86emu.h>
#if COREBOOT_V2
#include "compat/rtas.h"
#include "compat/time.h"
#else
#include <cpu.h>
#include "rtas.h"
#include <time.h>
#endif
#include "device.h"
#include "debug.h"
#include <x86emu/x86emu.h>
#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
#include <device/pci.h>
#include <device/pci_ops.h>
#endif
@ -359,10 +364,15 @@ pci_cfg_read(X86EMU_pioAddr addr, u8 size)
|| (devfn != bios_device.devfn)) {
// fail accesses to any device but ours...
printf
("Config access invalid! bus: %x, devfn: %x, offs: %x\n",
bus, devfn, offs);
("Config read access invalid! PCI device %x:%x.%x, offs: %x\n",
bus, devfn >> 3, devfn & 7, offs);
#ifdef CONFIG_YABEL_NO_ILLEGAL_ACCESS
HALT_SYS();
} else {
#else
}
{
#endif
#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
switch (size) {
case 1:
@ -410,8 +420,8 @@ pci_cfg_write(X86EMU_pioAddr addr, u32 val, u8 size)
|| (devfn != bios_device.devfn)) {
// fail accesses to any device but ours...
printf
("Config access invalid! bus: %x, devfn: %x, offs: %x\n",
bus, devfn, offs);
("Config write access invalid! PCI device %x:%x.%x, offs: %x\n",
bus, devfn >> 3, devfn & 7, offs);
HALT_SYS();
} else {
#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL

View file

@ -11,12 +11,18 @@
*****************************************************************************/
#include <types.h>
#if !COREBOOT_V2
#include <cpu.h>
#endif
#include "debug.h"
#include "device.h"
#include "x86emu/x86emu.h"
#include "biosemu.h"
#if COREBOOT_V2
#include "compat/time.h"
#else
#include <time.h>
#endif
// define a check for access to certain (virtual) memory regions (interrupt handlers, BIOS Data Area, ...)
#ifdef DEBUG

View file

@ -10,7 +10,11 @@
****************************************************************************/
#include <x86emu/x86emu.h>
#if COREBOOT_V2
#include "../x86emu/prim_ops.h"
#else
#include <x86emu/prim_ops.h>
#endif
#include <string.h>
#include "biosemu.h"

View file

@ -11,15 +11,20 @@
*****************************************************************************/
#include <string.h>
#include <types.h>
#if !COREBOOT_V2
#include <cpu.h>
#endif
#include "debug.h"
#include <x86emu/x86emu.h>
#include <x86emu/regs.h>
#if COREBOOT_V2
#include "../x86emu/prim_ops.h"
#else
#include <x86emu/prim_ops.h> // for push_word
#endif
#include "biosemu.h"
#include "io.h"