-static void
-cirrus_vesa_00h(struct bregs *regs)
-{
- u16 seg = regs->es;
- struct vbe_info *info = (void*)(regs->di+0);
-
- if (GET_FARVAR(seg, info->signature) == VBE2_SIGNATURE) {
- SET_FARVAR(seg, info->oem_revision, 0x0100);
- SET_FARVAR(seg, info->oem_vendor_string,
- SEGOFF(get_global_seg(), (u32)VBE_VENDOR_STRING));
- SET_FARVAR(seg, info->oem_product_string,
- SEGOFF(get_global_seg(), (u32)VBE_PRODUCT_STRING));
- SET_FARVAR(seg, info->oem_revision_string,
- SEGOFF(get_global_seg(), (u32)VBE_REVISION_STRING));
- }
- SET_FARVAR(seg, info->signature, VESA_SIGNATURE);
-
- SET_FARVAR(seg, info->version, 0x0200);
-
- SET_FARVAR(seg, info->oem_string
- , SEGOFF(get_global_seg(), (u32)VBE_OEM_STRING));
- SET_FARVAR(seg, info->capabilities, 0);
- SET_FARVAR(seg, info->total_memory, cirrus_get_memsize());
-
- u16 *destmode = (void*)info->reserved;
- u16 *last = (void*)&info->reserved[sizeof(info->reserved)];
- SET_FARVAR(seg, info->video_mode, SEGOFF(seg, (u32)destmode));
- clext_list_modes(seg, destmode, last);
-
- regs->ax = 0x004f;
-}
-
-static u32 cirrus_lfb_addr VAR16;
-
-static void
-cirrus_vesa_01h(struct bregs *regs)
-{
- u16 mode = cirrus_vesamode_to_mode(regs->cx & 0x3fff);
- if (!mode) {
- regs->ax = 0x014f;
- return;
- }
- struct cirrus_mode_s *table_g = cirrus_get_modeentry(mode);
- u32 lfb = GET_GLOBAL(cirrus_lfb_addr); // XXX
- if ((regs->cx & 0x4000) && !lfb) {
- regs->ax = 0x014f;
- return;
- }
-
- u16 seg = regs->es;
- struct vbe_mode_info *info = (void*)(regs->di+0);
- memset_far(seg, info, 0, sizeof(*info));
-
- SET_FARVAR(seg, info->mode_attributes, lfb ? 0xbb : 0x3b);
- SET_FARVAR(seg, info->winA_attributes, 0x07);
- SET_FARVAR(seg, info->winB_attributes, 0);
- SET_FARVAR(seg, info->win_granularity, 16);
- SET_FARVAR(seg, info->win_size, 64);
- SET_FARVAR(seg, info->winA_seg, SEG_GRAPH);
- SET_FARVAR(seg, info->winB_seg, 0x0);
- SET_FARVAR(seg, info->win_func_ptr.segoff, 0x0); // XXX
- u16 linesize = cirrus_get_line_offset_entry(table_g);
- SET_FARVAR(seg, info->bytes_per_scanline, linesize);
- SET_FARVAR(seg, info->xres, GET_GLOBAL(table_g->info.width));
- u16 height = GET_GLOBAL(table_g->info.height);
- SET_FARVAR(seg, info->yres, height);
- SET_FARVAR(seg, info->xcharsize, 8);
- SET_FARVAR(seg, info->ycharsize, 16);
- SET_FARVAR(seg, info->planes, 1);
- SET_FARVAR(seg, info->bits_per_pixel, GET_GLOBAL(table_g->info.depth));
- SET_FARVAR(seg, info->banks, 1);
- SET_FARVAR(seg, info->mem_model, GET_GLOBAL(table_g->info.memmodel));
- SET_FARVAR(seg, info->bank_size, 0);
-
- int pages = (cirrus_get_memsize() * 64 * 1024) / (height * linesize);
- SET_FARVAR(seg, info->pages, pages - 1);
- SET_FARVAR(seg, info->reserved0, 0);
-
- SET_FARVAR(seg, info->red_size, GET_GLOBAL(table_g->vesaredmask));
- SET_FARVAR(seg, info->red_pos, GET_GLOBAL(table_g->vesaredpos));
- SET_FARVAR(seg, info->green_size, GET_GLOBAL(table_g->vesagreenmask));
- SET_FARVAR(seg, info->green_pos, GET_GLOBAL(table_g->vesagreenpos));
- SET_FARVAR(seg, info->blue_size, GET_GLOBAL(table_g->vesabluemask));
- SET_FARVAR(seg, info->blue_pos, GET_GLOBAL(table_g->vesabluepos));
- SET_FARVAR(seg, info->alpha_size, GET_GLOBAL(table_g->vesareservedmask));
- SET_FARVAR(seg, info->alpha_pos, GET_GLOBAL(table_g->vesareservedpos));
- u8 directcolor_info = GET_GLOBAL(table_g->bitsperpixel) <= 8;
- SET_FARVAR(seg, info->directcolor_info, directcolor_info);
-
- SET_FARVAR(seg, info->phys_base, lfb);
-
- regs->ax = 0x004f;
-}
-
-static void
-cirrus_vesa_02h(struct bregs *regs)
-{
- if (regs->bx & 0x3e00) {
- regs->ax = 0x014f;
- return;
- }
- if ((regs->bx & 0x1ff) < 0x100) {
- // XXX - call legacy mode switch
- regs->ax = 0x004f;
- return;
- }
-
- u16 mode = cirrus_vesamode_to_mode(regs->cx & 0x3fff);
- if (!mode) {
- regs->ax = 0x014f;
- return;
- }
- struct cirrus_mode_s *table_g = cirrus_get_modeentry(mode);
- cirrus_switch_mode(table_g);
-
- if (!(regs->bx & 0x4000))
- cirrus_enable_16k_granularity();
- if (!(regs->bx & 0x8000))
- cirrus_clear_vram(0);
- SET_BDA(video_mode, mode);
- SET_BDA(vbe_mode, regs->bx);
-
- regs->ax = 0x004f;
-}
-
-static void
-cirrus_vesa_03h(struct bregs *regs)
-{
- u16 mode = GET_BDA(vbe_mode);
- if (!mode)
- mode = GET_BDA(video_mode);
- regs->bx = mode;
-
- regs->ax = 0x004f;
-}
-
-// XXX - add cirrus_vesa_05h_farentry to vgaentry.S
-