]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Pass PCIINFO on BIOS to OpenBSD since otherwise it fails to boot
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 7 Jun 2012 14:41:52 +0000 (16:41 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 7 Jun 2012 14:41:52 +0000 (16:41 +0200)
on some qemu versions with GRUB.

* include/grub/i386/openbsd_bootarg.h (OPENBSD_BOOTARG_PCIBIOS): New
define.
(grub_openbsd_bootarg_pcibios): New struct.
* grub-core/loader/i386/bsd.c (grub_openbsd_boot) [GRUB_MACHINE_PCBIOS]:
Add PCIINFO.

ChangeLog
grub-core/loader/i386/bsd.c
include/grub/i386/openbsd_bootarg.h

index 9eb758966910e85401fe69e741c0d1d488c46b6f..3d47ebf578b8e85fdca39b455ee5f70491414fb0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-06-07  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Pass PCIINFO on BIOS to OpenBSD since otherwise it fails to boot
+       on some qemu versions with GRUB.
+
+       * include/grub/i386/openbsd_bootarg.h (OPENBSD_BOOTARG_PCIBIOS): New
+       define.
+       (grub_openbsd_bootarg_pcibios): New struct.
+       * grub-core/loader/i386/bsd.c (grub_openbsd_boot) [GRUB_MACHINE_PCBIOS]:
+       Add PCIINFO.
+
 2012-06-07  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * tests/util/grub-shell.in: Trim firmware output on EFI.
index 299cedc489191b32d807b18264794d5c5bcd1df6..0fd4df0ffc974176b88559397dc897a7ae1f8541 100644 (file)
@@ -35,6 +35,9 @@
 #include <grub/ns8250.h>
 #include <grub/bsdlabel.h>
 #include <grub/crypto.h>
+#ifdef GRUB_MACHINE_PCBIOS
+#include <grub/machine/int.h>
+#endif
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -809,6 +812,35 @@ grub_openbsd_boot (void)
   if (err)
     return err;
 
+#ifdef GRUB_MACHINE_PCBIOS
+  {
+    struct grub_bios_int_registers regs;
+
+    regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
+
+    regs.ebx = 0;
+    regs.ecx = 0;
+    regs.eax = 0xb101;
+    regs.es = 0;
+    regs.edi = 0;
+    regs.edx = 0;
+
+    grub_bios_interrupt (0x1a, &regs);
+    if (regs.edx == 0x20494350)
+      {
+       struct grub_openbsd_bootarg_pcibios pcibios;
+       
+       pcibios.characteristics = regs.eax & 0xff;
+       pcibios.revision = regs.ebx & 0xffff;
+       pcibios.pm_entry = regs.edi;
+       pcibios.last_bus = regs.ecx & 0xff;
+
+       grub_bsd_add_meta (OPENBSD_BOOTARG_PCIBIOS, &pcibios,
+                          sizeof (pcibios));
+      }
+  }
+#endif
+
   {
     struct bsd_tag *tag;
     tag_buf_len = 0;
index 935dfc0c8e4c34255594d8e629be8ed59162f958..75bb9fb8826e3a9f110ba7155eb30aa1a216a49f 100644 (file)
@@ -61,6 +61,7 @@
 #define OPENBSD_BOOTARG_END    -1
 
 #define        OPENBSD_BOOTARG_MMAP    0
+#define        OPENBSD_BOOTARG_PCIBIOS 4
 #define        OPENBSD_BOOTARG_CONSOLE 5
 
 struct grub_openbsd_bootargs
@@ -76,6 +77,14 @@ struct grub_openbsd_bootarg_console
   grub_uint32_t speed;
 };
 
+struct grub_openbsd_bootarg_pcibios
+{
+  grub_uint32_t characteristics;
+  grub_uint32_t revision;
+  grub_uint32_t pm_entry;
+  grub_uint32_t last_bus;
+};
+
 #define GRUB_OPENBSD_COM_MAJOR 8
 #define GRUB_OPENBSD_VGA_MAJOR 12