This series reorganizes the vgabios headers so that there is just one header for each C file, except for vgautil.h which is used for C files that only need simple function and variable extern definitions.
-Kevin
Kevin O'Connor (5): vgafb: Move header definitions from vgabios.h to new file vgafb.h vgainit: Move video param setup to stdvga_build_video_param() vgautil: Add new header file with misc function and variable definitions vgautil: Move generic definitions from stdvga.h to vgautil.h vgautil: Move definitions from cbvga.h and clext.h to vgautil.h
vgasrc/bochsvga.c | 5 +-- vgasrc/cbvga.c | 5 +-- vgasrc/cbvga.h | 20 ------------ vgasrc/clext.c | 4 +-- vgasrc/clext.h | 20 ------------ vgasrc/geodevga.c | 3 +- vgasrc/stdvga.c | 1 + vgasrc/stdvga.h | 32 +------------------ vgasrc/stdvgaio.c | 3 +- vgasrc/stdvgamodes.c | 13 +++++++- vgasrc/swcursor.c | 4 ++- vgasrc/vbe.c | 8 ++++- vgasrc/vgabios.c | 4 ++- vgasrc/vgabios.h | 72 +++-------------------------------------- vgasrc/vgafb.c | 4 ++- vgasrc/vgafb.h | 42 ++++++++++++++++++++++++ vgasrc/vgafonts.c | 2 +- vgasrc/vgahw.h | 3 +- vgasrc/vgainit.c | 11 ++----- vgasrc/vgautil.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 20 files changed, 182 insertions(+), 164 deletions(-) delete mode 100644 vgasrc/cbvga.h delete mode 100644 vgasrc/clext.h create mode 100644 vgasrc/vgafb.h create mode 100644 vgasrc/vgautil.h
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- vgasrc/cbvga.c | 1 + vgasrc/swcursor.c | 3 ++- vgasrc/vgabios.c | 1 + vgasrc/vgabios.h | 36 ------------------------------------ vgasrc/vgafb.c | 1 + vgasrc/vgafb.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 47 insertions(+), 37 deletions(-) create mode 100644 vgasrc/vgafb.h
diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 1cfb9d3..b4d7d36 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -11,6 +11,7 @@ #include "string.h" // memset16_far #include "util.h" // find_cb_table #include "vgabios.h" // VGAREG_* +#include "vgafb.h" // handle_gfx_op
static int CBmode VAR16; static struct vgamode_s CBmodeinfo VAR16; diff --git a/vgasrc/swcursor.c b/vgasrc/swcursor.c index 83f4822..b7b3250 100644 --- a/vgasrc/swcursor.c +++ b/vgasrc/swcursor.c @@ -6,7 +6,8 @@
#include "biosvar.h" // GET_BDA #include "bregs.h" // struct bregs -#include "vgabios.h" // handle_gfx_op +#include "vgabios.h" // get_cursor_pos +#include "vgafb.h" // handle_gfx_op
// Draw/undraw a cursor on the framebuffer by xor'ing the cursor cell static void diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index 4e897c4..44ce312 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -14,6 +14,7 @@ #include "stdvga.h" // stdvga_set_cursor_shape #include "string.h" // memset_far #include "vgabios.h" // calc_page_size +#include "vgafb.h" // vgafb_write_char #include "vgahw.h" // vgahw_set_mode
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h index ffbb729..0e988bd 100644 --- a/vgasrc/vgabios.h +++ b/vgasrc/vgabios.h @@ -43,25 +43,6 @@ struct vgamode_s { u16 sstart; };
-// Graphics pixel operations. -struct gfx_op { - struct vgamode_s *vmode_g; - u32 linelength; - u32 displaystart; - - u8 op; - u16 x, y; - - u8 pixels[8]; - u16 xlen, ylen; - u16 srcy; -}; - -#define GO_READ8 1 -#define GO_WRITE8 2 -#define GO_MEMSET 3 -#define GO_MEMMOVE 4 - // Custom internal storage in BDA (don't change here without also // updating vgaentry.S) #define VGA_CUSTOM_BDA 0xb9 @@ -107,12 +88,6 @@ extern struct video_param_s video_param_table[29]; extern int VgaBDF; extern int HaveRunInit; #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val)) -struct carattr { - u8 car, attr, use_attr, pad; -}; -struct cursorpos { - u8 x, y, page, pad; -}; int vga_bpp(struct vgamode_s *vmode_g); u16 calc_page_size(u8 memmodel, u16 width, u16 height); u16 get_cursor_shape(void); @@ -122,17 +97,6 @@ struct vgamode_s *get_current_mode(void); int vga_set_mode(int mode, int flags); extern struct video_func_static static_functionality;
-// vgafb.c -void init_gfx_op(struct gfx_op *op, struct vgamode_s *vmode_g); -void handle_gfx_op(struct gfx_op *op); -void *text_address(struct cursorpos cp); -void vgafb_scroll(struct cursorpos win, struct cursorpos winsize - , int lines, struct carattr ca); -void vgafb_write_char(struct cursorpos cp, struct carattr ca); -struct carattr vgafb_read_char(struct cursorpos cp); -void vgafb_write_pixel(u8 color, u16 x, u16 y); -u8 vgafb_read_pixel(u16 x, u16 y); - // swcursor.c struct bregs; void swcursor_pre_handle10(struct bregs *regs); diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index 57ecc9b..04d543e 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -11,6 +11,7 @@ #include "stdvga.h" // stdvga_planar4_plane #include "string.h" // memset_far #include "vgabios.h" // vgafb_scroll +#include "vgafb.h" // vgafb_write_char #include "vgahw.h" // vgahw_get_linelength
static inline void diff --git a/vgasrc/vgafb.h b/vgasrc/vgafb.h new file mode 100644 index 0000000..ccdc703 --- /dev/null +++ b/vgasrc/vgafb.h @@ -0,0 +1,42 @@ +#ifndef __VGAFB_H +#define __VGAFB_H + +// Graphics pixel operations. +struct gfx_op { + struct vgamode_s *vmode_g; + u32 linelength; + u32 displaystart; + + u8 op; + u16 x, y; + + u8 pixels[8]; + u16 xlen, ylen; + u16 srcy; +}; + +#define GO_READ8 1 +#define GO_WRITE8 2 +#define GO_MEMSET 3 +#define GO_MEMMOVE 4 + +struct cursorpos { + u8 x, y, page, pad; +}; + +struct carattr { + u8 car, attr, use_attr, pad; +}; + +// vgafb.c +void init_gfx_op(struct gfx_op *op, struct vgamode_s *vmode_g); +void handle_gfx_op(struct gfx_op *op); +void *text_address(struct cursorpos cp); +void vgafb_scroll(struct cursorpos win, struct cursorpos winsize + , int lines, struct carattr ca); +void vgafb_write_char(struct cursorpos cp, struct carattr ca); +struct carattr vgafb_read_char(struct cursorpos cp); +void vgafb_write_pixel(u8 color, u16 x, u16 y); +u8 vgafb_read_pixel(u16 x, u16 y); + +#endif // vgafb.h
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 --- vgasrc/stdvgamodes.c | 10 ++++++++++ vgasrc/vgabios.c | 1 + vgasrc/vgabios.h | 9 +++------ vgasrc/vgainit.c | 8 -------- 4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c index c553514..f61d52f 100644 --- a/vgasrc/stdvgamodes.c +++ b/vgasrc/stdvgamodes.c @@ -7,6 +7,7 @@
#include "biosvar.h" // GET_GLOBAL #include "output.h" // warn_internalerror +#include "std/vga.h" // struct video_param_s #include "stdvga.h" // stdvga_find_mode #include "string.h" // memcpy_far #include "vgabios.h" // video_param_table @@ -348,9 +349,18 @@ stdvga_list_modes(u16 seg, u16 *dest, u16 *last) SET_FARVAR(seg, *dest, 0xffff); }
+static struct video_save_pointer_s video_save_pointer_table VAR16; + +static struct video_param_s video_param_table[29] VAR16; + void stdvga_build_video_param(void) { + SET_BDA(video_savetable + , SEGOFF(get_global_seg(), (u32)&video_save_pointer_table)); + SET_VGA(video_save_pointer_table.videoparam + , SEGOFF(get_global_seg(), (u32)video_param_table)); + static u8 parammodes[] VAR16 = { 0, 0, 0, 0, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0x0d, 0x0e, 0, diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index 44ce312..b980da5 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -11,6 +11,7 @@ #include "config.h" // CONFIG_* #include "output.h" // dprintf #include "std/vbe.h" // VBE_RETURN_STATUS_FAILED +#include "std/vga.h" // struct video_func_static #include "stdvga.h" // stdvga_set_cursor_shape #include "string.h" // memset_far #include "vgabios.h" // calc_page_size diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h index 0e988bd..2176ec6 100644 --- a/vgasrc/vgabios.h +++ b/vgasrc/vgabios.h @@ -2,9 +2,8 @@ #define __VGABIOS_H
#include "config.h" // CONFIG_VGA_EMULATE_TEXT +#include "farptr.h" // GET_FARVAR #include "types.h" // u8 -#include "farptr.h" // struct segoff_s -#include "std/vga.h" // struct video_param_s
// Save/Restore flags #define SR_HARDWARE 0x0001 @@ -81,12 +80,10 @@ extern u8 vgafont14alt[]; extern u8 vgafont16alt[];
// vgainit.c -extern struct video_save_pointer_s video_save_pointer_table; -extern struct video_param_s video_param_table[29]; - -// vgabios.c extern int VgaBDF; extern int HaveRunInit; + +// vgabios.c #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val)) int vga_bpp(struct vgamode_s *vmode_g); u16 calc_page_size(u8 memmodel, u16 width, u16 height); diff --git a/vgasrc/vgainit.c b/vgasrc/vgainit.c index 6249e66..f003026 100644 --- a/vgasrc/vgainit.c +++ b/vgasrc/vgainit.c @@ -18,10 +18,6 @@ #include "vgabios.h" // video_save_pointer_table #include "vgahw.h" // vgahw_setup
-struct video_save_pointer_s video_save_pointer_table VAR16; - -struct video_param_s video_param_table[29] VAR16; - // Type of emulator platform - for dprintf with certain compile options. int PlatformRunningOn VAR16;
@@ -132,8 +128,6 @@ init_bios_area(void) SET_BDA(modeset_ctl, 0x51);
SET_BDA(dcc_index, CONFIG_VGA_STDVGA_PORTS ? 0x08 : 0xff); - SET_BDA(video_savetable - , SEGOFF(get_global_seg(), (u32)&video_save_pointer_table));
// FIXME SET_BDA(video_msr, 0x00); // Unavailable on vanilla vga, but... @@ -171,8 +165,6 @@ vga_post(struct bregs *regs)
init_bios_area();
- SET_VGA(video_save_pointer_table.videoparam - , SEGOFF(get_global_seg(), (u32)video_param_table)); if (CONFIG_VGA_STDVGA_PORTS) stdvga_build_video_param();
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 --- vgasrc/bochsvga.c | 3 ++- vgasrc/cbvga.c | 3 ++- vgasrc/clext.c | 3 ++- vgasrc/geodevga.c | 3 ++- vgasrc/stdvgamodes.c | 3 ++- vgasrc/swcursor.c | 1 + vgasrc/vbe.c | 8 +++++++- vgasrc/vgabios.c | 1 + vgasrc/vgabios.h | 31 +++---------------------------- vgasrc/vgafb.c | 3 ++- vgasrc/vgafonts.c | 2 +- vgasrc/vgainit.c | 3 ++- vgasrc/vgautil.h | 30 ++++++++++++++++++++++++++++++ 13 files changed, 57 insertions(+), 37 deletions(-) create mode 100644 vgasrc/vgautil.h
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index aa82fc5..5658031 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -14,7 +14,8 @@ #include "output.h" // dprintf #include "std/vbe.h" // VBE_CAPABILITY_8BIT_DAC #include "stdvga.h" // VGAREG_SEQU_ADDRESS -#include "vgabios.h" // struct vbe_modeinfo +#include "vgabios.h" // SET_VGA +#include "vgautil.h" // VBE_total_memory #include "x86.h" // outw
diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index b4d7d36..9d0adef 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -10,8 +10,9 @@ #include "stdvga.h" // SEG_CTEXT #include "string.h" // memset16_far #include "util.h" // find_cb_table -#include "vgabios.h" // VGAREG_* +#include "vgabios.h" // SET_VGA #include "vgafb.h" // handle_gfx_op +#include "vgautil.h" // VBE_total_memory
static int CBmode VAR16; static struct vgamode_s CBmodeinfo VAR16; diff --git a/vgasrc/clext.c b/vgasrc/clext.c index fc5b42f..45b5de3 100644 --- a/vgasrc/clext.c +++ b/vgasrc/clext.c @@ -13,7 +13,8 @@ #include "output.h" // dprintf #include "stdvga.h" // VGAREG_SEQU_ADDRESS #include "string.h" // memset16_far -#include "vgabios.h" // VBE_VENDOR_STRING +#include "vgabios.h" // SET_VGA +#include "vgautil.h" // VBE_total_memory
/**************************************************************** diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c index f8f61c3..a5a58cd 100644 --- a/vgasrc/geodevga.c +++ b/vgasrc/geodevga.c @@ -13,7 +13,8 @@ #include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0 #include "output.h" // dprintf #include "stdvga.h" // stdvga_crtc_write -#include "vgabios.h" // VGAREG_* +#include "vgabios.h" // SET_VGA +#include "vgautil.h" // VBE_total_memory
/**************************************************************** diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c index f61d52f..173dd4f 100644 --- a/vgasrc/stdvgamodes.c +++ b/vgasrc/stdvgamodes.c @@ -10,7 +10,8 @@ #include "std/vga.h" // struct video_param_s #include "stdvga.h" // stdvga_find_mode #include "string.h" // memcpy_far -#include "vgabios.h" // video_param_table +#include "vgabios.h" // SET_VGA +#include "vgautil.h" // vgafont16
/**************************************************************** diff --git a/vgasrc/swcursor.c b/vgasrc/swcursor.c index b7b3250..f2212d5 100644 --- a/vgasrc/swcursor.c +++ b/vgasrc/swcursor.c @@ -8,6 +8,7 @@ #include "bregs.h" // struct bregs #include "vgabios.h" // get_cursor_pos #include "vgafb.h" // handle_gfx_op +#include "vgautil.h" // swcursor_check_event
// Draw/undraw a cursor on the framebuffer by xor'ing the cursor cell static void diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index af3d0cc..facad19 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -12,8 +12,14 @@ #include "output.h" // dprintf #include "std/vbe.h" // struct vbe_info #include "string.h" // memset_far -#include "vgabios.h" // handle_104f +#include "vgabios.h" // get_current_mode #include "vgahw.h" // vgahw_set_mode +#include "vgautil.h" // handle_104f + +#define VBE_OEM_STRING "SeaBIOS VBE(C) 2011" +#define VBE_VENDOR_STRING "SeaBIOS Developers" +#define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter" +#define VBE_REVISION_STRING "Rev. 1"
u32 VBE_total_memory VAR16 = 256 * 1024; u32 VBE_capabilities VAR16; diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index b980da5..db4f868 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -17,6 +17,7 @@ #include "vgabios.h" // calc_page_size #include "vgafb.h" // vgafb_write_char #include "vgahw.h" // vgahw_set_mode +#include "vgautil.h" // swcursor_pre_handle10
/**************************************************************** diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h index 2176ec6..3d5bbfe 100644 --- a/vgasrc/vgabios.h +++ b/vgasrc/vgabios.h @@ -68,23 +68,14 @@ static inline int vga_emulate_text(void) { return CONFIG_VGA_EMULATE_TEXT && GET_BDA_EXT(flags) & BF_EMULATE_TEXT; }
+// Write to global variables (during "post" phase only) +#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val)) + // Debug settings #define DEBUG_VGA_POST 1 #define DEBUG_VGA_10 3
-// vgafonts.c -extern u8 vgafont8[]; -extern u8 vgafont14[]; -extern u8 vgafont16[]; -extern u8 vgafont14alt[]; -extern u8 vgafont16alt[]; - -// vgainit.c -extern int VgaBDF; -extern int HaveRunInit; - // vgabios.c -#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val)) int vga_bpp(struct vgamode_s *vmode_g); u16 calc_page_size(u8 memmodel, u16 width, u16 height); u16 get_cursor_shape(void); @@ -94,20 +85,4 @@ struct vgamode_s *get_current_mode(void); int vga_set_mode(int mode, int flags); extern struct video_func_static static_functionality;
-// swcursor.c -struct bregs; -void swcursor_pre_handle10(struct bregs *regs); -void swcursor_check_event(void); - -// vbe.c -extern u32 VBE_total_memory; -extern u32 VBE_capabilities; -extern u32 VBE_framebuffer; -extern u16 VBE_win_granularity; -#define VBE_OEM_STRING "SeaBIOS VBE(C) 2011" -#define VBE_VENDOR_STRING "SeaBIOS Developers" -#define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter" -#define VBE_REVISION_STRING "Rev. 1" -void handle_104f(struct bregs *regs); - #endif // vgabios.h diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index 04d543e..46adfb5 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -10,9 +10,10 @@ #include "output.h" // dprintf #include "stdvga.h" // stdvga_planar4_plane #include "string.h" // memset_far -#include "vgabios.h" // vgafb_scroll +#include "vgabios.h" // get_current_mode #include "vgafb.h" // vgafb_write_char #include "vgahw.h" // vgahw_get_linelength +#include "vgautil.h" // VBE_framebuffer
static inline void memmove_stride(u16 seg, void *dst, void *src, int copylen, int stride, int lines) diff --git a/vgasrc/vgafonts.c b/vgasrc/vgafonts.c index 47a6437..e64ef6c 100644 --- a/vgasrc/vgafonts.c +++ b/vgasrc/vgafonts.c @@ -1,4 +1,4 @@ -#include "vgabios.h" // vgafont8 +#include "vgautil.h" // vgafont8
/* * These fonts come from ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip diff --git a/vgasrc/vgainit.c b/vgasrc/vgainit.c index f003026..4050c96 100644 --- a/vgasrc/vgainit.c +++ b/vgasrc/vgainit.c @@ -15,8 +15,9 @@ #include "std/pmm.h" // struct pmmheader #include "string.h" // checksum_far #include "util.h" // VERSION -#include "vgabios.h" // video_save_pointer_table +#include "vgabios.h" // SET_VGA #include "vgahw.h" // vgahw_setup +#include "vgautil.h" // swcursor_check_event
// Type of emulator platform - for dprintf with certain compile options. int PlatformRunningOn VAR16; diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h new file mode 100644 index 0000000..9e4debb --- /dev/null +++ b/vgasrc/vgautil.h @@ -0,0 +1,30 @@ +// Misc function and variable declarations. +#ifndef __VGAUTIL_H +#define __VGAUTIL_H + +#include "types.h" // u8 + +// swcursor.c +struct bregs; +void swcursor_pre_handle10(struct bregs *regs); +void swcursor_check_event(void); + +// vbe.c +extern u32 VBE_total_memory; +extern u32 VBE_capabilities; +extern u32 VBE_framebuffer; +extern u16 VBE_win_granularity; +void handle_104f(struct bregs *regs); + +// vgafonts.c +extern u8 vgafont8[]; +extern u8 vgafont14[]; +extern u8 vgafont16[]; +extern u8 vgafont14alt[]; +extern u8 vgafont16alt[]; + +// vgainit.c +extern int VgaBDF; +extern int HaveRunInit; + +#endif // 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 --- vgasrc/bochsvga.c | 2 +- vgasrc/stdvga.c | 1 + vgasrc/stdvga.h | 32 +------------------------------- vgasrc/stdvgaio.c | 3 ++- vgasrc/vgahw.h | 1 + vgasrc/vgautil.h | 31 +++++++++++++++++++++++++++++++ 6 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index 5658031..ec5d101 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -13,7 +13,7 @@ #include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0 #include "output.h" // dprintf #include "std/vbe.h" // VBE_CAPABILITY_8BIT_DAC -#include "stdvga.h" // VGAREG_SEQU_ADDRESS +#include "stdvga.h" // stdvga_get_linelength #include "vgabios.h" // SET_VGA #include "vgautil.h" // VBE_total_memory #include "x86.h" // outw diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c index 00a0fc5..886deca 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -10,6 +10,7 @@ #include "stdvga.h" // stdvga_setup #include "string.h" // memset_far #include "vgabios.h" // struct vgamode_s +#include "vgautil.h" // stdvga_attr_write #include "x86.h" // outb
diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h index 39753b4..4184c60 100644 --- a/vgasrc/stdvga.h +++ b/vgasrc/stdvga.h @@ -44,37 +44,6 @@ #define SEG_CTEXT 0xB800 #define SEG_MTEXT 0xB000
-// stdvgamodes.c -struct vgamode_s *stdvga_find_mode(int mode); -void stdvga_list_modes(u16 seg, u16 *dest, u16 *last); -void stdvga_build_video_param(void); -void stdvga_override_crtc(int mode, u8 *crtc); -int stdvga_set_mode(struct vgamode_s *vmode_g, int flags); -void stdvga_set_packed_palette(void); - -// stdvgaio.c -u8 stdvga_pelmask_read(void); -void stdvga_pelmask_write(u8 val); -u8 stdvga_misc_read(void); -void stdvga_misc_write(u8 value); -void stdvga_misc_mask(u8 off, u8 on); -u8 stdvga_sequ_read(u8 index); -void stdvga_sequ_write(u8 index, u8 value); -void stdvga_sequ_mask(u8 index, u8 off, u8 on); -u8 stdvga_grdc_read(u8 index); -void stdvga_grdc_write(u8 index, u8 value); -void stdvga_grdc_mask(u8 index, u8 off, u8 on); -u8 stdvga_crtc_read(u16 crtc_addr, u8 index); -void stdvga_crtc_write(u16 crtc_addr, u8 index, u8 value); -void stdvga_crtc_mask(u16 crtc_addr, u8 index, u8 off, u8 on); -u8 stdvga_attr_read(u8 index); -void stdvga_attr_write(u8 index, u8 value); -void stdvga_attr_mask(u8 index, u8 off, u8 on); -u8 stdvga_attrindex_read(void); -void stdvga_attrindex_write(u8 value); -void stdvga_dac_read(u16 seg, u8 *data_far, u8 start, int count); -void stdvga_dac_write(u16 seg, u8 *data_far, u8 start, int count); - // stdvga.c void stdvga_set_border_color(u8 color); void stdvga_set_overscan_border_color(u8 color); @@ -91,6 +60,7 @@ void stdvga_planar4_plane(int plane); void stdvga_load_font(u16 seg, void *src_far, u16 count , u16 start, u8 destflags, u8 fontsize); u16 stdvga_get_crtc(void); +struct vgamode_s; int stdvga_vram_ratio(struct vgamode_s *vmode_g); void stdvga_set_cursor_shape(u16 cursor_type); void stdvga_set_cursor_pos(int address); diff --git a/vgasrc/stdvgaio.c b/vgasrc/stdvgaio.c index d6138c2..77fcecd 100644 --- a/vgasrc/stdvgaio.c +++ b/vgasrc/stdvgaio.c @@ -5,7 +5,8 @@ // This file may be distributed under the terms of the GNU LGPLv3 license.
#include "farptr.h" // GET_FARVAR -#include "stdvga.h" // stdvga_pelmask_read +#include "stdvga.h" // VGAREG_PEL_MASK +#include "vgautil.h" // stdvga_pelmask_read #include "x86.h" // inb
u8 diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h index 39f818a..3d9ae39 100644 --- a/vgasrc/vgahw.h +++ b/vgasrc/vgahw.h @@ -9,6 +9,7 @@ #include "bochsvga.h" // bochsvga_set_mode #include "stdvga.h" // stdvga_set_mode #include "geodevga.h" // geodevga_setup +#include "vgautil.h" // stdvga_list_modes
static inline struct vgamode_s *vgahw_find_mode(int mode) { if (CONFIG_VGA_CIRRUS) diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h index 9e4debb..90fa54d 100644 --- a/vgasrc/vgautil.h +++ b/vgasrc/vgautil.h @@ -4,6 +4,37 @@
#include "types.h" // u8
+// stdvgaio.c +u8 stdvga_pelmask_read(void); +void stdvga_pelmask_write(u8 val); +u8 stdvga_misc_read(void); +void stdvga_misc_write(u8 value); +void stdvga_misc_mask(u8 off, u8 on); +u8 stdvga_sequ_read(u8 index); +void stdvga_sequ_write(u8 index, u8 value); +void stdvga_sequ_mask(u8 index, u8 off, u8 on); +u8 stdvga_grdc_read(u8 index); +void stdvga_grdc_write(u8 index, u8 value); +void stdvga_grdc_mask(u8 index, u8 off, u8 on); +u8 stdvga_crtc_read(u16 crtc_addr, u8 index); +void stdvga_crtc_write(u16 crtc_addr, u8 index, u8 value); +void stdvga_crtc_mask(u16 crtc_addr, u8 index, u8 off, u8 on); +u8 stdvga_attr_read(u8 index); +void stdvga_attr_write(u8 index, u8 value); +void stdvga_attr_mask(u8 index, u8 off, u8 on); +u8 stdvga_attrindex_read(void); +void stdvga_attrindex_write(u8 value); +void stdvga_dac_read(u16 seg, u8 *data_far, u8 start, int count); +void stdvga_dac_write(u16 seg, u8 *data_far, u8 start, int count); + +// stdvgamodes.c +struct vgamode_s *stdvga_find_mode(int mode); +void stdvga_list_modes(u16 seg, u16 *dest, u16 *last); +void stdvga_build_video_param(void); +void stdvga_override_crtc(int mode, u8 *crtc); +int stdvga_set_mode(struct vgamode_s *vmode_g, int flags); +void stdvga_set_packed_palette(void); + // swcursor.c struct bregs; void swcursor_pre_handle10(struct bregs *regs);
These files only need to export simple function definitions - move them to vgautil.h.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- vgasrc/cbvga.c | 1 - vgasrc/cbvga.h | 20 -------------------- vgasrc/clext.c | 1 - vgasrc/clext.h | 20 -------------------- vgasrc/vgabios.c | 1 - vgasrc/vgahw.h | 2 -- vgasrc/vgautil.h | 31 ++++++++++++++++++++++++++++++- 7 files changed, 30 insertions(+), 46 deletions(-) delete mode 100644 vgasrc/cbvga.h delete mode 100644 vgasrc/clext.h
diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 9d0adef..b8216a9 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -5,7 +5,6 @@ // This file may be distributed under the terms of the GNU LGPLv3 license.
#include "biosvar.h" // GET_BDA -#include "cbvga.h" // cbvga_setup #include "output.h" // dprintf #include "stdvga.h" // SEG_CTEXT #include "string.h" // memset16_far diff --git a/vgasrc/cbvga.h b/vgasrc/cbvga.h deleted file mode 100644 index fb892c8..0000000 --- a/vgasrc/cbvga.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __CBVGA_H -#define __CBVGA_H - -#include "types.h" // u16 - -struct vgamode_s *cbvga_find_mode(int mode); -void cbvga_list_modes(u16 seg, u16 *dest, u16 *last); -int cbvga_get_window(struct vgamode_s *vmode_g, int window); -int cbvga_set_window(struct vgamode_s *vmode_g, int window, int val); -int cbvga_get_linelength(struct vgamode_s *vmode_g); -int cbvga_set_linelength(struct vgamode_s *vmode_g, int val); -int cbvga_get_displaystart(struct vgamode_s *vmode_g); -int cbvga_set_displaystart(struct vgamode_s *vmode_g, int val); -int cbvga_get_dacformat(struct vgamode_s *vmode_g); -int cbvga_set_dacformat(struct vgamode_s *vmode_g, int val); -int cbvga_save_restore(int cmd, u16 seg, void *data); -int cbvga_set_mode(struct vgamode_s *vmode_g, int flags); -int cbvga_setup(void); - -#endif // cbvga.h diff --git a/vgasrc/clext.c b/vgasrc/clext.c index 45b5de3..da8b790 100644 --- a/vgasrc/clext.c +++ b/vgasrc/clext.c @@ -7,7 +7,6 @@
#include "biosvar.h" // GET_GLOBAL #include "bregs.h" // struct bregs -#include "clext.h" // clext_setup #include "hw/pci.h" // pci_config_readl #include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0 #include "output.h" // dprintf diff --git a/vgasrc/clext.h b/vgasrc/clext.h deleted file mode 100644 index cf47a5b..0000000 --- a/vgasrc/clext.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __CLEXT_H -#define __CLEXT_H - -#include "types.h" // u16 - -struct vgamode_s *clext_find_mode(int mode); -void clext_list_modes(u16 seg, u16 *dest, u16 *last); -int clext_get_window(struct vgamode_s *vmode_g, int window); -int clext_set_window(struct vgamode_s *vmode_g, int window, int val); -int clext_get_linelength(struct vgamode_s *vmode_g); -int clext_set_linelength(struct vgamode_s *vmode_g, int val); -int clext_get_displaystart(struct vgamode_s *vmode_g); -int clext_set_displaystart(struct vgamode_s *vmode_g, int val); -int clext_save_restore(int cmd, u16 seg, void *data); -int clext_set_mode(struct vgamode_s *vmode_g, int flags); -struct bregs; -void clext_1012(struct bregs *regs); -int clext_setup(void); - -#endif // clext.h diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index db4f868..3b9694c 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -7,7 +7,6 @@
#include "biosvar.h" // GET_BDA #include "bregs.h" // struct bregs -#include "clext.h" // clext_1012 #include "config.h" // CONFIG_* #include "output.h" // dprintf #include "std/vbe.h" // VBE_RETURN_STATUS_FAILED diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h index 3d9ae39..dab2b4d 100644 --- a/vgasrc/vgahw.h +++ b/vgasrc/vgahw.h @@ -4,8 +4,6 @@ #include "types.h" // u8 #include "config.h" // CONFIG_*
-#include "cbvga.h" // cbvga_setup -#include "clext.h" // clext_set_mode #include "bochsvga.h" // bochsvga_set_mode #include "stdvga.h" // stdvga_set_mode #include "geodevga.h" // geodevga_setup diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h index 90fa54d..79c16be 100644 --- a/vgasrc/vgautil.h +++ b/vgasrc/vgautil.h @@ -4,6 +4,36 @@
#include "types.h" // u8
+// cbvga.c +struct vgamode_s *cbvga_find_mode(int mode); +void cbvga_list_modes(u16 seg, u16 *dest, u16 *last); +int cbvga_get_window(struct vgamode_s *vmode_g, int window); +int cbvga_set_window(struct vgamode_s *vmode_g, int window, int val); +int cbvga_get_linelength(struct vgamode_s *vmode_g); +int cbvga_set_linelength(struct vgamode_s *vmode_g, int val); +int cbvga_get_displaystart(struct vgamode_s *vmode_g); +int cbvga_set_displaystart(struct vgamode_s *vmode_g, int val); +int cbvga_get_dacformat(struct vgamode_s *vmode_g); +int cbvga_set_dacformat(struct vgamode_s *vmode_g, int val); +int cbvga_save_restore(int cmd, u16 seg, void *data); +int cbvga_set_mode(struct vgamode_s *vmode_g, int flags); +int cbvga_setup(void); + +// clext.c +struct vgamode_s *clext_find_mode(int mode); +void clext_list_modes(u16 seg, u16 *dest, u16 *last); +int clext_get_window(struct vgamode_s *vmode_g, int window); +int clext_set_window(struct vgamode_s *vmode_g, int window, int val); +int clext_get_linelength(struct vgamode_s *vmode_g); +int clext_set_linelength(struct vgamode_s *vmode_g, int val); +int clext_get_displaystart(struct vgamode_s *vmode_g); +int clext_set_displaystart(struct vgamode_s *vmode_g, int val); +int clext_save_restore(int cmd, u16 seg, void *data); +int clext_set_mode(struct vgamode_s *vmode_g, int flags); +struct bregs; +void clext_1012(struct bregs *regs); +int clext_setup(void); + // stdvgaio.c u8 stdvga_pelmask_read(void); void stdvga_pelmask_write(u8 val); @@ -36,7 +66,6 @@ int stdvga_set_mode(struct vgamode_s *vmode_g, int flags); void stdvga_set_packed_palette(void);
// swcursor.c -struct bregs; void swcursor_pre_handle10(struct bregs *regs); void swcursor_check_event(void);
On Fri, Aug 05, 2016 at 12:23:15PM -0400, Kevin O'Connor wrote:
FYI, I committed this series.
-Kevin