aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-08-05 11:14:58 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-08-05 11:28:19 -0400
commit2f2ec113beac2b9b1614a25a0992b03bf599eac5 (patch)
tree76bea95e2c00159b2612c4f1fdaf34d25003f31c
parent536129ac3a434409cf9881706c55d7efd67b231e (diff)
downloadseabios-2f2ec113beac2b9b1614a25a0992b03bf599eac5.tar.gz
seabios-2f2ec113beac2b9b1614a25a0992b03bf599eac5.tar.xz
seabios-2f2ec113beac2b9b1614a25a0992b03bf599eac5.zip
vgautil: Add new header file with misc function and variable definitions
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>
-rw-r--r--vgasrc/bochsvga.c3
-rw-r--r--vgasrc/cbvga.c3
-rw-r--r--vgasrc/clext.c3
-rw-r--r--vgasrc/geodevga.c3
-rw-r--r--vgasrc/stdvgamodes.c3
-rw-r--r--vgasrc/swcursor.c1
-rw-r--r--vgasrc/vbe.c8
-rw-r--r--vgasrc/vgabios.c1
-rw-r--r--vgasrc/vgabios.h31
-rw-r--r--vgasrc/vgafb.c3
-rw-r--r--vgasrc/vgafonts.c2
-rw-r--r--vgasrc/vgainit.c3
-rw-r--r--vgasrc/vgautil.h30
13 files changed, 57 insertions, 37 deletions
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