blob: 46a9b58441590daa11ee8b0aafaa1ae11c6bcdb9 [file] [log] [blame]
Libra Lic1436932009-12-23 19:16:47 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2009 coresystems GmbH
5 * Copyright (C) 2009 Libra Li <libra.li@technexion.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <stdint.h>
23#include <stdlib.h>
24#include <console/console.h>
25#include <arch/interrupt.h>
26#include "vgabios.h"
Patrick Georgi199b09c2012-11-22 12:46:12 +010027#include <x86emu/regs.h>
Libra Lic1436932009-12-23 19:16:47 +000028
29
Patrick Georgi199b09c2012-11-22 12:46:12 +010030int tim5690_int15_handler(void);
Libra Lic1436932009-12-23 19:16:47 +000031
32static rs690_vbios_regs vbios_regs_local;
33
34/* Initialization interrupt function */
35static void vbios_fun_init(rs690_vbios_regs *vbios_regs)
36{
37 vbios_regs_local.int15_regs.fun00_panel_id = vbios_regs->int15_regs.fun00_panel_id;
38 vbios_regs_local.int15_regs.fun05_tv_standard = vbios_regs->int15_regs.fun05_tv_standard;
39}
Stefan Reinauer23836e22010-04-15 12:39:29 +000040
Libra Lic1436932009-12-23 19:16:47 +000041/* BIOS int15 function */
Patrick Georgi199b09c2012-11-22 12:46:12 +010042int tim5690_int15_handler(void)
Libra Lic1436932009-12-23 19:16:47 +000043{
Patrick Georgi503af722012-11-22 10:48:18 +010044 int res = 0;
Libra Lic1436932009-12-23 19:16:47 +000045
46 printk(BIOS_DEBUG, "tim5690_int15_handler\n");
47
Patrick Georgi199b09c2012-11-22 12:46:12 +010048 switch (X86_EAX & 0xffff) {
Libra Lic1436932009-12-23 19:16:47 +000049 case AMD_RS690_INT15:
Patrick Georgi199b09c2012-11-22 12:46:12 +010050 switch (X86_EBX & 0xff) {
Libra Lic1436932009-12-23 19:16:47 +000051 case 0x00:
Patrick Georgi199b09c2012-11-22 12:46:12 +010052 X86_EAX &= ~(0xff);
53 X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id;
Patrick Georgi503af722012-11-22 10:48:18 +010054 res = 1;
Libra Lic1436932009-12-23 19:16:47 +000055 break;
56 case 0x05:
Patrick Georgi199b09c2012-11-22 12:46:12 +010057 X86_EAX &= ~(0xff);
58 X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard;
Patrick Georgi503af722012-11-22 10:48:18 +010059 res = 1;
Libra Lic1436932009-12-23 19:16:47 +000060 break;
61 }
62 break;
63 default:
64 printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
Patrick Georgi199b09c2012-11-22 12:46:12 +010065 X86_EAX & 0xffff);
Libra Lic1436932009-12-23 19:16:47 +000066 break;
67 }
68
69 return res;
70}
71
72/* Initialization VBIOS function */
73void vgabios_init(rs690_vbios_regs *vbios_regs)
74{
75 printk(BIOS_DEBUG, "vgabios_init\n");
76
77 mainboard_interrupt_handlers(0x15, &tim5690_int15_handler);
78 vbios_fun_init(vbios_regs);
79}