=== modified file 'commands/i386/pc/vbeinfo.c' --- commands/i386/pc/vbeinfo.c 2008-08-31 04:27:54 +0000 +++ commands/i386/pc/vbeinfo.c 2008-08-31 16:30:27 +0000 @@ -26,6 +26,31 @@ #include #include +/* Bits from the VBE "mode_attributes" field in the mode info struct. */ +#define VBE_MODEATTR_SUPPORTED (1 << 0) +#define VBE_MODEATTR_RESERVED_1 (1 << 1) +#define VBE_MODEATTR_BIOS_TTY_OUTPUT_SUPPORT (1 << 2) +#define VBE_MODEATTR_COLOR (1 << 3) +#define VBE_MODEATTR_GRAPHICS (1 << 4) +#define VBE_MODEATTR_VGA_COMPATIBLE (1 << 5) +#define VBE_MODEATTR_VGA_WINDOWED_AVAIL (1 << 6) +#define VBE_MODEATTR_LINEAR_FB_AVAIL (1 << 7) +#define VBE_MODEATTR_DOUBLE_SCAN_AVAIL (1 << 8) +#define VBE_MODEATTR_INTERLACED_AVAIL (1 << 9) +#define VBE_MODEATTR_TRIPLE_BUF_AVAIL (1 << 10) +#define VBE_MODEATTR_STEREO_AVAIL (1 << 11) +#define VBE_MODEATTR_DUAL_DISPLAY_START (1 << 12) + +/* Values for the VBE memory_model field in the mode info struct. */ +#define VBE_MODE_MEMORY_MODEL_TEXT 0x00 +#define VBE_MODE_MEMORY_MODEL_CGA 0x01 +#define VBE_MODE_MEMORY_MODEL_HERCULES 0x02 +#define VBE_MODE_MEMORY_MODEL_PLANAR 0x03 +#define VBE_MODE_MEMORY_MODEL_PACKED_PIXEL 0x04 +#define VBE_MODE_MEMORY_MODEL_NONCHAIN4_256 0x05 +#define VBE_MODE_MEMORY_MODEL_DIRECT_COLOR 0x06 +#define VBE_MODE_MEMORY_MODEL_YUV 0x07 + static void * real2pm (grub_vbe_farptr_t ptr) { @@ -57,6 +82,7 @@ controller_info.version & 0xFF, controller_info.oem_software_rev >> 8, controller_info.oem_software_rev & 0xFF); + /* The total_memory field is in 64 KiB units. */ grub_printf (" total memory: %d KiB\n", (controller_info.total_memory << 16) / 1024); @@ -90,32 +116,32 @@ continue; } - if ((mode_info_tmp.mode_attributes & 0x001) == 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_SUPPORTED) == 0) /* If not available, skip it. */ continue; - if ((mode_info_tmp.mode_attributes & 0x002) == 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_RESERVED_1) == 0) /* Not enough information. */ continue; - if ((mode_info_tmp.mode_attributes & 0x008) == 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_COLOR) == 0) /* Monochrome is unusable. */ continue; - if ((mode_info_tmp.mode_attributes & 0x080) == 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_LINEAR_FB_AVAIL) == 0) /* We support only linear frame buffer modes. */ continue; - if ((mode_info_tmp.mode_attributes & 0x010) == 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_GRAPHICS) == 0) /* We allow only graphical modes. */ continue; switch (mode_info_tmp.memory_model) { - case 0x04: + case VBE_MODE_MEMORY_MODEL_PACKED_PIXEL: memory_model = "Packed"; break; - case 0x06: + case VBE_MODE_MEMORY_MODEL_DIRECT_COLOR: memory_model = "Direct"; break;