2 * This file is part of the coreboot project.
4 * Copyright (C) 2009 Joseph Smith <joe@settoplinux.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <console/console.h>
24 #include <device/device.h>
25 #include <device/pci.h>
26 #include <device/pci_ids.h>
28 #if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL
29 #include <x86emu/x86emu.h>
32 static void vga_init(device_t dev)
34 printk(BIOS_INFO, "Starting Graphics Initialization\n");
35 struct cbfs_file *file = cbfs_find("mbi.bin");
37 unsigned int mbi_len = 0;
40 if (ntohl(file->type) != CBFS_TYPE_MBI) {
41 printk(BIOS_INFO, "CBFS: MBI binary is of type %x instead of"
42 "type %x\n", file->type, CBFS_TYPE_MBI);
44 mbi = (void *) CBFS_SUBHEADER(file);
45 mbi_len = ntohl(file->len);
48 printk(BIOS_INFO, "Could not find MBI.\n");
52 /* The GDT or coreboot table is going to live here. But
53 * a long time after we relocated the GNVS, so this is
56 *(u32 *)0x500 = (u32)mbi;
57 *(u32 *)0x504 = (u32)mbi_len;
62 printk(BIOS_INFO, "Graphics Initialization Complete\n");
65 #if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL
66 #define PIPE_A_CRT (1 << 0)
67 #define PIPE_A_LFP (1 << 1)
68 #define PIPE_A_TV (1 << 3)
69 #define PIPE_B_CRT (1 << 8)
70 #define PIPE_B_TV (1 << 10)
71 printk(BIOS_DEBUG, "Enabling TV-Out\n");
74 M.x86.R_BX = 0x0001; // Set Display Device, force execution
75 M.x86.R_CX = PIPE_A_CRT | PIPE_A_TV;
76 // M.x86.R_CX = PIPE_B_TV;
80 printk(BIOS_DEBUG, "... failed.\n");
83 printk(BIOS_DEBUG, "... ok.\n");
86 printk(BIOS_DEBUG, "... not supported.\n");
92 static const struct device_operations vga_operations = {
93 .read_resources = pci_dev_read_resources,
94 .set_resources = pci_dev_set_resources,
95 .enable_resources = pci_dev_enable_resources,
102 static const struct pci_driver vga_driver __pci_driver = {
103 .ops = &vga_operations,
104 .vendor = PCI_VENDOR_ID_INTEL,