diff options
author | Stefan Reinauer <stepan@openbios.org> | 2004-06-28 12:04:06 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2004-06-28 12:04:06 +0000 |
commit | f2065a4cf9d8a66f237dfb0f7502b19f89a852c9 (patch) | |
tree | 75d88b8591372c99fa351e3f51e65bef63c2f3a7 /src/drivers/emulation/qemu/init.c | |
parent | e2b53e14327ea01dff9291815b10709b74b661f2 (diff) |
add qemu graphics card initialization driver
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1612 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/drivers/emulation/qemu/init.c')
-rw-r--r-- | src/drivers/emulation/qemu/init.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/drivers/emulation/qemu/init.c b/src/drivers/emulation/qemu/init.c new file mode 100644 index 0000000000..88fa5aeb75 --- /dev/null +++ b/src/drivers/emulation/qemu/init.c @@ -0,0 +1,90 @@ +#include <delay.h> +#include <stdlib.h> +#include <string.h> +#include <arch/io.h> + +#include <console/console.h> +#include <device/device.h> +#include <device/pci.h> +#include <device/pci_ids.h> +#include <device/pci_ops.h> + +#if CONFIG_CONSOLE_BTEXT==1 + +#define PLL_CRTC_DECODE 0 +#define SUPPORT_8_BPP_ABOVE 0 + +#include "fb.h" +#include "fbcon.h" + +#include <console/btext.h> + +#endif /*CONFIG_CONSOLE_BTEXT*/ + + +/* VGA init. We use the Bochs VESA VBE extensions */ +#define VBE_DISPI_INDEX_ID 0x0 +#define VBE_DISPI_INDEX_XRES 0x1 +#define VBE_DISPI_INDEX_YRES 0x2 +#define VBE_DISPI_INDEX_BPP 0x3 +#define VBE_DISPI_INDEX_ENABLE 0x4 +#define VBE_DISPI_INDEX_BANK 0x5 +#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6 +#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7 +#define VBE_DISPI_INDEX_X_OFFSET 0x8 +#define VBE_DISPI_INDEX_Y_OFFSET 0x9 +#define VBE_DISPI_INDEX_NB 0xa + +#define VBE_DISPI_ID0 0xB0C0 +#define VBE_DISPI_ID1 0xB0C1 +#define VBE_DISPI_ID2 0xB0C2 + +#define VBE_DISPI_DISABLED 0x00 +#define VBE_DISPI_ENABLED 0x01 +#define VBE_DISPI_LFB_ENABLED 0x40 +#define VBE_DISPI_NOCLEARMEM 0x80 + +#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000 + +static void vbe_outw(int index, int val) +{ + outw(0x1ce, index); + outw(0x1cf, val); +} + +static void qemu_init(void) +{ + int width=640, height=480, depth=8; + + printk_debug("Initializing VGA!\n"); + + vbe_outw(VBE_DISPI_INDEX_XRES, width); + vbe_outw(VBE_DISPI_INDEX_YRES, height); + vbe_outw(VBE_DISPI_INDEX_BPP, depth); + vbe_outw(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED); + outb(0x3c0, 0x20); /* disable blanking */ +/* + vga_fb_phys_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS; + vga_fb_width = width; + vga_fb_height = height; + vga_fb_depth = depth; + vga_fb_bpp = (depth + 7) >> 3; + vga_fb_linesize = width * vga_fb_bpp; + */ +} + +static struct device_operations qemu_graph_ops = { + .read_resources = pci_dev_read_resources, + .set_resources = pci_dev_set_resources, + .enable_resources = pci_dev_enable_resources, + .init = qemu_init, + .scan_bus = 0, +}; + +static struct pci_driver qemu_graph_driver __pci_driver = { + .ops = &qemu_graph_ops, + .vendor = 0x1234, + .device = 0x1111, +}; + + |