vbetables-gen.c revision bef8e573c184a69e2ea26cecd5d15c57eb66398f
/* Generate the VGABIOS VBE Tables */
#include <stdlib.h>
#include <stdio.h>
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 8
typedef struct {
int width;
int height;
int depth;
int mode;
} ModeInfo;
/* standard VESA modes */
{ 640, 400, 8 , 0x100},
{ 640, 480, 8 , 0x101},
{ 800, 600, 4 , 0x102},
{ 800, 600, 8 , 0x103},
{ 1024, 768, 4 , 0x104},
{ 1024, 768, 8 , 0x105},
{ 1280, 1024, 4 , 0x106},
{ 1280, 1024, 8 , 0x107},
{ 320, 200, 15 , 0x10D},
{ 320, 200, 16 , 0x10E},
{ 320, 200, 24 , 0x10F},
{ 640, 480, 15 , 0x110},
{ 640, 480, 16 , 0x111},
{ 640, 480, 24 , 0x112},
{ 800, 600, 15 , 0x113},
{ 800, 600, 16 , 0x114},
{ 800, 600, 24 , 0x115},
{ 1024, 768, 15 , 0x116},
{ 1024, 768, 16 , 0x117},
{ 1024, 768, 24 , 0x118},
{ 1280, 1024, 15 , 0x119},
{ 1280, 1024, 16 , 0x11A},
{ 1280, 1024, 24 , 0x11B},
{ 1600, 1200, 8 , 0x11C},
{ 1600, 1200, 15 , 0x11D},
{ 1600, 1200, 16 , 0x11E},
{ 1600, 1200, 24 , 0x11F},
{ 320, 200, 32 , 0x140},
{ 640, 400, 32 , 0x141},
{ 640, 480, 32 , 0x142},
{ 800, 600, 32 , 0x143},
{ 1024, 768, 32 , 0x144},
{ 1280, 1024, 32 , 0x145},
{ 320, 200, 8 , 0x146},
{ 1600, 1200, 32 , 0x147},
{ 1152, 864, 8 , 0x148},
{ 1152, 864, 15 , 0x149},
{ 1152, 864, 16 , 0x14a},
{ 1152, 864, 24 , 0x14b},
{ 1152, 864, 32 , 0x14c},
{ 0, },
};
{
const char *str;
printf("/* THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT */\n\n");
printf("static ModeInfoListItem mode_info_list[]=\n");
printf("{\n");
else
if (pages > 0) {
printf("{ 0x%04x, /* %dx%dx%d */\n",
printf("{ /*Bit16u ModeAttributes*/ %s,\n",
"VBE_MODE_ATTRIBUTE_SUPPORTED | "
"VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE | "
"VBE_MODE_ATTRIBUTE_COLOR_MODE | "
"VBE_MODE_ATTRIBUTE_TTY_BIOS_SUPPORT | "
"VBE_MODE_ATTRIBUTE_GRAPHICS_MODE");
else
printf("{ /*Bit16u ModeAttributes*/ %s,\n",
"VBE_MODE_ATTRIBUTE_SUPPORTED | "
"VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE | "
"VBE_MODE_ATTRIBUTE_COLOR_MODE | "
"VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE | "
"VBE_MODE_ATTRIBUTE_GRAPHICS_MODE");
printf("/*Bit8u WinAAttributes*/ %s,\n",
"VBE_WINDOW_ATTRIBUTE_RELOCATABLE | "
"VBE_WINDOW_ATTRIBUTE_READABLE | "
"VBE_WINDOW_ATTRIBUTE_WRITEABLE");
printf("/*Bit8u WinBAttributes*/ %d,\n", 0);
printf("/*Bit16u WinBSegment*/ 0x%04x,\n", 0);
printf("/*Bit32u WinFuncPtr*/ %d,\n", 0);
/* Mandatory information for VBE 1.2 and above */
} else {
}
str = "VBE_MEMORYMODEL_PLANAR";
str = "VBE_MEMORYMODEL_PACKED_PIXEL";
else
str = "VBE_MEMORYMODEL_DIRECT_COLOR";
printf("/*Bit8u BankSize*/ %d,\n", 0);
else
printf("/*Bit8u Reserved_page*/ %d,\n", 0);
/* Direct Color fields (required for direct/6 and YUV/7 memory models) */
case 15:
r_size = 5;
r_pos = 10;
g_size = 5;
g_pos = 5;
b_size = 5;
b_pos = 0;
a_size = 1;
a_pos = 15;
break;
case 16:
r_size = 5;
r_pos = 11;
g_size = 6;
g_pos = 5;
b_size = 5;
b_pos = 0;
a_size = 0;
a_pos = 0;
break;
case 24:
r_size = 8;
r_pos = 16;
g_size = 8;
g_pos = 8;
b_size = 8;
b_pos = 0;
a_size = 0;
a_pos = 0;
break;
case 32:
r_size = 8;
r_pos = 16;
g_size = 8;
g_pos = 8;
b_size = 8;
b_pos = 0;
a_size = 8;
a_pos = 24;
break;
default:
r_size = 0;
r_pos = 0;
g_size = 0;
g_pos = 0;
b_size = 0;
b_pos = 0;
a_size = 0;
a_pos = 0;
break;
}
printf("/*Bit8u DirectColorModeInfo*/ %s,\n",
"VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE");
else
/* Mandatory information for VBE 2.0 and above */
printf("/*Bit32u PhysBasePtr*/ %s,\n",
"VBE_DISPI_LFB_PHYSICAL_ADDRESS");
else
printf("/*Bit32u OffScreenMemOffset*/ %d,\n", 0);
printf("/*Bit16u OffScreenMemSize*/ %d,\n", 0);
/* Mandatory information for VBE 3.0 and above */
printf("/*Bit8u BnkNumberOfPages*/ %d,\n", 0);
printf("/*Bit8u LinNumberOfPages*/ %d,\n", 0);
printf("/*Bit32u MaxPixelClock*/ %d,\n", 0);
printf("} },\n");
}
}
#ifndef VBOX /* We'll add the terminator ourselves, thank you. */
printf("{ VBE_VESA_MODE_END_OF_LIST,\n");
printf("{ 0,\n");
printf("} },\n");
#endif
printf("};\n");
return 0;
}