Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +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 | * Copyright (C) 2010 Siemens AG, Inc. |
| 7 | * (Written by Josef Kellermann <joseph.kellermann@heitec.de> for Siemens AG, Inc.) |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | */ |
| 23 | |
| 24 | #include <stdint.h> |
| 25 | #include <stdlib.h> |
| 26 | #include <console/console.h> |
| 27 | #include <arch/interrupt.h> |
| 28 | #include "int15_func.h" |
| 29 | |
| 30 | int sbios_INT15_handler(struct eregs *); |
| 31 | /*extern*/ unsigned long vgainfo_addr; |
| 32 | |
| 33 | static INT15_function_extensions __int15_func; |
| 34 | |
| 35 | /* System BIOS int15 function */ |
| 36 | int sbios_INT15_handler(struct eregs *regs) |
| 37 | { |
| 38 | int res = -1; |
| 39 | |
| 40 | printk(BIOS_DEBUG, "System BIOS INT 15h\n"); |
| 41 | |
| 42 | switch (regs->eax & 0xffff) { |
| 43 | #define BOOT_DISPLAY_DEFAULT 0 |
| 44 | #define BOOT_DISPLAY_CRT (1 << 0) |
| 45 | #define BOOT_DISPLAY_TV (1 << 1) |
| 46 | #define BOOT_DISPLAY_EFP (1 << 2) |
| 47 | #define BOOT_DISPLAY_LCD (1 << 3) |
| 48 | #define BOOT_DISPLAY_CRT2 (1 << 4) |
| 49 | #define BOOT_DISPLAY_TV2 (1 << 5) |
| 50 | #define BOOT_DISPLAY_EFP2 (1 << 6) |
| 51 | #define BOOT_DISPLAY_LCD2 (1 << 7) |
| 52 | case 0x5f35: |
| 53 | regs->eax = 0x5f; |
| 54 | regs->ecx = BOOT_DISPLAY_DEFAULT; |
| 55 | res = 0; |
| 56 | break; |
| 57 | case 0x5f40: |
| 58 | regs->eax = 0x5f; |
| 59 | regs->ecx = 3; // This is mainboard specific |
| 60 | printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx); |
| 61 | res = 0; |
| 62 | break; |
| 63 | case 0x4e08: |
| 64 | switch (regs->ebx & 0xff) { |
| 65 | case 0x00: |
| 66 | regs->eax &= ~(0xff); |
| 67 | regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id; |
| 68 | printk(BIOS_DEBUG, "DISPLAY = %x\n", regs->ebx & 0xff); |
| 69 | res = 0; |
| 70 | break; |
| 71 | case 0x02: |
| 72 | break; |
| 73 | case 0x05: |
| 74 | regs->eax &= ~(0xff); |
| 75 | regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func05_TV_standard; |
| 76 | printk(BIOS_DEBUG, "TV = %x\n", regs->ebx & 0xff); |
| 77 | res = 0; |
| 78 | break; |
| 79 | case 0x80: |
| 80 | regs->eax &= ~(0xff); |
| 81 | regs->ebx &= ~(0xff); |
| 82 | printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", regs->edx, regs->edi); |
| 83 | vgainfo_addr = (regs->edx * 16) + regs->edi; |
| 84 | res = 0; |
| 85 | break; |
| 86 | case 0x89: |
| 87 | regs->eax &= ~(0xff); |
| 88 | regs->ebx &= ~(0xff); |
| 89 | printk(BIOS_DEBUG, "Get supported display device information\n"); |
| 90 | res = 0; |
| 91 | break; |
| 92 | default: |
| 93 | break; |
| 94 | } |
| 95 | break; |
| 96 | default: |
| 97 | printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", regs->eax & 0xffff); |
| 98 | break; |
| 99 | } |
| 100 | |
| 101 | return res; |
| 102 | } |
| 103 | |
| 104 | /* Initialization VBIOS function extensions */ |
| 105 | void install_INT15_function_extensions(INT15_function_extensions *int15_func) |
| 106 | { |
| 107 | printk(BIOS_DEBUG, "Initialize function extensions for Callback function number 04E08h ..\n"); |
| 108 | __int15_func.regs.func00_LCD_panel_id = int15_func->regs.func00_LCD_panel_id; |
| 109 | __int15_func.regs.func05_TV_standard = int15_func->regs.func05_TV_standard; |
| 110 | mainboard_interrupt_handlers(0x15, &sbios_INT15_handler); |
| 111 | } |