uboot/arch/arm/lib/bootm-fdt.c
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2013, Google Inc.
   3 *
   4 * Copyright (C) 2011
   5 * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
   6 *  - Added prep subcommand support
   7 *  - Reorganized source - modeled after powerpc version
   8 *
   9 * (C) Copyright 2002
  10 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  11 * Marius Groeger <mgroeger@sysgo.de>
  12 *
  13 * Copyright (C) 2001  Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
  14 *
  15 * SPDX-License-Identifier:     GPL-2.0+
  16 */
  17
  18#include <common.h>
  19#include <fdt_support.h>
  20#ifdef CONFIG_ARMV7_NONSEC
  21#include <asm/armv7.h>
  22#endif
  23#include <asm/psci.h>
  24#include <asm/spin_table.h>
  25
  26DECLARE_GLOBAL_DATA_PTR;
  27
  28#ifdef CONFIG_ARCH_FIXUP_FDT
  29int arch_fixup_fdt(void *blob)
  30{
  31        bd_t *bd = gd->bd;
  32        int bank, ret;
  33        u64 start[CONFIG_NR_DRAM_BANKS];
  34        u64 size[CONFIG_NR_DRAM_BANKS];
  35
  36        for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
  37                start[bank] = bd->bi_dram[bank].start;
  38                size[bank] = bd->bi_dram[bank].size;
  39#ifdef CONFIG_ARMV7_NONSEC
  40                ret = armv7_apply_memory_carveout(&start[bank], &size[bank]);
  41                if (ret)
  42                        return ret;
  43#endif
  44        }
  45
  46        ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
  47        if (ret)
  48                return ret;
  49
  50#ifdef CONFIG_ARMV8_SPIN_TABLE
  51        ret = spin_table_update_dt(blob);
  52        if (ret)
  53                return ret;
  54#endif
  55
  56#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV8_PSCI)
  57        ret = psci_update_dt(blob);
  58        if (ret)
  59                return ret;
  60#endif
  61
  62        return 0;
  63}
  64#endif
  65