From patchwork Sun Sep 25 00:19:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 674493 X-Patchwork-Delegate: trini@ti.com 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 3shSXl2D3Nz9sCZ for ; Sun, 25 Sep 2016 10:24:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=jF92XTLX; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 60E34A7661; Sun, 25 Sep 2016 02:23:02 +0200 (CEST) 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 KdcTzSSDXdqi; Sun, 25 Sep 2016 02:23:02 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E0783A76B9; Sun, 25 Sep 2016 02:22:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 831A1A76CF for ; Sun, 25 Sep 2016 02:21:21 +0200 (CEST) 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 YpDd_NVQl8EA for ; Sun, 25 Sep 2016 02:21:21 +0200 (CEST) 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-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) by theia.denx.de (Postfix) with ESMTPS id 1266BA76E0 for ; Sun, 25 Sep 2016 02:20:25 +0200 (CEST) Received: by mail-it0-f47.google.com with SMTP id n143so46761448ita.1 for ; Sat, 24 Sep 2016 17:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=D4+US+RngQZf0kSdHVRHzGVPqPVU4+atVIK15ADhdQs=; b=jF92XTLXVYbH0LHyUHYlxO0Kg+RgA/5xcbpV1vtw6b0buEjBO9tGiUsmHpnXImCVGe N7N3veVqDlkkbtGJB7EDbb4XtHWHP1XXub3ieukudd43Axe9aSwCjRg8wM4Nauh5SulZ RwtO4aSXkZEQr2nnCinnW2GCKhdQvbfTP+j3VJdvw9GbZONnJkm11FkOC0mChtxPpumt IfnoqFZAwFEUx4BL3WwzqLYVMfHS8BkzxlVHbZVz9O7g/6BBOqfy1LAoBsXA8rpIv91t NiB4vG31AjdIwQr8tbNWd2vM1d+xM2LclNtQPbouIesg24q4q71Sqm1Ga+I6zSBRLSRi rflQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=D4+US+RngQZf0kSdHVRHzGVPqPVU4+atVIK15ADhdQs=; b=gEGKAw22MILo16xCb31EnPNuOaHcigd6ftjgEUvuxK79L+7seMN3XwjXq/ulnxvnb/ 7Ssm+rCVIGDeUCUn4gOChK70qH1+nw1vMew0zltCwnZMJ2Ss0ongMSyctVz4ycsvhie5 M/tdIJCT+BxGOi9QCpagcI4bKbSHrVPptcH41BapbnhFqAkzPgxSUEv9yzbTr7rl90nP DNdxjZ7AbJjur8tIqEnOHpVPSzPb/Ku26a5orxxOpUnxGV8UdWTqz+5Qu7+jPq2ls3sK E7AUoF+um5y22IMdLt+5IPPav5gtGfmz08mKo5HMnvG7Xz280i909chL0jsi0HSV3j0v A56w== X-Gm-Message-State: AA6/9RkzBIrE5wigGBl1NcVEzX9oc/za6/Eugh6io5g3/Pk6tbc5v0LL2By1NfdcowNQFPEM X-Received: by 10.36.130.135 with SMTP id t129mr10568607itd.31.1474762824554; Sat, 24 Sep 2016 17:20:24 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.202.55]) by smtp.gmail.com with ESMTPSA id v7sm1151056itd.6.2016.09.24.17.20.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Sep 2016 17:20:23 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 17C91220D57; Sat, 24 Sep 2016 18:20:22 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 24 Sep 2016 18:19:52 -0600 Message-Id: <1474762817-23091-3-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1474762817-23091-1-git-send-email-sjg@chromium.org> References: <1474762817-23091-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH v2 02/27] spl: Add a parameter to spl_set_header_raw_uboot() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Rather than act on the global variable, pass the required struct in as a parameter. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- Changes in v2: None common/spl/spl.c | 14 +++++++------- common/spl/spl_nand.c | 2 +- include/spl.h | 13 ++++++++++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index e14ec80..1a4a5d8 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -82,13 +82,13 @@ __weak void spl_board_prepare_for_boot(void) /* Nothing to do! */ } -void spl_set_header_raw_uboot(void) +void spl_set_header_raw_uboot(struct spl_image_info *spl_image) { - spl_image.size = CONFIG_SYS_MONITOR_LEN; - spl_image.entry_point = CONFIG_SYS_UBOOT_START; - spl_image.load_addr = CONFIG_SYS_TEXT_BASE; - spl_image.os = IH_OS_U_BOOT; - spl_image.name = "U-Boot"; + spl_image->size = CONFIG_SYS_MONITOR_LEN; + spl_image->entry_point = CONFIG_SYS_UBOOT_START; + spl_image->load_addr = CONFIG_SYS_TEXT_BASE; + spl_image->os = IH_OS_U_BOOT; + spl_image->name = "U-Boot"; } int spl_parse_image_header(const struct image_header *header) @@ -153,7 +153,7 @@ int spl_parse_image_header(const struct image_header *header) /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); - spl_set_header_raw_uboot(); + spl_set_header_raw_uboot(&spl_image); #endif } return 0; diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index 0e35e0f..8f9bd5da 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -20,7 +20,7 @@ int spl_nand_load_image(void) nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, (void *)CONFIG_SYS_NAND_U_BOOT_DST); - spl_set_header_raw_uboot(); + spl_set_header_raw_uboot(&spl_image); nand_deselect(); return 0; diff --git a/include/spl.h b/include/spl.h index 6c397ca..ce449ff 100644 --- a/include/spl.h +++ b/include/spl.h @@ -67,7 +67,18 @@ extern struct spl_image_info spl_image; void preloader_console_init(void); u32 spl_boot_device(void); u32 spl_boot_mode(const u32 boot_device); -void spl_set_header_raw_uboot(void); + +/** + * spl_set_header_raw_uboot() - Set up a standard SPL image structure + * + * This sets up the given spl_image which the standard values obtained from + * config options: CONFIG_SYS_MONITOR_LEN, CONFIG_SYS_UBOOT_START, + * CONFIG_SYS_TEXT_BASE. + * + * @spl_image: Image to set up + */ +void spl_set_header_raw_uboot(struct spl_image_info *spl_image); + int spl_parse_image_header(const struct image_header *header); void spl_board_prepare_for_linux(void); void spl_board_prepare_for_boot(void);