aboutsummaryrefslogtreecommitdiffstats
path: root/vgasrc/vgabios.h
Commit message (Collapse)AuthorAgeFilesLines
* vgasrc: Increase debug levelPaul Menzel2017-01-291-1/+1
| | | | | | | | | | You only want this information for debugging. As it also slows down the boot considerably, as, for example, for every character of the GRUB menu, something is sent over the serial console. Therefore, increase the debugging level to 9. Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* vgautil: Add new header file with misc function and variable definitionsKevin O'Connor2016-08-051-28/+3
| | | | | | | | 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-6/+3
| | | | | | | 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-36/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* swcursor: Concentrate swcursor logic in swcursor.cKevin O'Connor2016-08-041-2/+3
| | | | | | | | 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>
* swcursor: Move swcursor code from vgafb.c to new file swcursor.cKevin O'Connor2016-08-041-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Simplify scroll logicKevin O'Connor2016-07-211-4/+2
| | | | | | | | | 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: Don't use extra stack if it appears a modern OS is in useKevin O'Connor2015-03-181-1/+3
| | | | | | | | | | | | | | | 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: Add software cursor capabilityKevin O'Connor2014-11-121-0/+4
| | | | | | | | 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: Support emulating text mode attributes while in graphics modeKevin O'Connor2014-11-121-1/+9
| | | | | | | | | Add support for simple text mode attribute emulation while in graphics mode. This improves text highlighting and background color on some boot-loaders. Enable it only for CBVGA vgabios and only when a text mode is requested. 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-0/+1
| | | | | | | 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-16/+3
| | | | | | | | 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: Rename vbe_flags to flagsKevin O'Connor2014-10-271-1/+3
| | | | | | | Allow the custom bda field vbe_flags to be used for flags outside of vbe. 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-2/+2
| | | | | | | | 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-0/+1
| | | | | | | | | | | | | | 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-0/+13
| | | | | | | | | | | 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: Initial support for coreboot native vga vgabios.Kevin O'Connor2014-04-111-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Add support for manipulating framebuffers in high memory.Kevin O'Connor2014-04-111-0/+1
| | | | | | | Add code for manipulating "direct" style linear RGB framebuffers that may be in high memory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Introduce text_address().Kevin O'Connor2014-04-111-0/+1
| | | | | | | Factor out code that calculates the text mode address of a given character. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Rewrite vgafb.c graphics operations to set of 4 standard operators.Kevin O'Connor2014-04-111-4/+22
| | | | | | | | | | | The vgabios graphics manipulations can all be implemented on top of 4 basic primitives: read 8 pixels, write 8 pixels, move pixels, and clear pixels. Implement these four operators for all the graphics modes and rewrite the graphics functions in vgafb.c to use them. This simplifies the graphics code as the high level logic no longer needs to be implemented for each graphical framebuffer type. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Split vgafb_scroll() into separate move and clear functions.Kevin O'Connor2014-04-111-2/+4
| | | | | | | | | | 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: Simplify save/restore mechanism.Kevin O'Connor2014-02-051-9/+8
| | | | | | | 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-14/+3
| | | | | | | | | | | | 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: Move initialization code to new file vgainit.c.Kevin O'Connor2013-12-041-0/+3
| | | | | | | 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: Fix cirrus memory clear on mode switch.Kevin O'Connor2013-03-091-0/+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>
* vgabios: Some tweaks to optimize stack space.Kevin O'Connor2012-02-131-2/+2
| | | | | | | | | | | | | | | | 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-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Implement VBE save/restore state function (func 04).Kevin O'Connor2012-02-041-1/+1
| | | | 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-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Handle VGA option rom being re-run.Kevin O'Connor2012-02-021-0/+1
| | | | | | | | Check for the case where the option rom is executed a second time - in that case re-init the hardware, but do not set any variables. This should make the rom better behaving when run from S3 resume. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Fix missing "extern" declaration on vbe variables.Kevin O'Connor2012-02-011-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Add support for vbe get/set line length function.Kevin O'Connor2012-02-011-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move BDA setting from driver code to common code.Kevin O'Connor2012-02-011-1/+2
| | | | | | | | | | Always setup the BDA on a mode switch. Call that BDA setup code unconditionally. Also, always set vbe_mode and use that for finding the current mode and for reporting the mode to vbe callers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Extract out current mode finding into new function.Kevin O'Connor2012-01-211-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Check that the PCI BDF passed in is valid before using.Kevin O'Connor2012-01-191-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Make VBE code depend on a config setting.Kevin O'Connor2012-01-161-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move video_param_table definition to vgabios.c.Kevin O'Connor2012-01-161-4/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move static_functionality[] from vgatables.c to vgabios.c.Kevin O'Connor2012-01-161-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Unify cirrus and vbe vesa functions.Kevin O'Connor2012-01-141-0/+1
| | | | | | Unify the code for the Cirrus and VBE vesa functions 00-03. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Make VBE code independent of bochsvga.Kevin O'Connor2012-01-141-11/+4
| | | | | | | | | | | Introduce new global variables (VBE_enabled, VBE_total_memory, VBE_capabilities, VBE_framebuffer) to replace the need for function calls that were specific to bochsvga. Replace info received from bochsvga_mode_info with info found in vgahw_find_mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Extract out common parts of struct vgamode_s.Kevin O'Connor2012-01-141-2/+10
| | | | | | | | Extract out the fields in 'struct vgamode_s' that are used in the main code. The remaining fields are specific to the standard vga hardware driver. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Unify page size calculations; remove page size from vgamode_s.Kevin O'Connor2012-01-141-3/+1
| | | | | | | | | | | | | | | | | | | The previous code could obtain the page size in different ways - from vmode_g->sslength, from SCREEN_MEM_START, or by manually multiplying cols and rows. Add a new func (calc_page_size) and use that in areas that need to calculate the page size. Convert readers of the page size to read it from the "video_pagesize" entry in the BDA instead of recalculating it. Remove the page size from struct vgamode_s (slength) as it is now calculated dynamically. The new calculated versions are different from the existing values exported in video_param_table. However, the existing values (for CGA) did not look correct - I compared the values to those exported by two other VGA BIOS manufacturers and used the values that look more standard. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Use vesa style memory model flags in stdvga code.Kevin O'Connor2012-01-141-0/+10
| | | | | | Replace the custom flags with the flags defined in the VBE spec. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Unify X_init() functions.Kevin O'Connor2011-12-311-0/+1
| | | | | | | | | | | | Use the same function signature for cirrus, bochsvga, geodelx, and stdvga init code. Have each hardware type explicitly call stdvga_init when needed. To unify bochsvga_init() signature, store the device BDF passed into the optionrom init code in a global variable (VgaBDF). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Create clext.h and use "clext_" as prefix for exported funcs.Kevin O'Connor2011-12-311-4/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Refactor vga_set_mode and stdvga_set_mode.Kevin O'Connor2011-12-311-2/+8
| | | | | | | | | | | | | | Split out the BDA setup part of vga_set_mode to new function modeswitch_set_bda. Move the remaining parts (palette loading, screen clearing, font loading) of vga_set_mode into stdvga_set_mode. Add new mode switching flags and pass them to stdvga_set_mode, so it does not need to inspect modeset_ctl directly. Move code needed by stdvga_set_mode (perform_gray_scale_summing, clear_screen) to stdvga.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move vgafb_load_font to stdvga.c.Kevin O'Connor2011-12-311-2/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Rename vgaio.c to stdvga.c.Kevin O'Connor2011-12-311-142/+1
| | | | | | Also, introduce stdvga.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Move vbe code from vgabios.c to new file vbe.c.Kevin O'Connor2011-12-311-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgabios: Rename vga.c to vgabios.c.Kevin O'Connor2011-12-311-0/+225
Also, rename vgatables.h to vgabios.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>