Skip to contentSkip to conversation

Emulate the bios area in efi linux loader

PATCH In review Bean 2 participants 4 messages Feb 27, 2009 – Mar 1, 2009

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 Emulate the bios area in efi linux loader

Hi,

Linux needs to locate important data structure such as ACPI. In normal EFI booting, these information can be retrieved from efi system table, However, in case of cross booting, for example, booting 32-bit kernel from 64-bit firmware, or vice verse, the efi information is not usable, which leads to dead keyboard and the hda timeout problem.

Moreover, in kernel 2.6.27 and above, linux only map RAM, and efi runtime area need to be mapped with efi_ioremap. However, efi_ioremap only reserve MAX_EFI_IO_PAGES (100) pages for efi, which is not enough for apple 64-bit firmware (about 17m). Until this is fixed, we need to pass "noefi" option to avoid hanging at startup. But this would lead to similar problem as cross booting.

This patch copy the ACPI information to conventional memory and emulated the extended bios data area. With this, linux can find information about ACPI even if efi information is not available, thus resolving the above problem.

2009-02-27 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 (acpi2_guid): New variable. (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.

Signature · 1 line
Bean
include/grub/efi/api.h +20 -0
index 50556bf..1a56554 100644
@@ -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
   {
loader/i386/efi/linux.c +43 -0

55 lines not on this page · raw message

#1 lore raw
Quoted 5 lines

This patch copy the ACPI information to conventional memory and emulated the extended bios data area. With this, linux can find information about ACPI even if efi information is not available, thus resolving the above problem.

In my efiemu I have a code which does exactly the opposite. But additionally it allows the user to replace/add/remove ACPI tables. Perhaps we can share the code and make it also works in cases like replacing some of ACPI tables on pc then putting new rsdp pointer to EBDA, replacing some tables on efi system then using EBDA, modyfiing acpi on efi and putting bew rsdp back to efi and so on.

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
author
#2 lore raw

Hi,

This is an update patch, it checks ACPI 1 & 2.

Signature · 1 line
Bean
include/grub/efi/api.h +20 -0
index 50556bf..1a56554 100644
@@ -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
   {
loader/i386/efi/linux.c +55 -2

75 lines not on this page · raw message

author
#3 lore raw
Quoted 3 lines · Bean

Hi,

This is an update patch, it checks ACPI 1 & 2.

Hi,

I'm getting good test result from the ubuntu forum. With this patch, it's able to boot 2.6.26-28 686/amd64 linux kernel from 32-bit/64-bit firmware.

Committed.

Signature · 1 line
Bean