[SeaBIOS] [PATCH 04/20] vgabios: Use bochsvga_ prefix for bochs vga functions.

Kevin O'Connor kevin at koconnor.net
Sun Jan 1 18:21:02 CET 2012


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/bochsvga.c  |   33 ++++++++++++++++-----------------
 vgasrc/bochsvga.h  |   12 ++++++++++++
 vgasrc/vga.c       |   31 ++++++++++++++++---------------
 vgasrc/vgatables.h |   10 ----------
 4 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index 7ea1a1f..99d4041 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -5,13 +5,13 @@
 #include "config.h" // CONFIG_
 #include "biosvar.h" // SET_BDA
 
-struct mode
+static struct mode
 {
     u16 mode;
     u16 width;
     u16 height;
     u8 depth;
-} vbe_modes[] VAR16 = {
+} bochsvga_modes[] VAR16 = {
     /* standard modes */
     { 0x100, 640,  400,  8  },
     { 0x101, 640,  480,  8  },
@@ -135,7 +135,7 @@ static u16 dispi_get_max_bpp(void)
 
 /* Called only during POST */
 int
-vbe_init(u8 bus, u8 devfn)
+bochsvga_init(u8 bus, u8 devfn)
 {
     u32 lfb_addr;
 
@@ -165,13 +165,13 @@ vbe_init(u8 bus, u8 devfn)
 }
 
 int
-vbe_enabled(void)
+bochsvga_enabled(void)
 {
     return GET_BDA(vbe_flag);
 }
 
 u16
-vbe_total_mem(void)
+bochsvga_total_mem(void)
 {
     return dispi_read(VBE_DISPI_INDEX_VIDEO_MEMORY_64K);
 }
@@ -180,7 +180,7 @@ static struct mode *find_mode_entry(u16 mode)
 {
     struct mode *m;
 
-    for (m = vbe_modes; GET_GLOBAL(m->mode); m++) {
+    for (m = bochsvga_modes; GET_GLOBAL(m->mode); m++) {
         if (GET_GLOBAL(m->mode) == mode)
             return m;
     }
@@ -192,7 +192,7 @@ static int mode_valid(struct mode *m)
 {
     u16 max_xres = dispi_get_max_xres();
     u16 max_bpp = dispi_get_max_bpp();
-    u32 max_mem = vbe_total_mem() * 64 * 1024;
+    u32 max_mem = bochsvga_total_mem() * 64 * 1024;
 
     u32 mem = GET_GLOBAL(m->width) * GET_GLOBAL(m->height) *
               BYTES_PER_PIXEL(m);
@@ -206,13 +206,13 @@ static int mode_valid(struct mode *m)
 }
 
 int
-vbe_list_modes(u16 seg, u16 ptr)
+bochsvga_list_modes(u16 seg, u16 ptr)
 {
     int count = 0;
     u16 *dest = (u16 *)(u32)ptr;
     struct mode *m;
 
-    for (m = vbe_modes; GET_GLOBAL(m->mode); m++) {
+    for (m = bochsvga_modes; GET_GLOBAL(m->mode); m++) {
         if (!mode_valid(m))
             continue;
 
@@ -228,7 +228,7 @@ vbe_list_modes(u16 seg, u16 ptr)
 }
 
 int
-vbe_mode_info(u16 mode, struct vbe_modeinfo *info)
+bochsvga_mode_info(u16 mode, struct vbe_modeinfo *info)
 {
     struct mode *m;
 
@@ -242,13 +242,13 @@ vbe_mode_info(u16 mode, struct vbe_modeinfo *info)
 
     info->linesize = info->width * ((info->depth + 7) / 8);
     info->phys_base = GET_GLOBAL(pci_lfb_addr);
-    info->vram_size = vbe_total_mem() * 64 * 1024;
+    info->vram_size = bochsvga_total_mem() * 64 * 1024;
 
     return 0;
 }
 
 void
-vbe_hires_enable(int enable)
+bochsvga_hires_enable(int enable)
 {
     u16 flags = enable ?
         VBE_DISPI_ENABLED |
@@ -259,7 +259,7 @@ vbe_hires_enable(int enable)
 }
 
 void
-vbe_set_mode(u16 mode, struct vbe_modeinfo *info)
+bochsvga_set_mode(u16 mode, struct vbe_modeinfo *info)
 {
     if (info->depth == 4)
         vga_set_mode(0x6a, 0);
@@ -317,7 +317,7 @@ vbe_set_mode(u16 mode, struct vbe_modeinfo *info)
 }
 
 void
-vbe_clear_scr(void)
+bochsvga_clear_scr(void)
 {
     u16 en;
 
@@ -327,14 +327,13 @@ vbe_clear_scr(void)
 }
 
 int
-vbe_hires_enabled(void)
+bochsvga_hires_enabled(void)
 {
     return dispi_read(VBE_DISPI_INDEX_ENABLE) & VBE_DISPI_ENABLED;
 }
 
 u16
-vbe_curr_mode(void)
+bochsvga_curr_mode(void)
 {
     return GET_BDA(vbe_mode);
 }
-
diff --git a/vgasrc/bochsvga.h b/vgasrc/bochsvga.h
index 963cb13..aaa3a97 100644
--- a/vgasrc/bochsvga.h
+++ b/vgasrc/bochsvga.h
@@ -52,4 +52,16 @@ static inline void dispi_write(u16 reg, u16 val)
     outw(val, VBE_DISPI_IOPORT_DATA);
 }
 
+int bochsvga_init(u8 bus, u8 devfn);
+int bochsvga_enabled(void);
+u16 bochsvga_total_mem(void);
+int bochsvga_list_modes(u16 seg, u16 ptr);
+struct vbe_modeinfo;
+int bochsvga_mode_info(u16 mode, struct vbe_modeinfo *info);
+void bochsvga_hires_enable(int enable);
+void bochsvga_set_mode(u16 mode, struct vbe_modeinfo *info);
+void bochsvga_clear_scr(void);
+int bochsvga_hires_enabled(void);
+u16 bochsvga_curr_mode(void);
+
 #endif
diff --git a/vgasrc/vga.c b/vgasrc/vga.c
index 539cd7a..9e5884b 100644
--- a/vgasrc/vga.c
+++ b/vgasrc/vga.c
@@ -17,8 +17,9 @@
 #include "vgatables.h" // find_vga_entry
 #include "optionroms.h" // struct pci_data
 #include "config.h" // CONFIG_*
-#include "vbe.h" // vbe_*
+#include "vbe.h" // struct vbe_info
 #include "geodelx.h" // geodelx_init
+#include "bochsvga.h" // bochsvga_init
 
 // XXX
 #define DEBUG_VGA_POST 1
@@ -478,8 +479,8 @@ handle_1000(struct bregs *regs)
             return;
     }
 
-    if (vbe_enabled())
-        vbe_hires_enable(0);
+    if (bochsvga_enabled())
+        bochsvga_hires_enable(0);
 
     vga_set_mode(mode, noclearmem);
 }
@@ -1232,7 +1233,7 @@ handle_104f00(struct bregs *regs)
     SET_FARVAR(seg, info->video_mode, SEGOFF(seg, regs->di + 34));
 
     /* Total memory (in 64 blocks) */
-    SET_FARVAR(seg, info->total_memory, vbe_total_mem());
+    SET_FARVAR(seg, info->total_memory, bochsvga_total_mem());
 
     SET_FARVAR(seg, info->oem_vendor_string,
             SEGOFF(get_global_seg(), (u32)VBE_VENDOR_STRING));
@@ -1242,7 +1243,7 @@ handle_104f00(struct bregs *regs)
             SEGOFF(get_global_seg(), (u32)VBE_REVISION_STRING));
 
     /* Fill list of modes */
-    vbe_list_modes(seg, regs->di + 32);
+    bochsvga_list_modes(seg, regs->di + 32);
 
     regs->al = regs->ah; /* 0x4F, Function supported */
     regs->ah = 0x0; /* 0x0, Function call successful */
@@ -1259,7 +1260,7 @@ handle_104f01(struct bregs *regs)
 
     dprintf(1, "VBE mode info request: %x\n", mode);
 
-    rc = vbe_mode_info(mode, &modeinfo);
+    rc = bochsvga_mode_info(mode, &modeinfo);
     if (rc) {
         dprintf(1, "VBE mode %x not found\n", mode);
         regs->ax = 0x100;
@@ -1379,24 +1380,24 @@ handle_104f02(struct bregs *regs)
     if (mode < 0x100) { /* VGA */
         dprintf(1, "set VGA mode %x\n", mode);
 
-        vbe_hires_enable(0);
+        bochsvga_hires_enable(0);
         vga_set_mode(mode, 0);
     } else { /* VBE */
-        rc = vbe_mode_info(mode & 0x1ff, &modeinfo);
+        rc = bochsvga_mode_info(mode & 0x1ff, &modeinfo);
         if (rc) {
             dprintf(1, "VBE mode %x not found\n", mode & 0x1ff);
             regs->ax = 0x100;
             return;
         }
-        vbe_hires_enable(1);
-        vbe_set_mode(mode & 0x1ff, &modeinfo);
+        bochsvga_hires_enable(1);
+        bochsvga_set_mode(mode & 0x1ff, &modeinfo);
 
         if (mode & 0x4000) {
             /* Linear frame buffer */
             /* XXX: ??? */
         }
         if (!(mode & 0x8000)) {
-            vbe_clear_scr();
+            bochsvga_clear_scr();
         }
     }
 
@@ -1407,10 +1408,10 @@ handle_104f02(struct bregs *regs)
 static void
 handle_104f03(struct bregs *regs)
 {
-    if (!vbe_hires_enabled()) {
+    if (!bochsvga_hires_enabled()) {
         regs->bx = GET_BDA(video_mode);
     } else {
-        regs->bx = vbe_curr_mode();
+        regs->bx = bochsvga_curr_mode();
     }
 
     dprintf(1, "VBE current mode=%x\n", regs->bx);
@@ -1471,7 +1472,7 @@ handle_104fXX(struct bregs *regs)
 static void
 handle_104f(struct bregs *regs)
 {
-    if (!vbe_enabled()) {
+    if (!bochsvga_enabled()) {
         handle_104fXX(regs);
         return;
     }
@@ -1575,7 +1576,7 @@ vga_post(struct bregs *regs)
 
     init_bios_area();
 
-    vbe_init(regs->ah, regs->al);
+    bochsvga_init(regs->ah, regs->al);
 
     extern void entry_10(void);
     SET_IVT(0x10, SEGOFF(get_global_seg(), (u32)entry_10));
diff --git a/vgasrc/vgatables.h b/vgasrc/vgatables.h
index 5a90174..e0d61c9 100644
--- a/vgasrc/vgatables.h
+++ b/vgasrc/vgatables.h
@@ -221,15 +221,5 @@ struct vbe_modeinfo
     u32 phys_base;
     u32 vram_size;
 };
-int vbe_init(u8 bus, u8 devfn);
-int vbe_enabled(void);
-u16 vbe_total_mem(void);
-int vbe_list_modes(u16 seg, u16 ptr);
-int vbe_mode_info(u16 mode, struct vbe_modeinfo *info);
-void vbe_hires_enable(int enable);
-void vbe_set_mode(u16 mode, struct vbe_modeinfo *info);
-void vbe_clear_scr(void);
-int vbe_hires_enabled(void);
-u16 vbe_curr_mode(void);
 
 #endif // vgatables.h
-- 
1.7.6.4




More information about the SeaBIOS mailing list