Remove VBE multiboot support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-28 13:46:42 +02:00
parent fe9381dd00
commit f5d5c327e3
6 changed files with 34 additions and 133 deletions

View file

@ -1,9 +0,0 @@
2010-01-14 Vladimir Serbinenko <phcoder@gmail.com>
VBE multiboot support.
* loader/i386/multiboot_mbi.c (HAS_VBE): New constant.
(grub_multiboot_get_mbi_size) [HAS_VBE]: Account for VBE structures.
(grub_multiboot_make_mbi) [HAS_VBE]: Likewise.
(fill_vbe_info) [HAS_VBE]: New function.
(retrieve_video_parameters) [HAS_VBE]: Call fill_vbe_info.

View file

@ -11,7 +11,6 @@
(grub_get_multiboot_mmap_count): New proto.
(grub_fill_multiboot_mmap): Likewise.
(grub_multiboot_set_video_mode): Likewise.
(grub_multiboot_fill_vbe_info_real): Likewise.
(grub_multiboot_set_console): Likewise.
(grub_multiboot_load): Likewise.
(grub_multiboot_load_elf): Likewise.
@ -24,9 +23,6 @@
* loader/i386/multiboot_mbi.c (HAS_VGA_TEXT): Moved from here ..
* include/grub/multiboot.h (GRUB_MACHINE_HAS_VGA_TEXT): ... here. All
users updated.
* loader/i386/multiboot_mbi.c (HAS_VBE): Moved from here ..
* include/grub/multiboot.h (GRUB_MACHINE_HAS_VBE): ... here. All
users updated.
* loader/i386/multiboot_mbi.c (accepts_video): Moved from here...
* loader/i386/multiboot.c (accepts_video): ... here. All users updated.
* loader/i386/multiboot_mbi.c (grub_multiboot_set_accepts_video):
@ -40,8 +36,4 @@
* loader/i386/multiboot_mbi.c (set_video_mode): Moved from here...
* loader/i386/multiboot.c (grub_multiboot_set_video_mode): ... here.
All users updated.
* loader/i386/multiboot_mbi.c (fill_vbe_info): Moved generic parts
from here...
* loader/i386/multiboot.c (grub_multiboot_fill_vbe_info_real): ... here.
All users updated.
* loader/i386/multiboot_mbi2.c: New file.

View file

@ -51,17 +51,8 @@ grub_err_t grub_multiboot_set_video_mode (void);
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
#include <grub/i386/pc/vbe.h>
grub_err_t
grub_multiboot_fill_vbe_info_real (struct grub_vbe_info_block *vbe_control_info,
struct grub_vbe_mode_info_block *vbe_mode_info,
multiboot_uint16_t *vbe_mode,
multiboot_uint16_t *vbe_interface_seg,
multiboot_uint16_t *vbe_interface_off,
multiboot_uint16_t *vbe_interface_len);
#define GRUB_MACHINE_HAS_VBE 1
#define GRUB_MACHINE_HAS_VGA_TEXT 1
#else
#define GRUB_MACHINE_HAS_VBE 0
#define GRUB_MACHINE_HAS_VGA_TEXT 0
#endif

View file

@ -20,6 +20,7 @@
/*
* FIXME: The following features from the Multiboot specification still
* need to be implemented:
* - VBE support
* - symbol table
* - drives table
* - ROM configuration table
@ -115,54 +116,6 @@ grub_multiboot_set_video_mode (void)
return err;
}
#if GRUB_MACHINE_HAS_VBE
grub_err_t
grub_multiboot_fill_vbe_info_real (struct grub_vbe_info_block *vbe_control_info,
struct grub_vbe_mode_info_block *vbe_mode_info,
multiboot_uint16_t *vbe_mode,
multiboot_uint16_t *vbe_interface_seg,
multiboot_uint16_t *vbe_interface_off,
multiboot_uint16_t *vbe_interface_len)
{
grub_vbe_status_t status;
void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
status = grub_vbe_bios_get_controller_info (scratch);
if (status != GRUB_VBE_STATUS_OK)
return grub_error (GRUB_ERR_IO, "Can't get controller info.");
grub_memcpy (vbe_control_info, scratch, sizeof (struct grub_vbe_info_block));
status = grub_vbe_bios_get_mode (scratch);
*vbe_mode = *(grub_uint32_t *) scratch;
if (status != GRUB_VBE_STATUS_OK)
return grub_error (GRUB_ERR_IO, "can't get VBE mode");
/* get_mode_info isn't available for mode 3. */
if (*vbe_mode == 3)
{
grub_memset (vbe_mode_info, 0, sizeof (struct grub_vbe_mode_info_block));
vbe_mode_info->memory_model = GRUB_VBE_MEMORY_MODEL_TEXT;
vbe_mode_info->x_resolution = 80;
vbe_mode_info->y_resolution = 25;
}
else
{
status = grub_vbe_bios_get_mode_info (*vbe_mode, scratch);
if (status != GRUB_VBE_STATUS_OK)
return grub_error (GRUB_ERR_IO, "can't get mode info");
grub_memcpy (vbe_mode_info, scratch,
sizeof (struct grub_vbe_mode_info_block));
}
/* FIXME: retrieve those. */
*vbe_interface_seg = 0;
*vbe_interface_off = 0;
*vbe_interface_len = 0;
return GRUB_ERR_NONE;
}
#endif
static grub_err_t
grub_multiboot_boot (void)
{

View file

@ -186,10 +186,6 @@ grub_multiboot_get_mbi_size (void)
+ modcnt * sizeof (struct multiboot_mod_list) + total_modcmd
+ ALIGN_UP (sizeof(PACKAGE_STRING), 4)
+ grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry)
#if GRUB_MACHINE_HAS_VBE
+ sizeof (struct grub_vbe_info_block)
+ sizeof (struct grub_vbe_mode_info_block)
#endif
+ 256 * sizeof (struct multiboot_color);
}
@ -391,12 +387,6 @@ grub_multiboot_make_mbi (void *orig, grub_uint32_t dest, grub_off_t buf_off,
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
}
#if GRUB_MACHINE_HAS_VBE
ptrorig += sizeof (struct grub_vbe_info_block);
ptrdest += sizeof (struct grub_vbe_info_block);
ptrorig += sizeof (struct grub_vbe_mode_info_block);
ptrdest += sizeof (struct grub_vbe_mode_info_block);
#endif
return GRUB_ERR_NONE;
}

