mirror of
https://xff.cz/git/u-boot/
synced 2025-09-25 04:21:18 +02:00
x86: zImage: Pass working device tree data to the kernel
On x86 platforms, U-Boot does not pass Device Tree data to the kernel. This prevents the kernel from using FDT loaded by U-Boot. Read the working FDT address from the "fdtaddr" environment variable and add a copy of the FDT data to the kernel setup_data list. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: add #include <linux/libfdt.h> to zimage.c to fix build error] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
@@ -10,8 +10,11 @@
|
|||||||
#include <asm/video/edid.h>
|
#include <asm/video/edid.h>
|
||||||
|
|
||||||
/* setup data types */
|
/* setup data types */
|
||||||
#define SETUP_NONE 0
|
enum {
|
||||||
#define SETUP_E820_EXT 1
|
SETUP_NONE = 0,
|
||||||
|
SETUP_E820_EXT,
|
||||||
|
SETUP_DTB,
|
||||||
|
};
|
||||||
|
|
||||||
/* extensible setup data list node */
|
/* extensible setup data list node */
|
||||||
struct setup_data {
|
struct setup_data {
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <malloc.h>
|
||||||
#include <asm/acpi_table.h>
|
#include <asm/acpi_table.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/ptrace.h>
|
#include <asm/ptrace.h>
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
#include <asm/arch/timestamp.h>
|
#include <asm/arch/timestamp.h>
|
||||||
#endif
|
#endif
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
#include <linux/libfdt.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
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,
|
struct boot_params *load_zimage(char *image, unsigned long kernel_size,
|
||||||
ulong *load_addressp)
|
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();
|
hdr->acpi_rsdp_addr = acpi_get_rsdp_addr();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
setup_device_tree(hdr, (const void *)env_get_hex("fdtaddr", 0));
|
||||||
setup_video(&setup_base->screen_info);
|
setup_video(&setup_base->screen_info);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user