Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 1 | // Hooks for via vgabios calls into main bios. |
| 2 | // |
| 3 | // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> |
| 4 | // |
Kevin O'Connor | b1b7c2a | 2009-01-15 20:52:58 -0500 | [diff] [blame] | 5 | // This file may be distributed under the terms of the GNU LGPLv3 license. |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 6 | |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 7 | #include "biosvar.h" // GET_GLOBAL |
Kevin O'Connor | 2d2fa31 | 2013-09-14 21:55:26 -0400 | [diff] [blame] | 8 | #include "bregs.h" // set_code_invalid |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 9 | #include "config.h" // CONFIG_* |
Kevin O'Connor | 4d8510c | 2016-02-03 01:28:20 -0500 | [diff] [blame] | 10 | #include "hw/pci.h" // pci_config_readb |
| 11 | #include "hw/pcidevice.h" // pci_find_device |
Kevin O'Connor | 2d2fa31 | 2013-09-14 21:55:26 -0400 | [diff] [blame] | 12 | #include "hw/pci_ids.h" // PCI_VENDOR_ID_VIA |
| 13 | #include "hw/pci_regs.h" // PCI_VENDOR_ID |
| 14 | #include "output.h" // dprintf |
Kevin O'Connor | fa9c66a | 2013-09-14 19:10:40 -0400 | [diff] [blame] | 15 | #include "string.h" // strcmp |
Jonathan A. Kollasch | e9a3e12 | 2013-10-20 12:48:56 -0500 | [diff] [blame] | 16 | #include "util.h" // handle_155f, handle_157f |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 17 | |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 18 | #define VH_VIA 1 |
| 19 | #define VH_INTEL 2 |
Jonathan A. Kollasch | e9a3e12 | 2013-10-20 12:48:56 -0500 | [diff] [blame] | 20 | #define VH_SMI 3 |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 21 | |
Kevin O'Connor | 89a2f96 | 2013-02-18 23:36:03 -0500 | [diff] [blame] | 22 | int VGAHookHandlerType VARFSEG; |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 23 | |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 24 | static void |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 25 | handle_155fXX(struct bregs *regs) |
| 26 | { |
Kevin O'Connor | dfefeb5 | 2009-12-13 13:04:17 -0500 | [diff] [blame] | 27 | set_code_unimplemented(regs, RET_EUNSUPPORTED); |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 28 | } |
| 29 | |
Jonathan A. Kollasch | e9a3e12 | 2013-10-20 12:48:56 -0500 | [diff] [blame] | 30 | static void |
| 31 | handle_157fXX(struct bregs *regs) |
| 32 | { |
| 33 | set_code_unimplemented(regs, RET_EUNSUPPORTED); |
| 34 | } |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 35 | |
| 36 | /**************************************************************** |
| 37 | * Via hooks |
| 38 | ****************************************************************/ |
| 39 | |
Kevin O'Connor | 89a2f96 | 2013-02-18 23:36:03 -0500 | [diff] [blame] | 40 | int ViaFBsize VARFSEG, ViaRamSpeed VARFSEG; |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 41 | |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 42 | static void |
| 43 | via_155f01(struct bregs *regs) |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 44 | { |
| 45 | regs->eax = 0x5f; |
| 46 | regs->cl = 2; // panel type = 2 = 1024 * 768 |
| 47 | set_success(regs); |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 48 | dprintf(1, "Warning: VGA panel type is hardcoded\n"); |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | static void |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 52 | via_155f02(struct bregs *regs) |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 53 | { |
| 54 | regs->eax = 0x5f; |
| 55 | regs->bx = 2; |
| 56 | regs->cx = 0x401; // PAL + crt only |
| 57 | regs->dx = 0; // TV Layout - default |
| 58 | set_success(regs); |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 59 | dprintf(1, "Warning: VGA TV/CRT output type is hardcoded\n"); |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 60 | } |
| 61 | |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 62 | static void |
| 63 | via_155f18(struct bregs *regs) |
| 64 | { |
| 65 | int fbsize = GET_GLOBAL(ViaFBsize), ramspeed = GET_GLOBAL(ViaRamSpeed); |
| 66 | if (fbsize < 0 || ramspeed < 0) { |
| 67 | set_code_invalid(regs, RET_EUNSUPPORTED); |
| 68 | return; |
| 69 | } |
| 70 | regs->eax = 0x5f; |
| 71 | regs->ebx = 0x500 | (ramspeed << 4) | fbsize; |
| 72 | regs->ecx = 0x060; |
| 73 | set_success(regs); |
| 74 | } |
| 75 | |
| 76 | static void |
| 77 | via_155f19(struct bregs *regs) |
| 78 | { |
| 79 | set_invalid_silent(regs); |
| 80 | } |
| 81 | |
| 82 | static void |
| 83 | via_155f(struct bregs *regs) |
| 84 | { |
| 85 | switch (regs->al) { |
| 86 | case 0x01: via_155f01(regs); break; |
| 87 | case 0x02: via_155f02(regs); break; |
| 88 | case 0x18: via_155f18(regs); break; |
| 89 | case 0x19: via_155f19(regs); break; |
| 90 | default: handle_155fXX(regs); break; |
| 91 | } |
| 92 | } |
| 93 | |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 94 | static int |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 95 | getFBSize(struct pci_device *pci) |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 96 | { |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 97 | /* FB config */ |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 98 | u8 reg = pci_config_readb(pci->bdf, 0xa1); |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 99 | |
| 100 | /* GFX disabled ? */ |
| 101 | if (!(reg & 0x80)) |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 102 | return -1; |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 103 | |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 104 | static u8 mem_power[] = {0, 3, 4, 5, 6, 7, 8, 9}; |
| 105 | return mem_power[(reg >> 4) & 0x7]; |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | static int |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 109 | getViaRamSpeed(struct pci_device *pci) |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 110 | { |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 111 | return (pci_config_readb(pci->bdf, 0x90) & 0x07) + 3; |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | static int |
Kevin O'Connor | 1ca05b0 | 2010-01-03 17:43:37 -0500 | [diff] [blame] | 115 | getAMDRamSpeed(void) |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 116 | { |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 117 | struct pci_device *pci = pci_find_device(PCI_VENDOR_ID_AMD |
| 118 | , PCI_DEVICE_ID_AMD_K8_NB_MEMCTL); |
| 119 | if (!pci) |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 120 | return -1; |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 121 | |
| 122 | /* mem clk 0 = DDR2 400 */ |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 123 | return (pci_config_readb(pci->bdf, 0x94) & 0x7) + 6; |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | /* int 0x15 - 5f18 |
| 127 | |
Stefan Weil | 6bcacf7 | 2015-10-02 08:46:40 +0200 | [diff] [blame] | 128 | ECX = unknown/don't care |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 129 | EBX[3..0] Frame Buffer Size 2^N MiB |
| 130 | EBX[7..4] Memory speed: |
| 131 | 0: SDR 66Mhz |
| 132 | 1: SDR 100Mhz |
| 133 | 2: SDR 133Mhz |
| 134 | 3: DDR 100Mhz (PC1600 or DDR200) |
| 135 | 4: DDR 133Mhz (PC2100 or DDR266) |
| 136 | 5: DDR 166Mhz (PC2700 or DDR333) |
| 137 | 6: DDR 200Mhz (PC3200 or DDR400) |
| 138 | 7: DDR2 133Mhz (DDR2 533) |
| 139 | 8: DDR2 166Mhz (DDR2 667) |
| 140 | 9: DDR2 200Mhz (DDR2 800) |
| 141 | A: DDR2 233Mhz (DDR2 1066) |
| 142 | B: and above: Unknown |
| 143 | EBX[?..8] Total memory size? |
| 144 | EAX = 0x5f for success |
Kevin O'Connor | 4735877 | 2008-12-26 13:01:23 -0500 | [diff] [blame] | 145 | */ |
| 146 | |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 147 | #define PCI_DEVICE_ID_VIA_K8M890CE_3 0x3336 |
| 148 | #define PCI_DEVICE_ID_VIA_VX855_MEMCTRL 0x3409 |
| 149 | |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 150 | static void |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 151 | via_setup(struct pci_device *pci) |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 152 | { |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 153 | VGAHookHandlerType = VH_VIA; |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 154 | |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 155 | struct pci_device *d = pci_find_device(PCI_VENDOR_ID_VIA |
| 156 | , PCI_DEVICE_ID_VIA_K8M890CE_3); |
| 157 | if (d) { |
| 158 | ViaFBsize = getFBSize(d); |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 159 | ViaRamSpeed = getAMDRamSpeed(); |
| 160 | return; |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 161 | } |
Kevin O'Connor | 0cd7005 | 2011-07-02 14:04:19 -0400 | [diff] [blame] | 162 | d = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VX855_MEMCTRL); |
| 163 | if (d) { |
| 164 | ViaFBsize = getFBSize(d); |
| 165 | ViaRamSpeed = getViaRamSpeed(d); |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 166 | return; |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | dprintf(1, "Warning: VGA memory size and speed is hardcoded\n"); |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 170 | ViaFBsize = 5; // 32M frame buffer |
| 171 | ViaRamSpeed = 4; // MCLK = DDR266 |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 172 | } |
| 173 | |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 174 | |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 175 | /**************************************************************** |
| 176 | * Intel VGA hooks |
| 177 | ****************************************************************/ |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 178 | |
Kevin O'Connor | 89a2f96 | 2013-02-18 23:36:03 -0500 | [diff] [blame] | 179 | u8 IntelDisplayType VARFSEG, IntelDisplayId VARFSEG; |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 180 | |
| 181 | static void |
| 182 | intel_155f35(struct bregs *regs) |
| 183 | { |
| 184 | regs->ax = 0x005f; |
| 185 | regs->cl = GET_GLOBAL(IntelDisplayType); |
| 186 | set_success(regs); |
| 187 | } |
| 188 | |
| 189 | static void |
| 190 | intel_155f40(struct bregs *regs) |
| 191 | { |
| 192 | regs->ax = 0x005f; |
| 193 | regs->cl = GET_GLOBAL(IntelDisplayId); |
| 194 | set_success(regs); |
| 195 | } |
| 196 | |
| 197 | static void |
Julian Pidancet | 0214515 | 2012-02-05 04:51:06 +0000 | [diff] [blame] | 198 | intel_155f50(struct bregs *regs) |
| 199 | { |
| 200 | /* Mandatory hook on some Dell laptops */ |
| 201 | regs->ax = 0x005f; |
| 202 | set_success(regs); |
| 203 | } |
| 204 | |
| 205 | static void |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 206 | intel_155f(struct bregs *regs) |
| 207 | { |
| 208 | switch (regs->al) { |
| 209 | case 0x35: intel_155f35(regs); break; |
| 210 | case 0x40: intel_155f40(regs); break; |
Julian Pidancet | 0214515 | 2012-02-05 04:51:06 +0000 | [diff] [blame] | 211 | case 0x50: intel_155f50(regs); break; |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 212 | default: handle_155fXX(regs); break; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | #define BOOT_DISPLAY_DEFAULT (0) |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 217 | #define BOOT_DISPLAY_CRT (1 << 0) |
| 218 | #define BOOT_DISPLAY_TV (1 << 1) |
| 219 | #define BOOT_DISPLAY_EFP (1 << 2) |
| 220 | #define BOOT_DISPLAY_LCD (1 << 3) |
| 221 | #define BOOT_DISPLAY_CRT2 (1 << 4) |
| 222 | #define BOOT_DISPLAY_TV2 (1 << 5) |
| 223 | #define BOOT_DISPLAY_EFP2 (1 << 6) |
| 224 | #define BOOT_DISPLAY_LCD2 (1 << 7) |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 225 | |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 226 | static void |
Julian Pidancet | 0214515 | 2012-02-05 04:51:06 +0000 | [diff] [blame] | 227 | intel_setup(struct pci_device *pci) |
| 228 | { |
| 229 | VGAHookHandlerType = VH_INTEL; |
| 230 | |
| 231 | IntelDisplayType = BOOT_DISPLAY_DEFAULT; |
| 232 | IntelDisplayId = 3; |
| 233 | } |
| 234 | |
| 235 | static void |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 236 | roda_setup(struct pci_device *pci) |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 237 | { |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 238 | VGAHookHandlerType = VH_INTEL; |
| 239 | // IntelDisplayType = BOOT_DISPLAY_DEFAULT; |
| 240 | IntelDisplayType = BOOT_DISPLAY_LCD; |
| 241 | // IntelDisplayId = inb(0x60f) & 0x0f; // Correct according to Crete |
| 242 | IntelDisplayId = 3; // Correct according to empirical studies |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | static void |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 246 | kontron_setup(struct pci_device *pci) |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 247 | { |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 248 | VGAHookHandlerType = VH_INTEL; |
| 249 | IntelDisplayType = BOOT_DISPLAY_CRT; |
| 250 | IntelDisplayId = 3; |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | static void |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 254 | getac_setup(struct pci_device *pci) |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 255 | { |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 256 | } |
| 257 | |
Jonathan A. Kollasch | e9a3e12 | 2013-10-20 12:48:56 -0500 | [diff] [blame] | 258 | /**************************************************************** |
| 259 | * Silicon Motion hooks |
| 260 | ****************************************************************/ |
| 261 | |
| 262 | u8 SmiBootDisplay VARFSEG; // 1: LCD, 2: CRT, 3: Both */ |
| 263 | |
| 264 | static void |
| 265 | smi_157f02(struct bregs *regs) |
| 266 | { |
| 267 | /* Boot Display Device Override */ |
| 268 | regs->ax = 0x007f; |
| 269 | regs->bl = GET_GLOBAL(SmiBootDisplay); |
| 270 | set_success(regs); |
| 271 | } |
| 272 | |
| 273 | static void |
| 274 | smi_157f14(struct bregs *regs) |
| 275 | { |
| 276 | /* ReduceOn support default status */ |
| 277 | regs->ax = 0x007f; |
| 278 | regs->bl = 0x00; |
| 279 | set_success(regs); |
| 280 | } |
| 281 | |
| 282 | static void |
| 283 | smi_157f(struct bregs *regs) |
| 284 | { |
| 285 | switch (regs->al) { |
| 286 | case 0x02: smi_157f02(regs); break; |
| 287 | case 0x14: smi_157f14(regs); break; |
| 288 | default: handle_157fXX(regs); break; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | static void |
| 293 | winent_mb6047_setup(struct pci_device *pci) |
| 294 | { |
| 295 | VGAHookHandlerType = VH_SMI; |
| 296 | SmiBootDisplay = 0x02; |
| 297 | } |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 298 | |
| 299 | /**************************************************************** |
| 300 | * Entry and setup |
| 301 | ****************************************************************/ |
| 302 | |
| 303 | // Main 16bit entry point |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 304 | void |
| 305 | handle_155f(struct bregs *regs) |
| 306 | { |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 307 | if (!CONFIG_VGAHOOKS) { |
| 308 | handle_155fXX(regs); |
| 309 | return; |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 310 | } |
| 311 | |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 312 | int htype = GET_GLOBAL(VGAHookHandlerType); |
| 313 | switch (htype) { |
| 314 | case VH_VIA: via_155f(regs); break; |
| 315 | case VH_INTEL: intel_155f(regs); break; |
| 316 | default: handle_155fXX(regs); break; |
| 317 | } |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 318 | } |
| 319 | |
Jonathan A. Kollasch | e9a3e12 | 2013-10-20 12:48:56 -0500 | [diff] [blame] | 320 | // Main 16bit entry point |
| 321 | void |
| 322 | handle_157f(struct bregs *regs) |
| 323 | { |
| 324 | if (!CONFIG_VGAHOOKS) { |
| 325 | handle_157fXX(regs); |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | int htype = GET_GLOBAL(VGAHookHandlerType); |
| 330 | switch (htype) { |
| 331 | case VH_SMI: smi_157f(regs); break; |
| 332 | default: handle_157fXX(regs); break; |
| 333 | } |
| 334 | } |
| 335 | |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 336 | // Setup |
| 337 | void |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 338 | vgahook_setup(struct pci_device *pci) |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 339 | { |
Julian Pidancet | 0214515 | 2012-02-05 04:51:06 +0000 | [diff] [blame] | 340 | if (!CONFIG_VGAHOOKS) |
Kevin O'Connor | 22e1b91 | 2009-07-19 18:52:46 -0400 | [diff] [blame] | 341 | return; |
Stefan Reinauer | 8cb8ba5 | 2010-06-09 09:45:28 +0200 | [diff] [blame] | 342 | |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 343 | if (strcmp(CBvendor, "KONTRON") == 0 && strcmp(CBpart, "986LCD-M") == 0) |
| 344 | kontron_setup(pci); |
| 345 | else if (strcmp(CBvendor, "GETAC") == 0 && strcmp(CBpart, "P470") == 0) |
| 346 | getac_setup(pci); |
| 347 | else if (strcmp(CBvendor, "RODA") == 0 && strcmp(CBpart, "RK886EX") == 0) |
| 348 | roda_setup(pci); |
Jonathan A. Kollasch | e9a3e12 | 2013-10-20 12:48:56 -0500 | [diff] [blame] | 349 | else if (strcmp(CBvendor, "Win Enterprise") == 0 && strcmp(CBpart, "MB6047") == 0) |
| 350 | winent_mb6047_setup(pci); |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 351 | else if (pci->vendor == PCI_VENDOR_ID_VIA) |
| 352 | via_setup(pci); |
Julian Pidancet | 0214515 | 2012-02-05 04:51:06 +0000 | [diff] [blame] | 353 | else if (pci->vendor == PCI_VENDOR_ID_INTEL) |
| 354 | intel_setup(pci); |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 355 | } |