return 0;
}
+int
+bochsvga_get_dacformat(struct vgamode_s *vmode_g)
+{
+ u16 en = dispi_read(VBE_DISPI_INDEX_ENABLE);
+ return (en & VBE_DISPI_8BIT_DAC) ? 8 : 6;
+}
+
+int
+bochsvga_set_dacformat(struct vgamode_s *vmode_g, int val)
+{
+ u16 en = dispi_read(VBE_DISPI_INDEX_ENABLE);
+ if (val == 6)
+ en &= ~VBE_DISPI_8BIT_DAC;
+ else if (val == 8)
+ en |= VBE_DISPI_8BIT_DAC;
+ else
+ return -1;
+ dispi_write(VBE_DISPI_INDEX_ENABLE, en);
+ return 0;
+}
+
/****************************************************************
* Mode setting
int bochsvga_set_linelength(struct vgamode_s *vmode_g, int val);
int bochsvga_get_displaystart(struct vgamode_s *vmode_g);
int bochsvga_set_displaystart(struct vgamode_s *vmode_g, int val);
+int bochsvga_get_dacformat(struct vgamode_s *vmode_g);
+int bochsvga_set_dacformat(struct vgamode_s *vmode_g, int val);
int bochsvga_set_mode(struct vgamode_s *vmode_g, int flags);
int bochsvga_init(void);
return 0;
}
+int
+stdvga_get_dacformat(struct vgamode_s *vmode_g)
+{
+ return -1;
+}
+
+int
+stdvga_set_dacformat(struct vgamode_s *vmode_g, int val)
+{
+ return -1;
+}
+
/****************************************************************
* Save/Restore state
int stdvga_set_linelength(struct vgamode_s *vmode_g, int val);
int stdvga_get_displaystart(struct vgamode_s *vmode_g);
int stdvga_set_displaystart(struct vgamode_s *vmode_g, int val);
+int stdvga_get_dacformat(struct vgamode_s *vmode_g);
+int stdvga_set_dacformat(struct vgamode_s *vmode_g, int val);
void stdvga_save_state(u16 seg, struct saveVideoHardware *info);
void stdvga_restore_state(u16 seg, struct saveVideoHardware *info);
void stdvga_enable_video_addressing(u8 disable);
static void
vbe_104f08(struct bregs *regs)
{
- debug_stub(regs);
- regs->ax = 0x0100;
+ struct vgamode_s *vmode_g = get_current_mode();
+ if (! vmode_g)
+ goto fail;
+ u8 memmodel = GET_GLOBAL(vmode_g->memmodel);
+ if (memmodel == MM_DIRECT || memmodel == MM_YUV) {
+ regs->ax = 0x034f;
+ return;
+ }
+ if (regs->bl > 1)
+ goto fail;
+ if (regs->bl == 0) {
+ int ret = vgahw_set_dacformat(vmode_g, regs->bh);
+ if (ret < 0)
+ goto fail;
+ }
+ int ret = vgahw_get_dacformat(vmode_g);
+ if (ret < 0)
+ goto fail;
+ regs->bh = ret;
+ regs->ax = 0x004f;
+ return;
+fail:
+ regs->ax = 0x014f;
}
static void
return stdvga_set_displaystart(vmode_g, val);
}
+static inline int vgahw_get_dacformat(struct vgamode_s *vmode_g) {
+ if (CONFIG_VGA_BOCHS)
+ return bochsvga_get_dacformat(vmode_g);
+ return stdvga_get_dacformat(vmode_g);
+}
+
+static inline int vgahw_set_dacformat(struct vgamode_s *vmode_g, int val) {
+ if (CONFIG_VGA_BOCHS)
+ return bochsvga_set_dacformat(vmode_g, val);
+ return stdvga_set_dacformat(vmode_g, val);
+}
+
#endif // vgahw.h