SHA256
1
0
forked from pool/u-boot
u-boot/efi-map-fdt-as-reserved.patch
Dominique Leuenberger cad836ad68 Accepting request 366093 from Base:System
Sorry for the supersede, this fixes a small issue with beaglebone where grub2
would overwrite the initrd while patching the device tree because it's missing
boundary checks.

- EFI: Map fdt as reserved
  * efi-map-fdt-as-reserved.patch

- Fix OMAP3 boards to load u-boot from raw sector offset
  * omap3-Use-raw-SPL-by-default-for-mmc1.patch

- Allow grub2 to find its config
  * efi_loader-Pass-proper-device-path-in-on-boot.patch
- Fix Raspberry Pi 1 build
  * efi_loader-Provide-icache-flush-stub.patch

- Move omap3 to distro bootcmd (to enable efi boot on beagle-xm)
  * omap3-Move-to-distro-bootcmd.patch
- Add EFI patch to support FDT fixups (patches in RAM size)
  * efi_loader-Call-fdt-preparation-functions.patch

- Patch the default u-boot env to search for dtb in /boot at part 2
  * efi-default-env.patch

- Use $fdtfile rather than $fdt_name everywhere:
  * efi2.patch

- Add EFI support about to move upstream:
  * efi.patch

- EFI: Map fdt as reserved
  * efi-map-fdt-as-reserved.patch

- Fix OMAP3 boards to load u-boot from raw sector offset
  * omap3-Use-raw-SPL-by-default-for-mmc1.patch (forwarded request 365802 from algraf)

OBS-URL: https://build.opensuse.org/request/show/366093
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/u-boot?expand=0&rev=68
2016-03-07 12:27:45 +00:00

44 lines
1.4 KiB
Diff

From 058aba8cbd2194c0dfe6b232170f43f8e410f119 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 3 Mar 2016 15:02:27 +0100
Subject: [PATCH] bootefi: Mark fdt memory as in-use
Signed-off-by: Alexander Graf <agraf@suse.de>
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 6119854..8ba2c53 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -10,6 +10,7 @@
#include <command.h>
#include <efi_loader.h>
#include <errno.h>
+#include <libfdt.h>
#include <libfdt_env.h>
/*
@@ -91,6 +92,7 @@ static unsigned long do_bootefi_exec(void *efi)
{
ulong (*entry)(void *image_handle, struct efi_system_table *st);
bootm_headers_t img = { 0 };
+ ulong fdt_pages, fdt_size, fdt_start, fdt_end;
/*
* gd lives in a fixed register which may get clobbered while we execute
@@ -111,6 +113,15 @@ static unsigned long do_bootefi_exec(void *efi)
systab.tables[0].guid = EFI_FDT_GUID;
systab.tables[0].table = working_fdt;
systab.nr_tables = 1;
+
+ /* And reserve the space in the memory map */
+ fdt_start = ((ulong)working_fdt) & ~EFI_PAGE_MASK;
+ fdt_end = ((ulong)working_fdt) + fdt_totalsize(working_fdt);
+ fdt_size = (fdt_end - fdt_start) + EFI_PAGE_MASK;
+ fdt_pages = (fdt_size >> EFI_PAGE_SHIFT) + 2;
+ efi_add_memory_map(fdt_start, fdt_pages,
+ EFI_BOOT_SERVICES_DATA, true);
+
} else {
printf("WARNING: No device tree loaded, expect boot to fail\n");
systab.nr_tables = 0;