blob: fd5e586b00edfa2ca03f4516713aa62169fbc078 [file] [log] [blame]
Kevin O'Connord9211ee2012-01-31 22:54:49 -05001// Bochs VGA interface to extended "VBE" modes
2//
3// Copyright (C) 2012 Kevin O'Connor <kevin@koconnor.net>
4// Copyright (C) 2011 Julian Pidancet <julian.pidancet@citrix.com>
5// Copyright (C) 2002 Jeroen Janssen
6//
7// This file may be distributed under the terms of the GNU LGPLv3 license.
8
Kevin O'Connore6bc4c12012-01-21 11:26:37 -05009#include "biosvar.h" // GET_GLOBAL
Kevin O'Connor2d2fa312013-09-14 21:55:26 -040010#include "bochsvga.h" // bochsvga_set_mode
11#include "config.h" // CONFIG_*
Kevin O'Connor5d369d82013-09-02 20:48:46 -040012#include "hw/pci.h" // pci_config_readl
13#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
Kevin O'Connor2d2fa312013-09-14 21:55:26 -040014#include "output.h" // dprintf
Kevin O'Connor2e57c812013-09-14 22:29:32 -040015#include "std/vbe.h" // VBE_CAPABILITY_8BIT_DAC
Kevin O'Connorc682ffe2016-08-05 11:48:20 -040016#include "stdvga.h" // stdvga_get_linelength
Kevin O'Connor2f2ec112016-08-05 11:14:58 -040017#include "vgabios.h" // SET_VGA
18#include "vgautil.h" // VBE_total_memory
Kevin O'Connor4ade5232013-09-18 21:41:48 -040019#include "x86.h" // outw
Julian Pidancet87879e22011-12-19 05:08:00 +000020
Kevin O'Connor933bb762012-02-01 21:54:55 -050021
22/****************************************************************
23 * Mode tables
24 ****************************************************************/
25
Gerd Hoffmann004f5b32019-03-08 11:10:59 +010026#include "svgamodes.h"
Julian Pidancet87879e22011-12-19 05:08:00 +000027
Gerd Hoffmann53663502013-09-05 10:16:18 +020028static int dispi_found VAR16 = 0;
29
Kevin O'Connore6bc4c12012-01-21 11:26:37 -050030static int is_bochsvga_mode(struct vgamode_s *vmode_g)
31{
Gerd Hoffmann004f5b32019-03-08 11:10:59 +010032 unsigned int mcount = GET_GLOBAL(svga_mcount);
33
34 return (vmode_g >= &svga_modes[0].info
35 && vmode_g <= &svga_modes[mcount-1].info);
Kevin O'Connore6bc4c12012-01-21 11:26:37 -050036}
37
Kevin O'Connor3339c052012-01-13 20:00:35 -050038struct vgamode_s *bochsvga_find_mode(int mode)
39{
Gerd Hoffmann004f5b32019-03-08 11:10:59 +010040 struct generic_svga_mode *m = svga_modes;
41 unsigned int mcount = GET_GLOBAL(svga_mcount);
42
Gerd Hoffmann53663502013-09-05 10:16:18 +020043 if (GET_GLOBAL(dispi_found))
Gerd Hoffmann004f5b32019-03-08 11:10:59 +010044 for (; m < &svga_modes[mcount]; m++)
Gerd Hoffmann53663502013-09-05 10:16:18 +020045 if (GET_GLOBAL(m->mode) == mode)
46 return &m->info;
Kevin O'Connor3339c052012-01-13 20:00:35 -050047 return stdvga_find_mode(mode);
Julian Pidancet87879e22011-12-19 05:08:00 +000048}
49
Kevin O'Connor34203cd2012-01-09 20:55:31 -050050void
51bochsvga_list_modes(u16 seg, u16 *dest, u16 *last)
Julian Pidancet87879e22011-12-19 05:08:00 +000052{
Gerd Hoffmann004f5b32019-03-08 11:10:59 +010053 struct generic_svga_mode *m = svga_modes;
54 unsigned int mcount = GET_GLOBAL(svga_mcount);
55
Gerd Hoffmann53663502013-09-05 10:16:18 +020056 if (GET_GLOBAL(dispi_found)) {
Gerd Hoffmann004f5b32019-03-08 11:10:59 +010057 for (; m < &svga_modes[mcount] && dest<last; m++) {
Gerd Hoffmann53663502013-09-05 10:16:18 +020058 u16 mode = GET_GLOBAL(m->mode);
59 if (mode == 0xffff)
60 continue;
61 SET_FARVAR(seg, *dest, mode);
62 dest++;
63 }
Julian Pidancet8bd766f2011-12-19 05:08:01 +000064 }
Kevin O'Connor34203cd2012-01-09 20:55:31 -050065 stdvga_list_modes(seg, dest, last);
Julian Pidancet87879e22011-12-19 05:08:00 +000066}
67
Kevin O'Connor933bb762012-02-01 21:54:55 -050068
69/****************************************************************
70 * Helper functions
71 ****************************************************************/
72
Kevin O'Connor4ade5232013-09-18 21:41:48 -040073static inline u16 dispi_read(u16 reg)
74{
75 outw(reg, VBE_DISPI_IOPORT_INDEX);
76 return inw(VBE_DISPI_IOPORT_DATA);
77}
78static inline void dispi_write(u16 reg, u16 val)
79{
80 outw(reg, VBE_DISPI_IOPORT_INDEX);
81 outw(val, VBE_DISPI_IOPORT_DATA);
82}
83
Paolo Bonzini9c291482015-01-01 21:27:46 +010084static u8
85bochsvga_dispi_enabled(void)
86{
87 if (!GET_GLOBAL(dispi_found))
88 return 0;
89 u16 en = dispi_read(VBE_DISPI_INDEX_ENABLE);
90 if (!(en & VBE_DISPI_ENABLED))
91 return 0;
92 return 1;
93}
94
Kevin O'Connor9961f992012-01-21 11:53:44 -050095int
96bochsvga_get_window(struct vgamode_s *vmode_g, int window)
97{
Paolo Bonzini9c291482015-01-01 21:27:46 +010098 if (!bochsvga_dispi_enabled())
Gerd Hoffmann53663502013-09-05 10:16:18 +020099 return stdvga_get_window(vmode_g, window);
Kevin O'Connor9961f992012-01-21 11:53:44 -0500100 if (window != 0)
101 return -1;
102 return dispi_read(VBE_DISPI_INDEX_BANK);
103}
104
105int
106bochsvga_set_window(struct vgamode_s *vmode_g, int window, int val)
107{
Paolo Bonzini9c291482015-01-01 21:27:46 +0100108 if (!bochsvga_dispi_enabled())
Gerd Hoffmann53663502013-09-05 10:16:18 +0200109 return stdvga_set_window(vmode_g, window, val);
Kevin O'Connor9961f992012-01-21 11:53:44 -0500110 if (window != 0)
111 return -1;
112 dispi_write(VBE_DISPI_INDEX_BANK, val);
113 if (dispi_read(VBE_DISPI_INDEX_BANK) != val)
114 return -1;
115 return 0;
116}
117
Kevin O'Connor3876b532012-01-24 00:07:44 -0500118int
119bochsvga_get_linelength(struct vgamode_s *vmode_g)
120{
Paolo Bonzini9c291482015-01-01 21:27:46 +0100121 if (!bochsvga_dispi_enabled())
Gerd Hoffmann53663502013-09-05 10:16:18 +0200122 return stdvga_get_linelength(vmode_g);
Kevin O'Connor3876b532012-01-24 00:07:44 -0500123 return dispi_read(VBE_DISPI_INDEX_VIRT_WIDTH) * vga_bpp(vmode_g) / 8;
124}
125
126int
127bochsvga_set_linelength(struct vgamode_s *vmode_g, int val)
128{
129 stdvga_set_linelength(vmode_g, val);
Paolo Bonzini9c291482015-01-01 21:27:46 +0100130 if (bochsvga_dispi_enabled()) {
Gerd Hoffmann53663502013-09-05 10:16:18 +0200131 int pixels = (val * 8) / vga_bpp(vmode_g);
132 dispi_write(VBE_DISPI_INDEX_VIRT_WIDTH, pixels);
133 }
Kevin O'Connor3876b532012-01-24 00:07:44 -0500134 return 0;
135}
136
Kevin O'Connord61fc532012-01-27 20:37:45 -0500137int
138bochsvga_get_displaystart(struct vgamode_s *vmode_g)
139{
Paolo Bonzini9c291482015-01-01 21:27:46 +0100140 if (!bochsvga_dispi_enabled())
Gerd Hoffmann53663502013-09-05 10:16:18 +0200141 return stdvga_get_displaystart(vmode_g);
Kevin O'Connord61fc532012-01-27 20:37:45 -0500142 int bpp = vga_bpp(vmode_g);
143 int linelength = dispi_read(VBE_DISPI_INDEX_VIRT_WIDTH) * bpp / 8;
144 int x = dispi_read(VBE_DISPI_INDEX_X_OFFSET);
145 int y = dispi_read(VBE_DISPI_INDEX_Y_OFFSET);
146 return x * bpp / 8 + linelength * y;
147}
148
149int
150bochsvga_set_displaystart(struct vgamode_s *vmode_g, int val)
151{
152 stdvga_set_displaystart(vmode_g, val);
Paolo Bonzini9c291482015-01-01 21:27:46 +0100153 if (bochsvga_dispi_enabled()) {
Gerd Hoffmann53663502013-09-05 10:16:18 +0200154 int bpp = vga_bpp(vmode_g);
155 int linelength = dispi_read(VBE_DISPI_INDEX_VIRT_WIDTH) * bpp / 8;
Kevin O'Connor06c6d472013-11-30 11:45:46 -0500156 if (!linelength)
157 return 0;
Gerd Hoffmann53663502013-09-05 10:16:18 +0200158 dispi_write(VBE_DISPI_INDEX_X_OFFSET, (val % linelength) * 8 / bpp);
159 dispi_write(VBE_DISPI_INDEX_Y_OFFSET, val / linelength);
160 }
Kevin O'Connord61fc532012-01-27 20:37:45 -0500161 return 0;
162}
163
Kevin O'Connore737b172012-02-04 11:08:39 -0500164int
165bochsvga_get_dacformat(struct vgamode_s *vmode_g)
166{
Paolo Bonzini9c291482015-01-01 21:27:46 +0100167 if (!bochsvga_dispi_enabled())
Gerd Hoffmann53663502013-09-05 10:16:18 +0200168 return stdvga_get_dacformat(vmode_g);
Kevin O'Connore737b172012-02-04 11:08:39 -0500169 u16 en = dispi_read(VBE_DISPI_INDEX_ENABLE);
170 return (en & VBE_DISPI_8BIT_DAC) ? 8 : 6;
171}
172
173int
174bochsvga_set_dacformat(struct vgamode_s *vmode_g, int val)
175{
Paolo Bonzini9c291482015-01-01 21:27:46 +0100176 if (!bochsvga_dispi_enabled())
Gerd Hoffmann53663502013-09-05 10:16:18 +0200177 return stdvga_set_dacformat(vmode_g, val);
Kevin O'Connore737b172012-02-04 11:08:39 -0500178 u16 en = dispi_read(VBE_DISPI_INDEX_ENABLE);
179 if (val == 6)
180 en &= ~VBE_DISPI_8BIT_DAC;
181 else if (val == 8)
182 en |= VBE_DISPI_8BIT_DAC;
183 else
184 return -1;
185 dispi_write(VBE_DISPI_INDEX_ENABLE, en);
186 return 0;
187}
188
Kevin O'Connor20dc4192014-02-05 20:52:25 -0500189static int
190bochsvga_save_state(u16 seg, u16 *info)
Kevin O'Connor2469f892012-02-04 12:40:02 -0500191{
Kevin O'Connor2469f892012-02-04 12:40:02 -0500192 u16 en = dispi_read(VBE_DISPI_INDEX_ENABLE);
193 SET_FARVAR(seg, *info, en);
194 info++;
195 if (!(en & VBE_DISPI_ENABLED))
196 return 0;
197 int i;
198 for (i = VBE_DISPI_INDEX_XRES; i <= VBE_DISPI_INDEX_Y_OFFSET; i++)
199 if (i != VBE_DISPI_INDEX_ENABLE) {
200 u16 v = dispi_read(i);
201 SET_FARVAR(seg, *info, v);
202 info++;
203 }
204 return 0;
205}
206
Kevin O'Connor20dc4192014-02-05 20:52:25 -0500207static int
208bochsvga_restore_state(u16 seg, u16 *info)
Kevin O'Connor2469f892012-02-04 12:40:02 -0500209{
Kevin O'Connor2469f892012-02-04 12:40:02 -0500210 u16 en = GET_FARVAR(seg, *info);
211 info++;
212 if (!(en & VBE_DISPI_ENABLED)) {
213 dispi_write(VBE_DISPI_INDEX_ENABLE, en);
214 return 0;
215 }
216 int i;
217 for (i = VBE_DISPI_INDEX_XRES; i <= VBE_DISPI_INDEX_Y_OFFSET; i++)
218 if (i == VBE_DISPI_INDEX_ENABLE) {
219 dispi_write(i, en);
220 } else {
221 dispi_write(i, GET_FARVAR(seg, *info));
222 info++;
223 }
224 return 0;
225}
226
Kevin O'Connor20dc4192014-02-05 20:52:25 -0500227int
228bochsvga_save_restore(int cmd, u16 seg, void *data)
229{
230 int ret = stdvga_save_restore(cmd, seg, data);
231 if (ret < 0 || !(cmd & SR_REGISTERS) || !GET_GLOBAL(dispi_found))
232 return ret;
233
234 u16 *info = (data + ret);
235 if (cmd & SR_SAVE)
236 bochsvga_save_state(seg, info);
237 if (cmd & SR_RESTORE)
238 bochsvga_restore_state(seg, info);
239 return ret + (VBE_DISPI_INDEX_Y_OFFSET-VBE_DISPI_INDEX_XRES+1)*sizeof(u16);
240}
241
Kevin O'Connor933bb762012-02-01 21:54:55 -0500242
243/****************************************************************
244 * Mode setting
245 ****************************************************************/
246
Kevin O'Connor5108c692011-12-31 19:13:45 -0500247int
Kevin O'Connore6bc4c12012-01-21 11:26:37 -0500248bochsvga_set_mode(struct vgamode_s *vmode_g, int flags)
Julian Pidancet87879e22011-12-19 05:08:00 +0000249{
Gerd Hoffmann53663502013-09-05 10:16:18 +0200250 if (GET_GLOBAL(dispi_found))
251 dispi_write(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED);
Kevin O'Connorc8845022012-01-31 22:51:56 -0500252 if (! is_bochsvga_mode(vmode_g))
Kevin O'Connore6bc4c12012-01-21 11:26:37 -0500253 return stdvga_set_mode(vmode_g, flags);
Gerd Hoffmann53663502013-09-05 10:16:18 +0200254 if (!GET_GLOBAL(dispi_found))
255 return -1;
Kevin O'Connor5108c692011-12-31 19:13:45 -0500256
Kevin O'Connor5b6936e2013-11-29 18:43:35 -0500257 u8 memmodel = GET_GLOBAL(vmode_g->memmodel);
258 if (memmodel == MM_PLANAR)
Kevin O'Connore6bc4c12012-01-21 11:26:37 -0500259 stdvga_set_mode(stdvga_find_mode(0x6a), 0);
Kevin O'Connor5b6936e2013-11-29 18:43:35 -0500260 if (memmodel == MM_PACKED && !(flags & MF_NOPALETTE))
261 stdvga_set_packed_palette();
Julian Pidancet87879e22011-12-19 05:08:00 +0000262
Kevin O'Connor5b6936e2013-11-29 18:43:35 -0500263 dispi_write(VBE_DISPI_INDEX_BPP, GET_GLOBAL(vmode_g->depth));
Kevin O'Connor3339c052012-01-13 20:00:35 -0500264 u16 width = GET_GLOBAL(vmode_g->width);
265 u16 height = GET_GLOBAL(vmode_g->height);
266 dispi_write(VBE_DISPI_INDEX_XRES, width);
267 dispi_write(VBE_DISPI_INDEX_YRES, height);
Julian Pidancet8bd766f2011-12-19 05:08:01 +0000268 dispi_write(VBE_DISPI_INDEX_BANK, 0);
Kevin O'Connorc8845022012-01-31 22:51:56 -0500269 u16 bf = ((flags & MF_NOCLEARMEM ? VBE_DISPI_NOCLEARMEM : 0)
270 | (flags & MF_LINEARFB ? VBE_DISPI_LFB_ENABLED : 0));
271 dispi_write(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | bf);
Julian Pidancet8bd766f2011-12-19 05:08:01 +0000272
273 /* VGA compat setup */
Kevin O'Connor184705f2012-01-14 22:17:43 -0500274 u16 crtc_addr = VGAREG_VGA_CRTC_ADDRESS;
275 stdvga_crtc_write(crtc_addr, 0x11, 0x00);
276 stdvga_crtc_write(crtc_addr, 0x01, width / 8 - 1);
Kevin O'Connorc8845022012-01-31 22:51:56 -0500277 stdvga_set_linelength(vmode_g, width);
Kevin O'Connor184705f2012-01-14 22:17:43 -0500278 stdvga_crtc_write(crtc_addr, 0x12, height - 1);
279 u8 v = 0;
280 if ((height - 1) & 0x0100)
281 v |= 0x02;
282 if ((height - 1) & 0x0200)
Julian Pidancet8bd766f2011-12-19 05:08:01 +0000283 v |= 0x40;
Kevin O'Connor184705f2012-01-14 22:17:43 -0500284 stdvga_crtc_mask(crtc_addr, 0x07, 0x42, v);
Julian Pidancet8bd766f2011-12-19 05:08:01 +0000285
Kevin O'Connor184705f2012-01-14 22:17:43 -0500286 stdvga_crtc_write(crtc_addr, 0x09, 0x00);
287 stdvga_crtc_mask(crtc_addr, 0x17, 0x00, 0x03);
288 stdvga_attr_mask(0x10, 0x00, 0x01);
289 stdvga_grdc_write(0x06, 0x05);
290 stdvga_sequ_write(0x02, 0x0f);
Kevin O'Connor5b6936e2013-11-29 18:43:35 -0500291 if (memmodel != MM_PLANAR) {
Kevin O'Connor184705f2012-01-14 22:17:43 -0500292 stdvga_crtc_mask(crtc_addr, 0x14, 0x00, 0x40);
293 stdvga_attr_mask(0x10, 0x00, 0x40);
294 stdvga_sequ_mask(0x04, 0x00, 0x08);
295 stdvga_grdc_mask(0x05, 0x20, 0x40);
Julian Pidancet8bd766f2011-12-19 05:08:01 +0000296 }
David Woodhouse0069a312013-02-08 15:50:54 +0000297 stdvga_attrindex_write(0x20);
Julian Pidancet8bd766f2011-12-19 05:08:01 +0000298
Kevin O'Connor5108c692011-12-31 19:13:45 -0500299 return 0;
Julian Pidancet87879e22011-12-19 05:08:00 +0000300}
Kevin O'Connor933bb762012-02-01 21:54:55 -0500301
302
303/****************************************************************
304 * Init
305 ****************************************************************/
306
307int
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500308bochsvga_setup(void)
Kevin O'Connor933bb762012-02-01 21:54:55 -0500309{
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500310 int ret = stdvga_setup();
Kevin O'Connor933bb762012-02-01 21:54:55 -0500311 if (ret)
312 return ret;
313
314 /* Sanity checks */
315 dispi_write(VBE_DISPI_INDEX_ID, VBE_DISPI_ID0);
316 if (dispi_read(VBE_DISPI_INDEX_ID) != VBE_DISPI_ID0) {
Gerd Hoffmann53663502013-09-05 10:16:18 +0200317 dprintf(1, "No VBE DISPI interface detected, falling back to stdvga\n");
318 return 0;
Kevin O'Connor933bb762012-02-01 21:54:55 -0500319 }
320
321 dispi_write(VBE_DISPI_INDEX_ID, VBE_DISPI_ID5);
Gerd Hoffmann53663502013-09-05 10:16:18 +0200322 SET_VGA(dispi_found, 1);
Kevin O'Connor933bb762012-02-01 21:54:55 -0500323
Kevin O'Connorcfd7ef92012-02-02 22:52:17 -0500324 if (GET_GLOBAL(HaveRunInit))
325 return 0;
326
Kevin O'Connor933bb762012-02-01 21:54:55 -0500327 u32 lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
Gerd Hoffmann083801d2019-03-19 11:48:13 +0100328 u32 io_addr = 0;
Kevin O'Connor933bb762012-02-01 21:54:55 -0500329 int bdf = GET_GLOBAL(VgaBDF);
330 if (CONFIG_VGA_PCI && bdf >= 0) {
Gerd Hoffmann5d598772013-12-12 14:55:14 +0100331 u16 vendor = pci_config_readw(bdf, PCI_VENDOR_ID);
Gerd Hoffmann083801d2019-03-19 11:48:13 +0100332 int barid, bar;
Gerd Hoffmann5d598772013-12-12 14:55:14 +0100333 switch (vendor) {
334 case 0x15ad: /* qemu vmware vga */
Kevin O'Connor933bb762012-02-01 21:54:55 -0500335 barid = 1;
Gerd Hoffmann5d598772013-12-12 14:55:14 +0100336 break;
Gerd Hoffmann083801d2019-03-19 11:48:13 +0100337 case 0x1234: /* stdvga */
338 bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_2);
339 io_addr = bar & PCI_BASE_ADDRESS_IO_MASK;
340 barid = 0;
341 break;
342 default: /* qxl, virtio */
Gerd Hoffmann5d598772013-12-12 14:55:14 +0100343 barid = 0;
344 break;
Kevin O'Connor933bb762012-02-01 21:54:55 -0500345 }
Gerd Hoffmann083801d2019-03-19 11:48:13 +0100346 bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_0 + barid * 4);
Kevin O'Connor933bb762012-02-01 21:54:55 -0500347 lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK;
348 dprintf(1, "VBE DISPI: bdf %02x:%02x.%x, bar %d\n", pci_bdf_to_bus(bdf)
349 , pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf), barid);
350 }
351
352 SET_VGA(VBE_framebuffer, lfb_addr);
353 u32 totalmem = dispi_read(VBE_DISPI_INDEX_VIDEO_MEMORY_64K) * 64 * 1024;
354 SET_VGA(VBE_total_memory, totalmem);
Kevin O'Connor49ddd9e2012-09-04 13:16:36 -0400355 SET_VGA(VBE_win_granularity, 64);
Kevin O'Connor933bb762012-02-01 21:54:55 -0500356 SET_VGA(VBE_capabilities, VBE_CAPABILITY_8BIT_DAC);
357
358 dprintf(1, "VBE DISPI: lfb_addr=%x, size %d MB\n",
Gerd Hoffmann091dd172012-02-06 15:51:43 +0100359 lfb_addr, totalmem >> 20);
Kevin O'Connor933bb762012-02-01 21:54:55 -0500360
361 // Validate modes
362 u16 en = dispi_read(VBE_DISPI_INDEX_ENABLE);
363 dispi_write(VBE_DISPI_INDEX_ENABLE, en | VBE_DISPI_GETCAPS);
364 u16 max_xres = dispi_read(VBE_DISPI_INDEX_XRES);
365 u16 max_bpp = dispi_read(VBE_DISPI_INDEX_BPP);
366 dispi_write(VBE_DISPI_INDEX_ENABLE, en);
Gerd Hoffmann004f5b32019-03-08 11:10:59 +0100367 struct generic_svga_mode *m = svga_modes;
368 unsigned int mcount = GET_GLOBAL(svga_mcount);
369 for (; m < &svga_modes[mcount]; m++) {
Kevin O'Connor933bb762012-02-01 21:54:55 -0500370 u16 width = GET_GLOBAL(m->info.width);
371 u16 height = GET_GLOBAL(m->info.height);
372 u8 depth = GET_GLOBAL(m->info.depth);
373 u32 mem = (height * DIV_ROUND_UP(width * vga_bpp(&m->info), 8)
Kevin O'Connor68f56aa2013-09-10 10:41:33 -0400374 * stdvga_vram_ratio(&m->info));
Kevin O'Connor933bb762012-02-01 21:54:55 -0500375
376 if (width > max_xres || depth > max_bpp || mem > totalmem) {
377 dprintf(1, "Removing mode %x\n", GET_GLOBAL(m->mode));
378 SET_VGA(m->mode, 0xffff);
379 }
380 }
381
Gerd Hoffmann083801d2019-03-19 11:48:13 +0100382 if (io_addr) {
383 int i;
384 u8 *edid = (void*)(io_addr);
385 for (i = 0; i < sizeof(VBE_edid); i++)
386 SET_VGA(VBE_edid[i], readb(edid + i));
387 }
388
Kevin O'Connor933bb762012-02-01 21:54:55 -0500389 return 0;
390}