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. |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 18 | */ |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 19 | |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 20 | #include <stdint.h> |
| 21 | #include <stdlib.h> |
| 22 | #include <console/console.h> |
| 23 | #include <arch/interrupt.h> |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame] | 24 | #include <x86emu/regs.h> |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 25 | #include "int15_func.h" |
| 26 | |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame] | 27 | int sbios_INT15_handler(void); |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 28 | /*extern*/ unsigned long vgainfo_addr; |
| 29 | |
| 30 | static INT15_function_extensions __int15_func; |
| 31 | |
| 32 | /* System BIOS int15 function */ |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame] | 33 | int sbios_INT15_handler(void) |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 34 | { |
Elyes HAOUAS | ffcc07d | 2016-10-01 20:41:59 +0200 | [diff] [blame] | 35 | int res = -1; |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 36 | |
Elyes HAOUAS | ffcc07d | 2016-10-01 20:41:59 +0200 | [diff] [blame] | 37 | printk(BIOS_DEBUG, "System BIOS INT 15h\n"); |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 38 | |
Elyes HAOUAS | ffcc07d | 2016-10-01 20:41:59 +0200 | [diff] [blame] | 39 | switch (X86_EAX & 0xffff) { |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 40 | #define BOOT_DISPLAY_DEFAULT 0 |
| 41 | #define BOOT_DISPLAY_CRT (1 << 0) |
| 42 | #define BOOT_DISPLAY_TV (1 << 1) |
| 43 | #define BOOT_DISPLAY_EFP (1 << 2) |
| 44 | #define BOOT_DISPLAY_LCD (1 << 3) |
| 45 | #define BOOT_DISPLAY_CRT2 (1 << 4) |
| 46 | #define BOOT_DISPLAY_TV2 (1 << 5) |
| 47 | #define BOOT_DISPLAY_EFP2 (1 << 6) |
| 48 | #define BOOT_DISPLAY_LCD2 (1 << 7) |
| 49 | case 0x5f35: |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame] | 50 | X86_EAX = 0x5f; |
| 51 | X86_ECX = BOOT_DISPLAY_DEFAULT; |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 52 | res = 0; |
| 53 | break; |
| 54 | case 0x5f40: |
Patrick Georgi | 199b09c | 2012-11-22 12:46:12 +0100 | [diff] [blame] | 55 | X86_EAX = 0x5f; |
| 56 | X86_ECX = 3; // This is mainboard specific |
| 57 | printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX); |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 58 | res = 0; |
| 59 | break; |
Elyes HAOUAS | ffcc07d | 2016-10-01 20:41:59 +0200 | [diff] [blame] | 60 | case 0x4e08: |
| 61 | switch (X86_EBX & 0xff) { |
| 62 | case 0x00: |
| 63 | X86_EAX &= ~(0xff); |
| 64 | X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id; |
| 65 | printk(BIOS_DEBUG, "DISPLAY = %x\n", X86_EBX & 0xff); |
| 66 | res = 0; |
| 67 | break; |
| 68 | case 0x02: |
| 69 | break; |
| 70 | case 0x05: |
| 71 | X86_EAX &= ~(0xff); |
| 72 | X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func05_TV_standard; |
| 73 | printk(BIOS_DEBUG, "TV = %x\n", X86_EBX & 0xff); |
| 74 | res = 0; |
| 75 | break; |
| 76 | case 0x80: |
| 77 | X86_EAX &= ~(0xff); |
| 78 | X86_EBX &= ~(0xff); |
| 79 | printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", X86_EDX, X86_EDI); |
| 80 | vgainfo_addr = (X86_EDX * 16) + X86_EDI; |
| 81 | res = 0; |
| 82 | break; |
| 83 | case 0x89: |
| 84 | X86_EAX &= ~(0xff); |
| 85 | X86_EBX &= ~(0xff); |
| 86 | printk(BIOS_DEBUG, "Get supported display device information\n"); |
| 87 | res = 0; |
| 88 | break; |
| 89 | default: |
| 90 | break; |
| 91 | } |
| 92 | break; |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 93 | default: |
Elyes HAOUAS | ffcc07d | 2016-10-01 20:41:59 +0200 | [diff] [blame] | 94 | printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_EAX & 0xffff); |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 95 | break; |
Elyes HAOUAS | ffcc07d | 2016-10-01 20:41:59 +0200 | [diff] [blame] | 96 | } |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 97 | |
Elyes HAOUAS | ffcc07d | 2016-10-01 20:41:59 +0200 | [diff] [blame] | 98 | return res; |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | /* Initialization VBIOS function extensions */ |
| 102 | void install_INT15_function_extensions(INT15_function_extensions *int15_func) |
| 103 | { |
| 104 | printk(BIOS_DEBUG, "Initialize function extensions for Callback function number 04E08h ..\n"); |
| 105 | __int15_func.regs.func00_LCD_panel_id = int15_func->regs.func00_LCD_panel_id; |
| 106 | __int15_func.regs.func05_TV_standard = int15_func->regs.func05_TV_standard; |
| 107 | mainboard_interrupt_handlers(0x15, &sbios_INT15_handler); |
| 108 | } |