[SeaBIOS] [PATCH 1/7] vga: move code to vgahw.c

Gerd Hoffmann kraxel at redhat.com
Mon Feb 6 15:51:37 CET 2012


Create vgahw.c, move code from vgahw.h there, soon we will add more bits
there which will make inlining less useful.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 Makefile       |    2 +-
 vgasrc/vgahw.c |   95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vgasrc/vgahw.h |   93 ++++++------------------------------------------------
 3 files changed, 106 insertions(+), 84 deletions(-)
 create mode 100644 vgasrc/vgahw.c

diff --git a/Makefile b/Makefile
index 0343ce5..1dcfaeb 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,7 @@ $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o tools/checkrom.py
 SRCVGA=src/output.c src/util.c src/pci.c \
     vgasrc/vgabios.c vgasrc/vgafb.c vgasrc/vgafonts.c vgasrc/vbe.c \
     vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \
-    vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c
+    vgasrc/vgahw.c vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c
 
 CFLAGS16VGA = $(CFLAGS16INC) -g -Isrc
 
diff --git a/vgasrc/vgahw.c b/vgasrc/vgahw.c
new file mode 100644
index 0000000..be5945e
--- /dev/null
+++ b/vgasrc/vgahw.c
@@ -0,0 +1,95 @@
+#include "vgahw.h"
+
+struct vgamode_s *vgahw_find_mode(int mode)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_find_mode(mode);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_find_mode(mode);
+    return stdvga_find_mode(mode);
+}
+
+int vgahw_set_mode(struct vgamode_s *vmode_g, int flags)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_set_mode(vmode_g, flags);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_set_mode(vmode_g, flags);
+    return stdvga_set_mode(vmode_g, flags);
+}
+
+void vgahw_list_modes(u16 seg, u16 *dest, u16 *last)
+{
+    if (CONFIG_VGA_CIRRUS)
+        clext_list_modes(seg, dest, last);
+    else if (CONFIG_VGA_BOCHS)
+        bochsvga_list_modes(seg, dest, last);
+    else
+        stdvga_list_modes(seg, dest, last);
+}
+
+int vgahw_init(void)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_init();
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_init();
+    if (CONFIG_VGA_GEODEGX2 || CONFIG_VGA_GEODELX)
+        return geodevga_init();
+    return stdvga_init();
+}
+
+int vgahw_get_window(struct vgamode_s *vmode_g, int window)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_get_window(vmode_g, window);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_get_window(vmode_g, window);
+    return stdvga_get_window(vmode_g, window);
+}
+
+int vgahw_set_window(struct vgamode_s *vmode_g, int window, int val)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_set_window(vmode_g, window, val);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_set_window(vmode_g, window, val);
+    return stdvga_set_window(vmode_g, window, val);
+}
+
+int vgahw_get_linelength(struct vgamode_s *vmode_g)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_get_linelength(vmode_g);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_get_linelength(vmode_g);
+    return stdvga_get_linelength(vmode_g);
+}
+
+int vgahw_set_linelength(struct vgamode_s *vmode_g, int val)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_set_linelength(vmode_g, val);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_set_linelength(vmode_g, val);
+    return stdvga_set_linelength(vmode_g, val);
+}
+
+int vgahw_get_displaystart(struct vgamode_s *vmode_g)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_get_displaystart(vmode_g);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_get_displaystart(vmode_g);
+    return stdvga_get_displaystart(vmode_g);
+}
+
+int vgahw_set_displaystart(struct vgamode_s *vmode_g, int val)
+{
+    if (CONFIG_VGA_CIRRUS)
+        return clext_set_displaystart(vmode_g, val);
+    if (CONFIG_VGA_BOCHS)
+        return bochsvga_set_displaystart(vmode_g, val);
+    return stdvga_set_displaystart(vmode_g, val);
+}
+
diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h
index af6b068..751d4fd 100644
--- a/vgasrc/vgahw.h
+++ b/vgasrc/vgahw.h
@@ -9,88 +9,15 @@
 #include "stdvga.h" // stdvga_set_mode
 #include "geodevga.h" // geodevga_init
 
-static inline struct vgamode_s *vgahw_find_mode(int mode) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_find_mode(mode);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_find_mode(mode);
-    return stdvga_find_mode(mode);
-}
-
-static inline int vgahw_set_mode(struct vgamode_s *vmode_g, int flags) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_set_mode(vmode_g, flags);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_set_mode(vmode_g, flags);
-    return stdvga_set_mode(vmode_g, flags);
-}
-
-static inline void vgahw_list_modes(u16 seg, u16 *dest, u16 *last) {
-    if (CONFIG_VGA_CIRRUS)
-        clext_list_modes(seg, dest, last);
-    else if (CONFIG_VGA_BOCHS)
-        bochsvga_list_modes(seg, dest, last);
-    else
-        stdvga_list_modes(seg, dest, last);
-}
-
-static inline int vgahw_init(void) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_init();
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_init();
-    if (CONFIG_VGA_GEODEGX2 || CONFIG_VGA_GEODELX)
-        return geodevga_init();
-    return stdvga_init();
-}
-
-static inline int vgahw_get_window(struct vgamode_s *vmode_g, int window) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_get_window(vmode_g, window);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_get_window(vmode_g, window);
-    return stdvga_get_window(vmode_g, window);
-}
-
-static inline int vgahw_set_window(struct vgamode_s *vmode_g, int window
-                                   , int val) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_set_window(vmode_g, window, val);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_set_window(vmode_g, window, val);
-    return stdvga_set_window(vmode_g, window, val);
-}
-
-static inline int vgahw_get_linelength(struct vgamode_s *vmode_g) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_get_linelength(vmode_g);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_get_linelength(vmode_g);
-    return stdvga_get_linelength(vmode_g);
-}
-
-static inline int vgahw_set_linelength(struct vgamode_s *vmode_g, int val) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_set_linelength(vmode_g, val);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_set_linelength(vmode_g, val);
-    return stdvga_set_linelength(vmode_g, val);
-}
-
-static inline int vgahw_get_displaystart(struct vgamode_s *vmode_g) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_get_displaystart(vmode_g);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_get_displaystart(vmode_g);
-    return stdvga_get_displaystart(vmode_g);
-}
-
-static inline int vgahw_set_displaystart(struct vgamode_s *vmode_g, int val) {
-    if (CONFIG_VGA_CIRRUS)
-        return clext_set_displaystart(vmode_g, val);
-    if (CONFIG_VGA_BOCHS)
-        return bochsvga_set_displaystart(vmode_g, val);
-    return stdvga_set_displaystart(vmode_g, val);
-}
+struct vgamode_s *vgahw_find_mode(int mode);
+int vgahw_set_mode(struct vgamode_s *vmode_g, int flags);
+void vgahw_list_modes(u16 seg, u16 *dest, u16 *last);
+int vgahw_init(void);
+int vgahw_get_window(struct vgamode_s *vmode_g, int window);
+int vgahw_set_window(struct vgamode_s *vmode_g, int window, int val);
+int vgahw_get_linelength(struct vgamode_s *vmode_g);
+int vgahw_set_linelength(struct vgamode_s *vmode_g, int val);
+int vgahw_get_displaystart(struct vgamode_s *vmode_g);
+int vgahw_set_displaystart(struct vgamode_s *vmode_g, int val);
 
 #endif // vgahw.h
-- 
1.7.1




More information about the SeaBIOS mailing list