summaryrefslogtreecommitdiff
path: root/common/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/load.c')
-rw-r--r--common/load.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/common/load.c b/common/load.c
index cb3b41d..56fc96a 100644
--- a/common/load.c
+++ b/common/load.c
@@ -55,3 +55,30 @@ int tb_load_semihosting(const char *fname, uintptr_t load_addr,
smh_close(fd);
return 0;
}
+
+/*
+ * the initrd path, no header, no placement math, bytes to the
+ * address the dtb /chosen already names.
+ */
+int tb_load_raw(const char *fname, uintptr_t load_addr)
+{
+ long fd, len, ret;
+
+ fd = smh_open(fname, MODE_READ | MODE_BINARY);
+ if (fd < 0)
+ return fd;
+
+ len = smh_flen(fd);
+ if (len < 0) {
+ smh_close(fd);
+ return len;
+ }
+
+ ret = smh_read(fd, (void *)load_addr, len);
+ smh_close(fd);
+
+ if (ret != len)
+ return -6;
+
+ return 0;
+}