aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorTom Rini2018-03-30 18:17:23 -0400
committerTom Rini2018-03-30 18:17:23 -0400
commit80a66a55fa46960e0c8c527503e76adc18bfe904 (patch)
tree318e064a0759986e8d941f32b1f99194eb4ecd78 /arch
parent0ca0a546b186478b9de80cbd27fa8baf17e30863 (diff)
parent5d73292cf84db1e8f7d99dd27100ef2e8ac15c4e (diff)
Merge git://git.denx.de/u-boot-x86
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/bootparam.h7
-rw-r--r--arch/x86/lib/zimage.c35
2 files changed, 40 insertions, 2 deletions
diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
index 90768a99ceb..6aba6143612 100644
--- a/arch/x86/include/asm/bootparam.h
+++ b/arch/x86/include/asm/bootparam.h
@@ -10,8 +10,11 @@
#include <asm/video/edid.h>
/* setup data types */
-#define SETUP_NONE 0
-#define SETUP_E820_EXT 1
+enum {
+ SETUP_NONE = 0,
+ SETUP_E820_EXT,
+ SETUP_DTB,
+};
/* extensible setup data list node */
struct setup_data {
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 2a82bc83d6c..6af1bf46783 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -14,6 +14,7 @@
*/
#include <common.h>
+#include <malloc.h>
#include <asm/acpi_table.h>
#include <asm/io.h>
#include <asm/ptrace.h>
@@ -25,6 +26,7 @@
#include <asm/arch/timestamp.h>
#endif
#include <linux/compiler.h>
+#include <linux/libfdt.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -95,6 +97,38 @@ static int get_boot_protocol(struct setup_header *hdr)
}
}
+static int setup_device_tree(struct setup_header *hdr, const void *fdt_blob)
+{
+ int bootproto = get_boot_protocol(hdr);
+ struct setup_data *sd;
+ int size;
+
+ if (bootproto < 0x0209)
+ return -ENOTSUPP;
+
+ if (!fdt_blob)
+ return 0;
+
+ size = fdt_totalsize(fdt_blob);
+ if (size < 0)
+ return -EINVAL;
+
+ size += sizeof(struct setup_data);
+ sd = (struct setup_data *)malloc(size);
+ if (!sd) {
+ printf("Not enough memory for DTB setup data\n");
+ return -ENOMEM;
+ }
+
+ sd->next = hdr->setup_data;
+ sd->type = SETUP_DTB;
+ sd->len = fdt_totalsize(fdt_blob);
+ memcpy(sd->data, fdt_blob, sd->len);
+ hdr->setup_data = (unsigned long)sd;
+
+ return 0;
+}
+
struct boot_params *load_zimage(char *image, unsigned long kernel_size,
ulong *load_addressp)
{
@@ -261,6 +295,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
hdr->acpi_rsdp_addr = acpi_get_rsdp_addr();
#endif
+ setup_device_tree(hdr, (const void *)env_get_hex("fdtaddr", 0));
setup_video(&setup_base->screen_info);
return 0;