vgabios: Minor fixes to struct vbe_info definition.
[seabios.git] / vgasrc / vga.c
index ee107043efe558d7eea9723d38f92b42d67d7521..539cd7aa959a179058bb38451972990e663fb000 100644 (file)
 #include "optionroms.h" // struct pci_data
 #include "config.h" // CONFIG_*
 #include "vbe.h" // vbe_*
+#include "geodelx.h" // geodelx_init
 
 // XXX
 #define DEBUG_VGA_POST 1
 #define DEBUG_VGA_10 3
 
-#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
 
 /****************************************************************
  * PCI Data
@@ -175,8 +175,7 @@ set_active_page(u8 page)
         // Start address
         address = SCREEN_IO_START(nbcols, nbrows, page);
     } else {
-        struct VideoParam_s *vparam_g = GET_GLOBAL(vmode_g->vparam);
-        address = page * GET_GLOBAL(vparam_g->slength);
+        address = page * GET_GLOBAL(vmode_g->slength);
     }
 
     vgahw_set_active_page(address);
@@ -394,8 +393,7 @@ vga_set_mode(u8 mode, u8 noclearmem)
             perform_gray_scale_summing(0x00, 0x100);
     }
 
-    struct VideoParam_s *vparam_g = GET_GLOBAL(vmode_g->vparam);
-    vgahw_set_mode(vparam_g);
+    vgahw_set_mode(vmode_g);
 
     if (noclearmem == 0x00)
         clear_screen(vmode_g);
@@ -406,12 +404,12 @@ vga_set_mode(u8 mode, u8 noclearmem)
         crtc_addr = VGAREG_MDA_CRTC_ADDRESS;
 
     // Set the BIOS mem
-    u16 cheight = GET_GLOBAL(vparam_g->cheight);
+    u16 cheight = GET_GLOBAL(vmode_g->cheight);
     SET_BDA(video_mode, mode);
-    SET_BDA(video_cols, GET_GLOBAL(vparam_g->twidth));
-    SET_BDA(video_pagesize, GET_GLOBAL(vparam_g->slength));
+    SET_BDA(video_cols, GET_GLOBAL(vmode_g->twidth));
+    SET_BDA(video_pagesize, GET_GLOBAL(vmode_g->slength));
     SET_BDA(crtc_address, crtc_addr);
-    SET_BDA(video_rows, GET_GLOBAL(vparam_g->theightm1));
+    SET_BDA(video_rows, GET_GLOBAL(vmode_g->theight)-1);
     SET_BDA(char_height, cheight);
     SET_BDA(video_ctl, (0x60 | noclearmem));
     SET_BDA(video_switches, 0xF9);
@@ -1092,8 +1090,7 @@ handle_101a(struct bregs *regs)
 
 
 struct funcInfo {
-    u16 static_functionality_off;
-    u16 static_functionality_seg;
+    struct segoff_s static_functionality;
     u8 bda_0x49[30];
     u8 bda_0x84[3];
     u8 dcc_index;
@@ -1119,8 +1116,8 @@ handle_101b(struct bregs *regs)
     struct funcInfo *info = (void*)(regs->di+0);
     memset_far(seg, info, 0, sizeof(*info));
     // Address of static functionality table
-    SET_FARVAR(seg, info->static_functionality_off, (u32)static_functionality);
-    SET_FARVAR(seg, info->static_functionality_seg, get_global_seg());
+    SET_FARVAR(seg, info->static_functionality
+               , SEGOFF(get_global_seg(), (u32)static_functionality));
 
     // Hard coded copy from BIOS area. Should it be cleaner ?
     memcpy_far(seg, info->bda_0x49, SEG_BDA, (void*)0x49
@@ -1229,7 +1226,7 @@ handle_104f00(struct bregs *regs)
 
     SET_FARVAR(seg, info->oem_string,
             SEGOFF(get_global_seg(), (u32)VBE_OEM_STRING));
-    SET_FARVAR(seg, info->capabilities[0], 0x1); /* 8BIT DAC */
+    SET_FARVAR(seg, info->capabilities, 0x1); /* 8BIT DAC */
 
     /* We generate our mode list in the reserved field of the info block */
     SET_FARVAR(seg, info->video_mode, SEGOFF(seg, regs->di + 34));
@@ -1287,7 +1284,7 @@ handle_104f01(struct bregs *regs)
     SET_FARVAR(seg, info->win_size, 64); /* Bank size 64K */
     SET_FARVAR(seg, info->winA_seg, 0xA000);
     SET_FARVAR(seg, info->winB_seg, 0x0);
-    SET_FARVAR(seg, info->win_func_ptr, 0x0);
+    SET_FARVAR(seg, info->win_func_ptr.segoff, 0x0);
     SET_FARVAR(seg, info->bytes_per_scanline, modeinfo.linesize);
     SET_FARVAR(seg, info->xres, modeinfo.width);
     SET_FARVAR(seg, info->yres, modeinfo.height);
@@ -1573,6 +1570,9 @@ vga_post(struct bregs *regs)
 
     vgahw_init();
 
+    if (CONFIG_VGA_GEODELX)
+        geodelx_init();
+
     init_bios_area();
 
     vbe_init(regs->ah, regs->al);
@@ -1585,9 +1585,7 @@ vga_post(struct bregs *regs)
 
     // XXX - clear screen and display info
 
-    // XXX: fill it
-    SET_VGA(video_save_pointer_table.videoparam
-            , SEGOFF(get_global_seg(), (u32)video_param_table));
+    build_video_param();
 
     // Fixup checksum
     extern u8 _rom_header_size, _rom_header_checksum;