summaryrefslogtreecommitdiff
path: root/src/mainboard/technexion/tim5690/vgabios.c
blob: fe4b41cde9ddafe6f0c99a4a3672f973d86e9dd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2009 coresystems GmbH
 * Copyright (C) 2009 Libra Li <libra.li@technexion.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <stdint.h>
#include <stdlib.h>
#include <console/console.h>
#include <arch/interrupt.h>
#include "vgabios.h"
#include <x86emu/regs.h>


int tim5690_int15_handler(void);

static rs690_vbios_regs vbios_regs_local;

/* Initialization interrupt function */
static void vbios_fun_init(rs690_vbios_regs *vbios_regs)
{
	vbios_regs_local.int15_regs.fun00_panel_id = vbios_regs->int15_regs.fun00_panel_id;
	vbios_regs_local.int15_regs.fun05_tv_standard = vbios_regs->int15_regs.fun05_tv_standard;
}

/* BIOS int15 function */
int tim5690_int15_handler(void)
{
	int res = 0;

	printk(BIOS_DEBUG, "tim5690_int15_handler\n");

	switch (X86_EAX & 0xffff) {
	case AMD_RS690_INT15:
		switch (X86_EBX & 0xff) {
		case 0x00:
			X86_EAX &= ~(0xff);
			X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id;
			res = 1;
			break;
		case 0x05:
			X86_EAX &= ~(0xff);
			X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard;
			res = 1;
			break;
		}
		break;
	default:
		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
				X86_EAX & 0xffff);
		break;
	}

	return res;
}

/* Initialization VBIOS function */
void vgabios_init(rs690_vbios_regs *vbios_regs)
{
	printk(BIOS_DEBUG, "vgabios_init\n");

	mainboard_interrupt_handlers(0x15, &tim5690_int15_handler);
	vbios_fun_init(vbios_regs);
}