aboutsummaryrefslogtreecommitdiff
path: root/include/efi_loader.h
diff options
context:
space:
mode:
authorAlexander Graf2016-03-04 01:10:14 +0100
committerTom Rini2016-03-15 21:30:14 -0400
commit0f4060ebcb4f60287c456586cf089510e43ba339 (patch)
treebbcf2d01e545099b686ef123325022e3f3a25236 /include/efi_loader.h
parentdea2174d9d941db2ec64997779771a4b4c3527c2 (diff)
efi_loader: Pass proper device path in on boot
EFI payloads can query for the device they were booted from. Because we have a disconnect between loading binaries and running binaries, we passed in a dummy device path so far. Unfortunately that breaks grub2's logic to find its configuration file from the same device it was booted from. This patch adds logic to have the "load" command call into our efi code to set the device path to the one we last loaded a binary from. With this grub2 properly detects where we got booted from and can find its configuration file, even when searching by-partition. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include/efi_loader.h')
-rw-r--r--include/efi_loader.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 11be685f0e1..74bed26662d 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -109,6 +109,8 @@ void efi_restore_gd(void);
efi_status_t efi_exit_func(efi_status_t ret);
/* Call this to relocate the runtime section to an address space */
void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map);
+/* Call this to set the current device name */
+void efi_set_bootdev(const char *dev, const char *devnr);
/* Generic EFI memory allocator, call this to get memory */
void *efi_alloc(uint64_t len, int memory_type);
@@ -129,6 +131,13 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
/* Called by board init to initialize the EFI memory map */
int efi_memory_init(void);
+/* Convert strings from normal C strings to uEFI strings */
+static inline void ascii2unicode(u16 *unicode, char *ascii)
+{
+ while (*ascii)
+ *(unicode++) = *(ascii++);
+}
+
/*
* Use these to indicate that your code / data should go into the EFI runtime
* section and thus still be available when the OS is running
@@ -144,5 +153,6 @@ int efi_memory_init(void);
/* No loader configured, stub out EFI_ENTRY */
static inline void efi_restore_gd(void) { }
+static inline void efi_set_bootdev(const char *dev, const char *devnr) { }
#endif