From patchwork Fri Jan 3 11:13:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 854861 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp8187541wrq; Fri, 3 Jan 2025 03:13:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVKjbNgrlxiGNLkNB4okDaDBfgm3QVuSJ70y7uvYHuZOlD8ojp51yiwLgWpiixFr0zzcojyhw==@linaro.org X-Google-Smtp-Source: AGHT+IEYzVmNzyAJOlI0r6wRkI3Vb0l+CM/IJd7q/+8ybp/ip3uwtJ2U6oT7o8MhscVFbmmszZNB X-Received: by 2002:a17:907:a316:b0:aae:eb0b:f39a with SMTP id a640c23a62f3a-aaeeb0bf561mr2782033066b.42.1735902831535; Fri, 03 Jan 2025 03:13:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735902831; cv=none; d=google.com; s=arc-20240605; b=CQjMue8eDrURaULHTErAICn+nmityVPj+CjU/lgCFbB0J31G1cncniIOR0ESNMqhrc fuxj/jht75HqJQhgtf4TxnWjHKlaljHWOCyla9mRpMSQ7V+GuZJQ9E+Xh5yr428xEXJ0 1Fo4fFiUvDv+OLh3Rq14GyVm47AtuihIE9qSpzoJu2m+6x9KEl/9BQCAO+bZOzTHj/b3 ZBpzgYe0VPX1uCh/2n3CXrgL11DnKIOOv6ttmUNPdJ9scBvBOIK2CxPvsEIpGrCLv1pS 2h/hqJpbLhWdy3Ov0DGYu+0nXV75zRKMtYCnJQ5ZEtcBigWYXt3JZ7+vsCuCStlqUY7M SqHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=38qdx33uF+l1HnO7b1WPRRhoY3zG1Wds1S/AcyNOvZQ=; fh=A1as7Hc1elN08R0LcIm7S2Yhsd9+xASWdoO3S6uVu9o=; b=QOJkJaJbcN350BG3D7fNs11s78hiel8ts0+Jo33lW86o1gKUbHPRo9E81OJaHCii6V vBzEV4BE33xA97oIP+s961NA0v4HaP/zkA7VUwJrBEJj3WLChd7jusxfnfVRixw4yQpB XYPDJ9gjQSkduA+XXMAT2ZMmBkJHYXvwXnmeaUs8jQsJP9DwnhgPA6QdiDJopwZfgiB9 q4P8oUbzzhQQTPTFyh7RYTvgLRNVWBB1JUtRPGK9FxLIoCQhkFlNAWIgqcmNHvwNgQ1U d9a6xuxgpBZl8NKtxYTQPPXpvvpwRZUCkAFaIfDkGVDl75xBDUVqLG2ev+6+wkPthgh/ w4Zw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lJEsXaOT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0e7f115csi1797299966b.98.2025.01.03.03.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:13:51 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lJEsXaOT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6CF7E803C6; Fri, 3 Jan 2025 12:13:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="lJEsXaOT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C1C88036E; Fri, 3 Jan 2025 12:13:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4981E80295 for ; Fri, 3 Jan 2025 12:13:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4361f664af5so137493045e9.1 for ; Fri, 03 Jan 2025 03:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735902816; x=1736507616; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=38qdx33uF+l1HnO7b1WPRRhoY3zG1Wds1S/AcyNOvZQ=; b=lJEsXaOTPL0Ai7QaI1UhOA/e7ZcaONdmzj9RCr5n80GDydT/DqQKXtSmBQdIwKDrEc bIYV9WdbP7E/HHa5+GwwcUE9COuDB3Qe9tfLuf08h1jnyUl4mOvKqN5MJuWuf7HF9eKn kjGjZWWNmgpy/bKWbwldjHelr2oKQkAuWsr+TFS1VNHEADwtRe9wb3B079aCGBS+jJsz BAb9dgaz1pplUCSVgaJvESaCIPU2ggG7c/wMebJQEKhEtBhLDPgqn+VA+7k7EfbzVOS/ BcJIZUxWgNzOr1j/p1yrZ3qb25L3KQ1Xv9FnOkLAIiCARtBlgn+iXBzMKSLm0WyDSERc JmFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735902816; x=1736507616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=38qdx33uF+l1HnO7b1WPRRhoY3zG1Wds1S/AcyNOvZQ=; b=oRfAqseS+wJ1zxPzuMcmrklsm6u7l6+2sUPO0vRGGYOmNYvU7grEe9r2Pi8bYzQu1l 5niIq+KFys9MYy8z87ISuynauzI6Mr2H0W7Xe3IIBTJqriSneK8fqpM+TDiWL0qECmZm WHLG/ijAN8ISveUvUelCBK9C0/XY9M7rJjdpv6LOxEdstQqCcyD0PJbUHGyl7IOhhMYD sXwZd930o8ZRxz+XqhBkoH0DmKkHJc/A2yFO25vez0LgIIYtcg/yy7oKwc2oG/b25HYN 8rXVAVXGTiiv49X6uLdSEgUmya2fuSvdTqqTzHVbJgZUiTi0UBMvudzWmdAwJjZa/S9p DzVA== X-Gm-Message-State: AOJu0YxOSmktpUQLgKDw8OHREOQr6j8AHxstIaQLS9vnCrsYaKvGlX6+ 6pze8pd9tbENLgqF0FUzCIuGIq6j52bTacLKqY9eRdYK1RAAPdWpNgBSiGI3KOMwsbrnaETsuNM lBhM= X-Gm-Gg: ASbGncvfoHsiwsdn/YwYY5/MXTDS1S8v/lzrve+XYIyJhLFngUv6sq+cvxtSixUSPww EMsn/+ijep+5ey/zJ1QKGJIIEyIQTF/s8euRM+pLo3xkh/MLUtcRqGu0gQFMQmr9rrqbqmsdC9w Yr5qmVSfnuLz/UniEsFXNE78ltGutGF6kRmFi8XAeiqwm/xqE0LkiXf05kFz2Rq0JsKMirFTYof Tp7kT/8+q1WEdSlobNKjKcpqJdSP2dim2pbtkWxX6KRT2b3tNRSbXTB8zeOWTXZew== X-Received: by 2002:a05:600c:468f:b0:434:a815:2b5d with SMTP id 5b1f17b1804b1-43668b785ddmr379916495e9.24.1735902816463; Fri, 03 Jan 2025 03:13:36 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656a0b361sm513138075e9.0.2025.01.03.03.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:13:36 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Jonas Karlman , Devarsh Thakkar , Evgeny Bachinin , Christian Marangi , Sughosh Ganu Subject: [PATCH v3 1/5] common: board: Simplify array with function pointers with CONFIG_IS_ENABLED Date: Fri, 3 Jan 2025 12:13:13 +0100 Message-ID: <23e213375671ff56eb6a0f2e7ad63773c0f16ab8.1735896540.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean From: Michal Simek Convert all simple cases where current ifdef is used with using CONFIG_IS_ENABLED. The change doesn't have impact on code size and it is only cleaning up description. Checkpatch is reporting issue: space required after that ',' (ctx:VxB) When space is there another warning is coming up: space prohibited before that close parenthesis ')' but there is no way how to fix it that's why leave it like it is. Signed-off-by: Michal Simek Reviewed-by: Tom Rini [jf: s/Simply/Simplify/ in subject] Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- common/board_f.c | 49 +++++------------- common/board_r.c | 128 ++++++++++++----------------------------------- 2 files changed, 46 insertions(+), 131 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 54c48d42ee9..a4d8850cb7d 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -872,12 +872,8 @@ static int initf_upl(void) static const init_fnc_t init_sequence_f[] = { setup_mon_len, -#ifdef CONFIG_OF_CONTROL - fdtdec_setup, -#endif -#ifdef CONFIG_TRACE_EARLY - trace_early_init, -#endif + CONFIG_IS_ENABLED(OF_CONTROL, (fdtdec_setup,)) + CONFIG_IS_ENABLED(TRACE_EARLY, (trace_early_init,)) initf_malloc, initf_upl, log_init, @@ -885,16 +881,12 @@ static const init_fnc_t init_sequence_f[] = { event_init, bloblist_maybe_init, setup_spl_handoff, -#if defined(CONFIG_CONSOLE_RECORD_INIT_F) - console_record_init, -#endif + CONFIG_IS_ENABLED(CONSOLE_RECORD_INIT_F, (console_record_init,)) INITCALL_EVENT(EVT_FSP_INIT_F), arch_cpu_init, /* basic arch cpu dependent setup */ mach_cpu_init, /* SoC/machine dependent CPU setup */ initf_dm, -#if defined(CONFIG_BOARD_EARLY_INIT_F) - board_early_init_f, -#endif + CONFIG_IS_ENABLED(BOARD_EARLY_INIT_F, (board_early_init_f,)) #if defined(CONFIG_PPC) || defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K) /* get CPU and bus clocks according to the environment variable */ get_clocks, /* get CPU and bus clocks (etc.) */ @@ -902,9 +894,7 @@ static const init_fnc_t init_sequence_f[] = { #if !defined(CONFIG_M68K) || (defined(CONFIG_M68K) && !defined(CONFIG_MCFTMR)) timer_init, /* initialize timer */ #endif -#if defined(CONFIG_BOARD_POSTCLK_INIT) - board_postclk_init, -#endif + CONFIG_IS_ENABLED(BOARD_POSTCLK_INIT, (board_postclk_init,)) env_init, /* initialize environment */ init_baud_rate, /* initialze baudrate settings */ serial_init, /* serial communications setup */ @@ -912,38 +902,25 @@ static const init_fnc_t init_sequence_f[] = { display_options, /* say that we are here */ display_text_info, /* show debugging info if required */ checkcpu, -#if defined(CONFIG_SYSRESET) - print_resetinfo, -#endif -#if defined(CONFIG_DISPLAY_CPUINFO) - print_cpuinfo, /* display cpu info (and speed) */ -#endif -#if defined(CONFIG_DTB_RESELECT) - embedded_dtb_select, -#endif -#if defined(CONFIG_DISPLAY_BOARDINFO) - show_board_info, -#endif + CONFIG_IS_ENABLED(SYSRESET, (print_resetinfo,)) + /* display cpu info (and speed) */ + CONFIG_IS_ENABLED(DISPLAY_CPUINFO, (print_cpuinfo,)) + CONFIG_IS_ENABLED(DTB_RESELECT, (embedded_dtb_select,)) + CONFIG_IS_ENABLED(DISPLAY_BOARDINFO, (show_board_info,)) INIT_FUNC_WATCHDOG_INIT INITCALL_EVENT(EVT_MISC_INIT_F), INIT_FUNC_WATCHDOG_RESET -#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) - init_func_i2c, -#endif + CONFIG_IS_ENABLED(SYS_I2C_LEGACY, (init_func_i2c,)) announce_dram_init, dram_init, /* configure available RAM banks */ -#ifdef CONFIG_POST - post_init_f, -#endif + CONFIG_IS_ENABLED(POST, (post_init_f,)) INIT_FUNC_WATCHDOG_RESET #if defined(CFG_SYS_DRAM_TEST) testdram, #endif /* CFG_SYS_DRAM_TEST */ INIT_FUNC_WATCHDOG_RESET -#ifdef CONFIG_POST - init_post, -#endif + CONFIG_IS_ENABLED(POST, (init_post,)) INIT_FUNC_WATCHDOG_RESET /* * Now that we have DRAM mapped and working, we can diff --git a/common/board_r.c b/common/board_r.c index f63c6aed4d5..c65c0b2ed1e 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -612,19 +612,11 @@ static init_fnc_t init_sequence_r[] = { initr_malloc, log_init, initr_bootstage, /* Needs malloc() but has its own timer */ -#if defined(CONFIG_CONSOLE_RECORD) - console_record_init, -#endif -#ifdef CONFIG_SYS_NONCACHED_MEMORY - noncached_init, -#endif + CONFIG_IS_ENABLED(CONSOLE_RECORD, (console_record_init,)) + CONFIG_IS_ENABLED(SYS_NONCACHED_MEMORY, (noncached_init,)) initr_of_live, -#ifdef CONFIG_DM - initr_dm, -#endif -#ifdef CONFIG_ADDR_MAP - init_addr_map, -#endif + CONFIG_IS_ENABLED(DM, (initr_dm,)) + CONFIG_IS_ENABLED(ADDR_MAP, (init_addr_map,)) #if defined(CONFIG_ARM) || defined(CONFIG_RISCV) || defined(CONFIG_SANDBOX) board_init, /* Setup chipselects */ #endif @@ -634,36 +626,22 @@ static init_fnc_t init_sequence_r[] = { * davinci SOC's is added. Remove this check once all the board * implement this. */ -#ifdef CONFIG_CLOCKS - set_cpu_clk_info, /* Setup clock information */ -#endif + CONFIG_IS_ENABLED(CLOCKS, (set_cpu_clk_info,)) /* Setup clock information */ initr_lmb, -#ifdef CONFIG_EFI_LOADER - efi_memory_init, -#endif -#ifdef CONFIG_BINMAN_FDT - initr_binman, -#endif -#ifdef CONFIG_FSP_VERSION2 - arch_fsp_init_r, -#endif + CONFIG_IS_ENABLED(EFI_LOADER, (efi_memory_init,)) + CONFIG_IS_ENABLED(BINMAN_FDT, (initr_binman,)) + CONFIG_IS_ENABLED(FSP_VERSION2, (arch_fsp_init_r,)) initr_dm_devices, stdio_init_tables, serial_initialize, initr_announce, dm_announce, -#if CONFIG_IS_ENABLED(WDT) - initr_watchdog, -#endif + CONFIG_IS_ENABLED(WDT, (initr_watchdog,)) INIT_FUNC_WATCHDOG_RESET arch_initr_trap, -#if defined(CONFIG_BOARD_EARLY_INIT_R) - board_early_init_r, -#endif + CONFIG_IS_ENABLED(BOARD_EARLY_INIT_R, (board_early_init_r,)) INIT_FUNC_WATCHDOG_RESET -#ifdef CONFIG_POST - post_output_backlog, -#endif + CONFIG_IS_ENABLED(POST, (post_output_backlog,)) INIT_FUNC_WATCHDOG_RESET #if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT) /* @@ -672,45 +650,25 @@ static init_fnc_t init_sequence_r[] = { */ pci_init, #endif -#ifdef CONFIG_ARCH_EARLY_INIT_R - arch_early_init_r, -#endif + CONFIG_IS_ENABLED(ARCH_EARLY_INIT_R, (arch_early_init_r,)) power_init_board, -#ifdef CONFIG_MTD_NOR_FLASH - initr_flash, -#endif + CONFIG_IS_ENABLED(MTD_NOR_FLASH, (initr_flash,)) INIT_FUNC_WATCHDOG_RESET #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) /* initialize higher level parts of CPU like time base and timers */ cpu_init_r, #endif -#ifdef CONFIG_EFI_LOADER - efi_init_early, -#endif -#ifdef CONFIG_CMD_NAND - initr_nand, -#endif -#ifdef CONFIG_CMD_ONENAND - initr_onenand, -#endif -#ifdef CONFIG_MMC - initr_mmc, -#endif -#ifdef CONFIG_XEN - xen_init, -#endif -#ifdef CONFIG_PVBLOCK - initr_pvblock, -#endif + CONFIG_IS_ENABLED(EFI_LOADER, (efi_init_early,)) + CONFIG_IS_ENABLED(CMD_NAND, (initr_nand,)) + CONFIG_IS_ENABLED(CMD_ONENAND, (initr_onenand,)) + CONFIG_IS_ENABLED(MMC, (initr_mmc,)) + CONFIG_IS_ENABLED(XEN, (xen_init,)) + CONFIG_IS_ENABLED(PVBLOCK, (initr_pvblock,)) initr_env, -#ifdef CONFIG_SYS_MALLOC_BOOTPARAMS - initr_malloc_bootparams, -#endif + CONFIG_IS_ENABLED(SYS_MALLOC_BOOTPARAMS, (initr_malloc_bootparams,)) INIT_FUNC_WATCHDOG_RESET cpu_secondary_init_r, -#if defined(CONFIG_ID_EEPROM) - mac_read_from_eeprom, -#endif + CONFIG_IS_ENABLED(ID_EEPROM, (mac_read_from_eeprom,)) INITCALL_EVENT(EVT_SETTINGS_R), INIT_FUNC_WATCHDOG_RESET #if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT) @@ -721,24 +679,15 @@ static init_fnc_t init_sequence_r[] = { #endif stdio_add_devices, jumptable_init, -#ifdef CONFIG_API - api_init, -#endif + CONFIG_IS_ENABLED(API, (api_init,)) console_init_r, /* fully init console as a device */ -#ifdef CONFIG_DISPLAY_BOARDINFO_LATE - console_announce_r, - show_board_info, -#endif -#ifdef CONFIG_ARCH_MISC_INIT - arch_misc_init, /* miscellaneous arch-dependent init */ -#endif -#ifdef CONFIG_MISC_INIT_R - misc_init_r, /* miscellaneous platform-dependent init */ -#endif + CONFIG_IS_ENABLED(DISPLAY_BOARDINFO_LATE, (console_announce_r, show_board_info,)) + /* miscellaneous arch-dependent init */ + CONFIG_IS_ENABLED(ARCH_MISC_INIT, (arch_misc_init,)) + /* miscellaneous platform-dependent init */ + CONFIG_IS_ENABLED(MISC_INIT_R, (misc_init_r,)) INIT_FUNC_WATCHDOG_RESET -#ifdef CONFIG_CMD_KGDB - kgdb_init, -#endif + CONFIG_IS_ENABLED(CMD_KGDB, (kgdb_init,)) interrupt_init, #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K) timer_init, /* initialize timer */ @@ -746,22 +695,11 @@ static init_fnc_t init_sequence_r[] = { initr_status_led, initr_boot_led_blink, /* PPC has a udelay(20) here dating from 2002. Why? */ -#ifdef CONFIG_BOARD_LATE_INIT - board_late_init, -#endif -#ifdef CONFIG_BITBANGMII - bb_miiphy_init, -#endif -#ifdef CONFIG_PCI_ENDPOINT - pci_ep_init, -#endif -#if defined(CONFIG_CMD_NET) - INIT_FUNC_WATCHDOG_RESET - initr_net, -#endif -#ifdef CONFIG_POST - initr_post, -#endif + CONFIG_IS_ENABLED(BOARD_LATE_INIT, (board_late_init,)) + CONFIG_IS_ENABLED(BITBANGMII, (bb_miiphy_init,)) + CONFIG_IS_ENABLED(PCI_ENDPOINT, (pci_ep_init,)) + CONFIG_IS_ENABLED(CMD_NET, (INIT_FUNC_WATCHDOG_RESET initr_net,)) + CONFIG_IS_ENABLED(POST, (initr_post,)) INIT_FUNC_WATCHDOG_RESET INITCALL_EVENT(EVT_LAST_STAGE_INIT), #if defined(CFG_PRAM) From patchwork Fri Jan 3 11:13:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 854863 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp8187682wrq; Fri, 3 Jan 2025 03:14:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUl7y2zJ72DnvN9gFrbJuQhFvWAoRSo+LDOIPo0vTevpdN73UUZxx20Xl1WMJwk3uDxsZYnZw==@linaro.org X-Google-Smtp-Source: AGHT+IHsWu/znqOuXkiwLGs9xFx2SUa9Qm6CVl6R33kKQSDmSksrGslxC6deaWR6J9pGmXdm08Ja X-Received: by 2002:a05:6402:51ce:b0:5d2:7270:6125 with SMTP id 4fb4d7f45d1cf-5d81dd8acdamr44943518a12.8.1735902850425; Fri, 03 Jan 2025 03:14:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735902850; cv=none; d=google.com; s=arc-20240605; b=geIfInJrMouLOGiQKKHjUd5WGf+csnE16sD9mc/wiM3P5/krr/+AJi4DoSu8AZgH6E Xh1jTGkAoP3Aoekg3ePX92Fd5lV9EIE7qgJnQgIjaVzS1j1cjl4yMg6dNT8P8aaFbP0L jASJTmT+TbqWnkf3a5uaCDjQSJN+dZQdHjJrH593jCJj71N+PtcR2EihR6bVr85fGN7T tzuvdmTNqwJp2atjDh/b9cbj3zwnLwCdNxQKL399XrnviEUUhjaYoULf8h4Mi6Wzw2nV kYLtSnfgopQvMpp/aRp62RH1J3ntMp1KPgS/vzWUOp+XBlutJoVUaQEbdJayAVBGnhqa 4T2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sfDOaSAv1fBQA8QtVc5IoWAJsxQS+z+L7wwQ2Zls04s=; fh=7T9U8CxT8/pi4VxDQB+ogewXJ7jd6DKe4+xLsZpalAc=; b=hNJo+27BGDXaye8JpLdVdHa/li/rRa5XNg12B4tCe3v9MZRkUSAx8q54fOCTCIpOCH gXsp9ZAqUoLZQCpF5aT0WyyI4Y1DHujMl9H1JdEG6TBkiz0E0UaI55QbrTGrICYPH1sI S0nDudC+pl4abm0MjLf9R+Rh+dFlPyfNEQZefTQRGA3Or7habj7NdFvSR7bb3Xl4WHPg rG5PE6IK+HuBXutMNtcdtNMSPKjVrvNuSP9pm7xeMKjAawvXdxjz4Ul45NDdJPI/YrYH byvzf6lJYPSUwdHuKDlwDVkeNmCm4qTpNcUqCtsPyrJoh1OvgXMGeAqSFviBtz6yskfg YpJg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mRUNm1Zt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d80705644bsi18959863a12.620.2025.01.03.03.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:14:10 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mRUNm1Zt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 96B35803F5; Fri, 3 Jan 2025 12:13:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="mRUNm1Zt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 02182803D2; Fri, 3 Jan 2025 12:13:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4A5478034E for ; Fri, 3 Jan 2025 12:13:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4368a293339so84499715e9.3 for ; Fri, 03 Jan 2025 03:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735902817; x=1736507617; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sfDOaSAv1fBQA8QtVc5IoWAJsxQS+z+L7wwQ2Zls04s=; b=mRUNm1ZtMy/+rJ+s5VWIvJVHi6ETFWk9RMrARtN055G5B2zDbcmvvl8afIin9s8C5Z CWRRs/Mfxoo/JQg29UbynwIvtS5WFe+E6MuPviyG16i3NHO/+eOTwINALKxsEY5GSinX efp5DojXz7gRNiEhqKlrj3Q5Z/GeIaLYWnIRPnXLZSP5d7ZnhHPDCRb/eTsGr2wLjEF7 SFg9bZiMKFcyMiBlSLr69T6H/50KXNWG7434bGwlj3L8oZKRdY6IpU5+dBjIQ/QUJ5qJ F3+gj+5dQ05gc5Igy6P0rxOf0/V4b3Fll4OBkHCENWqoTkZXGUaGFFxDz0CLu7qrzo95 69/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735902817; x=1736507617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sfDOaSAv1fBQA8QtVc5IoWAJsxQS+z+L7wwQ2Zls04s=; b=fMPwUB0y2U8Vi35alNISFr1a4wMLbZ9HK9G6KFEp3IRjm/WIgtuVWii8NJ5owcsaZX v06CSTQZjR7jtoQkh8hXdh76W/sqTbFa4JzBx2REGLR7Blbt7ps9vIcSoQqtyJKzQYDy 1UUyJO99R27vBvHwVkHVa8D0ygeTHbcs3Y167PcePKyIBBeU9bFnz5UPka5vJxQwCNl7 iOZaMFg145uBcELUxIitOgKzAT0ZGqYftLFuKCs1d9QkxDLz7MfkBMZgpJ3r43r6mCt2 x8LS/faejPKAu/e0wgTcOd3vJ1dDNGcLoS03/6LuCI0FzO/4PGqzb98TyXbw4VH023Rv jFGQ== X-Gm-Message-State: AOJu0YwVYqy8wylhcMfDyESwfdYUcYdnul4sw8Pz9TC5TxEjKXPFRol6 x+ugPEeIKPSH12ob6t0RZGh2c7w5l2wvI29C1thmTSqsLcIjB6qHSPwG3Md3TL0H57ELIj0/4DO zHhU= X-Gm-Gg: ASbGncvLvQtBzqh1AmebjdNBgAJY//HQ8x2gt4wLDSxwhInC2Io/sTVNXL83gmX0sq/ UlqcG+Q/XASdWyRXWO8ViR+OI0MB36O1ljLg/F8d8n/M0R5UIhXU8pHtyy8oiSHx3VoW1x4U7Bb W/Tt/MgRMd2YSE6fARHJwXXvUz9st7Zx585Ylx3GLIRIQ244OmJ1M4qcE5mUD9X4FwWUGMSMisc S5MImSjPICBeAytiR2JpTa81Cr2tvYEW59g4CAgHQ5rZYWfdhLRvwCuTbdh0zCtiw== X-Received: by 2002:a05:600c:4f0d:b0:432:cbe5:4f09 with SMTP id 5b1f17b1804b1-43671247b46mr395385645e9.4.1735902817490; Fri, 03 Jan 2025 03:13:37 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656a0b361sm513138075e9.0.2025.01.03.03.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:13:37 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Jonas Karlman , Devarsh Thakkar Subject: [PATCH v3 2/5] board_init_f(): use static calls Date: Fri, 3 Jan 2025 12:13:14 +0100 Message-ID: <270cd303e577c51467abc3a8520311a6facb7f68.1735896540.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Make static calls instead of iterating over the init_sequence_f arrays. Tested on a KV260 board (xilinx_zynqmp_kria_defconfig). - With LTO enabled, the code size reported by bloat-o-meter is 1037 bytes less (-0.10%) - With LTO disabled, the code is 193 bytes smaller (-0.02%) - Execution time does not change in a noticeable way Signed-off-by: Jerome Forissier --- common/board_f.c | 169 +++++++++++++++++++++++---------------------- include/initcall.h | 27 ++++++++ 2 files changed, 114 insertions(+), 82 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index a4d8850cb7d..c2446ba344d 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -870,58 +871,64 @@ static int initf_upl(void) return 0; } -static const init_fnc_t init_sequence_f[] = { - setup_mon_len, - CONFIG_IS_ENABLED(OF_CONTROL, (fdtdec_setup,)) - CONFIG_IS_ENABLED(TRACE_EARLY, (trace_early_init,)) - initf_malloc, - initf_upl, - log_init, - initf_bootstage, /* uses its own timer, so does not need DM */ - event_init, - bloblist_maybe_init, - setup_spl_handoff, - CONFIG_IS_ENABLED(CONSOLE_RECORD_INIT_F, (console_record_init,)) - INITCALL_EVENT(EVT_FSP_INIT_F), - arch_cpu_init, /* basic arch cpu dependent setup */ - mach_cpu_init, /* SoC/machine dependent CPU setup */ - initf_dm, - CONFIG_IS_ENABLED(BOARD_EARLY_INIT_F, (board_early_init_f,)) +static void initcall_run_f(void) +{ + /* + * Please do not add logic to this function (variables, if (), etc.). + * For simplicity it should remain an ordered list of function calls. + */ + INITCALL(setup_mon_len); + CONFIG_IS_ENABLED(OF_CONTROL, (INITCALL(fdtdec_setup))); + CONFIG_IS_ENABLED(TRACE_EARLY, (INITCALL(trace_early_init))); + INITCALL(initf_malloc); + INITCALL(initf_upl); + INITCALL(log_init); + INITCALL(initf_bootstage); /* uses its own timer, so does not need DM */ + INITCALL(event_init); + INITCALL(bloblist_maybe_init); + INITCALL(setup_spl_handoff); + CONFIG_IS_ENABLED(CONSOLE_RECORD_INIT_F, + (INITCALL(console_record_init);)) + INITCALL_EVT(EVT_FSP_INIT_F); + INITCALL(arch_cpu_init); /* basic arch cpu dependent setup */ + INITCALL(mach_cpu_init); /* SoC/machine dependent CPU setup */ + INITCALL(initf_dm); + CONFIG_IS_ENABLED(BOARD_EARLY_INIT_F, (INITCALL(board_early_init_f);)) #if defined(CONFIG_PPC) || defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K) /* get CPU and bus clocks according to the environment variable */ - get_clocks, /* get CPU and bus clocks (etc.) */ + INITCALL(get_clocks); /* get CPU and bus clocks (etc.) */ #endif #if !defined(CONFIG_M68K) || (defined(CONFIG_M68K) && !defined(CONFIG_MCFTMR)) - timer_init, /* initialize timer */ + INITCALL(timer_init); /* initialize timer */ #endif - CONFIG_IS_ENABLED(BOARD_POSTCLK_INIT, (board_postclk_init,)) - env_init, /* initialize environment */ - init_baud_rate, /* initialze baudrate settings */ - serial_init, /* serial communications setup */ - console_init_f, /* stage 1 init of console */ - display_options, /* say that we are here */ - display_text_info, /* show debugging info if required */ - checkcpu, - CONFIG_IS_ENABLED(SYSRESET, (print_resetinfo,)) + CONFIG_IS_ENABLED(BOARD_POSTCLK_INIT, + (INITCALL(board_postclk_init);)) + INITCALL(env_init); /* initialize environment */ + INITCALL(init_baud_rate); /* initialze baudrate settings */ + INITCALL(serial_init); /* serial communications setup */ + INITCALL(console_init_f); /* stage 1 init of console */ + INITCALL(display_options); /* say that we are here */ + INITCALL(display_text_info); /* show debugging info if required */ + INITCALL(checkcpu); + CONFIG_IS_ENABLED(SYSRESET, (INITCALL(print_resetinfo);)) /* display cpu info (and speed) */ - CONFIG_IS_ENABLED(DISPLAY_CPUINFO, (print_cpuinfo,)) - CONFIG_IS_ENABLED(DTB_RESELECT, (embedded_dtb_select,)) - CONFIG_IS_ENABLED(DISPLAY_BOARDINFO, (show_board_info,)) - INIT_FUNC_WATCHDOG_INIT - INITCALL_EVENT(EVT_MISC_INIT_F), - INIT_FUNC_WATCHDOG_RESET - CONFIG_IS_ENABLED(SYS_I2C_LEGACY, (init_func_i2c,)) - announce_dram_init, - dram_init, /* configure available RAM banks */ - CONFIG_IS_ENABLED(POST, (post_init_f,)) - INIT_FUNC_WATCHDOG_RESET + CONFIG_IS_ENABLED(DISPLAY_CPUINFO, (INITCALL(print_cpuinfo);)) + CONFIG_IS_ENABLED(DTB_RESELECT, (INITCALL(embedded_dtb_select);)) + CONFIG_IS_ENABLED(DISPLAY_BOARDINFO, (INITCALL(show_board_info);)) + WATCHDOG_INIT(); + INITCALL_EVT(EVT_MISC_INIT_F); + WATCHDOG_RESET(); + CONFIG_IS_ENABLED(SYS_I2C_LEGACY, (INITCALL(init_func_i2c);)) + INITCALL(announce_dram_init); + INITCALL(dram_init); /* configure available RAM banks */ + CONFIG_IS_ENABLED(POST, (INITCALL(post_init_f);)) + WATCHDOG_RESET(); #if defined(CFG_SYS_DRAM_TEST) - testdram, + INITCALL(testdram); #endif /* CFG_SYS_DRAM_TEST */ - INIT_FUNC_WATCHDOG_RESET - - CONFIG_IS_ENABLED(POST, (init_post,)) - INIT_FUNC_WATCHDOG_RESET + WATCHDOG_RESET(); + CONFIG_IS_ENABLED(POST, (INITCALL(init_post);)) + WATCHDOG_RESET(); /* * Now that we have DRAM mapped and working, we can * relocate the code and continue running from DRAM. @@ -934,48 +941,48 @@ static const init_fnc_t init_sequence_f[] = { * - monitor code * - board info struct */ - setup_dest_addr, + INITCALL(setup_dest_addr); #if defined(CONFIG_OF_BOARD_FIXUP) && !defined(CONFIG_OF_INITIAL_DTB_READONLY) - fix_fdt, + INITCALL(fix_fdt); #endif #ifdef CFG_PRAM - reserve_pram, + INITCALL(reserve_pram); #endif - reserve_round_4k, - setup_relocaddr_from_bloblist, - arch_reserve_mmu, - reserve_video, - reserve_trace, - reserve_uboot, - reserve_malloc, - reserve_board, - reserve_global_data, - reserve_fdt, + INITCALL(reserve_round_4k); + INITCALL(setup_relocaddr_from_bloblist); + INITCALL(arch_reserve_mmu); + INITCALL(reserve_video); + INITCALL(reserve_trace); + INITCALL(reserve_uboot); + INITCALL(reserve_malloc); + INITCALL(reserve_board); + INITCALL(reserve_global_data); + INITCALL(reserve_fdt); #if defined(CONFIG_OF_BOARD_FIXUP) && defined(CONFIG_OF_INITIAL_DTB_READONLY) - reloc_fdt, - fix_fdt, + INITCALL(reloc_fdt); + INITCALL(fix_fdt); #endif - reserve_bootstage, - reserve_bloblist, - reserve_arch, - reserve_stacks, - dram_init_banksize, - show_dram_config, - INIT_FUNC_WATCHDOG_RESET - setup_bdinfo, - display_new_sp, - INIT_FUNC_WATCHDOG_RESET + INITCALL(reserve_bootstage); + INITCALL(reserve_bloblist); + INITCALL(reserve_arch); + INITCALL(reserve_stacks); + INITCALL(dram_init_banksize); + INITCALL(show_dram_config); + WATCHDOG_RESET(); + INITCALL(setup_bdinfo); + INITCALL(display_new_sp); + WATCHDOG_RESET(); #if !defined(CONFIG_OF_BOARD_FIXUP) || !defined(CONFIG_OF_INITIAL_DTB_READONLY) - reloc_fdt, + INITCALL(reloc_fdt); #endif - reloc_bootstage, - reloc_bloblist, - setup_reloc, + INITCALL(reloc_bootstage); + INITCALL(reloc_bloblist); + INITCALL(setup_reloc); #if defined(CONFIG_X86) || defined(CONFIG_ARC) - copy_uboot_to_ram, - do_elf_reloc_fixups, + INITCALL(copy_uboot_to_ram); + INITCALL(do_elf_reloc_fixups); #endif - clear_bss, + INITCALL(clear_bss); /* * Deregister all cyclic functions before relocation, so that * gd->cyclic_list does not contain any references to pre-relocation @@ -985,12 +992,11 @@ static const init_fnc_t init_sequence_f[] = { * This should happen as late as possible so that the window where a * watchdog device is not serviced is as small as possible. */ - cyclic_unregister_all, + INITCALL(cyclic_unregister_all); #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) - jump_to_copy, + INITCALL(jump_to_copy); #endif - NULL, -}; +} void board_init_f(ulong boot_flags) { @@ -1000,8 +1006,7 @@ void board_init_f(ulong boot_flags) gd->flags &= ~GD_FLG_HAVE_CONSOLE; gd->boardf = &boardf; - if (initcall_run_list(init_sequence_f)) - hang(); + initcall_run_f(); #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ !defined(CONFIG_EFI_APP) && !CONFIG_IS_ENABLED(X86_64) && \ diff --git a/include/initcall.h b/include/initcall.h index 62d3bb67f08..8e22526dd9e 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -8,6 +8,7 @@ #include #include +#include _Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); @@ -35,4 +36,30 @@ typedef int (*init_fnc_t)(void); */ int initcall_run_list(const init_fnc_t init_sequence[]); +#define INITCALL(_call) \ + do { \ + if (_call()) { \ + printf("%s(): initcall %s() failed\n", __func__, \ + #_call); \ + hang(); \ + } \ + } while (0) + +#define INITCALL_EVT(_evt) \ + do { \ + if (event_notify_null(_evt)) { \ + printf("%s(): event %d/%s failed\n", __func__, _evt, \ + event_type_name(_evt)) ; \ + hang(); \ + } \ + } while (0) + +#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) +#define WATCHDOG_INIT() INITCALL(init_func_watchdog_init) +#define WATCHDOG_RESET() INITCALL(init_func_watchdog_reset) +#else +#define WATCHDOG_INIT() +#define WATCHDOG_RESET() +#endif + #endif From patchwork Fri Jan 3 11:13:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 854862 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp8187613wrq; Fri, 3 Jan 2025 03:14:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXE0T5yTGjp9mhCSA3hSjD82sDGofnLy41vXNZxRTZfGUynUxM0Eqik/eBSSbZmz46srawNWg==@linaro.org X-Google-Smtp-Source: AGHT+IFQkaF+BGD5l3+ERwNpcEEtlrhYG3ApvHCiRZbhhnqvxnNcPj7F652jEbfuXQwmPDSu7JFG X-Received: by 2002:a17:907:3d86:b0:aa6:8e72:e50b with SMTP id a640c23a62f3a-aac3366a0c0mr5094539166b.56.1735902841145; Fri, 03 Jan 2025 03:14:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735902841; cv=none; d=google.com; s=arc-20240605; b=GAAWvMjRCuDHBxrZZg254XX7d9gIp+ZocbGjKoiNaEQj8itHfhKGInwvxb/Ekq0J5/ VDwd3+tqvziYjP9iIZGk0nuTb0zka3gSiKoiSC8I45erTjNir0gSQ0hy8KA1nGp78p8Z tF4t6Ii/mGx9tGrwsiQf6FviadpL3PGrUtOFYZoZACr4tmLbNUgmxWCvsqArPpTs/uzt 2Wskvf2/HreTJ+x3kqtLTod8G3FALpnTmGgjyBBR7AlpjRw2eiVlqMnWy9/0Ahn5LQNF dGARKzdRTNTuo9ozlJ80amWzBQiQO7jpioqKdvSqWfAKPZ1Wdv8h2RYFEjsWQwSxj0gQ 6kmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fqMtU8J8RTjUYL2gkNXl4sjSogDVUkn/i1sjdMFI5vU=; fh=7T9U8CxT8/pi4VxDQB+ogewXJ7jd6DKe4+xLsZpalAc=; b=Ua0KJt27FKxm5eyGP/CjkUNaG72C65oFdHmsAoC6en5uxqLOKLh0fPiuyo2gmbrk25 OqUI/aVNtToe7JBklThXSlUI/HsU4/mQaiJN+W+vH2hT6X/AlqW2XdGJ4N9uN5KYbdWb XJVHoIo4oPngMz/Q0ru+O1YBdBa3nhtRy6vitZCSh62HK/TcRHzal1FwJ9mWvbDRSo3f 8VCtwglCyYPUNpweQJYYV48LbYeTwCbh0+/DyYI5+4WGDZ60d55vjVQ2h4jzx6XpPvYA ThIML+qqnUdupAk/mZ9s/3KjLYtqhel69tXMIOrRh8akNWqZXNW/7XMktHJxKEwSItTn +4TA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xYnW5RnT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0e8455fcsi1873091666b.215.2025.01.03.03.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:14:01 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xYnW5RnT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D429E8036D; Fri, 3 Jan 2025 12:13:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="xYnW5RnT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3046F8034E; Fri, 3 Jan 2025 12:13:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1647E80196 for ; Fri, 3 Jan 2025 12:13:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43623f0c574so82842115e9.2 for ; Fri, 03 Jan 2025 03:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735902818; x=1736507618; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fqMtU8J8RTjUYL2gkNXl4sjSogDVUkn/i1sjdMFI5vU=; b=xYnW5RnT5EVcjSnXpC85d4PgAjl0+VfL4LDMwLYApdb7bsZ5Ay8GbugVzlCVyeSzno j8wo+9VE9jsOGnuWxUDVsIH/uzncbK2YpsMIXfQgi6vZvvj2zP4ei/2v/kDptRwQz01i oXPgMlLMuWriTEm+UXL0UFiTis65GE592Q0ODhmqgSiaE6B8Llxf/c3+iZ5ZnOyoH+ru c/f1tDdUis5ERjmPtbCr8qtw1EY7lD/SbhOIPA7mXAzdETC5WgIMFHqJbJxNWGOPcsLb 1fiPluQjdagGtj2CjSiz8SOM7DlPZJEIfO6zf5jQu6xKZVt1xGj9P6OB6nQlH3oPCO4q Ky6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735902818; x=1736507618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fqMtU8J8RTjUYL2gkNXl4sjSogDVUkn/i1sjdMFI5vU=; b=G4aVzJoFDvCuUISqAvqU5G1OGRMt3jwkQht+M7nUUtBqLzGQbr9SMXKxwC2D6PBr7p LLBSohTrL7baHvBgSidoi9ODnpeTQ9YPMKxJlLtgMQhGAJXX7iZAPIfCnXyF43B1cGFo fpUVcBs+mfVbAKy5mrNj8ztyalNGVtKd2pW0lHOdRmkvCFnu7tSA9M09MYKHdxVptT/G PQjNuTQeaHH3DcFMgL8ddr8IMayCVUr/wH/uX1jyAIDbGdIDtEJ+41fi3P0Zv8AeRbyS FbJ7725JfFhbT9eLo5fn0assBmaMsb9QkRF8WSdDeuqM3Lw4L4FYBpNYBcysNv5E6ORe zDlQ== X-Gm-Message-State: AOJu0Yz52NHz5corhO/pzwVwgSa3NJx39rks2rIElIFl0Gr894YFSxTk P7w9I60qgOd4u5JrSUjIpxK6a6aepHrwqkqf+pwzLoUkaf+tE2cikOL0khNFu9sDmCNZsMzrMxC FvKA= X-Gm-Gg: ASbGncvrCmCIoItm0FHqqMq32esPJpRJIytBGABUyz6jVkKRZ63QagLv/TjJ12Gz6ej VOYLjKtrf+WCN37ID7qeMrdpUMQbMyYAi43Plif+LWNkmnxT/AN4rhQKcJHXqUQicLm6km/USFr CZr1ZMt7jFxx85k/KcssKx5LdNHJVycr0Dogr+uuyy7gU5is2dvJdQVswCDpfCQ7p4EIYphNIJT BIhVNq0tsizVTqaDtIWK9TVIMLnkAInWj+oD08RgsCyN1hPrVc7vNDw7B4xIqDK1g== X-Received: by 2002:a05:600c:6a87:b0:434:f623:9fe3 with SMTP id 5b1f17b1804b1-4366fb8a411mr415625465e9.16.1735902818315; Fri, 03 Jan 2025 03:13:38 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656a0b361sm513138075e9.0.2025.01.03.03.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:13:38 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Jonas Karlman , Devarsh Thakkar Subject: [PATCH v3 3/5] board_init_f_r(): use static calls Date: Fri, 3 Jan 2025 12:13:15 +0100 Message-ID: <18e378cd3cd3b9d5dd99d39d997d67b04921f182.1735896540.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Replace the init_sequence_f_r function array by direct calls. Signed-off-by: Jerome Forissier --- common/board_f.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index c2446ba344d..bd04a6eedcd 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -1020,8 +1020,8 @@ void board_init_f(ulong boot_flags) /* * For now this code is only used on x86. * - * init_sequence_f_r is the list of init functions which are run when - * U-Boot is executing from Flash with a semi-limited 'C' environment. + * Run init functions which are run when U-Boot is executing from Flash with a + * semi-limited 'C' environment. * The following limitations must be considered when implementing an * '_f_r' function: * - 'static' variables are read-only @@ -1034,18 +1034,14 @@ void board_init_f(ulong boot_flags) * NOTE: At present only x86 uses this route, but it is intended that * all archs will move to this when generic relocation is implemented. */ -static const init_fnc_t init_sequence_f_r[] = { -#if !CONFIG_IS_ENABLED(X86_64) - init_cache_f_r, -#endif - - NULL, -}; +static void initcall_run_f_r(void) +{ + CONFIG_IS_ENABLED(X86_64, (INITCALL(init_cache_f_r);)) +} void board_init_f_r(void) { - if (initcall_run_list(init_sequence_f_r)) - hang(); + initcall_run_f_r(); /* * The pre-relocation drivers may be using memory that has now gone From patchwork Fri Jan 3 11:13:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 854864 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp8187733wrq; Fri, 3 Jan 2025 03:14:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUoQOjb9DqA10BrkwhCWkDJ4brPZkYcJ5en2PXCDzHmzTg/w9KguDpGLErPfcecV7VwUZJQAw==@linaro.org X-Google-Smtp-Source: AGHT+IFOQJM8x52YF5cVSwFJiwSATtvbkYJpXU+EV02G4qvD0UVZP6CNdUGIm2tNzDKo/kv5R1uK X-Received: by 2002:a05:6402:27d2:b0:5d0:c697:1f02 with SMTP id 4fb4d7f45d1cf-5d81ddc0609mr105995557a12.17.1735902858839; Fri, 03 Jan 2025 03:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735902858; cv=none; d=google.com; s=arc-20240605; b=g9/SReiSm0S8RlTRpaEcjYFGHcZo4IsLlviSsCApA4PAaNupdxvUlMYRk6iz7KHmqR KBZQ/Ws4RN17wBCdMIpoR3l70nOweMSEoY+THb4E8BJ6V8dXIuFMAltEexV7r788OgfX ektU8YKH8k0EYBifDKXLd2U9QLTD3L62RmoMUD+td4WvPOOLuGD8268Wx9E1YQD4gr4a /PiU30uz9/BejyAxjqbfvn2vtDlBGHeWqgoCnEznR9XSZMSgxhY0BA5/Px0hWzVo0Z7g K6+ttWhQ46uDvgxQde5sEi69x5L0boQVtBE9tXt2/sFTHjlZe4USsr7gIgo/hHZFN+Ad 3bCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zMd+sinb3q6PanhAEgJJk6fMv9pR722mvZp/v9GXDrs=; fh=r1rFhPkrDlHk7N3x6GLX33XSgw49RNNSqz8aUyqs/Vw=; b=I5iF5hlERzaPD/Cja9O6+AjKWcnWWiQOvOqRD4L2GYia3yBGHki9d3PABwCOw5I4YX t8GHfz+qNW/244qBfs3aLg78/eXMAitpq+tyzKMlmAqPEY/vZtG6j5U4yZ1pj9TA31Dj miePLrNy8z9g/lGMihkWlQlmu0qLg0gvEAfvMUpJwxBUlTOBAXl3gJaOhpALZCP4QFwg QLGYOpxU85ox7aw0mOZau9ofSgFdq4rmDU/guxU0PwtsjGbAyVvuaZF23POuupN9eKP7 FKuxd+GHsDO152GZ0Lu0G7zGRo4mU2Ex0l7dJApddjyDeU1K6FNySECXl6EKW/woYyZI h4zQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UFskeRMA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d806755098si19009780a12.116.2025.01.03.03.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:14:18 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UFskeRMA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CFF458036E; Fri, 3 Jan 2025 12:13:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UFskeRMA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A5A60803E4; Fri, 3 Jan 2025 12:13:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3509280384 for ; Fri, 3 Jan 2025 12:13:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43624b2d453so125792385e9.2 for ; Fri, 03 Jan 2025 03:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735902819; x=1736507619; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zMd+sinb3q6PanhAEgJJk6fMv9pR722mvZp/v9GXDrs=; b=UFskeRMAq92ZVsV0PTmQ+cif/XESXtaLpd8B/nzZblOEU+FF/QT31e0SvYKNSX9B35 rEAPUoF+OJcu90BjXRVCgUCCBKRjZu3zggyJXu95w1liD9PqsDZbij6jnSD/YrBZ4zkt xIdM2M2Fc2YnBErz5zBHsVi/e3cmZ1bgVkP27SEDQpT1mH/Uw3pViJDezrELrRxq7G+K m6h4Zooey0NOo/Ay71LAUONUumhyPtQ1m14jzPEcwDsC4wc4GcyGLJ/5EakAUwNVGgNZ OmMikLJLf8LNYGPc9eFT0P6gxLadW3e6q5v6PPfDBFT21zUpNk2QusiCiUNTGt0a2kM8 UUEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735902819; x=1736507619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zMd+sinb3q6PanhAEgJJk6fMv9pR722mvZp/v9GXDrs=; b=pn8UzdEuc5RVYinSr3Pq8dnJjP9moCtijFAqi7Jail0xiar523y+hHLVLH63xtEWc/ CfxFwQrG5G/EhdCIXuHK7Tj/gXkplI4zVi3ag/9Pv6EBY0GgGcPKPtfOEvYcT8odkCbT aPgo/xqZ+rBFCNUVqOmCojBsAyszilSw36/gdV04NVxrX08duhLC6nKnHTlRLxulo2iy tPa8vNX81P13aJB8YsfyGP22kpNn8y+te4dzrd/ic8ZFnaVuMNGHR05tT6l/WFx3IMJ0 X/x9INnB1SXthnRIRD16dKT5wQH8xQpVGY47xEKwPQgXc6jujechj6E909czbjVj7gUi FnHg== X-Gm-Message-State: AOJu0Yx+uA1HoRuMeXzwqTu8nEcKC6b+gZxmLdxZZkBbqGXSw0AVglXG uKlbAneoWXY86vBDQGoUCgbCdWYRUk07oaVuYSUzCiNh6vYs0rbQxoRNftYwIfiPUNqUjURk3Ch NxeM= X-Gm-Gg: ASbGnctbBIHRZTJhtgd3Gv5eXckirhnDPy3KC0KA2QTbXukT/CQ660h8ZWbSyacYe1O FkBQepRX09lPmc6Cx1UjCbgWzk9QSuvUVUqRz7En7udd6Qu7qf/S2v1T0oftS2xkJB1sbrHgkRR caoHJam3Ktyqe2Ga0gGWwvJ46Ti8Hp5bqd45dgatibA5wlG527vnDVf5q5ASZ8tXu4fpwwGeOwE +NsOGTBzptFqH3PyOsedMLmz9DgSLNuDrijrp+YtoyY6kriZSjOlO12sd3E0h+9qw== X-Received: by 2002:a05:600c:474d:b0:436:18d0:aa6e with SMTP id 5b1f17b1804b1-4366835c14fmr418470625e9.5.1735902819392; Fri, 03 Jan 2025 03:13:39 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656a0b361sm513138075e9.0.2025.01.03.03.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:13:39 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Marek Vasut , Nobuhiro Iwamatsu , Evgeny Bachinin , Christian Marangi , Sughosh Ganu , Caleb Connolly Subject: [PATCH v3 4/5] board_init_r(): use static calls Date: Fri, 3 Jan 2025 12:13:16 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Replace the init_sequence_r function array by direct calls. bloat-o-meter stats before/after on u-boot.bin for configuration xilinx_zynqmp_kria_defconfig are the following: - With LTO: add/remove: 87/128 grow/shrink: 8/23 up/down: 19743/-20923 (-1180) Total: Before=1067882, After=1066702, chg -0.11% - Without LTO: add/remove: 0/23 grow/shrink: 2/0 up/down: 795/-1112 (-317) Total: Before=1119494, After=1119177, chg -0.03% Signed-off-by: Jerome Forissier --- arch/sh/lib/board.c | 9 +- common/board_r.c | 175 ++++++++++++++++++------------------ test/py/tests/test_trace.py | 8 +- 3 files changed, 96 insertions(+), 96 deletions(-) diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c index 53b1c147c2e..2daf54e7c33 100644 --- a/arch/sh/lib/board.c +++ b/arch/sh/lib/board.c @@ -19,18 +19,13 @@ int dram_init(void) void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr) { - void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r; - - if (new_gd->reloc_off) { + if (new_gd->reloc_off) memcpy((void *)new_gd->relocaddr, (void *)(new_gd->relocaddr - new_gd->reloc_off), new_gd->mon_len); - reloc_board_init_r += new_gd->reloc_off; - } - __asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp)); while (1) - reloc_board_init_r(new_gd, 0x0); + board_init_r(new_gd, 0x0); } diff --git a/common/board_r.c b/common/board_r.c index c65c0b2ed1e..56016994b11 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -582,21 +582,24 @@ static int run_main_loop(void) } /* - * Over time we hope to remove these functions with code fragments and - * stub functions, and instead call the relevant function directly. - * - * We also hope to remove most of the driver-related init and do it if/when - * the driver is later used. + * Over time we hope to remove most of the driver-related init and do it + * if/when the driver is later used. * * TODO: perhaps reset the watchdog in the initcall function after each call? */ -static init_fnc_t init_sequence_r[] = { - initr_trace, - initr_reloc, - event_init, + +static void initcall_run_r(void) +{ + /* + * Please do not add logic to this function (variables, if (), etc.). + * For simplicity it should remain an ordered list of function calls. + */ + INITCALL(initr_trace); + INITCALL(initr_reloc); + INITCALL(event_init); /* TODO: could x86/PPC have this also perhaps? */ #if defined(CONFIG_ARM) || defined(CONFIG_RISCV) - initr_caches, + INITCALL(initr_caches); /* Note: For Freescale LS2 SoCs, new MMU table is created in DDR. * A temporary mapping of IFC high region is since removed, * so environmental variables in NOR flash is not available @@ -604,21 +607,21 @@ static init_fnc_t init_sequence_r[] = { * region. */ #endif - initr_reloc_global_data, + INITCALL(initr_reloc_global_data); #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500) - initr_unlock_ram_in_cache, + INITCALL(initr_unlock_ram_in_cache); #endif - initr_barrier, - initr_malloc, - log_init, - initr_bootstage, /* Needs malloc() but has its own timer */ - CONFIG_IS_ENABLED(CONSOLE_RECORD, (console_record_init,)) - CONFIG_IS_ENABLED(SYS_NONCACHED_MEMORY, (noncached_init,)) - initr_of_live, - CONFIG_IS_ENABLED(DM, (initr_dm,)) - CONFIG_IS_ENABLED(ADDR_MAP, (init_addr_map,)) + INITCALL(initr_barrier); + INITCALL(initr_malloc); + INITCALL(log_init); + INITCALL(initr_bootstage); /* Needs malloc() but has its own timer */ + CONFIG_IS_ENABLED(CONSOLE_RECORD, (INITCALL(console_record_init);)) + CONFIG_IS_ENABLED(SYS_NONCACHED_MEMORY, (INITCALL(noncached_init);)) + INITCALL(initr_of_live); + CONFIG_IS_ENABLED(DM, (INITCALL(initr_dm);)) + CONFIG_IS_ENABLED(ADDR_MAP, (INITCALL(init_addr_map);)) #if defined(CONFIG_ARM) || defined(CONFIG_RISCV) || defined(CONFIG_SANDBOX) - board_init, /* Setup chipselects */ + INITCALL(board_init); /* Setup chipselects */ #endif /* * TODO: printing of the clock inforamtion of the board is now @@ -626,88 +629,91 @@ static init_fnc_t init_sequence_r[] = { * davinci SOC's is added. Remove this check once all the board * implement this. */ - CONFIG_IS_ENABLED(CLOCKS, (set_cpu_clk_info,)) /* Setup clock information */ - initr_lmb, - CONFIG_IS_ENABLED(EFI_LOADER, (efi_memory_init,)) - CONFIG_IS_ENABLED(BINMAN_FDT, (initr_binman,)) - CONFIG_IS_ENABLED(FSP_VERSION2, (arch_fsp_init_r,)) - initr_dm_devices, - stdio_init_tables, - serial_initialize, - initr_announce, - dm_announce, - CONFIG_IS_ENABLED(WDT, (initr_watchdog,)) - INIT_FUNC_WATCHDOG_RESET - arch_initr_trap, - CONFIG_IS_ENABLED(BOARD_EARLY_INIT_R, (board_early_init_r,)) - INIT_FUNC_WATCHDOG_RESET - CONFIG_IS_ENABLED(POST, (post_output_backlog,)) - INIT_FUNC_WATCHDOG_RESET + CONFIG_IS_ENABLED(CLOCKS, (INITCALL(set_cpu_clk_info);)) + INITCALL(initr_lmb); + CONFIG_IS_ENABLED(EFI_LOADER, (INITCALL(efi_memory_init);)) + CONFIG_IS_ENABLED(BINMAN_FDT, (INITCALL(initr_binman);)) + CONFIG_IS_ENABLED(FSP_VERSION2, (INITCALL(arch_fsp_init_r);)) + INITCALL(initr_dm_devices); + INITCALL(stdio_init_tables); + INITCALL(serial_initialize); + INITCALL(initr_announce); + INITCALL(dm_announce); + CONFIG_IS_ENABLED(WDT, (INITCALL(initr_watchdog);)) + WATCHDOG_RESET(); + INITCALL(arch_initr_trap); + CONFIG_IS_ENABLED(BOARD_EARLY_INIT_R, (INITCALL(board_early_init_r);)) + WATCHDOG_RESET(); + CONFIG_IS_ENABLED(POST, (INITCALL(post_output_backlog);)) + WATCHDOG_RESET(); #if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT) /* * Do early PCI configuration _before_ the flash gets initialised, * because PCU resources are crucial for flash access on some boards. */ - pci_init, + INITCALL(pci_init); #endif - CONFIG_IS_ENABLED(ARCH_EARLY_INIT_R, (arch_early_init_r,)) - power_init_board, - CONFIG_IS_ENABLED(MTD_NOR_FLASH, (initr_flash,)) - INIT_FUNC_WATCHDOG_RESET + CONFIG_IS_ENABLED(ARCH_EARLY_INIT_R, (INITCALL(arch_early_init_r);)) + INITCALL(power_init_board); + CONFIG_IS_ENABLED(MTD_NOR_FLASH, (INITCALL(initr_flash);)) + WATCHDOG_RESET(); #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) /* initialize higher level parts of CPU like time base and timers */ - cpu_init_r, + INITCALL(cpu_init_r); #endif - CONFIG_IS_ENABLED(EFI_LOADER, (efi_init_early,)) - CONFIG_IS_ENABLED(CMD_NAND, (initr_nand,)) - CONFIG_IS_ENABLED(CMD_ONENAND, (initr_onenand,)) - CONFIG_IS_ENABLED(MMC, (initr_mmc,)) - CONFIG_IS_ENABLED(XEN, (xen_init,)) - CONFIG_IS_ENABLED(PVBLOCK, (initr_pvblock,)) - initr_env, - CONFIG_IS_ENABLED(SYS_MALLOC_BOOTPARAMS, (initr_malloc_bootparams,)) - INIT_FUNC_WATCHDOG_RESET - cpu_secondary_init_r, - CONFIG_IS_ENABLED(ID_EEPROM, (mac_read_from_eeprom,)) - INITCALL_EVENT(EVT_SETTINGS_R), - INIT_FUNC_WATCHDOG_RESET + CONFIG_IS_ENABLED(EFI_LOADER, (INITCALL(efi_init_early);)) + CONFIG_IS_ENABLED(CMD_NAND, (INITCALL(initr_nand);)) + CONFIG_IS_ENABLED(CMD_ONENAND, (INITCALL(initr_onenand);)) + CONFIG_IS_ENABLED(MMC, (INITCALL(initr_mmc);)) + CONFIG_IS_ENABLED(XEN, (INITCALL(xen_init);)) + CONFIG_IS_ENABLED(PVBLOCK, (INITCALL(initr_pvblock);)) + INITCALL(initr_env); + CONFIG_IS_ENABLED(SYS_MALLOC_BOOTPARAMS, + (INITCALL(initr_malloc_bootparams);)) + WATCHDOG_RESET(); + INITCALL(cpu_secondary_init_r); + CONFIG_IS_ENABLED(ID_EEPROM, (INITCALL(mac_read_from_eeprom);)) + INITCALL_EVT(EVT_SETTINGS_R); + WATCHDOG_RESET(); #if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT) /* * Do pci configuration */ - pci_init, + INITCALL(pci_init); #endif - stdio_add_devices, - jumptable_init, - CONFIG_IS_ENABLED(API, (api_init,)) - console_init_r, /* fully init console as a device */ - CONFIG_IS_ENABLED(DISPLAY_BOARDINFO_LATE, (console_announce_r, show_board_info,)) + INITCALL(stdio_add_devices); + INITCALL(jumptable_init); + CONFIG_IS_ENABLED(API, (INITCALL(api_init);)) + INITCALL(console_init_r); /* fully init console as a device */ + CONFIG_IS_ENABLED(DISPLAY_BOARDINFO_LATE, + (INITCALL(console_announce_r); + INITCALL(show_board_info);)) /* miscellaneous arch-dependent init */ - CONFIG_IS_ENABLED(ARCH_MISC_INIT, (arch_misc_init,)) + CONFIG_IS_ENABLED(ARCH_MISC_INIT, (INITCALL(arch_misc_init);)) /* miscellaneous platform-dependent init */ - CONFIG_IS_ENABLED(MISC_INIT_R, (misc_init_r,)) - INIT_FUNC_WATCHDOG_RESET - CONFIG_IS_ENABLED(CMD_KGDB, (kgdb_init,)) - interrupt_init, + CONFIG_IS_ENABLED(MISC_INIT_R, (INITCALL(misc_init_r);)) + WATCHDOG_RESET(); + CONFIG_IS_ENABLED(CMD_KGDB, (INITCALL(kgdb_init);)) + INITCALL(interrupt_init); #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K) - timer_init, /* initialize timer */ + INITCALL(timer_init); /* initialize timer */ #endif - initr_status_led, - initr_boot_led_blink, + INITCALL(initr_status_led); + INITCALL(initr_boot_led_blink); /* PPC has a udelay(20) here dating from 2002. Why? */ - CONFIG_IS_ENABLED(BOARD_LATE_INIT, (board_late_init,)) - CONFIG_IS_ENABLED(BITBANGMII, (bb_miiphy_init,)) - CONFIG_IS_ENABLED(PCI_ENDPOINT, (pci_ep_init,)) - CONFIG_IS_ENABLED(CMD_NET, (INIT_FUNC_WATCHDOG_RESET initr_net,)) - CONFIG_IS_ENABLED(POST, (initr_post,)) - INIT_FUNC_WATCHDOG_RESET - INITCALL_EVENT(EVT_LAST_STAGE_INIT), + CONFIG_IS_ENABLED(BOARD_LATE_INIT, (INITCALL(board_late_init);)) + CONFIG_IS_ENABLED(BITBANGMII, (INITCALL(bb_miiphy_init);)) + CONFIG_IS_ENABLED(PCI_ENDPOINT, (INITCALL(pci_ep_init);)) + CONFIG_IS_ENABLED(CMD_NET, (WATCHDOG_RESET(); INITCALL(initr_net);)) + CONFIG_IS_ENABLED(POST, (INITCALL(initr_post);)) + WATCHDOG_RESET(); + INITCALL_EVT(EVT_LAST_STAGE_INIT); #if defined(CFG_PRAM) - initr_mem, + INITCALL(initr_mem); #endif - initr_boot_led_on, - run_main_loop, -}; + INITCALL(initr_boot_led_on); + INITCALL(run_main_loop); +} void board_init_r(gd_t *new_gd, ulong dest_addr) { @@ -734,8 +740,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) #endif gd->flags &= ~GD_FLG_LOG_READY; - if (initcall_run_list(init_sequence_r)) - hang(); + initcall_run_r(); /* NOTREACHED - run_main_loop() does not return */ hang(); diff --git a/test/py/tests/test_trace.py b/test/py/tests/test_trace.py index 44239da5280..1b072df73b6 100644 --- a/test/py/tests/test_trace.py +++ b/test/py/tests/test_trace.py @@ -201,7 +201,7 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat): # Then look for this: # u-boot-1 0..... 282.101375: funcgraph_exit: 0.006 us | } # Then check for this: - # u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | calc_reloc_ofs(); + # u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | event_init(); expected_indent = None found_start = False @@ -224,8 +224,8 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat): found_end = True # The next function after initf_bootstage() exits should be - # initcall_is_event() - assert upto == 'calc_reloc_ofs()' + # event_init() + assert upto == 'event_init()' # Now look for initf_dm() and dm_timer_init() so we can check the bootstage # time @@ -274,7 +274,7 @@ def check_flamegraph(cons, fname, proftool, map_fname, trace_fg): # We expect dm_timer_init() to be called twice: once before relocation and # once after look1 = 'initf_dm;dm_timer_init 1' - look2 = 'board_init_r;initcall_run_list;initr_dm_devices;dm_timer_init 1' + look2 = 'board_init_r;initcall_run_r;initr_dm_devices;dm_timer_init 1' found = 0 with open(trace_fg, 'r') as fd: for line in fd: From patchwork Fri Jan 3 11:13:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 854865 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp8187772wrq; Fri, 3 Jan 2025 03:14:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWH7CQ0tBseeYbcCkD/0TIGOe1VcCl2Qs6d6Qt1Tmknw6hT5TrVQpzca3/bGt/0RpUTe9rloA==@linaro.org X-Google-Smtp-Source: AGHT+IHgKzzMevZCrz1SUDl8lcCQq3Ip0etxu1KDgprvC4ZPkdpQpzJSzNmNAM1mSmLT4hNcBpIn X-Received: by 2002:a17:907:8dce:b0:aae:df74:acd1 with SMTP id a640c23a62f3a-aaedf74c300mr3254627166b.11.1735902867704; Fri, 03 Jan 2025 03:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735902867; cv=none; d=google.com; s=arc-20240605; b=F7/1T1jM50cArJgzLpvZYeEyQSMPjDWvK/CktHmepUJCsIAI86ixjcB5dhcrNNXW4i laFvdH5LcTPqvAgbOqenc+gfwqVF41py6JYWQgTqzHYAAJILB10VZZ0BheD4tE+CfyQ6 j2E+2A1MI0YU3VqIlRATpU3Og/IjbEYNRHFeVRRiINgjfD52e6udf/ugc0Fw+V2ST22O RIQ213p4xv49SvT9s3LWAhCiEv0xmq0D/GTcTweqBxvj+gvwd4xyKlEsegfotUNL1Ms4 VuKQyFTIWKCve+qGyNvpVvhVxZuuHxAWce/ZrgA+OBJRxLdL0JKTCeaI5SpizG/LRorW XZBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O+OcPxI2SSdquESZgqrciQ1/6QS8udlDuX8uSxv68oQ=; fh=CNnbbzflKG7ylJ86l34Ik34OFHtwbu+6ouoe5RXwBQc=; b=N6xmmrhJPovRZHRxg6p/ezgcpY5Cx/JX094+uqBGZ3R+wqxX6XbNpn57bkb4a+nzM1 aaLMHU/4uATGEoZxFOeqqHnfRAakn9FNoyWdY36orSICNroYp7zYwQLS+QDLlcRRoXV2 G9A6cCb3gkWDt+A8pzR0elzOXISZTEBzDO4lJ+UReurn2iGcR6MLyEUKa5sHQLeTbkHV 6gh2YYgU4Dfl1HTR0CYiY4VLGpjQNFXsNV1Irak0KtD8yDibcrle9XkYzd/vMHx28vDd CuJjXCLq5WVsC3EpN+x60JLbyP3qU+FIqQ1d/DHQjDrcWzw9LuTG3G1QuxIrwcJDuiKU mvZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EVaRkp/K"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0f046c73si1821327766b.617.2025.01.03.03.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:14:27 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EVaRkp/K"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 285588044A; Fri, 3 Jan 2025 12:13:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="EVaRkp/K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 172EF80295; Fri, 3 Jan 2025 12:13:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6DE7B80196 for ; Fri, 3 Jan 2025 12:13:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4361f664af5so137493525e9.1 for ; Fri, 03 Jan 2025 03:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735902821; x=1736507621; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O+OcPxI2SSdquESZgqrciQ1/6QS8udlDuX8uSxv68oQ=; b=EVaRkp/KKh+qLCU7JY48Vd/Kd4kVu25yj2fP0zQjddzsXXHt/AAAyPDjBTxp7gR+Jq eoN15DelYihHB0RB2s9NLcWaBt4n7alpHdCjRaVlPt1tIg92zd+Mj/WqEndfVWO66ywy e09d+mmUQjmnrtopV5iRSqreJVeMp6HSZCrC7cpRAK3STOctrWq5GhTctdNnuPBKBGkk qgjKaErl9hdpurrBCuVc7GNPhAxKii/LnL1w27l+yYApBz4j3k0n57ixL6k+eD9+QNuQ 14Gwxh72Yg7VPwDeMF+qsjgX56q+rls0gklkAcXT4OYsn15xTcWhd2NRGfV4PRX8e5Mx pbWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735902821; x=1736507621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O+OcPxI2SSdquESZgqrciQ1/6QS8udlDuX8uSxv68oQ=; b=aTQp6/rHPIEtVBOfFOCWJAFwvfpdxbSXX0v039wPkPtlRuMFOaqiOK/e6eJhXlz4rB Dxol7Hs4mwgWGoJySHci3SooDdLkQV/d+gOTO85A23ieJX1ooTeQm1gT7seci4mx6p45 OjvC0JjQX85iMoGO/keO9bDJQ0YIaxaG18kUQsl23nqUcM5K/MyFHhFX/cXBxbG7dRQt FzdhElaeQr/oHb8+tfOII4a2xMAMHGtRc69aCUWNDXsBm8U9KsgQ5YPdxtg76AOOzB6L RlHwrBi7FzAjSLAdfuaj7f4jErJ/Mo38KxZh0UzLb7EwAyx5W2nqO0j2WV8z2VhJuvOH gp6w== X-Gm-Message-State: AOJu0Yzt2vpG7stciFZoFPAUHT41M+nsNTHZuPJD+9dBQJxBFhrO/6Cx WMhpf8dDZ6vQqlhnHFbPKcbwpc21M9my/OtnbLPAlGo10vuwdakx/4ujHxy8rMJHyiSnQ9lY1fM AxRs= X-Gm-Gg: ASbGncucpQbQfl/QjGxZ8t3QvplTMsE/xaBV6pC4VEM1zy99KaxFkhKLLxHQ8R1CLHo pwJ6rCLCLeAX4TjcYPv20NKBlpvaKf1yZcvRGYgH8WyHdliLEUUGTC+p1jr/QeTzUXF32QODnow hIauvs1q6TPy0MSOMA32AHNqDhzNn4hqxBuvuETFiPgnfiJO/IBAOGbNMNsbuDmNsyphLrbAHyW 9rM5e+CeK74iI4Xr2dxjK2fSVh+MjusS09sivq/w6ERgbO1Qv8M2H9nqRU7OEBm/w== X-Received: by 2002:a05:600c:1388:b0:434:a7e3:db5c with SMTP id 5b1f17b1804b1-436686440abmr400101335e9.11.1735902820604; Fri, 03 Jan 2025 03:13:40 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656a0b361sm513138075e9.0.2025.01.03.03.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:13:40 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Raymond Mao , Sughosh Ganu , Heinrich Schuchardt , Caleb Connolly , Dan Carpenter Subject: [PATCH v3 5/5] initcall: remove initcall_run_list() Date: Fri, 3 Jan 2025 12:13:17 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Now that all initcalls have been converted to static calls, remove initcall_run_list(). Signed-off-by: Jerome Forissier --- include/initcall.h | 24 ----------- lib/Makefile | 1 - lib/initcall.c | 102 --------------------------------------------- 3 files changed, 127 deletions(-) delete mode 100644 lib/initcall.c diff --git a/include/initcall.h b/include/initcall.h index 8e22526dd9e..220a55ad84d 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -12,30 +12,6 @@ _Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); -/** - * init_fnc_t - Init function - * - * Return: 0 if OK -ve on error - */ -typedef int (*init_fnc_t)(void); - -/* Top bit indicates that the initcall is an event */ -#define INITCALL_IS_EVENT GENMASK(BITS_PER_LONG - 1, 8) -#define INITCALL_EVENT_TYPE GENMASK(7, 0) - -#define INITCALL_EVENT(_type) (void *)((_type) | INITCALL_IS_EVENT) - -/** - * initcall_run_list() - Run through a list of function calls - * - * This calls functions one after the other, stopping at the first error, or - * when NULL is obtained. - * - * @init_sequence: NULL-terminated init sequence to run - * Return: 0 if OK, or -ve error code from the first failure - */ -int initcall_run_list(const init_fnc_t init_sequence[]); - #define INITCALL(_call) \ do { \ if (_call()) { \ diff --git a/lib/Makefile b/lib/Makefile index 5cb3278d2ef..13fb36ce3ad 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -44,7 +44,6 @@ obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o obj-$(CONFIG_SMBIOS_PARSER) += smbios-parser.o obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o -obj-y += initcall.o obj-y += ldiv.o obj-$(CONFIG_XXHASH) += xxhash.o obj-y += net_utils.o diff --git a/lib/initcall.c b/lib/initcall.c deleted file mode 100644 index 2686b9aed5c..00000000000 --- a/lib/initcall.c +++ /dev/null @@ -1,102 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (c) 2013 The Chromium OS Authors. - */ - -#include -#include -#include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -static ulong calc_reloc_ofs(void) -{ -#ifdef CONFIG_EFI_APP - return (ulong)image_base; -#endif - /* - * Sandbox is relocated by the OS, so symbols always appear at - * the relocated address. - */ - if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC)) - return gd->reloc_off; - - return 0; -} - -/** - * initcall_is_event() - Get the event number for an initcall - * - * func: Function pointer to check - * Return: Event number, if this is an event, else 0 - */ -static int initcall_is_event(init_fnc_t func) -{ - ulong val = (ulong)func; - - if ((val & INITCALL_IS_EVENT) == INITCALL_IS_EVENT) - return val & INITCALL_EVENT_TYPE; - - return 0; -} - -/* - * To enable debugging. add #define DEBUG at the top of the including file. - * - * To find a symbol, use grep on u-boot.map - */ -int initcall_run_list(const init_fnc_t init_sequence[]) -{ - ulong reloc_ofs; - const init_fnc_t *ptr; - enum event_t type; - init_fnc_t func; - int ret = 0; - - for (ptr = init_sequence; func = *ptr, func; ptr++) { - reloc_ofs = calc_reloc_ofs(); - type = initcall_is_event(func); - - if (type) { - if (!CONFIG_IS_ENABLED(EVENT)) - continue; - debug("initcall: event %d/%s\n", type, - event_type_name(type)); - } else if (reloc_ofs) { - debug("initcall: %p (relocated to %p)\n", - (char *)func - reloc_ofs, (char *)func); - } else { - debug("initcall: %p\n", (char *)func - reloc_ofs); - } - - ret = type ? event_notify_null(type) : func(); - if (ret) - break; - } - - if (ret) { - if (CONFIG_IS_ENABLED(EVENT)) { - char buf[60]; - - /* don't worry about buf size as we are dying here */ - if (type) { - sprintf(buf, "event %d/%s", type, - event_type_name(type)); - } else { - sprintf(buf, "call %p", - (char *)func - reloc_ofs); - } - - printf("initcall failed at %s (err=%dE)\n", buf, ret); - } else { - printf("initcall failed at call %p (err=%d)\n", - (char *)func - reloc_ofs, ret); - } - - return ret; - } - - return 0; -}