]> xenbits.xensource.com Git - seabios.git/commitdiff
vgabios: Add option to control use of standard VGA IO ports.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 9 Feb 2014 16:50:21 +0000 (11:50 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 11 Apr 2014 15:26:22 +0000 (11:26 -0400)
Add option CONFIG_VGA_STDVGA_PORTS.  When this option is disabled, the
main BIOS code will not attempt to access any of the legacy VGA IO
ports.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
vgasrc/Kconfig
vgasrc/vgabios.c
vgasrc/vgafb.c
vgasrc/vgainit.c

index b442b3e83259a82eed50a735012f117159970f00..f04fca7df558aa81f38fc0834f0fad2689e66976 100644 (file)
@@ -13,6 +13,7 @@ menu "VGA ROM"
         config VGA_STANDARD_VGA
             depends on QEMU
             bool "QEMU/Bochs Original IBM 256K VGA"
+            select VGA_STDVGA_PORTS
             help
                 Build basic VGA BIOS support (pre Super-VGA) for use
                 on emulators.
@@ -20,6 +21,7 @@ menu "VGA ROM"
         config VGA_CIRRUS
             depends on QEMU
             bool "QEMU/Bochs Cirrus SVGA"
+            select VGA_STDVGA_PORTS
             help
                 Build support for Cirrus VGA emulation found on QEMU
                 and Bochs emulators.  This is for emulators; it is not
@@ -28,17 +30,20 @@ menu "VGA ROM"
         config VGA_BOCHS
             depends on QEMU
             bool "QEMU/Bochs VBE SVGA"
+            select VGA_STDVGA_PORTS
             help
                 Build support for Bochs DISPI interface (a custom VBE
                 protocol) found on QEMU and Bochs emulators.
 
         config VGA_GEODEGX2
             bool "GeodeGX2"
+            select VGA_STDVGA_PORTS
             help
                 Build support for Geode GX2 vga.
 
         config VGA_GEODELX
             bool "GeodeLX"
+            select VGA_STDVGA_PORTS
             help
                 Build support for Geode LX vga.
     endchoice
@@ -68,6 +73,9 @@ menu "VGA ROM"
         bool
         default !NO_VGABIOS
 
+    config VGA_STDVGA_PORTS
+        bool
+
     config VGA_ALLOCATE_EXTRA_STACK
         depends on BUILD_VGABIOS
         bool "Allocate an internal stack for 16bit interrupt entry point"
index 44502b3e69acb2ef115eb5a7aa2cbc85e82dc473..040a7ae4e046c4c88e06467b5d513a8e6e528d1b 100644 (file)
@@ -59,6 +59,9 @@ set_cursor_shape(u8 start, u8 end)
     u16 curs = (start << 8) + end;
     SET_BDA(cursor_type, curs);
 
+    if (!CONFIG_VGA_STDVGA_PORTS)
+        return;
+
     u8 modeset_ctl = GET_BDA(modeset_ctl);
     u16 cheight = GET_BDA(char_height);
     if ((modeset_ctl & 0x01) && (cheight > 8) && (end < 8) && (start < 0x20)) {
@@ -92,6 +95,9 @@ set_cursor_pos(struct cursorpos cp)
     // Bios cursor pos
     SET_BDA(cursor_pos[page], (y << 8) | x);
 
+    if (!CONFIG_VGA_STDVGA_PORTS)
+        return;
+
     // Set the hardware cursor
     u8 current = GET_BDA(video_page);
     if (cp.page != current)
@@ -300,7 +306,7 @@ vga_set_mode(int mode, int flags)
         SET_BDA(cursor_type, 0x0000);
     }
     SET_BDA(video_pagesize, calc_page_size(memmodel, width, height));
-    SET_BDA(crtc_address, stdvga_get_crtc());
+    SET_BDA(crtc_address, CONFIG_VGA_STDVGA_PORTS ? stdvga_get_crtc() : 0);
     SET_BDA(char_height, cheight);
     SET_BDA(video_ctl, 0x60 | (flags & MF_NOCLEARMEM ? 0x80 : 0x00));
     SET_BDA(video_switches, 0xF9);
@@ -485,6 +491,10 @@ handle_100bXX(struct bregs *regs)
 static void
 handle_100b(struct bregs *regs)
 {
+    if (!CONFIG_VGA_STDVGA_PORTS) {
+        handle_100bXX(regs);
+        return;
+    }
     switch (regs->bh) {
     case 0x00: handle_100b00(regs); break;
     case 0x01: handle_100b01(regs); break;
@@ -641,6 +651,10 @@ handle_1010XX(struct bregs *regs)
 static void
 handle_1010(struct bregs *regs)
 {
+    if (!CONFIG_VGA_STDVGA_PORTS) {
+        handle_1010XX(regs);
+        return;
+    }
     switch (regs->al) {
     case 0x00: handle_101000(regs); break;
     case 0x01: handle_101001(regs); break;
@@ -838,16 +852,20 @@ handle_1011XX(struct bregs *regs)
 static void
 handle_1011(struct bregs *regs)
 {
+    if (CONFIG_VGA_STDVGA_PORTS) {
+        switch (regs->al) {
+        case 0x00: handle_101100(regs); break;
+        case 0x01: handle_101101(regs); break;
+        case 0x02: handle_101102(regs); break;
+        case 0x03: handle_101103(regs); break;
+        case 0x04: handle_101104(regs); break;
+        case 0x10: handle_101110(regs); break;
+        case 0x11: handle_101111(regs); break;
+        case 0x12: handle_101112(regs); break;
+        case 0x14: handle_101114(regs); break;
+        }
+    }
     switch (regs->al) {
-    case 0x00: handle_101100(regs); break;
-    case 0x01: handle_101101(regs); break;
-    case 0x02: handle_101102(regs); break;
-    case 0x03: handle_101103(regs); break;
-    case 0x04: handle_101104(regs); break;
-    case 0x10: handle_101110(regs); break;
-    case 0x11: handle_101111(regs); break;
-    case 0x12: handle_101112(regs); break;
-    case 0x14: handle_101114(regs); break;
     case 0x30: handle_101130(regs); break;
     case 0x20: handle_101120(regs); break;
     case 0x21: handle_101121(regs); break;
@@ -912,8 +930,10 @@ handle_101231(struct bregs *regs)
 static void
 handle_101232(struct bregs *regs)
 {
-    stdvga_enable_video_addressing(regs->al);
-    regs->al = 0x12;
+    if (CONFIG_VGA_STDVGA_PORTS) {
+        stdvga_enable_video_addressing(regs->al);
+        regs->al = 0x12;
+    }
 }
 
 static void
index 2efaab552036d30bda31b7e9b8e26d72e145e848..7c2570fcec365ab7e4efa2ba53e2ef61847e8068 100644 (file)
@@ -43,6 +43,8 @@ static void
 scroll_pl4(struct vgamode_s *vmode_g, int nblines, int attr
            , struct cursorpos ul, struct cursorpos lr)
 {
+    if (!CONFIG_VGA_STDVGA_PORTS)
+        return;
     int cheight = GET_BDA(char_height);
     int cwidth = 1;
     int stride = GET_BDA(video_cols) * cwidth;
@@ -225,6 +227,8 @@ static void
 write_gfx_char_pl4(struct vgamode_s *vmode_g
                    , struct cursorpos cp, struct carattr ca)
 {
+    if (!CONFIG_VGA_STDVGA_PORTS)
+        return;
     u16 nbcols = GET_BDA(video_cols);
     if (cp.x >= nbcols)
         return;
@@ -407,6 +411,8 @@ vgafb_write_pixel(u8 color, u16 x, u16 y)
     u8 *addr_far, mask, attr, data, i;
     switch (GET_GLOBAL(vmode_g->memmodel)) {
     case MM_PLANAR:
+        if (!CONFIG_VGA_STDVGA_PORTS)
+            return;
         addr_far = (void*)(x / 8 + y * GET_BDA(video_cols));
         mask = 0x80 >> (x & 0x07);
         for (i=0; i<4; i++) {
@@ -464,6 +470,8 @@ vgafb_read_pixel(u16 x, u16 y)
     u8 *addr_far, mask, attr=0, data, i;
     switch (GET_GLOBAL(vmode_g->memmodel)) {
     case MM_PLANAR:
+        if (!CONFIG_VGA_STDVGA_PORTS)
+            return 0;
         addr_far = (void*)(x / 8 + y * GET_BDA(video_cols));
         mask = 0x80 >> (x & 0x07);
         attr = 0x00;
index 4692c34fe6cd8533fb6223aa84b33f95cd1b2de4..33b8eb9bf0aef5565c9f7f12a8b663cd377bc005 100644 (file)
@@ -153,7 +153,8 @@ vga_post(struct bregs *regs)
 
     SET_VGA(video_save_pointer_table.videoparam
             , SEGOFF(get_global_seg(), (u32)video_param_table));
-    stdvga_build_video_param();
+    if (CONFIG_VGA_STDVGA_PORTS)
+        stdvga_build_video_param();
 
     extern void entry_10(void);
     SET_IVT(0x10, SEGOFF(get_global_seg(), (u32)entry_10));