@@ -41,8 +41,10 @@ DECLARE_GLOBAL_DATA_PTR;
static struct mm_region rbx_mem_map[CONFIG_NR_DRAM_BANKS + 2] = { { 0 } };
struct mm_region *mem_map = rbx_mem_map;
+struct efi_info_hdr *efi_info __section(".data") = NULL;
+
static void show_psci_version(void)
{
struct arm_smccc_res res;
@@ -59,15 +61,28 @@ static void show_psci_version(void)
*/
void *board_fdt_blob_setup(int *err)
{
struct fdt_header *fdt;
+ struct efi_info_hdr *info = NULL;
bool internal_valid, external_valid;
*err = 0;
fdt = (struct fdt_header *)get_prev_bl_fdt_addr();
external_valid = fdt && !fdt_check_header(fdt);
internal_valid = !fdt_check_header(gd->fdt_blob);
+ /*
+ * If EFI_STUB is enabled, we got handed a pointer and it's NOT
+ * a valid FDT, then it might be the efi_info table!
+ */
+ if (CONFIG_IS_ENABLED(EFI_STUB) && fdt && !external_valid)
+ info = (struct efi_info_hdr *)fdt;
+
+ if (info->version == 1) {
+ debug("Got EFI info header!\n");
+ efi_info = info;
+ }
+
/*
* There is no point returning an error here, U-Boot can't do anything useful in this situation.
* Bail out while we can still print a useful error message.
*/
@@ -7,12 +7,15 @@
#define pr_fmt(fmt) "QCOM-DRAM: " fmt
#include <asm-generic/unaligned.h>
#include <dm.h>
+#include <efi_stub.h>
#include <log.h>
#include <sort.h>
#include <soc/qcom/smem.h>
+#include "qcom-priv.h"
+
#define SMEM_USABLE_RAM_PARTITION_TABLE 402
#define RAM_PART_NAME_LENGTH 16
#define RAM_NUM_PART_ENTRIES 32
#define CATEGORY_SDRAM 0x0E
@@ -89,9 +92,19 @@ static void qcom_configure_bi_dram(void)
}
int dram_init_banksize(void)
{
- qcom_configure_bi_dram();
+#ifdef CONFIG_EFI_STUB
+ gd->arch.table = (phys_addr_t)efi_info;
+ /* We actually parsed a memory map from SMEM (and used it to
+ * set ram_base/ram_top), but it's better to respect the table
+ * from the EFI bootloader.
+ */
+ if (efi_info)
+ dram_init_banksize_from_efi();
+ else
+#endif
+ qcom_configure_bi_dram();
return 0;
}
@@ -4,8 +4,10 @@
#define __QCOM_PRIV_H__
#include <stdbool.h>
+extern struct efi_info_hdr *efi_info;
+
#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
void qcom_configure_capsule_updates(void);
#else
void qcom_configure_capsule_updates(void) {}
Retrieve the EFI info header passed in via x0 and use it to populate the memory banks when booting with CONFIG_EFI_STUB. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> --- arch/arm/mach-snapdragon/board.c | 15 +++++++++++++++ arch/arm/mach-snapdragon/dram.c | 15 ++++++++++++++- arch/arm/mach-snapdragon/qcom-priv.h | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-)