View file

@ -127,10 +127,10 @@ grub_multiboot_load (grub_file_t file)
case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO:
case MULTIBOOT_TAG_TYPE_BOOTDEV:
case MULTIBOOT_TAG_TYPE_MMAP:
case MULTIBOOT_TAG_TYPE_VBE:
case MULTIBOOT_TAG_TYPE_FRAMEBUFFER:
break;
case MULTIBOOT_TAG_TYPE_VBE:
case MULTIBOOT_TAG_TYPE_ELF_SECTIONS:
case MULTIBOOT_TAG_TYPE_APM:
default:
@ -271,37 +271,6 @@ grub_multiboot_get_mbi_size (void)
+ sizeof (struct multiboot_tag_vbe) + MULTIBOOT_TAG_ALIGN - 1;
}
#ifdef GRUB_MACHINE_HAS_VBE
static grub_err_t
fill_vbe_info (struct grub_vbe_mode_info_block **vbe_mode_info_out,
grub_uint8_t **ptrorig)
{
struct multiboot_tag_vbe *tag = (struct multiboot_tag_vbe *) *ptrorig;
grub_err_t err;
tag->type = MULTIBOOT_TAG_TYPE_VBE;
tag->size = 0;
err = grub_multiboot_fill_vbe_info_real ((struct grub_vbe_info_block *)
&(tag->vbe_control_info),
(struct grub_vbe_mode_info_block *)
&(tag->vbe_mode_info),
&(tag->vbe_mode),
&(tag->vbe_interface_seg),
&(tag->vbe_interface_off),
&(tag->vbe_interface_len));
if (err)
return err;
if (vbe_mode_info_out)
*vbe_mode_info_out = (struct grub_vbe_mode_info_block *)
&(tag->vbe_mode_info);
tag->size = sizeof (struct multiboot_tag_vbe);
*ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
return GRUB_ERR_NONE;
}
#endif
/* Fill previously allocated Multiboot mmap. */
static void
grub_fill_multiboot_mmap (struct multiboot_tag_mmap *tag)
@ -373,11 +342,35 @@ retrieve_video_parameters (grub_uint8_t **ptrorig)
#if HAS_VGA_TEXT
if (driv_id == GRUB_VIDEO_DRIVER_NONE)
{
struct grub_vbe_mode_info_block *vbe_mode_info;
err = fill_vbe_info (&vbe_mode_info, ptrorig);
if (err)
return err;
if (vbe_mode_info->memory_model == GRUB_VBE_MEMORY_MODEL_TEXT)
struct grub_vbe_mode_info_block vbe_mode_info;
grub_vbe_status_t status;
grub_uint32_t vbe_mode;
void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
status = grub_vbe_bios_get_mode (scratch);
vbe_mode = *(grub_uint32_t *) scratch;
if (status != GRUB_VBE_STATUS_OK)
return GRUB_ERR_NONE;
/* get_mode_info isn't available for mode 3. */
if (vbe_mode == 3)
{
grub_memset (&vbe_mode_info, 0,
sizeof (struct grub_vbe_mode_info_block));
vbe_mode_info.memory_model = GRUB_VBE_MEMORY_MODEL_TEXT;
vbe_mode_info.x_resolution = 80;
vbe_mode_info.y_resolution = 25;
}
else
{
status = grub_vbe_bios_get_mode_info (vbe_mode, scratch);
if (status != GRUB_VBE_STATUS_OK)
return GRUB_ERR_NONE;
grub_memcpy (&vbe_mode_info, scratch,
sizeof (struct grub_vbe_mode_info_block));
}
if (vbe_mode_info.memory_model == GRUB_VBE_MEMORY_MODEL_TEXT)
{
tag = (struct multiboot_tag_framebuffer *) *ptrorig;
tag->common.type = MULTIBOOT_TAG_TYPE_FRAMEBUFFER;
@ -385,9 +378,9 @@ retrieve_video_parameters (grub_uint8_t **ptrorig)
tag->common.framebuffer_addr = 0xb8000;
tag->common.framebuffer_pitch = 2 * vbe_mode_info->x_resolution;
tag->common.framebuffer_width = vbe_mode_info->x_resolution;
tag->common.framebuffer_height = vbe_mode_info->y_resolution;
tag->common.framebuffer_pitch = 2 * vbe_mode_info.x_resolution;
tag->common.framebuffer_width = vbe_mode_info.x_resolution;
tag->common.framebuffer_height = vbe_mode_info.y_resolution;
tag->common.framebuffer_bpp = 16;
@ -453,15 +446,6 @@ retrieve_video_parameters (grub_uint8_t **ptrorig)
}
*ptrorig += ALIGN_UP (tag->common.size, MULTIBOOT_TAG_ALIGN);
#if HAS_VBE
if (driv_id == GRUB_VIDEO_DRIVER_VBE)
{
err = fill_vbe_info (NULL, ptrorig);
if (err)
return err;
}
#endif
return GRUB_ERR_NONE;
}