From patchwork Thu Jan 10 14:58:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 211044 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 315BE2C0331 for ; Fri, 11 Jan 2013 02:01:17 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6DA444A195; Thu, 10 Jan 2013 16:00:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rvRbXZGjlO9w; Thu, 10 Jan 2013 16:00:43 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 286224A196; Thu, 10 Jan 2013 15:59:22 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 87AF94A188 for ; Thu, 10 Jan 2013 15:59:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 356yI4SU+B4v for ; Thu, 10 Jan 2013 15:59:14 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-qa0-f74.google.com (mail-qa0-f74.google.com [209.85.216.74]) by theia.denx.de (Postfix) with ESMTPS id AD00E4A14D for ; Thu, 10 Jan 2013 15:58:58 +0100 (CET) Received: by mail-qa0-f74.google.com with SMTP id r4so86992qaq.5 for ; Thu, 10 Jan 2013 06:58:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=QUotCK01pA/DcKD/mY9frwe3J3nClBm66UJpVRzkfZA=; b=C7vjssTBfRsIWXQdgXtAka9qib52s98NeLOFjzIXFNy5pIb2J5AC1QCpIAiuX0YWaB USSbr7HVQtqYR1OKxwJqpBKCA+vVgi+VpaOQTJfYPl0gCSCcXdnJ6imRsf8wRpmfEb1z k65GuC0SJXSiDWuClVeruTXIMyZYa7ySmG0gDchMJ2pF9N0cDQogPQEvoIhajo7TG6IC sQnSwx2bNSb5+NyBarkVpZFA9A2Giswmpx8h/lrssN70OrExVAdDT9Ew57uhTkgEj6vy 2hMKp7dqoGitvUwqT6xlQCmX2QG6lfp4mCQlV96NuESrwTipekU0lWXP/+RjDH74rkbU JkUw== X-Received: by 10.236.158.168 with SMTP id q28mr39845376yhk.20.1357829936109; Thu, 10 Jan 2013 06:58:56 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id j11si44116ank.2.2013.01.10.06.58.56 (version=TLSv1 cipher=AES128-SHA bits=128/128); Thu, 10 Jan 2013 06:58:56 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id BA24D82004A; Thu, 10 Jan 2013 06:58:55 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 69D66160C5E; Thu, 10 Jan 2013 06:58:55 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 10 Jan 2013 06:58:12 -0800 Message-Id: <1357829905-6579-10-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1357829905-6579-1-git-send-email-sjg@chromium.org> References: <1357829905-6579-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQkr80R0+LRiRkbufOaEJuTGV98tk7HHkSPupIEKDc1cqNhq3SuOP1xMnfXNINWUedD8NGuuRp3Gu+E3yyrRbB+ZdLUmCud4540xHLvn8Qu3DMrvVDcashSO9giA/QLpQWqJfgyFi/qayja+5qnfH/2q6Nt6RWjfJ+eFum0oJ5XIcYnQSdQ0HVZbtsRn8eK3YqNKHZt5 Cc: Kim Phillips , Joe Hershberger , Kumar Gala , Andy Fleming , Tom Rini , Vadim Bendebury , Stefan Roese Subject: [U-Boot] [RFC PATCH 09/22] powerpc: Use image_setup_linux() instead of local code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Rather than having similar code in powerpc, use image_setup_linux() which should be common across all architectures that use the FDT. Signed-off-by: Simon Glass Reviewed-by: Marek Vasut --- arch/powerpc/lib/bootm.c | 84 +--------------------------------------------- 1 files changed, 1 insertions(+), 83 deletions(-) diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 7088293..3091af7 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -222,101 +222,19 @@ static int boot_bd_t_linux(bootm_headers_t *images) return ret; } -/* - * Verify the device tree. - * - * This function is called after all device tree fix-ups have been enacted, - * so that the final device tree can be verified. The definition of "verified" - * is up to the specific implementation. However, it generally means that the - * addresses of some of the devices in the device tree are compared with the - * actual addresses at which U-Boot has placed them. - * - * Returns 1 on success, 0 on failure. If 0 is returned, U-boot will halt the - * boot process. - */ -static int __ft_verify_fdt(void *fdt) -{ - return 1; -} -__attribute__((weak, alias("__ft_verify_fdt"))) int ft_verify_fdt(void *fdt); - static int boot_body_linux(bootm_headers_t *images) { - ulong rd_len; - struct lmb *lmb = &images->lmb; - ulong *initrd_start = &images->initrd_start; - ulong *initrd_end = &images->initrd_end; -#if defined(CONFIG_OF_LIBFDT) - ulong of_size = images->ft_len; - char **of_flat_tree = &images->ft_addr; -#endif - int ret; -#if defined(CONFIG_OF_LIBFDT) - boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree); -#endif - - /* allocate space and init command line */ - ret = boot_cmdline_linux(images); - if (ret) - return ret; - /* allocate space for kernel copy of board info */ ret = boot_bd_t_linux(images); if (ret) return ret; - rd_len = images->rd_end - images->rd_start; - ret = boot_ramdisk_high (lmb, images->rd_start, rd_len, initrd_start, initrd_end); - if (ret) - return ret; - -#if defined(CONFIG_OF_LIBFDT) - ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size); + ret = image_setup_linux(images); if (ret) return ret; - /* - * Add the chosen node if it doesn't exist, add the env and bd_t - * if the user wants it (the logic is in the subroutines). - */ - if (of_size) { - if (fdt_chosen(*of_flat_tree, 1) < 0) { - puts ("ERROR: "); - puts ("/chosen node create failed"); - puts (" - must RESET the board to recover.\n"); - return -1; - } -#ifdef CONFIG_OF_BOARD_SETUP - /* Call the board-specific fixup routine */ - ft_board_setup(*of_flat_tree, gd->bd); -#endif - - /* Delete the old LMB reservation */ - lmb_free(lmb, (phys_addr_t)(u32)*of_flat_tree, - (phys_size_t)fdt_totalsize(*of_flat_tree)); - - ret = fdt_resize(*of_flat_tree); - if (ret < 0) - return ret; - of_size = ret; - - if (*initrd_start && *initrd_end) { - of_size += FDT_RAMDISK_OVERHEAD; - fdt_set_totalsize(*of_flat_tree, of_size); - } - /* Create a new LMB reservation */ - lmb_reserve(lmb, (ulong)*of_flat_tree, of_size); - - /* fixup the initrd now that we know where it should be */ - if (*initrd_start && *initrd_end) - fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 1); - - if (!ft_verify_fdt(*of_flat_tree)) - return -1; - } -#endif /* CONFIG_OF_LIBFDT */ return 0; }