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>
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 @@
     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 @@
 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