Commit Graph

44 Commits

Author SHA1 Message Date
Kevin O'Connor 731c88d503 stdvgaio: Only read/write one color palette entry at a time
Introduce stdvga_dac_read_many() and stdvga_dac_write_many() for
writing multiple dac palette entries.  Convert the stdvga_dac_read()
and stdvga_dac_write() low-level IO access functions in stdvgaio.c to
access just one color palette entry.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-13 13:19:56 -04:00
Kevin O'Connor c5a361c09a stdvga: Add stdvga_set_vertical_size() helper function
Add helper function and update the bochsvga.c code to use it.  This
emphasizes the relationship between stdvga_get_vertical_size() and
stdvga_set_vertical_size() code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:49 -04:00
Kevin O'Connor 22c9141260 stdvga: Rename stdvga_get_vde() to stdvga_get_vertical_size()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:49 -04:00
Kevin O'Connor 549463dbc0 stdvga: Rename stdvga_set_scan_lines() to stdvga_set_character_height()
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:45 -04:00
Kevin O'Connor c67914ac42 stdvga: Rename stdvga_set_text_block_specifier() to stdvga_set_font_location()
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:42 -04:00
Kevin O'Connor aa94925d29 stdvga: Rework stdvga palette index paging interface functions
Rename the functions to make them a little easier to understand.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:42 -04:00
Kevin O'Connor 8de51a5af2 stdvga: Rename stdvga_toggle_intensity() to stdvga_set_palette_blinking()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:42 -04:00
Kevin O'Connor 96c7781ff4 stdvga: Add comments to interface functions in stdvga.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:42 -04:00
Kevin O'Connor 2996819f7d stdvga: Rename CGA palette functions
Rename stdvga_set_border_color() to stdvga_set_cga_background_color()
and stdvga_set_palette() to stdvga_set_cga_palette().  These functions
implement compatibility for old CGA cards - rename them so they are
not confused with the functions that manipulte the VGA palette.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:58:49 -04:00
Kevin O'Connor 1588fd1437 vgasrc: Rename vgahw_get_linesize() to vgahw_minimum_linelength()
Make the relationship between vgahw_get_linelength() and
vgahw_get_linesize() more clear by renaming it to
vgahw_minimum_linelength().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-03-15 19:50:29 -04:00
Kevin O'Connor d73e18bb70 vgasrc: Use curmode_g instead of vmode_g when mode is the current video mode
Many functions are passed a pointer to the current video mode
vgamode_s struct.  Use the name 'curmode_g' for these functions and
use 'vmode_g' for functions that can accept an arbitrary video mode.
Hopefully this will make the goals of the functions more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-03-15 10:58:57 -04:00
Kevin O'Connor ef5fdc99b7 vga: Fix bug in stdvga_get_linesize()
Add required GET_GLOBAL() macro to vmode_g access.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-08-29 14:38:19 -04:00
Patrick Rudolph 4902b8a703 SeaVGABIOS/vbe: Query driver for scanline pitch v2
Query the driver for the real scanline pitch in bytes.

As cbvga doesn't change the pitch on mode change, always
return the same pitch, that might exceed width times Bytes-per-pixel.

