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" |
| 27 | |
| 28 | |
| 29 | int tim5690_int15_handler(struct eregs *regs); |
| 30 | |
| 31 | static rs690_vbios_regs vbios_regs_local; |
| 32 | |
| 33 | /* Initialization interrupt function */ |
| 34 | static void vbios_fun_init(rs690_vbios_regs *vbios_regs) |
| 35 | { |
| 36 | vbios_regs_local.int15_regs.fun00_panel_id = vbios_regs->int15_regs.fun00_panel_id; |
| 37 | vbios_regs_local.int15_regs.fun05_tv_standard = vbios_regs->int15_regs.fun05_tv_standard; |
| 38 | } |
| 39 | /* BIOS int15 function */ |
| 40 | int tim5690_int15_handler(struct eregs *regs) |
| 41 | { |
| 42 | int res = -1; |
| 43 | |
| 44 | printk(BIOS_DEBUG, "tim5690_int15_handler\n"); |
| 45 | |
| 46 | switch (regs->eax & 0xffff) { |
| 47 | case AMD_RS690_INT15: |
| 48 | switch (regs->ebx & 0xff) { |
| 49 | case 0x00: |
| 50 | regs->eax &= ~(0xff); |
| 51 | regs->ebx = (regs->ebx & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id; |
| 52 | res = 0; |
| 53 | break; |
| 54 | case 0x05: |
| 55 | regs->eax &= ~(0xff); |
| 56 | regs->ebx = (regs->ebx & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard; |
| 57 | res = 0; |
| 58 | break; |
| 59 | } |
| 60 | break; |
| 61 | default: |
| 62 | printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", |
| 63 | regs->eax & 0xffff); |
| 64 | break; |
| 65 | } |
| 66 | |
| 67 | return res; |
| 68 | } |
| 69 | |
| 70 | /* Initialization VBIOS function */ |
| 71 | void vgabios_init(rs690_vbios_regs *vbios_regs) |
| 72 | { |
| 73 | printk(BIOS_DEBUG, "vgabios_init\n"); |
| 74 | |
| 75 | mainboard_interrupt_handlers(0x15, &tim5690_int15_handler); |
| 76 | vbios_fun_init(vbios_regs); |
| 77 | } |