mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
This patch reshapes northbridge and southbridge inclusion. It selects
southbridge drivers in Kconfig. * It includes initial superio code as well, but there is at least one error in the pnp_device.c/superio scenario left * Fixed biosemu.c, vm86.c, pnp_device.c (sort of) * Enable vm86 instead of x86emu per default for vga init for now. This makes VGA in qemu work. There might be a bug in x86emu or the compiler I am using. (gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)) * Import isa-dma.c, keyboard.c and i8259.c from v2 /pc80, which was taken from LinuxBIOSv1 released from LANL under release LA-CC Number 00-34 and using parts from the Linux kernel. This patch makes vga and keyboard work in qemu. Yippie Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@260 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
305bb55783
commit
0528863e20
31 changed files with 671 additions and 140 deletions
4
Kconfig
4
Kconfig
|
@ -36,6 +36,10 @@ source mainboard/Kconfig
|
|||
source arch/Kconfig
|
||||
source lib/Kconfig
|
||||
source console/Kconfig
|
||||
# these are used for internal purposes only
|
||||
source northbridge/Kconfig
|
||||
source southbridge/Kconfig
|
||||
source superio/Kconfig
|
||||
|
||||
menu "Payload"
|
||||
|
||||
|
|
3
Makefile
3
Makefile
|
@ -96,6 +96,9 @@ include lib/Makefile
|
|||
include device/Makefile
|
||||
include console/Makefile
|
||||
include mainboard/$(MAINBOARDDIR)/Makefile
|
||||
include northbridge/Makefile
|
||||
include southbridge/Makefile
|
||||
include superio/Makefile
|
||||
include arch/$(ARCH)/Makefile
|
||||
|
||||
endif
|
||||
|
|
|
@ -106,6 +106,7 @@ STAGE2_LIB_OBJ = stage2.o clog2.o mem.o malloc.o tables.o delay.o compute_
|
|||
|
||||
STAGE2_ARCH_X86_OBJ = archtables.o linuxbios_table.o udelay_io.o
|
||||
STAGE2_ARCH_X86_OBJ += pci_ops_auto.o pci_ops_conf1.o pci_ops_conf2.o
|
||||
STAGE2_ARCH_X86_OBJ += keyboard.o i8259.o isa-dma.o
|
||||
|
||||
STAGE2_DYNAMIC_OBJ = statictree.o
|
||||
|
||||
|
|
41
arch/x86/i8259.c
Normal file
41
arch/x86/i8259.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <arch/io.h>
|
||||
/* code taken from:
|
||||
!
|
||||
! setup.S Copyright (C) 1991, 1992 Linus Torvalds
|
||||
!
|
||||
! setup.s is responsible for getting the system data from the BIOS,
|
||||
! and putting them into the appropriate places in system memory.
|
||||
! both setup.s and system has been loaded by the bootblock.
|
||||
*/
|
||||
/* we're getting screwed again and again by this problem of the 8259.
|
||||
* so we're going to leave this lying around for inclusion into
|
||||
* crt0.S on an as-needed basis.
|
||||
! well, that went ok, I hope. Now we have to reprogram the interrupts :-(
|
||||
! we put them right after the intel-reserved hardware interrupts, at
|
||||
! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really
|
||||
! messed this up with the original PC, and they haven't been able to
|
||||
! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f,
|
||||
! which is used for the internal hardware interrupts as well. We just
|
||||
! have to reprogram the 8259's, and it isn't fun.
|
||||
*/
|
||||
|
||||
void setup_i8259(void)
|
||||
{
|
||||
outb(0x11, 0x20); /*! initialization sequence to 8259A-1*/
|
||||
outb(0x11, 0xA0); /*! and to 8259A-2*/
|
||||
outb(0x20, 0x21); /*! start of hardware int's (0x20)*/
|
||||
outb(0x28, 0xA1); /*! start of hardware int's 2 (0x28)*/
|
||||
outb(0x04, 0x21); /*! 8259-1 is master*/
|
||||
outb(0x02, 0xA1); /*! 8259-2 is slave*/
|
||||
outb(0x01, 0x21); /*! 8086 mode for both*/
|
||||
outb(0x01, 0xA1);
|
||||
outb(0xFF, 0xA1); /*! mask off all interrupts for now*/
|
||||
outb(0xFB, 0x21); /*! mask all irq's but irq2 which is cascaded*/
|
||||
}
|
||||
|
||||
/*
|
||||
* I like the way Linus says it:
|
||||
! Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
|
||||
! need no steenking BIOS anyway (except for the initial loading :-).
|
||||
*/
|
||||
|
44
arch/x86/isa-dma.c
Normal file
44
arch/x86/isa-dma.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include <arch/io.h>
|
||||
#include <isa-dma.h>
|
||||
|
||||
/* DMA controller registers */
|
||||
#define DMA1_CMD_REG 0x08 /* command register (w) */
|
||||
#define DMA1_STAT_REG 0x08 /* status register (r) */
|
||||
#define DMA1_REQ_REG 0x09 /* request register (w) */
|
||||
#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
|
||||
#define DMA1_MODE_REG 0x0B /* mode register (w) */
|
||||
#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
|
||||
#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
|
||||
#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
|
||||
#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
|
||||
#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
|
||||
|
||||
#define DMA2_CMD_REG 0xD0 /* command register (w) */
|
||||
#define DMA2_STAT_REG 0xD0 /* status register (r) */
|
||||
#define DMA2_REQ_REG 0xD2 /* request register (w) */
|
||||
#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
|
||||
#define DMA2_MODE_REG 0xD6 /* mode register (w) */
|
||||
#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
|
||||
#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
|
||||
#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
|
||||
#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
|
||||
#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
|
||||
|
||||
#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
|
||||
#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
|
||||
#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
|
||||
|
||||
#define DMA_AUTOINIT 0x10
|
||||
|
||||
|
||||
void isa_dma_init(void)
|
||||
{
|
||||
/* slave at 0x00 - 0x0f */
|
||||
/* master at 0xc0 - 0xdf */
|
||||
/* 0x80 - 0x8f DMA page registers */
|
||||
/* DMA: 0x00, 0x02, 0x4, 0x06 base address for DMA channel */
|
||||
outb(0, DMA1_RESET_REG);
|
||||
outb(0, DMA2_RESET_REG);
|
||||
outb(DMA_MODE_CASCADE, DMA2_MODE_REG);
|
||||
outb(0, DMA2_MASK_REG);
|
||||
}
|
79
arch/x86/keyboard.c
Normal file
79
arch/x86/keyboard.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
#include <console/console.h>
|
||||
#include <keyboard.h>
|
||||
#include <device/device.h>
|
||||
#include <arch/io.h>
|
||||
|
||||
static int kbd_empty_input_buffer(void)
|
||||
{
|
||||
unsigned long timeout;
|
||||
for(timeout = 1000000; timeout && (inb(0x64) & 0x02); timeout--) {
|
||||
post_code(0);
|
||||
}
|
||||
return !!timeout;
|
||||
}
|
||||
|
||||
static int kbd_empty_output_buffer(void)
|
||||
{
|
||||
unsigned long timeout;
|
||||
for(timeout = 1000000; timeout && ((inb(0x64) & 0x01) == 0); timeout--) {
|
||||
post_code(0);
|
||||
}
|
||||
return !!timeout;
|
||||
}
|
||||
|
||||
/* much better keyboard init courtesy ollie@sis.com.tw
|
||||
TODO: Typematic Setting, the keyboard is too slow for me */
|
||||
static void pc_keyboard_init(struct pc_keyboard *keyboard)
|
||||
{
|
||||
unsigned char regval;
|
||||
|
||||
/* send cmd = 0xAA, self test 8042 */
|
||||
outb(0xaa, 0x64);
|
||||
|
||||
/* empty input buffer or any other command/data will be lost */
|
||||
if (!kbd_empty_input_buffer()) {
|
||||
printk(BIOS_ERR, "Keyboard input buffer would not empty\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* empty output buffer or any other command/data will be lost */
|
||||
if (!kbd_empty_output_buffer()) {
|
||||
printk(BIOS_ERR, "Keyboard output buffer would not empty\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* read self-test result, 0x55 should be returned form 0x60 */
|
||||
if ((regval = inb(0x60) != 0x55))
|
||||
return;
|
||||
|
||||
/* enable keyboard interface */
|
||||
outb(0x60, 0x64);
|
||||
kbd_empty_input_buffer();
|
||||
|
||||
/* send cmd: enable IRQ 1 */
|
||||
outb(0x61, 0x60);
|
||||
kbd_empty_input_buffer();
|
||||
|
||||
/* reset kerboard and self test (keyboard side) */
|
||||
outb(0xff, 0x60);
|
||||
|
||||
/* empty inut bufferm or any other command/data will be lost */
|
||||
kbd_empty_input_buffer();
|
||||
|
||||
/* empty output buffer or any other command/data will be lost */
|
||||
kbd_empty_output_buffer();
|
||||
|
||||
if ((regval = inb(0x60) != 0xfa))
|
||||
return;
|
||||
|
||||
kbd_empty_output_buffer();
|
||||
if ((regval = inb(0x60) != 0xaa))
|
||||
return;
|
||||
}
|
||||
|
||||
void init_pc_keyboard(unsigned int port0, unsigned int port1, struct pc_keyboard *kbd)
|
||||
{
|
||||
if ((port0 == 0x60) && (port1 == 0x64)) {
|
||||
pc_keyboard_init(kbd);
|
||||
}
|
||||
}
|
|
@ -110,6 +110,9 @@ gdt16xend:
|
|||
*/
|
||||
.align 4
|
||||
.globl gdtptr
|
||||
.globl gdt_limit
|
||||
gdt_limit = gdt_end - gdt - 1 /* compute the table limit */
|
||||
|
||||
gdt:
|
||||
gdtptr:
|
||||
.word gdt_end - gdt -1 /* compute the table limit */
|
||||
|
|
|
@ -25,5 +25,6 @@ $(obj)/device/%.o: $(src)/device/%.c
|
|||
$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
|
||||
|
||||
STAGE2_DEVICE_OBJ = device.o device_util.o root_device.o \
|
||||
pci_device.o pci_ops.o pci_rom.o
|
||||
pci_device.o pci_ops.o pci_rom.o \
|
||||
pnp_device.o
|
||||
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/*
|
||||
* Author(s) unknown
|
||||
* Copyright (C) 2003 Linux Networx
|
||||
*
|
||||
*
|
||||
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
|
||||
* 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 <console/console.h>
|
||||
#include <arch/io.h>
|
||||
#include <device/device.h>
|
||||
|
|
|
@ -659,8 +659,10 @@ void pci_dev_init(struct device *dev)
|
|||
// #warning "Need to set up CONFIG_PCI_ROM_RUN"
|
||||
#if CONFIG_PCI_ROM_RUN == 1
|
||||
void run_bios(struct device * dev, unsigned long addr);
|
||||
void do_vgabios(void);
|
||||
struct rom_header *rom, *ram;
|
||||
|
||||
printk(BIOS_INFO, "Probing for option rom\n");
|
||||
rom = pci_rom_probe(dev);
|
||||
if (rom == NULL)
|
||||
return;
|
||||
|
@ -668,7 +670,10 @@ void pci_dev_init(struct device *dev)
|
|||
if (ram == NULL)
|
||||
return;
|
||||
|
||||
run_bios(dev, ram);
|
||||
//run_bios(dev, ram);
|
||||
//void do_vgabios(void)
|
||||
//
|
||||
do_vgabios();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include <device/pci_ops.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CONFIG_CONSOLE_VGA 1
|
||||
#define CONFIG_CONSOLE_VGA_MULTI 0
|
||||
|
||||
struct rom_header * pci_rom_probe(struct device *dev)
|
||||
{
|
||||
unsigned long rom_address;
|
||||
|
@ -80,10 +83,15 @@ struct rom_header * pci_rom_probe(struct device *dev)
|
|||
|
||||
static void *pci_ram_image_start = (void *)PCI_RAM_IMAGE_START;
|
||||
|
||||
#ifndef GO_AWAY
|
||||
int vga_inited;
|
||||
struct device *vga_pri;
|
||||
#endif
|
||||
|
||||
#if CONFIG_CONSOLE_VGA == 1
|
||||
extern int vga_inited; // defined in vga_console.c
|
||||
#if CONFIG_CONSOLE_VGA_MULTI == 0
|
||||
extern device_t vga_pri; // the primary vga device, defined in device.c
|
||||
extern struct device *vga_pri; // the primary vga device, defined in device.c
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -109,11 +117,11 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade
|
|||
if (PCI_CLASS_DISPLAY_VGA == rom_data->class_hi) {
|
||||
#if CONFIG_CONSOLE_VGA == 1
|
||||
#if CONFIG_CONSOLE_VGA_MULTI == 0
|
||||
if (dev != vga_pri) return NULL; // only one VGA supported
|
||||
//if (dev != vga_pri) return NULL; // only one VGA supported
|
||||
#endif
|
||||
printk(BIOS_DEBUG, "Copying VGA ROM image from 0x%x to 0x%x, 0x%x bytes\n",
|
||||
rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);
|
||||
memcpy(PCI_VGA_RAM_IMAGE_START, rom_header, rom_size);
|
||||
memcpy((void *)PCI_VGA_RAM_IMAGE_START, rom_header, rom_size);
|
||||
vga_inited = 1;
|
||||
return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START);
|
||||
#endif
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/*
|
||||
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
|
||||
|
||||
*/
|
||||
* 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
|
||||
*/
|
||||
/* Copyright 2004 Linux Networx */
|
||||
|
||||
#include <arch/types.h>
|
||||
#include <console/console.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <bitops.h>
|
||||
//#include <stdint.h>
|
||||
//#include <bitops.h>
|
||||
#include <string.h>
|
||||
#include <arch/io.h>
|
||||
#include <device/device.h>
|
||||
|
@ -27,47 +27,47 @@
|
|||
|
||||
/* PNP fundamental operations */
|
||||
|
||||
void pnp_write_config(device_t dev, u8 reg, u8 value)
|
||||
void pnp_write_config(struct device * dev, u8 reg, u8 value)
|
||||
{
|
||||
outb(reg, dev->path.u.pnp.port);
|
||||
outb(value, dev->path.u.pnp.port + 1);
|
||||
}
|
||||
|
||||
u8 pnp_read_config(device_t dev, u8 reg)
|
||||
u8 pnp_read_config(struct device * dev, u8 reg)
|
||||
{
|
||||
outb(reg, dev->path.u.pnp.port);
|
||||
return inb(dev->path.u.pnp.port + 1);
|
||||
}
|
||||
|
||||
void pnp_set_logical_device(device_t dev)
|
||||
void pnp_set_logical_device(struct device * dev)
|
||||
{
|
||||
pnp_write_config(dev, 0x07, dev->path.u.pnp.device);
|
||||
}
|
||||
|
||||
void pnp_set_enable(device_t dev, int enable)
|
||||
void pnp_set_enable(struct device * dev, int enable)
|
||||
{
|
||||
pnp_write_config(dev, 0x30, enable?0x1:0x0);
|
||||
}
|
||||
|
||||
int pnp_read_enable(device_t dev)
|
||||
int pnp_read_enable(struct device * dev)
|
||||
{
|
||||
return !!pnp_read_config(dev, 0x30);
|
||||
}
|
||||
|
||||
void pnp_set_iobase(device_t dev, unsigned index, unsigned iobase)
|
||||
void pnp_set_iobase(struct device * dev, unsigned index, unsigned iobase)
|
||||
{
|
||||
/* Index == 0x60 or 0x62 */
|
||||
pnp_write_config(dev, index + 0, (iobase >> 8) & 0xff);
|
||||
pnp_write_config(dev, index + 1, iobase & 0xff);
|
||||
}
|
||||
|
||||
void pnp_set_irq(device_t dev, unsigned index, unsigned irq)
|
||||
void pnp_set_irq(struct device * dev, unsigned index, unsigned irq)
|
||||
{
|
||||
/* Index == 0x70 or 0x72 */
|
||||
pnp_write_config(dev, index, irq);
|
||||
}
|
||||
|
||||
void pnp_set_drq(device_t dev, unsigned index, unsigned drq)
|
||||
void pnp_set_drq(struct device * dev, unsigned index, unsigned drq)
|
||||
{
|
||||
/* Index == 0x74 */
|
||||
pnp_write_config(dev, index, drq & 0xff);
|
||||
|
@ -75,15 +75,15 @@ void pnp_set_drq(device_t dev, unsigned index, unsigned drq)
|
|||
|
||||
/* PNP device operations */
|
||||
|
||||
void pnp_read_resources(device_t dev)
|
||||
void pnp_read_resources(struct device * dev)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static void pnp_set_resource(device_t dev, struct resource *resource)
|
||||
static void pnp_set_resource(struct device * dev, struct resource *resource)
|
||||
{
|
||||
if (!(resource->flags & IORESOURCE_ASSIGNED)) {
|
||||
printk_err("ERROR: %s %02x %s size: 0x%010Lx not assigned\n",
|
||||
printk(BIOS_ERR, "ERROR: %s %02x %s size: 0x%010Lx not assigned\n",
|
||||
dev_path(dev), resource->index,
|
||||
resource_type(resource),
|
||||
resource->size);
|
||||
|
@ -101,7 +101,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource)
|
|||
pnp_set_irq(dev, resource->index, resource->base);
|
||||
}
|
||||
else {
|
||||
printk_err("ERROR: %s %02x unknown resource type\n",
|
||||
printk(BIOS_ERR, "ERROR: %s %02x unknown resource type\n",
|
||||
dev_path(dev), resource->index);
|
||||
return;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource)
|
|||
report_resource_stored(dev, resource, "");
|
||||
}
|
||||
|
||||
void pnp_set_resources(device_t dev)
|
||||
void pnp_set_resources(struct device * dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -123,13 +123,13 @@ void pnp_set_resources(device_t dev)
|
|||
}
|
||||
}
|
||||
|
||||
void pnp_enable_resources(device_t dev)
|
||||
void pnp_enable_resources(struct device * dev)
|
||||
{
|
||||
pnp_set_logical_device(dev);
|
||||
pnp_set_enable(dev, 1);
|
||||
}
|
||||
|
||||
void pnp_enable(device_t dev)
|
||||
void pnp_enable(struct device * dev)
|
||||
{
|
||||
if (!dev->enabled) {
|
||||
pnp_set_logical_device(dev);
|
||||
|
@ -138,15 +138,16 @@ void pnp_enable(device_t dev)
|
|||
}
|
||||
|
||||
struct device_operations pnp_ops = {
|
||||
.read_resources = pnp_read_resources,
|
||||
.set_resources = pnp_set_resources,
|
||||
.enable_resources = pnp_enable_resources,
|
||||
.enable = pnp_enable,
|
||||
.phase4_read_resources = pnp_read_resources,
|
||||
.phase4_set_resources = pnp_set_resources,
|
||||
.phase5_enable_resources = pnp_enable_resources,
|
||||
//.enable = pnp_enable,
|
||||
// FIXME
|
||||
};
|
||||
|
||||
/* PNP chip operations */
|
||||
|
||||
static void pnp_get_ioresource(device_t dev, unsigned index, struct io_info *info)
|
||||
static void pnp_get_ioresource(struct device * dev, unsigned index, struct io_info *info)
|
||||
{
|
||||
struct resource *resource;
|
||||
unsigned moving, gran, step;
|
||||
|
@ -185,7 +186,7 @@ static void pnp_get_ioresource(device_t dev, unsigned index, struct io_info *inf
|
|||
resource->size = 1 << gran;
|
||||
}
|
||||
|
||||
static void get_resources(device_t dev, struct pnp_info *info)
|
||||
static void get_resources(struct device * dev, struct pnp_info *info)
|
||||
{
|
||||
struct resource *resource;
|
||||
|
||||
|
@ -223,11 +224,12 @@ static void get_resources(device_t dev, struct pnp_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
void pnp_enable_devices(device_t base_dev, struct device_operations *ops,
|
||||
void pnp_enable_devices(struct device * base_dev, struct device_operations *ops,
|
||||
unsigned functions, struct pnp_info *info)
|
||||
{
|
||||
struct device_path path;
|
||||
device_t dev;
|
||||
struct device_id id = {.type = DEVICE_ID_PNP};
|
||||
struct device * dev;
|
||||
int i;
|
||||
|
||||
path.type = DEVICE_PATH_PNP;
|
||||
|
@ -236,7 +238,7 @@ void pnp_enable_devices(device_t base_dev, struct device_operations *ops,
|
|||
/* Setup the ops and resources on the newly allocated devices */
|
||||
for(i = 0; i < functions; i++) {
|
||||
path.u.pnp.device = info[i].function;
|
||||
dev = alloc_find_dev(base_dev->bus, &path);
|
||||
dev = alloc_find_dev(base_dev->bus, &path, &id);
|
||||
|
||||
/* Don't initialize a device multiple times */
|
||||
if (dev->ops)
|
||||
|
|
|
@ -1,43 +1,46 @@
|
|||
/*
|
||||
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
|
||||
* Copyright (C) FIXME
|
||||
* 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
|
||||
*/
|
||||
|
||||
*/
|
||||
#ifndef DEVICE_PNP_H
|
||||
#define DEVICE_PNP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arch/types.h>
|
||||
#include <device/device.h>
|
||||
#include <device/pnp_def.h>
|
||||
|
||||
/* Primitive pnp resource manipulation */
|
||||
void pnp_write_config(device_t dev, u8 reg, u8 value);
|
||||
u8 pnp_read_config(device_t dev, u8 reg);
|
||||
void pnp_set_logical_device(device_t dev);
|
||||
void pnp_set_enable(device_t dev, int enable);
|
||||
int pnp_read_enable(device_t dev);
|
||||
void pnp_set_iobase(device_t dev, unsigned index, unsigned iobase);
|
||||
void pnp_set_irq(device_t dev, unsigned index, unsigned irq);
|
||||
void pnp_set_drq(device_t dev, unsigned index, unsigned drq);
|
||||
void pnp_write_config(struct device * dev, u8 reg, u8 value);
|
||||
u8 pnp_read_config(struct device * dev, u8 reg);
|
||||
void pnp_set_logical_device(struct device * dev);
|
||||
void pnp_set_enable(struct device * dev, int enable);
|
||||
int pnp_read_enable(struct device * dev);
|
||||
void pnp_set_iobase(struct device * dev, unsigned index, unsigned iobase);
|
||||
void pnp_set_irq(struct device * dev, unsigned index, unsigned irq);
|
||||
void pnp_set_drq(struct device * dev, unsigned index, unsigned drq);
|
||||
|
||||
/* PNP device operations */
|
||||
void pnp_read_resources(device_t dev);
|
||||
void pnp_set_resources(device_t dev);
|
||||
void pnp_enable_resources(device_t dev);
|
||||
void pnp_enable(device_t dev);
|
||||
void pnp_read_resources(struct device * dev);
|
||||
void pnp_set_resources(struct device * dev);
|
||||
void pnp_enable_resources(struct device * dev);
|
||||
void pnp_enable(struct device * dev);
|
||||
|
||||
struct device_operations pnp_ops;
|
||||
extern struct device_operations pnp_ops;
|
||||
|
||||
/* PNP helper operations */
|
||||
|
||||
|
@ -59,7 +62,7 @@ struct pnp_info {
|
|||
#define PNP_DRQ1 0x80
|
||||
struct io_info io0, io1, io2, io3;
|
||||
};
|
||||
struct resource *pnp_get_resource(device_t dev, unsigned index);
|
||||
struct resource *pnp_get_resource(struct device * dev, unsigned index);
|
||||
void pnp_enable_devices(struct device *dev, struct device_operations *ops,
|
||||
unsigned functions, struct pnp_info *info);
|
||||
|
||||
|
|
27
include/isa-dma.h
Normal file
27
include/isa-dma.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* This file is part of the LinuxBIOS project.
|
||||
*
|
||||
* Copyright (C) 2007 Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __ISA_DMA_H
|
||||
#define __ISA_DMA_H
|
||||
|
||||
/* This function is called in the southbridge code */
|
||||
void isa_dma_init(void);
|
||||
|
||||
#endif
|
||||
|
34
include/keyboard.h
Normal file
34
include/keyboard.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This file is part of the LinuxBIOS project.
|
||||
*
|
||||
* Copyright (C) 2007 Stefan Reinauer <stepan@coresystems.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __KEYBOARD_H
|
||||
#define __KEYBOARD_H 1
|
||||
|
||||
struct pc_keyboard {
|
||||
// this structure should contain typematic settings, but LinuxBIOS
|
||||
// does not care yet.
|
||||
};
|
||||
|
||||
/* This function is called in the SuperIO code */
|
||||
void init_pc_keyboard(unsigned int port0, unsigned int port1, struct pc_keyboard *kbd);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -6,6 +6,9 @@ config BOARD_EMULATION_QEMU_X86
|
|||
bool "x86 QEMU"
|
||||
select ARCH_X86
|
||||
select CAR_TYPE_I586
|
||||
select NORTHBRIDGE_INTEL_I440BXEMULATION
|
||||
select SOUTHBRIDGE_INTEL_I82371EB
|
||||
select SUPERIO_WINBOND_W83627HF
|
||||
help
|
||||
x86 QEMU variant.
|
||||
|
||||
|
|
|
@ -60,10 +60,6 @@ $(obj)/mainboard/$(MAINBOARDDIR)/statictree.c: $(src)/mainboard/$(MAINBOARDDIR)/
|
|||
$(Q)printf " DTC $(subst $(shell pwd)/,,$(@))\n"
|
||||
$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts > $@
|
||||
|
||||
STAGE2_MAINBOARD_OBJ = mainboard.o
|
||||
STAGE2_MAINBOARD_OBJ = mainboard.o vga.o
|
||||
STAGE2_CHIPSET_OBJ =
|
||||
|
||||
# chipset
|
||||
include $(src)/northbridge/intel/i440bxemulation/Makefile
|
||||
include $(src)/southbridge/intel/i82371eb/Makefile
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
%%
|
||||
|
||||
#include <southbridge/intel/i82371eb/config.h>
|
||||
extern struct constructor qemuvga_constructors[];
|
||||
|
||||
struct mainboard_emulation_qemu_x86_config root = {
|
||||
.nothing = 1,
|
||||
|
@ -55,5 +56,5 @@ struct northbridge_intel_i440bx_config domain0 = {
|
|||
};
|
||||
|
||||
struct constructor *all_constructors[] ={
|
||||
i440bx_constructors, i82371eb_constructors, 0
|
||||
i440bx_constructors, i82371eb_constructors, qemuvga_constructors, 0
|
||||
};
|
||||
|
|
59
mainboard/emulation/qemu-x86/vga.c
Normal file
59
mainboard/emulation/qemu-x86/vga.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* This file is part of the LinuxBIOS 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
|
||||
*/
|
||||
|
||||
#include <console/console.h>
|
||||
#include <stdint.h>
|
||||
#include <device/device.h>
|
||||
#include <device/pci.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <keyboard.h>
|
||||
#include "config.h"
|
||||
|
||||
static void setup_onboard(struct device *dev)
|
||||
{
|
||||
struct pc_keyboard conf;
|
||||
printk(BIOS_INFO, "Init VGA device\n");
|
||||
dev->on_mainboard=1;
|
||||
dev->rom_address=0xc0000;
|
||||
|
||||
// FIXME - this should be in superio some day
|
||||
// but since qemu has no superio.
|
||||
init_pc_keyboard(0x60, 0x64, &conf);
|
||||
}
|
||||
|
||||
|
||||
static struct device_operations qemuvga_pci_ops_dev = {
|
||||
.constructor = default_device_constructor,
|
||||
.phase3_scan = 0,
|
||||
.phase4_read_resources = pci_dev_read_resources,
|
||||
.phase4_set_resources = pci_dev_set_resources,
|
||||
.phase4_enable_disable = setup_onboard,
|
||||
.phase5_enable_resources = pci_dev_enable_resources,
|
||||
.phase6_init = pci_dev_init,
|
||||
.ops_pci = &pci_dev_ops_pci,
|
||||
};
|
||||
|
||||
struct constructor qemuvga_constructors[] = {
|
||||
{.id = {.type = DEVICE_ID_PCI,
|
||||
.u = {.pci = {.vendor = 0x1013,.device = 0x00b8}}},
|
||||
&qemuvga_pci_ops_dev},
|
||||
{.ops = 0},
|
||||
};
|
23
northbridge/Kconfig
Normal file
23
northbridge/Kconfig
Normal file
|
@ -0,0 +1,23 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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
|
||||
##
|
||||
|
||||
source northbridge/intel/Kconfig
|
||||
|
23
northbridge/Makefile
Normal file
23
northbridge/Makefile
Normal file
|
@ -0,0 +1,23 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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 $(src)/northbridge/intel/Makefile
|
||||
|
28
northbridge/intel/Kconfig
Normal file
28
northbridge/intel/Kconfig
Normal file
|
@ -0,0 +1,28 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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
|
||||
##
|
||||
|
||||
config NORTHBRIDGE_INTEL_I440BXEMULATION
|
||||
boolean
|
||||
help
|
||||
This option is internally used to decide which northbridge code to
|
||||
use. It is set in the mainboard Kconfig
|
||||
|
||||
|
25
northbridge/intel/Makefile
Normal file
25
northbridge/intel/Makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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
|
||||
##
|
||||
|
||||
ifdef CONFIG_NORTHBRIDGE_INTEL_I440BXEMULATION
|
||||
include $(src)/northbridge/intel/i440bxemulation/Makefile
|
||||
endif
|
||||
|
|
@ -19,9 +19,10 @@
|
|||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
$(obj)/i440bx.o: $(src)/northbridge/intel/i440bxemulation/i440bx.c
|
||||
STAGE2_CHIPSET_OBJ += $(obj)/northbridge/intel/i440bxemulation/i440bx.o
|
||||
|
||||
$(obj)/northbridge/intel/i440bxemulation/%.o: $(src)/northbridge/intel/i440bxemulation/%.c
|
||||
$(Q)mkdir -p $(obj)/northbridge/intel/i440bxemulation
|
||||
$(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n"
|
||||
$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
|
||||
|
||||
STAGE2_CHIPSET_OBJ += $(obj)/i440bx.o
|
||||
|
||||
|
|
23
southbridge/Kconfig
Normal file
23
southbridge/Kconfig
Normal file
|
@ -0,0 +1,23 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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
|
||||
##
|
||||
|
||||
source southbridge/intel/Kconfig
|
||||
|
23
southbridge/Makefile
Normal file
23
southbridge/Makefile
Normal file
|
@ -0,0 +1,23 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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 $(src)/southbridge/intel/Makefile
|
||||
|
27
southbridge/intel/Kconfig
Normal file
27
southbridge/intel/Kconfig
Normal file
|
@ -0,0 +1,27 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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
|
||||
##
|
||||
|
||||
config SOUTHBRIDGE_INTEL_I82371EB
|
||||
boolean
|
||||
help
|
||||
This option is internally used to decide which southbridge code to
|
||||
use. It is set in the mainboard Kconfig
|
||||
|
29
southbridge/intel/Makefile
Normal file
29
southbridge/intel/Makefile
Normal file
|
@ -0,0 +1,29 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2007 coresystems GmbH
|
||||
## Written by Stefan Reinauer <stepan@coresystems.de> for 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
|
||||
##
|
||||
|
||||
# one entry like the below for each supported intel southbridge
|
||||
|
||||
ifdef CONFIG_SOUTHBRIDGE_INTEL_I82371EB
|
||||
include $(src)/southbridge/intel/i82371eb/Makefile
|
||||
endif
|
||||
|
||||
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
X86EMU_OBJ = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o
|
||||
PCBIOS_OBJ = pcibios.o
|
||||
BIOSEMU_OBJ = biosemu.o
|
||||
BIOSEMU_OBJ = biosemu.o vm86.o
|
||||
|
||||
LIBX86EMU_OBJS = $(patsubst %,$(obj)/util/x86emu/x86emu/%,$(X86EMU_OBJ)) \
|
||||
$(patsubst %,$(obj)/util/x86emu/pcbios/%,$(PCBIOS_OBJ)) \
|
||||
|
|
|
@ -70,7 +70,7 @@ u32 getIntVect(int num)
|
|||
return MEM_RW(num << 2) + (MEM_RW((num << 2) + 2) << 4);
|
||||
}
|
||||
|
||||
/* FixME: There is already a push_word() in the emulator */
|
||||
/* FIXME: There is already a push_word() in the emulator */
|
||||
void pushw(u16 val)
|
||||
{
|
||||
X86_ESP -= 2;
|
||||
|
@ -97,8 +97,8 @@ u8 x_inb(u16 port)
|
|||
|
||||
val = inb(port);
|
||||
|
||||
//if (port != 0x40)
|
||||
// printk(BIOS_DEBUG,"inb(0x%04x) = 0x%02x\n", port, val);
|
||||
if (port != 0x40)
|
||||
printk("inb(0x%04x) = 0x%02x\n", port, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ u16 x_inw(u16 port)
|
|||
|
||||
val = inw(port);
|
||||
|
||||
//printk(BIOS_DEBUG,"inw(0x%04x) = 0x%04x\n", port, val);
|
||||
printk("inw(0x%04x) = 0x%04x\n", port, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -119,26 +119,26 @@ u32 x_inl(u16 port)
|
|||
|
||||
val = inl(port);
|
||||
|
||||
//printk(BIOS_DEBUG,"inl(0x%04x) = 0x%08x\n", port, val);
|
||||
printk("inl(0x%04x) = 0x%08x\n", port, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
void x_outb(u16 port, u8 val)
|
||||
{
|
||||
//if (port != 0x43)
|
||||
// printk(BIOS_DEBUG,"outb(0x%02x, 0x%04x)\n", val, port);
|
||||
if (port != 0x43)
|
||||
printk("outb(0x%02x, 0x%04x)\n", val, port);
|
||||
outb(val, port);
|
||||
}
|
||||
|
||||
void x_outw(u16 port, u16 val)
|
||||
{
|
||||
//printk(BIOS_DEBUG,"outw(0x%04x, 0x%04x)\n", val, port);
|
||||
printk("outw(0x%04x, 0x%04x)\n", val, port);
|
||||
outw(val, port);
|
||||
}
|
||||
|
||||
void x_outl(u16 port, u32 val)
|
||||
{
|
||||
//printk(BIOS_DEBUG,"outl(0x%08x, 0x%04x)\n", val, port);
|
||||
printk("outl(0x%08x, 0x%04x)\n", val, port);
|
||||
outl(val, port);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ void do_int(int num)
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
// printk(BIOS_DEBUG,"int%x vector at %x\n", num, getIntVect(num));
|
||||
printk("int%x vector at %x\n", num, getIntVect(num));
|
||||
|
||||
switch (num) {
|
||||
#ifndef _PC
|
||||
|
@ -316,6 +316,7 @@ void reset_int_vect(void)
|
|||
MEM_WW((0x6D << 2) + 2, SYS_BIOS >> 4);
|
||||
}
|
||||
#endif
|
||||
|
||||
void run_bios(struct device * dev, unsigned long addr)
|
||||
{
|
||||
#if 1
|
||||
|
@ -367,10 +368,13 @@ void run_bios(struct device * dev, unsigned long addr)
|
|||
pushw(X86_SS);
|
||||
pushw(X86_SP + 2);
|
||||
|
||||
// X86EMU_trace_on();
|
||||
#ifndef NO_TRACE
|
||||
//X86EMU_trace_on();
|
||||
#endif
|
||||
|
||||
printk("entering emulator\n");
|
||||
|
||||
X86EMU_exec();
|
||||
printk("exited emulator\n");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@
|
|||
#include <arch/io.h>
|
||||
//#include <printk.h>
|
||||
#include <string.h>
|
||||
#include "vgachip.h"
|
||||
//#include "vgachip.h"
|
||||
/* Declare a temporary global descriptor table - necessary because the
|
||||
Core part of the bios no longer sets up any 16 bit segments */
|
||||
__asm__ (
|
||||
/* pointer to original gdt */
|
||||
"gdtarg: \n"
|
||||
" .word gdt_limit \n"
|
||||
" .long gdt \n"
|
||||
" .long gdtptr \n"
|
||||
|
||||
/* compute the table limit */
|
||||
"__mygdt_limit = __mygdt_end - __mygdt - 1 \n"
|
||||
|
@ -75,6 +75,15 @@ __asm__ (
|
|||
" .byte 0, 0x92, 0, 0 \n"
|
||||
|
||||
"__mygdt_end: \n"
|
||||
|
||||
"idtarg:\n"
|
||||
" .word _idt_end - _idt - 1\n" /* limit */
|
||||
" .long _idt\n"
|
||||
" .word 0\n"
|
||||
"_idt:\n"
|
||||
" .fill 20, 8, 0\n" // # idt is unitiailzed
|
||||
"_idt_end:\n"
|
||||
|
||||
);
|
||||
|
||||
/* Declare a pointer to where our idt is going to be i.e. at mem zero */
|
||||
|
@ -290,7 +299,7 @@ void vga_enable_console()
|
|||
|
||||
void do_vgabios(void)
|
||||
{
|
||||
device_t dev;
|
||||
struct device *dev;
|
||||
unsigned long busdevfn;
|
||||
unsigned int rom = 0;
|
||||
unsigned char *buf;
|
||||
|
@ -305,35 +314,36 @@ void do_vgabios(void)
|
|||
dev = dev_find_class(PCI_CLASS_DISPLAY_VGA<<8 , 0);
|
||||
|
||||
if (!dev) {
|
||||
printk_debug("NO VGA FOUND\n");
|
||||
printk(BIOS_DEBUG, "NO VGA FOUND\n");
|
||||
return;
|
||||
}
|
||||
printk_debug("found VGA: vid=%x, did=%x\n", dev->vendor, dev->device);
|
||||
printk(BIOS_DEBUG,"found VGA: vid=%x, did=%x\n", dev->vendor, dev->device);
|
||||
|
||||
/* declare rom address here - keep any config data out of the way
|
||||
* of core LXB stuff */
|
||||
|
||||
rom = 0xfffc0000;
|
||||
#warning fix rom address
|
||||
rom = 0xc0000;
|
||||
pci_write_config32(dev, PCI_ROM_ADDRESS, rom|1);
|
||||
printk_debug("rom base, size: %x\n", rom);
|
||||
printk(BIOS_DEBUG, "rom base, size: %x\n", rom);
|
||||
|
||||
buf = (unsigned char *) rom;
|
||||
if ((buf[0] == 0x55) && (buf[1] == 0xaa)) {
|
||||
memcpy((void *) 0xc0000, buf, size);
|
||||
|
||||
write_protect_vgabios(); // in northbridge
|
||||
#warning Implement write_protect_vgabios()
|
||||
//write_protect_vgabios(); // in northbridge
|
||||
|
||||
// check signature again
|
||||
buf = (unsigned char *) 0xc0000;
|
||||
if (buf[0]==0x55 && buf[1]==0xAA) {
|
||||
busdevfn = (dev->bus->secondary << 8) | dev->path.u.pci.devfn;
|
||||
printk_debug("bus/devfn = %#x\n", busdevfn);
|
||||
printk(BIOS_DEBUG, "bus/devfn = %#x\n", busdevfn);
|
||||
|
||||
real_mode_switch_call_vga(busdevfn);
|
||||
} else
|
||||
printk_debug("Failed to copy VGA BIOS to 0xc0000\n");
|
||||
printk(BIOS_DEBUG, "Failed to copy VGA BIOS to 0xc0000\n");
|
||||
} else
|
||||
printk_debug("BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]);
|
||||
printk(BIOS_DEBUG, "BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]);
|
||||
|
||||
pci_write_config32(dev, PCI_ROM_ADDRESS, 0);
|
||||
}
|
||||
|
@ -518,28 +528,28 @@ int biosint(unsigned long intnumber,
|
|||
cs = cs_ip >> 16;
|
||||
flags = stackflags;
|
||||
|
||||
printk_debug("biosint: INT# 0x%lx\n", intnumber);
|
||||
printk_debug("biosint: eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n",
|
||||
printk(BIOS_DEBUG, "biosint: INT# 0x%lx\n", intnumber);
|
||||
printk(BIOS_DEBUG, "biosint: eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n",
|
||||
eax, ebx, ecx, edx);
|
||||
printk_debug("biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n",
|
||||
printk(BIOS_DEBUG, "biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n",
|
||||
ebp, esp, edi, esi);
|
||||
printk_debug("biosint: ip 0x%x cs 0x%x flags 0x%x\n",
|
||||
printk(BIOS_DEBUG, "biosint: ip 0x%x cs 0x%x flags 0x%x\n",
|
||||
ip, cs, flags);
|
||||
|
||||
// cases in a good compiler are just as good as your own tables.
|
||||
switch (intnumber) {
|
||||
case 0 ... 15:
|
||||
// These are not BIOS service, but the CPU-generated exceptions
|
||||
printk_info("biosint: Oops, exception %u\n", intnumber);
|
||||
printk(BIOS_INFO, "biosint: Oops, exception %u\n", intnumber);
|
||||
if (esp < 0x1000) {
|
||||
printk_debug("Stack contents: ");
|
||||
printk(BIOS_DEBUG, "Stack contents: ");
|
||||
while (esp < 0x1000) {
|
||||
printk_debug("0x%04x ", *(unsigned short *) esp);
|
||||
printk(BIOS_DEBUG, "0x%04x ", *(unsigned short *) esp);
|
||||
esp += 2;
|
||||
}
|
||||
printk_debug("\n");
|
||||
printk(BIOS_DEBUG, "\n");
|
||||
}
|
||||
printk_debug("biosint: Bailing out\n");
|
||||
printk(BIOS_DEBUG, "biosint: Bailing out\n");
|
||||
// "longjmp"
|
||||
vga_exit();
|
||||
break;
|
||||
|
@ -558,7 +568,7 @@ int biosint(unsigned long intnumber,
|
|||
&ebx, &edx, &ecx, &eax, &flags);
|
||||
break;
|
||||
default:
|
||||
printk_info("BIOSINT: Unsupport int #0x%x\n",
|
||||
printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%x\n",
|
||||
intnumber);
|
||||
break;
|
||||
}
|
||||
|
@ -614,7 +624,7 @@ void setup_realmode_idt(void)
|
|||
TF bit is set upon call to real mode */
|
||||
idts[1].cs = 0;
|
||||
idts[1].offset = 16384;
|
||||
memcpy(16384, &debughandle, &end_debughandle - &debughandle);
|
||||
memcpy((void *)16384, &debughandle, &end_debughandle - &debughandle);
|
||||
|
||||
|
||||
}
|
||||
|
@ -658,7 +668,7 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
|
|||
unsigned short devid, vendorid, devfn;
|
||||
short devindex; /* Use short to get rid of gabage in upper half of 32-bit register */
|
||||
unsigned char bus;
|
||||
device_t dev;
|
||||
struct device *dev;
|
||||
|
||||
switch(func) {
|
||||
case CHECK:
|
||||
|
@ -684,7 +694,7 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
|
|||
// devfn is an int, so we mask it off.
|
||||
busdevfn = (dev->bus->secondary << 8)
|
||||
| (dev->path.u.pci.devfn & 0xff);
|
||||
printk_debug("0x%x: return 0x%x\n", func, busdevfn);
|
||||
printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn);
|
||||
*pebx = busdevfn;
|
||||
retval = 0;
|
||||
} else {
|
||||
|
@ -710,7 +720,7 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
|
|||
reg = *pedi;
|
||||
dev = dev_find_slot(bus, devfn);
|
||||
if (! dev) {
|
||||
printk_debug("0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
|
||||
printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
|
||||
// idiots. the pcibios guys assumed you'd never pass a bad bus/devfn!
|
||||
*peax = PCIBIOS_BADREG;
|
||||
retval = -1;
|
||||
|
@ -744,14 +754,14 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp,
|
|||
|
||||
if (retval)
|
||||
retval = PCIBIOS_BADREG;
|
||||
printk_debug("0x%x: bus %d devfn 0x%x reg 0x%x val 0x%lx\n",
|
||||
printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%lx\n",
|
||||
func, bus, devfn, reg, *pecx);
|
||||
*peax = 0;
|
||||
retval = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printk_err("UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func);
|
||||
printk(BIOS_ERR, "UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue