[U-Boot] [PATCH v1 12/12] HACK: efi_loader: hacks for SCT

Rob Clark
2017-09-10T13:22:33Z

Not intended to be merged, just to show the remaning TODOs to get
SCT.efi working.
---
include/config_distro_bootcmd.h | 2 +-
lib/efi_loader/efi_boottime.c | 4 ++--
lib/efi_loader/efi_console.c | 3 ++-
lib/efi_loader/efi_file.c | 11 +++++++++--
4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index e0d0034ed3..e232a62996 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -88,7 +88,7 @@

#ifdef CONFIG_EFI_LOADER
#if defined(CONFIG_ARM64)
-#define BOOTEFI_NAME "bootaa64.efi"
+#define BOOTEFI_NAME "shell.efi"
#elif defined(CONFIG_ARM)
#define BOOTEFI_NAME "bootarm.efi"
#endif
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 9628bef474..5db8ea9090 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -172,7 +172,7 @@ static efi_status_t efi_unsupported(const char *funcname)
static unsigned long EFIAPI efi_raise_tpl(UINTN new_tpl)
{
EFI_ENTRY("0x%zx", new_tpl);
- return EFI_EXIT(0);
+ return EFI_EXIT(TPL_APPLICATION);
}

static void EFIAPI efi_restore_tpl(UINTN old_tpl)
@@ -1021,7 +1021,7 @@ static efi_status_t EFIAPI efi_set_watchdog_timer(unsigned long timeout,
{
EFI_ENTRY("%ld, 0x%"PRIx64", %ld, %p", timeout, watchdog_code,
data_size, watchdog_data);
- return efi_unsupported(__func__);
+ return EFI_EXIT(EFI_SUCCESS);
}

static efi_status_t EFIAPI efi_connect_controller(
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index fcd65ca488..139f7ea55b 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -561,7 +561,8 @@ static efi_status_t EFIAPI efi_cin_ex_register_key_notify(
efi_handle_t *notify_handle)
{
EFI_ENTRY("%p, %p, %p", this, notify_fn, notify_handle);
- return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+// return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+ return EFI_EXIT(EFI_SUCCESS);
}

static efi_status_t EFIAPI efi_cin_ex_unregister_key_notify(
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 118d83ad7c..d66b0d0370 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -218,8 +218,8 @@ static efi_status_t EFIAPI efi_file_delete(struct efi_file_handle *file)
{
struct file_handle *fh = to_fh(file);
EFI_ENTRY("%p", file);
- file_close(fh);
- return EFI_EXIT(EFI_WARN_DELETE_FAILURE);
+ // TODO need fs_rm()..
+ return EFI_EXIT(file_close(fh));
}

static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size,
@@ -340,6 +340,13 @@ static efi_status_t EFIAPI efi_file_write(struct efi_file_handle *file,

EFI_ENTRY("%p, %p, %p", file, buffer_size, buffer);

+ // XXX hack because fat_write is horrible:
+ if (!fs_exists(fh->path)) {
+ char *p = fh->path;
+ while ((p = strchr(p, '/')))
+ *p++ = '_';
+ }
+
if (set_blk_dev(fh)) {
ret = EFI_DEVICE_ERROR;
goto error;
--
2.13.5