All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: Move firmware fdt search into global function
@ 2016-02-28 23:22 Alexander Graf
  2016-02-28 23:22 ` [PATCH 2/2] arm efi: Use fdt from firmware when available Alexander Graf
  2016-11-12  9:03 ` [PATCH 1/2] arm64: Move firmware fdt search into global function Andrei Borzenkov
  0 siblings, 2 replies; 11+ messages in thread
From: Alexander Graf @ 2016-02-28 23:22 UTC (permalink / raw)
  To: grub-devel; +Cc: leif.lindholm

Searching for a device tree that EFI passes to us via configuration tables
is nothing architecture specific. Move it into generic code.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 grub-core/kern/efi/init.c    | 22 ++++++++++++++++++++++
 grub-core/loader/arm64/fdt.c | 24 +-----------------------
 include/grub/efi/efi.h       |  2 ++
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index e9c85de..fb90ecd 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -72,6 +72,28 @@ grub_machine_get_bootlocation (char **device, char **path)
     }
 }
 
+void *
+grub_efi_get_firmware_fdt (void)
+{
+  grub_efi_configuration_table_t *tables;
+  grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
+  void *firmware_fdt = NULL;
+  unsigned int i;
+
+  /* Look for FDT in UEFI config tables. */
+  tables = grub_efi_system_table->configuration_table;
+
+  for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
+    if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
+      {
+	firmware_fdt = tables[i].vendor_table;
+	grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
+	break;
+      }
+
+  return firmware_fdt;
+}
+
 void
 grub_efi_fini (void)
 {
diff --git a/grub-core/loader/arm64/fdt.c b/grub-core/loader/arm64/fdt.c
index 5202c14..db49cf6 100644
--- a/grub-core/loader/arm64/fdt.c
+++ b/grub-core/loader/arm64/fdt.c
@@ -28,28 +28,6 @@
 static void *loaded_fdt;
 static void *fdt;
 
-static void *
-get_firmware_fdt (void)
-{
-  grub_efi_configuration_table_t *tables;
-  grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
-  void *firmware_fdt = NULL;
-  unsigned int i;
-
-  /* Look for FDT in UEFI config tables. */
-  tables = grub_efi_system_table->configuration_table;
-
-  for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
-    if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
-      {
-	firmware_fdt = tables[i].vendor_table;
-	grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
-	break;
-      }
-
-  return firmware_fdt;
-}
-
 void *
 grub_fdt_load (grub_size_t additional_size)
 {
@@ -65,7 +43,7 @@ grub_fdt_load (grub_size_t additional_size)
   if (loaded_fdt)
     raw_fdt = loaded_fdt;
   else
-    raw_fdt = get_firmware_fdt();
+    raw_fdt = grub_efi_get_firmware_fdt();
 
   size =
     raw_fdt ? grub_fdt_get_totalsize (raw_fdt) : GRUB_FDT_EMPTY_TREE_SZ;
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 0e6fd86..2acf85e 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -81,6 +81,8 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
 						char **device,
 						char **path);
 
+void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
+
 grub_addr_t grub_efi_modules_addr (void);
 
 void grub_efi_mm_init (void);
-- 
1.8.5.6



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-11-16 11:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-28 23:22 [PATCH 1/2] arm64: Move firmware fdt search into global function Alexander Graf
2016-02-28 23:22 ` [PATCH 2/2] arm efi: Use fdt from firmware when available Alexander Graf
2016-03-10 20:00   ` Vladimir 'phcoder' Serbinenko
2016-03-13 14:44     ` Leif Lindholm
2016-11-10 12:27   ` Daniel Kiper
2016-11-12  9:03 ` [PATCH 1/2] arm64: Move firmware fdt search into global function Andrei Borzenkov
2016-11-15 21:00   ` Daniel Kiper
2016-11-15 21:07     ` Alexander Graf
2016-11-16 10:28       ` Daniel Kiper
2016-11-16 10:33         ` Alexander Graf
2016-11-16 11:05           ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.