blob: df22d4b453beb5f92ee40e06b66ccd05e4badfee [file] [log] [blame]
Stefan Reinauerf2065a42004-06-28 12:04:06 +00001#include <delay.h>
2#include <stdlib.h>
3#include <string.h>
4#include <arch/io.h>
5
6#include <console/console.h>
7#include <device/device.h>
8#include <device/pci.h>
9#include <device/pci_ids.h>
10#include <device/pci_ops.h>
11
12#if CONFIG_CONSOLE_BTEXT==1
13
14#define PLL_CRTC_DECODE 0
15#define SUPPORT_8_BPP_ABOVE 0
16
17#include "fb.h"
18#include "fbcon.h"
19
20#include <console/btext.h>
21
22#endif /*CONFIG_CONSOLE_BTEXT*/
23
24
25/* VGA init. We use the Bochs VESA VBE extensions */
26#define VBE_DISPI_INDEX_ID 0x0
27#define VBE_DISPI_INDEX_XRES 0x1
28#define VBE_DISPI_INDEX_YRES 0x2
29#define VBE_DISPI_INDEX_BPP 0x3
30#define VBE_DISPI_INDEX_ENABLE 0x4
31#define VBE_DISPI_INDEX_BANK 0x5
32#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
33#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
34#define VBE_DISPI_INDEX_X_OFFSET 0x8
35#define VBE_DISPI_INDEX_Y_OFFSET 0x9
36#define VBE_DISPI_INDEX_NB 0xa
37
38#define VBE_DISPI_ID0 0xB0C0
39#define VBE_DISPI_ID1 0xB0C1
40#define VBE_DISPI_ID2 0xB0C2
41
42#define VBE_DISPI_DISABLED 0x00
43#define VBE_DISPI_ENABLED 0x01
44#define VBE_DISPI_LFB_ENABLED 0x40
45#define VBE_DISPI_NOCLEARMEM 0x80
46
47#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
48
49static void vbe_outw(int index, int val)
50{
51 outw(0x1ce, index);
52 outw(0x1cf, val);
53}
54
55static void qemu_init(void)
56{
57 int width=640, height=480, depth=8;
58
59 printk_debug("Initializing VGA!\n");
60
61 vbe_outw(VBE_DISPI_INDEX_XRES, width);
62 vbe_outw(VBE_DISPI_INDEX_YRES, height);
63 vbe_outw(VBE_DISPI_INDEX_BPP, depth);
64 vbe_outw(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED);
65 outb(0x3c0, 0x20); /* disable blanking */
66/*
67 vga_fb_phys_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
68 vga_fb_width = width;
69 vga_fb_height = height;
70 vga_fb_depth = depth;
71 vga_fb_bpp = (depth + 7) >> 3;
72 vga_fb_linesize = width * vga_fb_bpp;
73 */
74}
75
76static struct device_operations qemu_graph_ops = {
77 .read_resources = pci_dev_read_resources,
78 .set_resources = pci_dev_set_resources,
79 .enable_resources = pci_dev_enable_resources,
80 .init = qemu_init,
81 .scan_bus = 0,
82};
83
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000084static const struct pci_driver qemu_graph_driver __pci_driver = {
Stefan Reinauerf2065a42004-06-28 12:04:06 +000085 .ops = &qemu_graph_ops,
86 .vendor = 0x1234,
87 .device = 0x1111,
88};
89
90