From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED40CC6FA82 for ; Wed, 14 Sep 2022 16:23:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8573784B63; Wed, 14 Sep 2022 18:23:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="iSbpaGX+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 68DCD84B63; Wed, 14 Sep 2022 18:23:06 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9DAD0841B7 for ; Wed, 14 Sep 2022 18:23:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1663172569; bh=TEbMWiVntL27v5/XmmU5se/XYPYMhTAssb1hGsFHOJI=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=iSbpaGX+ksDg18JZEd3WxsSGtwkXLNLQmiTCXjelmcAgTtMU17loKkdrnsUOBnnVh A8ivHtpJPhhbUyt00SZKbmsMiMQXoNMJbY8G1nAfWDRWQeo7wn0oJnLf3lU2SRmY+2 LnclwJdjjB53axUVZBTETo+GnEoeFWag/5b+k7Vk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.94] ([84.118.157.2]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mxm3Q-1pXJB91cYI-00zDNw; Wed, 14 Sep 2022 18:22:49 +0200 Message-ID: <1cdc5b12-597b-1a7d-0708-81b23e0cc6dd@gmx.de> Date: Wed, 14 Sep 2022 18:22:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH 8/8] image: Drop some other #ifdefs in image-board.c Content-Language: en-US To: Simon Glass Cc: Tom Rini , Neil Armstrong , Alexandru Gagniuc , Andre Przywara , Artem Lapkin , Jan Kiszka , Joe Hershberger , Leo Yu-Chi Liang , Marek Vasut , Michal Simek , Philippe Reynes , U-Boot Mailing List References: <20220828183253.822815-1-sjg@chromium.org> <20220828183253.822815-9-sjg@chromium.org> From: Heinrich Schuchardt In-Reply-To: <20220828183253.822815-9-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:iscv0qMjc4wj2oshIAq7XGtlwHazyk9qnmC+U0XOaV/Tit1acfH ah0K+6B3V+xatcEW6E71UkyZEybYvlU1ruXUfkmkYMyU7fTxm6LBI1N/cbgneoRl02EYy1G 9rs3wiSfwSsV7u9NNyDO35aFb6dt4Dbdv4tBL5QWF3IVxQSI3emggI+uq4pP6IQ7hOjYNX7 OhXuxDfHYDBXWFQVOAnXA== X-UI-Out-Filterresults: notjunk:1;V03:K0:1jy8AO5wOG4=:oANhaB46qGYAUgCT9yD4TR HqdygMCZRkX9bVnouEa65PQbHX4HMMugrINthRvA2NaZHw265uHP2mhGw631r1N7THhY9Ph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PTMVQbnmmVYY/PL83mGP843v uVTkju2EDckoBCNoS8SFTE+Obc X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 8/28/22 20:32, Simon Glass wrote: > Remove all but a few that are difficult, relying on legacy CONFIG option= s > or optional global_data fields. > > Drop the duplicate function name in the comment for boot_get_cmdline(). > > Signed-off-by: Simon Glass > --- > > boot/image-board.c | 67 +++++++++++++++++++++++++--------------------- > include/image.h | 6 +++++ > 2 files changed, 42 insertions(+), 31 deletions(-) > > diff --git a/boot/image-board.c b/boot/image-board.c > index 7a17ffb7f7f..1be0a359aba 100644 > --- a/boot/image-board.c > +++ b/boot/image-board.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include This looks like an unrelated change. Best regards Heinrich > #include > #include > #include > @@ -172,29 +173,29 @@ void memmove_wd(void *to, void *from, size_t len, = ulong chunksz) > if (to =3D=3D from) > return; > > -#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) > - if (to > from) { > - from +=3D len; > - to +=3D len; > - } > - while (len > 0) { > - size_t tail =3D (len > chunksz) ? chunksz : len; > - > - WATCHDOG_RESET(); > + if (IS_ENABLED(CONFIG_HW_WATCHDOG) || IS_ENABLED(CONFIG_WATCHDOG)) { > if (to > from) { > - to -=3D tail; > - from -=3D tail; > + from +=3D len; > + to +=3D len; > } > - memmove(to, from, tail); > - if (to < from) { > - to +=3D tail; > - from +=3D tail; > + while (len > 0) { > + size_t tail =3D (len > chunksz) ? chunksz : len; > + > + WATCHDOG_RESET(); > + if (to > from) { > + to -=3D tail; > + from -=3D tail; > + } > + memmove(to, from, tail); > + if (to < from) { > + to +=3D tail; > + from +=3D tail; > + } > + len -=3D tail; > } > - len -=3D tail; > + } else { > + memmove(to, from, len); > } > -#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */ > - memmove(to, from, len); > -#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ > } > > /** > @@ -551,7 +552,6 @@ int boot_get_ramdisk(int argc, char *const argv[], b= ootm_headers_t *images, > return 0; > } > > -#if defined(CONFIG_LMB) > /** > * boot_ramdisk_high - relocate init ramdisk > * @lmb: pointer to lmb handle, will be used for memory mgmt > @@ -645,7 +645,6 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data= , ulong rd_len, > error: > return -1; > } > -#endif > > int boot_get_setup(bootm_headers_t *images, u8 arch, > ulong *setup_start, ulong *setup_len) > @@ -839,15 +838,13 @@ int boot_get_loadable(int argc, char *const argv[]= , bootm_headers_t *images, > return 0; > } > > -#if defined(CONFIG_LMB) > -#ifdef CONFIG_SYS_BOOT_GET_CMDLINE > /** > * boot_get_cmdline - allocate and initialize kernel cmdline > * @lmb: pointer to lmb handle, will be used for memory mgmt > * @cmd_start: pointer to a ulong variable, will hold cmdline start > * @cmd_end: pointer to a ulong variable, will hold cmdline end > * > - * boot_get_cmdline() allocates space for kernel command line below > + * This allocates space for kernel command line below > * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot envir= onment > * variable is present its contents is copied to allocated kernel > * command line. > @@ -858,10 +855,19 @@ int boot_get_loadable(int argc, char *const argv[]= , bootm_headers_t *images, > */ > int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end= ) > { > + int barg; > char *cmdline; > char *s; > > - cmdline =3D (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0x= f, > + /* > + * Help the compiler detect that this function is only called when > + * CONFIG_SYS_BOOT_GET_CMDLINE is enabled > + */ > + if (!IS_ENABLED(CONFIG_SYS_BOOT_GET_CMDLINE)) > + return 0; > + > + barg =3D IF_ENABLED_INT(CONFIG_SYS_BOOT_GET_CMDLINE, CONFIG_SYS_BARGSI= ZE); > + cmdline =3D (char *)(ulong)lmb_alloc_base(lmb, barg, 0xf, > env_get_bootm_mapsize() + env_get_bootm_low()); > if (!cmdline) > return -1; > @@ -907,22 +913,22 @@ int boot_get_kbd(struct lmb *lmb, struct bd_info *= *kbd) > > debug("## kernel board info at 0x%08lx\n", (ulong)*kbd); > > -#if defined(DEBUG) > - if (IS_ENABLED(CONFIG_CMD_BDI)) > + if (_DEBUG && IS_ENABLED(CONFIG_CMD_BDI)) > do_bdinfo(NULL, 0, 0, NULL); > -#endif > > return 0; > } > -#endif > > int image_setup_linux(bootm_headers_t *images) > { > ulong of_size =3D images->ft_len; > char **of_flat_tree =3D &images->ft_addr; > - struct lmb *lmb =3D &images->lmb; > + struct lmb *lmb =3D images_lmb(images); > int ret; > > + /* This function cannot be called without lmb support */ > + if (!CONFIG_IS_ENABLED(LMB)) > + return -EFAULT; > if (CONFIG_IS_ENABLED(OF_LIBFDT)) > boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree); > > @@ -949,7 +955,6 @@ int image_setup_linux(bootm_headers_t *images) > > return 0; > } > -#endif > > void genimg_print_size(uint32_t size) > { > diff --git a/include/image.h b/include/image.h > index e4c6a50b885..a148073113a 100644 > --- a/include/image.h > +++ b/include/image.h > @@ -360,6 +360,12 @@ typedef struct bootm_headers { > #endif > } bootm_headers_t; > > +#ifdef CONFIG_LMB > +#define images_lmb(_images) (&(_images)->lmb) > +#else > +#define images_lmb(_images) NULL > +#endif > + > extern bootm_headers_t images; > > /*