[2010] 2009-03-01 Bean <[email protected]>

Bean <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2010
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2010
Author:   bean
Date:     2009-03-01 17:57:57 +0000 (Sun, 01 Mar 2009)
Log Message:
-----------
2009-03-01  Bean  <[email protected]>

	* include/grub/efi/api.h (GRUB_EFI_MPS_TABALE_GUID): New constant.
	(GRUB_EFI_ACPI_TABLE_GUID): Likewise.
	(GRUB_EFI_ACPI_20_TABLE_GUID): Likewise.
	(GRUB_EFI_SMBIOS_TABLE_GUID): Likewise.

	* loader/i386/efi/linux.c (acpi_guid): New variable.
	(acpi_guid): Likewise.
	(EBDA_SEG_ADDR): New constant.
	(LOW_MEM_ADDR): Likewise.
	(FAKE_EBDA_SEG): Likewise.
	(fake_bios_data): New function.
	(grub_linux_boot): Call fake_bios_data.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/include/grub/efi/api.h
    trunk/grub2/loader/i386/efi/linux.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-03-01 17:51:44 UTC (rev 2009)
+++ trunk/grub2/ChangeLog	2009-03-01 17:57:57 UTC (rev 2010)
@@ -1,5 +1,20 @@
 2009-03-01  Bean  <[email protected]>
 
+	* include/grub/efi/api.h (GRUB_EFI_MPS_TABALE_GUID): New constant.
+	(GRUB_EFI_ACPI_TABLE_GUID): Likewise.
+	(GRUB_EFI_ACPI_20_TABLE_GUID): Likewise.
+	(GRUB_EFI_SMBIOS_TABLE_GUID): Likewise.
+
+	* loader/i386/efi/linux.c (acpi_guid): New variable.
+	(acpi_guid): Likewise.
+	(EBDA_SEG_ADDR): New constant.
+	(LOW_MEM_ADDR): Likewise.
+	(FAKE_EBDA_SEG): Likewise.
+	(fake_bios_data): New function.
+	(grub_linux_boot): Call fake_bios_data.
+
+2009-03-01  Bean  <[email protected]>
+
 	* commands/terminal.c: Removed.
 
 	* commands/handler.c: New file.

Modified: trunk/grub2/include/grub/efi/api.h
===================================================================
--- trunk/grub2/include/grub/efi/api.h	2009-03-01 17:51:44 UTC (rev 2009)
+++ trunk/grub2/include/grub/efi/api.h	2009-03-01 17:57:57 UTC (rev 2010)
@@ -88,6 +88,26 @@
     { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
   }
 
+#define GRUB_EFI_MPS_TABLE_GUID	\
+  { 0xeb9d2d2f, 0x2d88, 0x11d3, \
+    { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+  }
+
+#define GRUB_EFI_ACPI_TABLE_GUID	\
+  { 0xeb9d2d30, 0x2d88, 0x11d3, \
+    { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+  }
+
+#define GRUB_EFI_ACPI_20_TABLE_GUID	\
+  { 0x8868e871, 0xe4f1, 0x11d3, \
+    { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+  }
+
+#define GRUB_EFI_SMBIOS_TABLE_GUID	\
+  { 0xeb9d2d31, 0x2d88, 0x11d3, \
+    { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+  }
+
 /* Enumerations.  */
 enum grub_efi_timer_delay
   {

Modified: trunk/grub2/loader/i386/efi/linux.c
===================================================================
--- trunk/grub2/loader/i386/efi/linux.c	2009-03-01 17:51:44 UTC (rev 2009)
+++ trunk/grub2/loader/i386/efi/linux.c	2009-03-01 17:57:57 UTC (rev 2010)
@@ -283,6 +283,57 @@
     }
 }
 
+static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
+static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
+
+#define EBDA_SEG_ADDR	0x40e
+#define LOW_MEM_ADDR	0x413
+#define FAKE_EBDA_SEG	0x9fc0
+
+static void
+fake_bios_data (void)
+{
+  unsigned i;
+  void *acpi;
+  grub_uint16_t *ebda_seg_ptr, *low_mem_ptr;
+
+  acpi = 0;
+  for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
+    {
+      grub_efi_guid_t *guid =
+	&grub_efi_system_table->configuration_table[i].vendor_guid;
+
+      if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_efi_guid_t)))
+	{
+	  acpi = grub_efi_system_table->configuration_table[i].vendor_table;
+	  grub_printf ("ACPI2: %p\n", acpi);
+	}
+      else if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t)))
+	{
+	  void *t;
+
+	  t = grub_efi_system_table->configuration_table[i].vendor_table;
+	  if (! acpi)
+	    acpi = t;
+	  grub_printf ("ACPI: %p\n", t);
+	}
+    }
+
+  if (acpi == 0)
+    return;
+
+  ebda_seg_ptr = (grub_uint16_t *) EBDA_SEG_ADDR;
+  low_mem_ptr = (grub_uint16_t *) LOW_MEM_ADDR;
+
+  if ((*ebda_seg_ptr) || (*low_mem_ptr))
+    return;
+
+  *ebda_seg_ptr = FAKE_EBDA_SEG;
+  *low_mem_ptr = FAKE_EBDA_SEG >> 6;
+
+  grub_memcpy ((char *) (FAKE_EBDA_SEG << 4), acpi, 1024);
+}
+
 #ifdef __x86_64__
 struct
 {
@@ -302,6 +353,8 @@
   grub_efi_memory_descriptor_t *desc;
   int e820_num;
   
+  fake_bios_data ();
+
   params = real_mode_mem;
 
   grub_dprintf ("linux", "code32_start = %x, idt_desc = %lx, gdt_desc = %lx\n",
@@ -522,8 +575,8 @@
 
   grub_efi_set_text_mode (0);
   pixel = RGB_MAGIC;
-  efi_call_10 (c->blt, c, &pixel, GRUB_EFI_UGA_VIDEO_FILL,
-	       0, 0, 0, 0, 1, height, 0);
+  efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel,
+	       GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
   ret = find_framebuf (&fb_base, &line_len);
   grub_efi_set_text_mode (1);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.