aboutsummaryrefslogtreecommitdiffstats
path: root/vgasrc/vgabios.c
Commit message (Collapse)AuthorAgeFilesLines
* vgautil: Move definitions from cbvga.h and clext.h to vgautil.hKevin O'Connor2016-08-051-1/+0
| | | | | | | These files only need to export simple function definitions - move them to vgautil.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgautil: Add new header file with misc function and variable definitionsKevin O'Connor2016-08-051-0/+1
| | | | | | | | Move the generic function and variable definitions from vgabios.h to a new file vgautil.h. This reduces the size and complexity of vgabios.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgainit: Move video param setup to stdvga_build_video_param()Kevin O'Connor2016-08-051-0/+1
| | | | | | | Move the full video_param_table[] setup (including the updating of the BDA) to stdvga_build_video_param(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgafb: Move header definitions from vgabios.h to new file vgafb.hKevin O'Connor2016-08-041-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* swcursor: Concentrate swcursor logic in swcursor.cKevin O'Connor2016-08-041-6/+2
| | | | | | | | The software cursor code is not frequently used (only the coreboot framebuffer vga code uses it). Move its logic out of the main code and into swcursor.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Simplify scroll logicKevin O'Connor2016-07-211-43/+14
| | | | | | | | | Introduce a new function vgafb_scroll() to scroll a window on the screen and update vgabios.c to use only that function for scrolling. This makes the low-level vgafb_move_chars() and vgafb_clear_chars() local to vgafb.c, and it simplifies the callers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Simplify set_cursor_pos()Kevin O'Connor2016-07-041-18/+10
| | | | | | Rework set_cursor_pos() to be slightly simpler. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Don't check for special case of page==0xff on external callsKevin O'Connor2016-07-041-10/+4
| | | | | | | | | | | The original "lgpl vgabios" internally used page=0xff as a mechanism for specifying the current page. It also would allow int1013 calls to externally specify bh==0xff for the current page. However, there is no documentation supporting this as an externally available feature. SeaVGABIOS does not need the internal shortcut; this patch removes the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Remove special case of dh==0xff in handle_1013()Kevin O'Connor2016-07-041-7/+1
| | | | | | | | | | | The original "lgpl vgabios" had a special case for dh==0xff in its int1013 (write string) code. There does not appear to be any VGABIOS documentation supporting this as an externally available feature. It appears this was for its own internal use when writing its strings to the screen. SeaVGABIOS doesn't use this hack; this patch removes it from the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Don't use "smsww" instruction - it confuses x86emuKevin O'Connor2015-04-101-1/+1
| | | | | | | | | | Commit 251e2638 introduced the "smsww" instruction to the vgabios. Unfortunately, it appears at least some versions of x86emu crash when executing that instruction (eg, FC13 installer crashes). That instruction wasn't required to work around the problem fixed in 251e2638, so just avoid it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Don't use extra stack if it appears a modern OS is in useKevin O'Connor2015-03-181-0/+6
| | | | | | | | | | | | | | | If the last mode set (while not in vm86 mode) was done from a VBE mode set call then disable the extra stack. This works under the premise that only a modern OS would invoke the VBE mode changing facilities and a modern OS would always call the vgabios with sufficient stack space. This is an ugly hack to work around a problem Windows Vista (and possibly later Windows releases) has with the VGA BIOS using a stack in the e-segment. Reported-by: Richard Laager <rlaager@wiktel.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: On bda_save_restore() the saved vbe_mode also has flags in itKevin O'Connor2015-03-171-1/+1
| | | | | | | When restoring a saved state, make sure to remove any flags from the video mode prior to searching for that mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Add software cursor capabilityKevin O'Connor2014-11-121-3/+10
| | | | | | | | Add mechanism for drawing a cursor to the framebuffer to implement a cursor in software. The timer interrupt is "hooked" so that the cursor can blink. This can be useful for "coreboot native vga". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Fill in available legacy modes in video_func_static at runtimeKevin O'Connor2014-10-271-2/+2
| | | | | | | Instead of hard coding the list of modes, fill them in from the list of supported modes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move standard table definitions to std/vga.hKevin O'Connor2014-10-271-36/+8
| | | | | | | | Move the standard video bios definitions into a new header file. Also, define a struct with the layout for the static functionality table. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Only init BDA device details in init_bios_area()Kevin O'Connor2014-10-271-9/+0
| | | | | | | Don't set the device details when changing modes, and don't set mode details outside of mode setting. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Refactor get/set_cursor_shape() codeKevin O'Connor2014-10-271-28/+25
| | | | | | | Rework the code so that it is possible to calculate the current cursor shape even when not changing it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Set cursor shape fixesKevin O'Connor2014-10-271-11/+7
| | | | | | | | | | | | | The "cursor scaling" mode is determined by the first bit of the video_ctl bda value, not the modeset_ctl value. Also, on a set_scan_lines() call, the shape should be set to lines-3/lines-2 and the shape must be set after char_height has been updated. The existing cursor shape code matches the legacy "lgpl vgabios", but the behavior doesn't match bios documentation nor observations with an ati vga bios. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Don't pass vmode_g to vgafb_move_chars() / vgafb_clear_chars()Kevin O'Connor2014-10-271-15/+7
| | | | | | | | Now that a pointer to the current video mode info struct is cached in memory, it's not necessary to pass the struct into the vgafb code. The vgafb code can lookup the struct itself. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Cache a pointer to the current mode struct in the BDAKevin O'Connor2014-10-271-2/+6
| | | | | | | | | | | | | | Cache a pointer to the current mode 'vgamode_s' struct in the BDA to avoid doing a linear scan of all available vga modes when the struct is needed. This uses an additional two bytes in the BDA (at offset 0xbc). It's possible this could conflict with some other software, but that seams unlikely because that part of the BDA seems reserved for BIOS and VGABIOS uses. (And neither SeaBIOS nor Bochs BIOS currently make use of that area.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Don't declare custom internal BDA storage in std/bda.hKevin O'Connor2014-10-271-4/+4
| | | | | | | | | | | The vgabios uses storage in the BDA at offset 0xb9 for internal custom storage (the contents do not appear to be part of any bios standard). Move the description of this custom vgabios area from std/bda.h to vgasrc/vgabios.h. Add two new macros (GET_BDA_EXT and SET_BDA_EXT). This should make it more clear that the area is for custom internal storage. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Return from handle_1011() if handler found.Kevin O'Connor2014-05-281-9/+9
| | | | | | | Fix cut-and-paste error in handle_1011() causing spurious debug_stub() calls when CONFIG_VGA_STDVGA_PORTS is enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Introduce text_address().Kevin O'Connor2014-04-111-8/+4
| | | | | | | Factor out code that calculates the text mode address of a given character. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Split vgafb_scroll() into separate move and clear functions.Kevin O'Connor2014-04-111-11/+52
| | | | | | | | | | Rewrite the low-level scroll code so that it is implemented using two basic operations: move text and clear text. This simplifies the low-level code as it no longer needs to handle up scrolling vs down scrolling. Determining the direction of the scroll is now done in the higher level (vgabios.c) code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Add option to control use of standard VGA IO ports.Kevin O'Connor2014-04-111-12/+32
| | | | | | | | Add option CONFIG_VGA_STDVGA_PORTS. When this option is disabled, the main BIOS code will not attempt to access any of the legacy VGA IO ports. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Refactor write_teletype and write_chars.Kevin O'Connor2014-02-081-49/+31
| | | | | | | | | Factor out the common code of writing to the screen and advancing the cursor position to a new function write_char(). Eliminate write_chars() and then simplify write_teletype(). Also, eliminate the separate scroll_one() function as it no longer reduces stack space. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Don't interpret TAB character.Kevin O'Connor2014-02-081-7/+0
| | | | | | | | | | | Several sources document that the Bell, Backspace, newline, and carriage return characters are interpreted by int 10/0e. There does not seem to be any references to that function interpreting tab. The original "lgpl vgabios" has code for interpreting tab, but the code is incorrect. Finally, tests on an ATI vgabios indicate that tab is not interpreted. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Simplify save/restore mechanism.Kevin O'Connor2014-02-051-41/+37
| | | | | | | Reorganize the save/restore functions to eliminate some boilerplate code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Simplify the bios save state area.Kevin O'Connor2014-02-051-37/+10
| | | | | | | | | | | | The structure of the "bios save state area" as returned by handle_101c() and vbe_104f04() does not follow any particular order. (And there does not appear to be any documentation that would require it to follow a particular order.) So, rearrange the layout of the struct to make save and restore simpler. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Make sure exported structs use PACKED.Kevin O'Connor2014-02-051-1/+1
| | | | | | | | | | | | | | | Commit ca668640 introduced structs for data returned from the handle_101b and handle_101c calls. However, the structs were not declared as packed and that caused incorrect behavior for handle_101b. This was seen to break some old DOS programs (Win3 setup and DISPLAY.SYS). This patch adds in the necessary PACKED declaration to the structs. The 'struct saveBDAstate' remains un-packed, as it does not appear that its contents are documented. (And, its format already differs from what was in the previous "lgpl vgabios".) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move initialization code to new file vgainit.c.Kevin O'Connor2013-12-041-153/+1
| | | | | | | Move the initialization code out of vgabios.c to a new file to reduce the size of the vgabios.c file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Support allocating an extra stack for vgabios calls and default on.Kevin O'Connor2013-12-041-0/+43
| | | | | | | | | | | | | Add code to allocate an extra stack for the main vgabios int 0x10 entry point. The allocation is done via the PMM spec and uses a PCI v3 permanent low memory region request. This request will work with SeaBIOS - it is unknown how many other main BIOS implementations support this PMM call. The extra stack is useful for old DOS programs that call the VGABIOS and expect it to work with very small amounts of stack space. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move low-level hardware writing from output.c to new file hw/serialio.c.Kevin O'Connor2013-12-041-1/+1
| | | | | | | | | | Avoid hardware specific code in output.c. This will reduce the amount of change needed to output.c as support for more serial hardware is added. This patch also renames some functions to improve the naming scheme. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move vbe.h to std/vbe.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move optionroms.h to std/optionrom.h and util.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-8/+9
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-2/+2
| | | | | | Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Fix cirrus memory clear on mode switch.Kevin O'Connor2013-03-091-1/+1
| | | | | | | | | | | | | The cirrus_clear_vram() code wasn't actually doing anything because of a u8 overflow. Fix that. Fill with 0xff when performing a legacy cirrus mode switch (WinXP has been observed to incorrectly render dialog boxes if the memory is filled to 0). This was the behavior of the original LGPL vgabios code. To support this, add mechanism (MF_LEGACY) to allow vga drivers to detect if the mode switch is from vesa or int10. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.Kevin O'Connor2013-02-181-1/+1
| | | | | | | | | | | Convert all users of the alternative variable exports to VARFSEG. There isn't a significant distinction between the existing types of exports, so it's simpler to just use one type going forward. The new VARFSEG declaration is only emitting when in 32bit mode, so update and move some variables as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Normalize POST initialization function name suffixes.Kevin O'Connor2013-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The POST phase has to invoke many initialization functions, and these functions can have complex inter-dependencies. Try to categorize the functions into 4 classes: preinit - functions called very early in POST where function ordering is very important and the code has limited access to other interfaces. init - functions that initialize internal interfaces and standard external interfaces. This code is generally not dependent on particular hardware and typically does not communicate directly with any hardware devices. setup - functions which access hardware or are dependent on particular hardware or platform devices. prepboot - functions that finalize internal interfaces and that prepare for the boot phase. This patch attempts to normalize the suffixes - functions that used _init(), _setup(), _finalize(), or similar that did not follow the above pattern were renamed. Other than function name changes, there should be no code impact to this patch. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: implement AX=1120H..1124H functionsPaolo Bonzini2013-01-121-0/+60
| | | | | | | | | | | These function only have to set INT 1Fh and INT 43h, and set the BDA height + number of rows. I could not find out whether AX=1120h should also set the character height to 8. I think not, because INT 43h might still point to 14- or 16-pixel high characters and in this case INT 1Fh will not be used at all. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Minor - remove CLEARBITS_BDA and SETBITS_BDA macros.Kevin O'Connor2012-06-101-4/+1
| | | | | | | Remove these infrequently used macros and replace with explicit GET_BDA/SET_BDA calls. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Fetch _rom_header_size from the global segment when computing the ↵Julian Pidancet2012-03-061-1/+2
| | | | | | | | | | ROM's checksum Otherwise, checksum_far is getting called with zero as the length parameter, and the ROM checksum in the header end up beeing zero after vga_post() is called. Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
* vgabios: int1009 handler bug limits count to 256 characters.Kevin O'Connor2012-03-061-0/+5
| | | | | | Fix bug (u8 overflow) causing large screen fills to fail. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Some tweaks to optimize stack space.Kevin O'Connor2012-02-131-55/+41
| | | | | | | | | | | | | | | | Gcc seems to handle passing structs by value if they are 4 bytes in size instead of 3 bytes. So, add a pad byte to struct carattr and struct cursorpos. Reorganize set_cursor_pos(), verify_scroll(), and handle_1013() so there are less live variables. Don't inline the VBE functions into the main handler code. Code calling VBE functions are newer and are more likely to provide adequate stack space - inlining can cause more stack usage for older functions (which may be stack constrained). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Minor vgabios fixes.Kevin O'Connor2012-02-121-17/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Add version string to debug output.Kevin O'Connor2012-02-111-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Implement VBE save/restore state function (func 04).Kevin O'Connor2012-02-041-5/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move save/restore state code from vgabios.c to stdvga.c.Kevin O'Connor2012-02-041-66/+30
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>