From patchwork Tue Jul 25 03:51:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Sai X-Patchwork-Id: 2943 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 39C313F37D for ; Tue, 25 Jul 2023 05:51:24 +0200 (CEST) Received: by mail-oo1-f72.google.com with SMTP id 006d021491bc7-566ed1c021bsf7216791eaf.3 for ; Mon, 24 Jul 2023 20:51:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690257083; cv=pass; d=google.com; s=arc-20160816; b=BjSonw6GlW6R0gls+8bS7XVy87dos5QRK3uGM2HkHPn8uhwFubtN1vXB/GOS9f9pue 3DH0boq/BPSaUn94hBwrtAHDzWbqrr5Ik5mNiXPRscLCy/gqK9dXb05ysnz4gJB/qDRd 0P470MTTSW7ytZqFO7PWnWfGf0Q4i+DISFa5+LlygWNQX4V9fGxgzempPfraQioHzntg ZZo7qPp7Gg76WExb35MTtX2pE84mnpUyAWOi5G9QmILJfhsXpNlnPcIbPvknKhSFSuO3 ySS7eU/xpnm6XhoHV6AFIhbV53LiROkYFoU1cbIdqevdIvbAABbecBs2hKYkMLpPveW5 5W/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=cG65ZQhCN1R/c2OFsxn8mjPRdD/Fs8ZZksb3BNd10M8=; fh=ZtU/xXInpIejK4L8YauyoYBdqqK+nRzYacYy4t7Zzbc=; b=ObyfOhFnGDNYDKnTvPI/EdoXZxjclb8Iayhx1/qdrhHANW5eUPKCtUoBPwdO1H5WFE 6xQ1+ozW8NkLuF0tJS0ozjmVj9fJFFwUTtHMxDUvodHONUEd6HjQQx/4AHriVSxuax1q wiOFr8Mfs7xSzZLmw+ygwO6niCr6k5zPH9v0Hp1xVCfCK3QPDA7cgdswFHW8TkjSuAXI Qscv0POZt/mVIU/6VLVQDlHb41PwC8GTLpQSM/TamtqjOwc2F94uY4T+vkAjLVmhj1Mi a+QxkvH0fb03Ggi3enVlr4xp20oUJY9e8B0Aj527XiOfOb25i/rQFwnFIlYlW8r6kjZR y/qQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UwJh1Ma5; spf=pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=abbaraju.manojsai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1690257083; x=1690861883; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=cG65ZQhCN1R/c2OFsxn8mjPRdD/Fs8ZZksb3BNd10M8=; b=q8wQBlveUtQdppiera0n6MbnJbkq7wSYWe2ggLiYcauJbfRJIBKB2C/7PGq0F00t+R iiMhJuZq49MAk+5Aw2y4tf8KfNCkx7kPKMpkRmPwNhqEYLQp7i0WIhmjboMkzDcU/gEI cnNvtr5Gcskzc213C17TOIFWODKv3yP8d04+U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690257083; x=1690861883; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cG65ZQhCN1R/c2OFsxn8mjPRdD/Fs8ZZksb3BNd10M8=; b=Bxu3/MG5wocsnaMIZ6TQzMGyexWp+HYHE5quCnAz1Xen3Zp5pYNsybW5tdckbEFmMp ymqzswcMZOwUZ6ntZitpeol1pNnL9R1mpupGtySgLX5sr3XdfmqpF+HsF6zzpPl4oe1j W7pNs4ifWipcFwUkxhLHjt3gDuHaij3P1SIsp1Xi8V1FETVv9ZL/xMqds19COa8DR3oD 8UI7w6nn/OjwKf7qNnGu72ucITaBOMktKeUDMkLABid7TERMvI7KaP+CuuI+HxZF4RMj Lhyc7Y1hIbYI3SLdZY8YGPpfhVZoT0ObSUSgV/X7l0u7qhbYaAlbJpULF/D3fMRHyH7n P+AQ== X-Gm-Message-State: ABy/qLYNAnFvvFxI456MlLM3U+ZH/Wmp2SsV6fxe+T+dvA3fRsC1BS5q ++wEheNz8u/dq46OpUsR3MNXyAvK X-Google-Smtp-Source: APBJJlFdrUtS3s+D1i61c6GdlbDGopEQYOmOFYL3SBys3V8kBP68QhP/AOjX0pj3xyLRWlEAXofT/g== X-Received: by 2002:a05:6808:1451:b0:3a5:ae6b:135e with SMTP id x17-20020a056808145100b003a5ae6b135emr7152063oiv.53.1690257083079; Mon, 24 Jul 2023 20:51:23 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a4a:4146:0:b0:566:468c:c3b3 with SMTP id x67-20020a4a4146000000b00566468cc3b3ls4574421ooa.2.-pod-prod-06-us; Mon, 24 Jul 2023 20:51:22 -0700 (PDT) X-Received: by 2002:a05:6358:3421:b0:130:faea:a81f with SMTP id h33-20020a056358342100b00130faeaa81fmr3581917rwd.28.1690257082151; Mon, 24 Jul 2023 20:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690257082; cv=none; d=google.com; s=arc-20160816; b=ekuzD6nXtu9IpQ82xkpJ+jumkhmEiM0W1NXsmxI/XwsyI+kezUVOGw67AY+ukp9ktx JUGVuYtWIxqthN0CmWix3dwwtPxkCwKR5CSJGfBWn0QbV4xYJaCRbPOBAjCYN8N87NNB UoshVzAbHUwrDKcncu4pWkOd/g2QKSoSvu+HS+iggvq2mkdLRx15KBh0355NdCJ+Rc2F U2SYBm9VT3GmHzh5KKO8STZBHBDD6WmWWTwBiKYI3l8lnJVj8Ztao7mzWWLGJY7CzugF m2btog1Cd0VSUuSK5eB5E7aOvIxMlhjD6ittJiLAkngJfqMT764/NxaZeImfzS9IzaA2 mDFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=yIa8d6yNhllal3Gsc+yZ4Zl9rn7KgOVc9e6456YxTsY=; fh=ZtU/xXInpIejK4L8YauyoYBdqqK+nRzYacYy4t7Zzbc=; b=WeEefjDt4KBMfOIrT3dHFaVoKkAoNfpv9pPqXyF2EXsNSA3IKuIBUcKfu3ZL67+njE y52/9nFF2Dg6+dwr9F9rYXhyWb7bDtLDNG6GCswbJ+sUf0H0NNouM+xU7/g5tBLcmqbL eu8rEGDpuryhUr0VuxiQ+0wl4OIfIfKkwiUYSpgKnM04oMLLB+i/DZTG5saPj0dAWZPz Jj8K90nRNrd8UlAeuBxrzD4t0CpYaTYuKberTKJGYeqrF9yiCWRXNGahHlAFIUGjdB9c XpqFeRJcFfF9fCgThxotaB9OLKKmDhjxs1K1wEPH7lAclvDGowrvphsqYbZtSzykHzxc B+ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UwJh1Ma5; spf=pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=abbaraju.manojsai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id o28-20020a637e5c000000b005302f7dc13fsor3832681pgn.2.2023.07.24.20.51.22 for (Google Transport Security); Mon, 24 Jul 2023 20:51:22 -0700 (PDT) Received-SPF: pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6a20:b28f:b0:134:b28f:b581 with SMTP id ei15-20020a056a20b28f00b00134b28fb581mr12262235pzb.28.1690257081869; Mon, 24 Jul 2023 20:51:21 -0700 (PDT) Received: from localhost.localdomain ([49.204.25.25]) by smtp.gmail.com with ESMTPSA id j18-20020aa78d12000000b00679fef56287sm8658399pfe.147.2023.07.24.20.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 20:51:21 -0700 (PDT) From: Manoj Sai To: Simon Glass , Philipp Tomsich , Kever Yang , u-boot@lists.denx.de Cc: Da Xue , dsx724 , linux-amarula@amarulasolutions.com, Jagan Teki , Suniel Mahesh , Manoj Sai Subject: [PATCH v2 3/4] spl: fit: support for booting a GZIP-compressed U-boot binary Date: Tue, 25 Jul 2023 09:21:00 +0530 Message-Id: <20230725035101.281325-4-abbaraju.manojsai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230725035101.281325-1-abbaraju.manojsai@amarulasolutions.com> References: <20230630121146.513345-1-abbaraju.manojsai@amarulasolutions.com> <20230725035101.281325-1-abbaraju.manojsai@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: abbaraju.manojsai@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UwJh1Ma5; spf=pass (google.com: domain of abbaraju.manojsai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=abbaraju.manojsai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If GZIP Compression support is enabled, GZIP compressed U-Boot binary will be at a specified RAM location which is defined at CONFIG_SYS_LOAD_ADDR and will be assign it as the source address. gunzip function in spl_load_fit_image ,will decompress the GZIP compressed U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR) to the default CONFIG_SYS_TEXT_BASE location. spl_load_fit_image function will load the decompressed U-Boot binary, which is placed at the CONFIG_SYS_TEXT_BASE location. Signed-off-by: Manoj Sai Signed-off-by: Suniel Mahesh Reviewed-by: Simon Glass Reviewed-by: Kever Yang --- common/spl/spl_fit.c | 7 +++++-- include/spl.h | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 730639f756..d728ac71fc 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -239,7 +239,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, bool external_data = false; if (IS_ENABLED(CONFIG_SPL_FPGA) || - (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP))) { + (IS_ENABLED(CONFIG_SPL_OS_BOOT) && spl_decompression_enabled())) { if (fit_image_get_type(fit, node, &type)) puts("Cannot get image type.\n"); else @@ -281,7 +281,10 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, return 0; } - src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); + if ((IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP)) + src_ptr = map_sysmem(ALIGN(CONFIG_SYS_LOAD_ADDR, ARCH_DMA_MINALIGN), len); + else + src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); length = len; overhead = get_aligned_image_overhead(info, offset); diff --git a/include/spl.h b/include/spl.h index 92bcaa90a4..088479e357 100644 --- a/include/spl.h +++ b/include/spl.h @@ -897,4 +897,14 @@ struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size); void board_boot_order(u32 *spl_boot_list); void spl_save_restore_data(void); + +/* + * spl_decompression_enabled() - check decompression support is enabled for SPL build + * + * Returns true if decompression support is enabled, else False + */ +static inline bool spl_decompression_enabled(void) +{ + return (IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA)); +} #endif