From patchwork Tue Dec 2 20:17:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 417126 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 BE75A1401B5 for ; Wed, 3 Dec 2014 07:19:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 812524B7C6; Tue, 2 Dec 2014 21:19:18 +0100 (CET) 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 YpXvG5bk9KSf; Tue, 2 Dec 2014 21:19:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 442CD4B862; Tue, 2 Dec 2014 21:19:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 78E1F4B7C6 for ; Tue, 2 Dec 2014 21:18:36 +0100 (CET) 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 fJKstp8iSUOJ for ; Tue, 2 Dec 2014 21:18:36 +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-pa0-f74.google.com (mail-pa0-f74.google.com [209.85.220.74]) by theia.denx.de (Postfix) with ESMTPS id EF2224B7CE for ; Tue, 2 Dec 2014 21:18:31 +0100 (CET) Received: by mail-pa0-f74.google.com with SMTP id kq14so1829261pab.5 for ; Tue, 02 Dec 2014 12:18:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dNg2plZd6KH7fFGqp0Xr2f3jZb+ECRBwMuyWsiGhc0U=; b=VDm12HzsRJZur9pL3YOp3/DAONYjPTkKMZht4dIgYkAZGp1tQZaNNHcdJSESEIX7yI jmyfQ8DB0sI8E/7fh9ZoGJMGS+M2jMlmr0LX2yMfvXy9OeW3cziNTq8SEWFqGLXNSB4e nCCZ69fjHg3MAygaNtBp8fZWvR3cbc78TlLSiY/wUvP0AFV6grRuhPESQI/gJtU+H+Oy j6u0w4lgCd/GqCos+AwuAoMM9EmllxhrV1iTsqw5LB0EwRfQhh7uhVn1U+gMbjkOLdQN GVGpuPYoF+fjk2YfxmLIoMKw5e6P6CYAeidKvOQVjOIp5qd98Cf0wucMWY1uiZBsUKvt Jo7Q== X-Gm-Message-State: ALoCoQlhDq2O1YtgkKR0zxO0qd3LOrcTyxPqD6F7wA5zYle3CmohA2//mqegXAxdpD6Jt0bxV08y X-Received: by 10.66.66.202 with SMTP id h10mr1056394pat.34.1417551510437; Tue, 02 Dec 2014 12:18:30 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id r6si882382yhg.1.2014.12.02.12.18.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Dec 2014 12:18:30 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id CmyQG88N.1; Tue, 02 Dec 2014 12:18:30 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 561AB221612; Tue, 2 Dec 2014 13:18:29 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Tue, 2 Dec 2014 13:17:36 -0700 Message-Id: <1417551460-10000-9-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1417551460-10000-1-git-send-email-sjg@chromium.org> References: <1417551460-10000-1-git-send-email-sjg@chromium.org> Cc: Ahmad Draidi , Stephen Warren Subject: [U-Boot] [PATCH v2 08/12] bootm: Use print_decomp_msg() in all cases X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 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 Refactor to allow this function to be used to announce the image being loaded regardless of compression type and even when there is no decompression. Signed-off-by: Simon Glass --- Changes in v2: None common/bootm.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index 10c15ef..4a5c5ea 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -266,13 +266,25 @@ static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc, } #endif /* USE_HOSTC */ -#if defined(CONFIG_GZIP) || defined(CONFIG_GZIP) || defined(CONFIG_BZIP2) || \ - defined(CONFIG_LZMA) || defined(CONFIG_LZO) -static void print_decomp_msg(const char *type_name) +/** + * print_decomp_msg() - Print a suitable decompression/loading message + * + * @type: OS type (IH_OS_...) + * @comp_type: Compression type being used (IH_COMP_...) + * @is_xip: true if the load address matches the image start + */ +static void print_decomp_msg(int comp_type, int type, bool is_xip) { - printf(" Uncompressing %s ... ", type_name); + const char *name = genimg_get_type_name(type); + + if (comp_type == IH_COMP_NONE) + printf(" %s %s ... ", is_xip ? "XIP" : "Loading", name); + else + printf(" Uncompressing %s ... ", name); } +#if defined(CONFIG_GZIP) || defined(CONFIG_GZIP) || defined(CONFIG_BZIP2) || \ + defined(CONFIG_LZMA) || defined(CONFIG_LZO) static int handle_decomp_error(const char *algo, size_t size, size_t unc_len, int ret) { @@ -293,24 +305,18 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, void *load_buf, void *image_buf, ulong image_len, uint unc_len, ulong *load_end) { - const char *type_name = genimg_get_type_name(type); - *load_end = load; + print_decomp_msg(comp, type, load == image_start); switch (comp) { case IH_COMP_NONE: - if (load == image_start) { - printf(" XIP %s ... ", type_name); - } else { - printf(" Loading %s ... ", type_name); + if (load != image_start) memmove_wd(load_buf, image_buf, image_len, CHUNKSZ); - } *load_end = load + image_len; break; #ifdef CONFIG_GZIP case IH_COMP_GZIP: { int ret; - print_decomp_msg(type_name); ret = gunzip(load_buf, unc_len, image_buf, &image_len); if (ret != 0) { return handle_decomp_error("GUNZIP", image_len, @@ -325,7 +331,6 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, case IH_COMP_BZIP2: { size_t size = unc_len; - print_decomp_msg(type_name); /* * If we've got less than 4 MB of malloc() space, * use slower decompression algorithm which requires @@ -348,7 +353,6 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, SizeT lzma_len = unc_len; int ret; - print_decomp_msg(type_name); ret = lzmaBuffToBuffDecompress(load_buf, &lzma_len, image_buf, image_len); if (ret != SZ_OK) { @@ -365,8 +369,6 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, size_t size = unc_len; int ret; - print_decomp_msg(type_name); - ret = lzop_decompress(image_buf, image_len, load_buf, &size); if (ret != LZO_E_OK) return handle_decomp_error("LZO", size, unc_len, ret);