blob: 335e86bdac0ab85645d981ee62273ebb0c7ca6ae [file] [log] [blame]
Alexandru Gagniuc37a8a8b2013-05-21 14:51:26 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Alexandru Gagniuc <mr.nuke.me@gmail.com>
5 *
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.
10 *
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.
Alexandru Gagniuc37a8a8b2013-05-21 14:51:26 -050015 */
16
17#include <device/device.h>
18#include <device/pci_def.h>
19#include <device/pci_ops.h>
20#include <console/console.h>
21
22#if CONFIG_VGA_ROM_RUN
23
24#include <arch/interrupt.h>
25#include <x86emu/x86emu.h>
26
27#include <northbridge/via/vx900/vx900.h>
28
29static int vx900_int15_handler(void)
30{
31 int res;
32
33 printk(BIOS_DEBUG, "%s %0x\n", __func__, X86_AX & 0xffff);
34 /* Set AX return value here so we don't set it every time. Just set it
35 * to something else if the callback is unsupported */
36 res = -1;
37 switch (X86_AX & 0xffff) {
38#if 0
39 case 0x5f01:
40 /* VGA POST - panel type */
41 /* FIXME: Don't hardcode panel type */
42 /* Panel Type Number */
43 X86_CX = 0;
44 res = 0;
45 break;
46 case 0x5f02:
47 {
48 /* Boot device selection */
49 X86_BL = INT15_5F02_BL_HWOPT_CRTCONN;
50 /* FIXME: or 0 ? */
51 X86_BH = 0; // INT15_5F02_BH_TV_CONN_DEFAULT;
52 X86_EBX = 0; // INT15_5F02_EBX_HDTV_RGB;
53 X86_ECX = INT15_5F02_ECX_DISPLAY_CRT;
54 //X86_ECX |= INT15_5F02_ECX_TV_MODE_RGB;
55 //X86_ECX |= INT15_5F02_ECX_HDTV_1080P;
56 X86_DL = INT15_5F02_DL_TV_LAYOUT_DEFAULT;
57 res = 0;
58 break;
59 }
60#endif
61 case 0x5f18:
62 X86_BL = vx900_int15_get_5f18_bl();
63 res = 0;
64 break;
65#if 0
66 case 0x5f2a:
67 /* Get SSC Control Settings */
68 /* FIXME: No idea what this does. Just disable this feature
69 * for now */
70 X86_CX = INT15_5F2A_CX_SSC_ENABLE;
71 res = 0;
72 break;
73 case 0x5f2b:
74 /* Engine clock setting */
75 /* FIXME: ECLK fixed 250MHz ? */
76 X86_EBX = INT15_5F2B_EBX_ECLK_250MHZ;
77 break;
78#endif
79 default:
80 printk(BIOS_DEBUG, "Unsupported INT15 call %04x!\n",
81 X86_AX & 0xffff);
82 X86_AX = 0;
83 res = -1;
84 break;
85 }
86
87 if (res == 0)
88 X86_AX = 0x5f;
89 else
90 X86_AX = 0;
91 return X86_AX;
92}
93#endif
94
95static void mainboard_enable(device_t dev)
96{
97 (void)dev;
98
99#if CONFIG_VGA_ROM_RUN
Stefan Reinauer069f4762015-01-05 13:02:32 -0800100 printk(BIOS_DEBUG, "Installing INT15 handler...\n");
Alexandru Gagniuc37a8a8b2013-05-21 14:51:26 -0500101 mainboard_interrupt_handlers(0x15, &vx900_int15_handler);
102#endif
103}
104
105struct chip_operations mainboard_ops = {
106 CHIP_NAME("VIA EPIA-M850 Mainboard")
107 .enable_dev = mainboard_enable,
108};