Report the default stdvga pitch for all other drivers.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
2017-06-12 15:17:09 -04:00
Kevin O'Connor c682ffe671 vgautil: Move generic definitions from stdvga.h to vgautil.h
Don't use stdvga.h for function definitions of code in stdvgamodes.c
and stdvgaio.c.  Move them to vgautil.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-05 11:48:20 -04:00
Kevin O'Connor c9aecfcd14 vgabios: Refactor get/set_cursor_shape() code
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>
2014-10-27 11:02:28 -04:00
Kevin O'Connor 20dc419306 vgabios: Simplify save/restore mechanism.
Reorganize the save/restore functions to eliminate some boilerplate
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-02-05 20:52:25 -05:00
Kevin O'Connor f5ec1e0a5e vgabios: Make sure exported structs use PACKED.
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>
2014-02-05 18:59:56 -05:00
Kevin O'Connor 4ade523a9d Remove ioport.h; disperse its contents to other header files.
Move the inb(), insb(), etc. code from ioport.h to x86.h.  Move the
PORT_* definitions to their appropriate hardware files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-28 22:10:31 -04:00
Kevin O'Connor fa9c66a656 Rename util.c to string.c and introduce string.h.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18 20:48:34 -04:00
Kevin O'Connor 68f56aa6e9 vgabios: Rename stdvga_bpp_factor to stdvga_vram_ratio.
Invert the values returned by stdvga_bpp_factor and rename it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18 20:48:33 -04:00
Kevin O'Connor 9cba2b3d22 vgabios: Fix stdvga_perform_gray_scale_summing().
Fix conversion error that resulted in
stdvga_perform_gray_scale_summing not actually writing the new results
back.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-03-09 13:00:40 -05:00
Kevin O'Connor d83c87bb20 Normalize POST initialization function name suffixes.
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>
2013-02-05 20:00:29 -05:00
Kevin O'Connor 9f857fc97c vgabios: Move save/restore state code from vgabios.c to stdvga.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-04 12:41:04 -05:00
Kevin O'Connor e737b178e1 vgabios: Add support for VBE get/set dac palette format (func 08).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-04 11:08:39 -05:00
Kevin O'Connor f98bbf09fc vgabios: Move stdvga_set_mode() to stdvgamodes.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:39:27 -05:00
Kevin O'Connor 1692007a5f vgabios: Minor - pass display address to stdvga_set_cursor_pos().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:39:21 -05:00
Kevin O'Connor d61fc53a60 vgabios: Add support for VBE get/set display start function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:39:03 -05:00
Kevin O'Connor 3876b53122 vgabios: Add support for vbe get/set line length function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:38:49 -05:00
Kevin O'Connor 9961f9958c vgabios: Add support for vesa get/set window function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:37:02 -05:00
Kevin O'Connor e6bc4c1c58 vgabios: Move BDA setting from driver code to common code.
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>
2012-02-01 20:35:48 -05:00
Kevin O'Connor 160d34abce vgabios: Simplify planar4 vgafb code.
Don't bother programming the vga registers to manipulate the
framebuffer when in planar4 mode.  Instead, just switch between the
four planes and do the manipulation with regular reads and writes.
This makes the code simpler to understand (the vga hardware
manipulations are arcane and complex).

Note, this could make text scrolling in planar4 mode slower and more
likely to result in tearing.  However, it's unlikely anything
important uses the vgabios in planar4 mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-19 21:33:23 -05:00
Kevin O'Connor 86d2e004e2 vgabios: Use standard VGA IO wrapper functions in stdvga.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-16 11:51:37 -05:00
Kevin O'Connor 3471fdbe63 vgabios: Add wrapper functions for accessing standard VGA registers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-16 11:50:42 -05:00
Kevin O'Connor 34203cdf8a vgabios: Unify code to generate the vbe mode list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14 17:19:39 -05:00
Kevin O'Connor 10dff3db24 vgabios: Extract out common parts of struct vgamode_s.
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>
2012-01-14 17:19:25 -05:00
Kevin O'Connor d4398adab6 vgabios: Use vesa style memory model flags in stdvga code.
Replace the custom flags with the flags defined in the VBE spec.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14 12:59:46 -05:00
Kevin O'Connor 161d201aff vgabios: Unify X_init() functions.
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>
2011-12-31 19:45:14 -05:00
Kevin O'Connor 5108c69c47 vgabios: Unify X_set_mode() functions.
Use the same function signature for cirrus, bochsvga, and stdvga
set_mode code.

Make both the int1000 interface and the VBE 104f02 interface use the
same set_mode function.

Where clext and bochsvga need to fallback to the standard vga mode
switching, have them call vgastd_mode_switch directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 19:21:23 -05:00
Kevin O'Connor 821d6b410e vgabios: Refactor vga_set_mode and stdvga_set_mode.
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>
2011-12-31 18:19:22 -05:00
Kevin O'Connor c990f27298 vgabios: Introduce stdvga_get_crtc() and use it consistently.
The low level VGA code shouldn't depend on the crtc address stored in
the BDA - it can find the address on its own.

The cirrus_get_crtc() function is the same - replace it with
stdvga_get_crtc().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 16:03:41 -05:00
Kevin O'Connor 7e1d5301fd vgabios: Fix typo in release_font_access() - inb instead of inw.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 15:52:22 -05:00
Kevin O'Connor 2bec7d6162 vgabios: Move vgafb_load_font to stdvga.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 04:32:58 -05:00
Kevin O'Connor 88ca74183a vgabios: Rename vgahw_* functions to stdvga_*.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 04:24:20 -05:00
Kevin O'Connor ed68e5b601 vgabios: Rename vgaio.c to stdvga.c.
Also, introduce stdvga.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 04:17:44 -05:00
Renamed from vgasrc/vgaio.c (Browse further)