Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 1 | /* |
| 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 Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 27 | #include <x86emu/regs.h> |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 28 | |
| 29 | |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 30 | int tim5690_int15_handler(void); |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 31 | |
| 32 | static rs690_vbios_regs vbios_regs_local; |
| 33 | |
| 34 | /* Initialization interrupt function */ |
| 35 | static 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 Reinauer | 23836e2 | 2010-04-15 12:39:29 +0000 | [diff] [blame] | 40 | |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 41 | /* BIOS int15 function */ |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 42 | int tim5690_int15_handler(void) |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 43 | { |
Patrick Georgi | 503af72 | 2012-11-22 10:48:18 +0100 | [diff] [blame] | 44 | int res = 0; |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 45 | |
| 46 | printk(BIOS_DEBUG, "tim5690_int15_handler\n"); |
| 47 | |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 48 | switch (X86_EAX & 0xffff) { |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 49 | case AMD_RS690_INT15: |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 50 | switch (X86_EBX & 0xff) { |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 51 | case 0x00: |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 52 | X86_EAX &= ~(0xff); |
| 53 | X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id; |
Patrick Georgi | 503af72 | 2012-11-22 10:48:18 +0100 | [diff] [blame] | 54 | res = 1; |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 55 | break; |
| 56 | case 0x05: |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 57 | X86_EAX &= ~(0xff); |
| 58 | X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard; |
Patrick Georgi | 503af72 | 2012-11-22 10:48:18 +0100 | [diff] [blame] | 59 | res = 1; |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 60 | break; |
| 61 | } |
| 62 | break; |
| 63 | default: |
| 64 | printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame^] | 65 | X86_EAX & 0xffff); |
Libra Li | c143693 | 2009-12-23 19:16:47 +0000 | [diff] [blame] | 66 | break; |
| 67 | } |
| 68 | |
| 69 | return res; |
| 70 | } |
| 71 | |
| 72 | /* Initialization VBIOS function */ |
| 73 | void 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 | } |