]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix coreboot compilation.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 29 Sep 2010 21:51:12 +0000 (23:51 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 29 Sep 2010 21:51:12 +0000 (23:51 +0200)
* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_get_mbi_size):
Take VBE info into account even if only text is supported.
(fill_vbe_info): Take into account the case when only VGA text
is supported.
* include/grub/multiboot.h (GRUB_MACHINE_HAS_VBE): Set to zero
on coreboot, multiboot and qemu.

ChangeLog
grub-core/loader/i386/multiboot_mbi.c
include/grub/multiboot.h

index 63c6e83ee13d6dc89cad58a9e27b53076e111213..4614a1cac85ab5aa68197ffac53ce11f8155126a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-29  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Fix coreboot compilation.
+
+       * grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_get_mbi_size):
+       Take VBE info into account even if only text is supported.
+       (fill_vbe_info): Take into account the case when only VGA text
+       is supported.
+       * include/grub/multiboot.h (GRUB_MACHINE_HAS_VBE): Set to zero
+       on coreboot, multiboot and qemu.
+
 2010-09-29  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/lib/relocator.c (malloc_in_range): Trim too verbose
index 283b84c5a870aff58d2f1c353af65abd89880c8b..79f72ee0f69ffddaafdae7d60e312e689733bcd2 100644 (file)
@@ -187,6 +187,10 @@ grub_multiboot_load (grub_file_t file)
   return err;
 }
 
+#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
+#include <grub/i386/pc/vbe.h>
+#endif
+
 static grub_size_t
 grub_multiboot_get_mbi_size (void)
 {
@@ -196,7 +200,7 @@ grub_multiboot_get_mbi_size (void)
     + grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry)
     + elf_sec_entsize * elf_sec_num
     + 256 * sizeof (struct multiboot_color)
-#if GRUB_MACHINE_HAS_VBE
+#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
     + sizeof (struct grub_vbe_info_block)
     + sizeof (struct grub_vbe_mode_info_block)
 #endif
@@ -247,15 +251,17 @@ grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
   grub_mmap_iterate (hook);
 }
 
-#if GRUB_MACHINE_HAS_VBE
+#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
+
 static grub_err_t
 fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
               grub_uint32_t ptrdest, int fill_generic)
 {
-  grub_vbe_status_t status;
   grub_uint32_t vbe_mode;
-  void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
   struct grub_vbe_mode_info_block *mode_info;
+#if GRUB_MACHINE_HAS_VBE
+  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)
@@ -265,11 +271,18 @@ fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
   grub_memcpy (ptrorig, scratch, sizeof (struct grub_vbe_info_block));
   ptrorig += sizeof (struct grub_vbe_info_block);
   ptrdest += sizeof (struct grub_vbe_info_block);
-  
+#else
+  mbi->vbe_control_info = 0;
+#endif
+
+#if GRUB_MACHINE_HAS_VBE  
   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");
+#else
+  vbe_mode = 3;
+#endif
   mbi->vbe_mode = vbe_mode;
 
   mode_info = (struct grub_vbe_mode_info_block *) ptrorig;
@@ -284,18 +297,22 @@ fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
     }
   else
     {
+#if GRUB_MACHINE_HAS_VBE  
       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 (mode_info, scratch,
                   sizeof (struct grub_vbe_mode_info_block));
+#endif
     }
   ptrorig += sizeof (struct grub_vbe_mode_info_block);
   ptrdest += sizeof (struct grub_vbe_mode_info_block);
-      
+
+#if GRUB_MACHINE_HAS_VBE        
   grub_vbe_bios_get_pm_interface (&mbi->vbe_interface_seg,
                                  &mbi->vbe_interface_off,
                                  &mbi->vbe_interface_len);
+#endif
   
   mbi->flags |= MULTIBOOT_INFO_VBE_INFO;
 
index 364dc3ca626c2dc929dade2b5aab21830e4906b8..9a0b5735957017b46bdd2f14c55ee8e730507fef 100644 (file)
@@ -53,13 +53,17 @@ grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
 grub_uint32_t grub_get_multiboot_mmap_count (void);
 grub_err_t grub_multiboot_set_video_mode (void);
 
+/* FIXME: support coreboot as well.  */
+#if defined (GRUB_MACHINE_PCBIOS)
+#define GRUB_MACHINE_HAS_VBE 1
+#else
+#define GRUB_MACHINE_HAS_VBE 0
+#endif
+
 #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
-#include <grub/i386/pc/vbe.h>
 #define GRUB_MACHINE_HAS_VGA_TEXT 1
-#define GRUB_MACHINE_HAS_VBE 1
 #else
 #define GRUB_MACHINE_HAS_VGA_TEXT 0
-#define GRUB_MACHINE_HAS_VBE 0
 #endif
 
 #if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)